diff --git a/published/20190222 Developer happiness- What you need to know.md b/published/20190222 Developer happiness- What you need to know.md new file mode 100644 index 0000000000..706599ea05 --- /dev/null +++ b/published/20190222 Developer happiness- What you need to know.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12497-1.html) +[#]: subject: (Developer happiness: What you need to know) +[#]: via: (https://opensource.com/article/19/2/developer-happiness) +[#]: author: (Bart Copeland https://opensource.com/users/bartcopeland) + +开发者的福音:你需要知道的事 +====== + +> 开发者需要快速编程的工具和自由,而不会因为合规性和安全性所困扰。 + +![](https://img.linux.net.cn/data/attachment/album/202008/07/214051ki2zitovo8zzynco.jpg) + +一个人需要合适的工具来完成工作。比如说没有比修车修到一半,却发现你没有完成工作的专业工具更沮丧的事情了。同样的道理也适用在开发者身上:你需要工具来发挥你的才能,而不会因为合规性和安全性的需求打断你的工作流程,这样你才可以更快速地编码。 + +根据 ActiveState 的研究《[2018 年开发者调查:开源运行时的痛苦][1]》显示,超过一半的开发人员(具体为 51%),每天只需要花费 1-4 小时的时间进行编程。换句话说,大多数开发人员花费不到一半的时间编程。根据调查,一半的开发人员认为安全是他们最大的担忧之一,但是由于公司政策方面的原因,67% 的开发人员选择在编程时不添加新的语言。 + +结果是开发人员不得不投入更多的精力在非编码的活动上,例如在构建软件和语言之后检查软件的安全性和合规性标准。而且由于公司政策的原因,他们无法选择适合的开发工具或语言。他们的满意度会下降,同时风险提高。 + +因此,开发人员无法将时间投入在高价值的工作上。这会带来额外的商业风险,因为他们的软件上市时间变慢了,并且公司因为没有授权开发人员在不受公司政策影响的前提下决定“最佳的”技术的能力,从而增加了技术债务。 + +### 纳入安全性和合规性的工作流程 + +我们如何解决这个问题呢?一种方式是通过四个简单的步骤将安全性和合规性的工作流程集成到软件开发中: + +#### 1、集中你的力量 + +获得所有相关人员的支持,这是一个经常被遗忘但却至关重要的第一步。确保考虑到了广泛的利益相关者,包括: + + * 开发运维(DevOps) + * 开发人员 + * 信息安全 + * 合法/合规 + * IT 安全 + +利益相关者想要了解相关的商业利益,因此要为消除软件构建后的安全和合规性检查点提供坚实的理由。你可以在构建你的商业案例中考虑以下任何一个(或者全部)因素:节省时间、机会成本和开发人员生产力。在开发流程中,你也可以通过集成安全性和合规性来避免语言的改造。 + +#### 2、寻找可信赖的资源 + +接下来,选择可使用的可信资源,以及他们的许可证和安全要求。考虑到如下相关信息: + + * 基于环境或应用程序类型的使用限制以及每种语言的版本控制 + * 允许哪些开源组件,例如,特定的程序包 + * 哪种环境类型可以使用哪种许可证(例如,研究与生产) + * 安全级别的定义、可接受的脆弱性风险等级、什么样的风险级别会触发一个措施,这个措施是什么并且谁来负责它的执行 + +#### 3、从一开始就纳入安全性和合规性 + +纳入安全性和合规性的工作流程的结果是,它最终将安全性和合规性融入到代码的第一行。它消除了公司政策的拖累,因为你是按照规范进行编码,而不是必须事后解决问题。但要做到这一点,请考虑在构建代码时采用自动扫描代码的机制,以及使用无代理监控你的运行时代码。你可以节省时间,还可以通过编程实施策略来确保整个组织的合规性。 + +#### 4、监控、报告和更新 + +出现新的漏洞,新的补丁和版本也会出现。所以,将代码部署到生产中以及运行代码时,需要考虑安全性和合规性。你需要知道哪些(如果有的话)代码存在风险以及该代码在何处运行。所以,部署和运行代码的过程应该包括监视、报告和更新生产中的代码。 + +通过一开始就在你的软件开发过程中集成安全性和合规性,你还可以在部署后跟踪代码的运行位置,并在新的威胁出现时获得警报。你也能追踪当你的应用程序何时受到攻击,并通过自动执行软件策略做出响应。 + +如果你的软件开发过程中已经引入了安全性和合规性的工作流程,你将会提高你的生产率。你将能够通过增加编码时间、提高安全性和稳定性、以及在维护和发现安全性和合规性的威胁方面节省的成本和时间来衡量价值。 + +### 集成所带来的幸福 + +如果你不开发和更新软件,你的组织将无法前进。开发人员是公司成功的关键,这意味着他们需要快速编写代码的工具和自由。尽管合规性和安全性至关重要,但你不能让这个需求阻碍你的发展。开发人员显然很担心安全性,因此最好的办法就是“左移”,从一开始就集成安全性和合规性的工作流程。你将可以做更多的事情,在第一次就可以完成,而花费更少的时间进行代码更新。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/developer-happiness + +作者:[Bart Copeland][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bartcopeland +[b]: https://github.com/lujun9972 +[1]: https://www.activestate.com/company/press/press-releases/activestate-developer-survey-examines-open-source-challenges/ diff --git a/published/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md b/published/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md new file mode 100644 index 0000000000..ccca0f17d9 --- /dev/null +++ b/published/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md @@ -0,0 +1,341 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12511-1.html) +[#]: subject: (How to use OpenSSL: Hashes, digital signatures, and more) +[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-2) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +如何使用 OpenSSL:哈希值、数字签名等 +====== + +> 通过 OpenSSL 深入了解密码学的细节:哈希值、数字签名、数字证书等。 + +![](https://img.linux.net.cn/data/attachment/album/202008/13/150012t7zwwk6x7wr69wih.jpg) + +[本系列的第一篇文章][2]通过 OpenSSL 库和命令行实用程序介绍了哈希、加密/解密、数字签名和数字证书。这第二篇文章将对细节进行深入探讨。让我们从计算中无处不在的哈希开始,并考虑是什么使哈希函数*具备密码学意义*。 + +### 密码学哈希 + +OpenSSL 源代码的[下载页面](https://www.openssl.org/source/)包含了一个带有最新版本的表格。每个版本都有两个哈希值hash:160 位 SHA1 和 256 位 SHA256。这些值可以用来验证下载的文件是否与存储库中的原始文件相匹配:下载者在本地重新计算下载文件的哈希值,然后将结果与原始文件进行比较。现代系统有计算这种哈希值的实用程序。例如,Linux 有 `md5sum` 和 `sha256sum`。OpenSSL 本身也提供了类似的命令行实用程序。 + +哈希值被用于计算的许多领域。例如,比特币区块链使用 SHA256 哈希值作为区块标识符。挖比特币就是生成一个低于指定阈值的 SHA256 哈希值,也就是至少有 N 个前导零的哈希值。(N 的值可以上升或下降,这取决于特定时间的挖矿生产力)。作为一个兴趣点,如今的矿机是为并行生成 SHA256 哈希值而设计的硬件集群。在 2018 年的一个高峰期,全球的比特币矿工每秒产生约 7500 万个太哈希值terahash —— 这真是一个不可思议的数字。 + +网络协议也使用哈希值(在这里通常叫做“校验和checksum”)来支持消息的完整性;也就是说,保证收到的消息与发送的消息是一样的。消息发送者计算消息的校验和,并将结果与消息一起发送。当消息到达时,接收方重新计算校验和。如果发送的校验和与重新计算的校验和不一致,那么消息在传输过程中可能出现了一些问题,或者发送的校验和出现了问题,或者两者都出现了问题。在这种情况下,应该重新发送消息和它的校验和,或者至少应该触发一个错误情况。(如 UDP 这样的低级网络协议不会理会校验和。) + +哈希的其他例子大家都很熟悉。比如一个网站,要求用户用密码进行验证,用户在浏览器中输入密码,然后,他们通过 HTTPS 连接到服务器,密码从浏览器加密发送到服务器。一旦密码到达服务器,就会被解密,然后进行数据库表的查询。 + +在这个查询表中应该存储什么?存储密码本身是有风险的。风险要小得多的方式是存储一个由密码生成的哈希值,也许在计算哈希值之前“加一些salt(额外的位)改善口味”。你的密码可能会被发送到 Web 服务器上,但网站可以向你保证,密码不会存储在那里。 + +哈希值还出现在安全的各个领域。例如,基于哈希值的消息认证码hash-based message authentication code([HMAC][3])使用一个哈希值和一个秘密的加密密钥cryptographic key来认证通过网络发送的消息。HMAC 码轻量级且易于在程序中使用,在 Web 服务中很受欢迎。一个 X509 数字证书包括一个称为指纹fingerprint的哈希值,它可以方便证书验证。一个存放于内存中的可信存储truststore可以实现为一个以这种指纹为键的查找表 —— 作为一个支持恒定查找时间的哈希映射hash map。来自传入的证书的指纹可以与可信存储中的密钥进行比较,以确定是否匹配。 + +密码学哈希函数cryptographic hash function应该具有什么特殊属性?它应该是单向one-way的,这意味着很难被逆转。一个加密哈希函数应该是比较容易计算的,但是计算它的反函数(将哈希值映射回输入位串的函数)在计算上应该是困难的。下面是一个描述,用 `chf` 作为加密哈希函数,我的密码 `foobar` 作为样本输入。 + +``` + +---+ +foobar—>|chf|—>hash value ## 简单直接 + +--–+ +``` + +相比之下,逆向操作是不可行的: + +``` + +-----------+ +hash value—>|chf inverse|—>foobar ## 棘手困难 + +-----------+ +``` + +例如,回忆一下 SHA256 哈希函数。对于一个任意长度为 N > 0 的输入位串,这个函数会生成一个 256 位的固定长度的哈希值;因此,这个哈希值甚至不会反映出输入位串的长度 N,更不用说字符串中每个位的值了。顺便说一下,SHA256 不容易受到[长度扩展攻击][4]length extension attack。唯一有效的逆向工程方法是通过蛮力搜索将计算出的 SHA256 哈希值逆向返回到输入位串,这意味着需要尝试所有可能的输入位串,直到找到与目标哈希值匹配的位串。这样的搜索在 SHA256 这样一个完善的加密哈希函数上是不可行的。 + +现在,最后一个回顾的知识点是有序in order。加密哈希值是统计学上的唯一,而不是无条件的唯一,这意味着两个不同的输入位串产生相同的哈希值是不太可能的,但也不是不可能的 —— 这称之为碰撞collision。[生日问题][5]提供了一个很好的反直觉的碰撞例子。对各种哈希算法的抗碰撞性collision resistance有着广泛的研究。例如,MD5(128 位哈希值)在大约 2^21 次哈希之后,抗碰撞能力就会崩溃。对于 SHA1(160 位哈希值),大约在 2^61 次哈希后开始崩溃。 + +对于 SHA256 的抗碰撞能力的剖析,目前还没有一个很好的估计。这个事实并不奇怪。SHA256 有 2^256 个不同的哈希值范围,这个数字的十进制表示法有 78 位之多! 那么,SHA256 哈希会不会发生碰撞呢?当然可能,但可能性极小。 + +在下面的命令行示例中,有两个输入文件被用作位串源:`hashIn1.txt` 和 `hashIn2.txt`。第一个文件包含 `abc`,第二个文件包含 `1a2b3c`。 + +为了便于阅读,这些文件包含的是文本,但也可以使用二进制文件代替。 + +在命令行(百分号 `%` 是提示符)使用 Linux `sha256sum` 实用程序对这两个文件进行处理产生以下哈希值(十六进制): + +``` +% sha256sum hashIn1.txt +9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 hashIn1.txt + +% sha256sum hashIn2.txt +3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 hashIn2.txt +``` + +OpenSSL 哈希对应的结果与预期相同: + +``` +% openssl dgst -sha256 hashIn1.txt +SHA256(hashIn1.txt)= 9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 + +% openssl dgst -sha256 hashIn2.txt +SHA256(hashIn2.txt)= 3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 +``` + +这种对密码学哈希函数的研究,为我们仔细研究数字签名及其与密钥对的关系奠定了基础。 + +### 数字签名 + +顾名思义,数字签字digital signature可以附在文件或其他一些电子工件artifact(如程序)上,以证明其真实性。因此,这种签名类似于纸质文件上的手写签名。验证数字签名就是要确认两件事:第一,被担保的工件在签名被附上后没有改变,因为它部分是基于文件的加密学哈希值。第二,签名属于一个人(例如 Alice),只有她才能获得一对密钥中的私钥。顺便说一下,对代码(源码或编译后的代码)进行数字签名已经成为程序员的普遍做法。 + +让我们来了解一下数字签名是如何创建的。如前所述,没有公钥和私钥对就没有数字签名。当使用 OpenSSL 创建这些密钥时,有两个独立的命令:一个是创建私钥,另一个是从私钥中提取匹配的公钥。这些密钥对用 base64 编码,在这个过程中可以指定它们的大小。 + +私钥private key由数值组成,其中两个数值(一个模数modulus和一个指数exponent)组成了公钥。虽然私钥文件包含了公钥public key,但提取出来的公钥并**不会**透露相应私钥的值。 + +因此,生成的带有私钥的文件包含了完整的密钥对。将公钥提取到自己的文件中是很实用的,因为这两把钥匙有不同的用途,而这种提取方式也将私钥可能被意外公开的危险降到最低。 + +接下来,这对密钥的私钥被用来生成目标工件(如电子邮件)的哈希值,从而创建签名。在另一端,接收者的系统使用这对密钥的公钥来验证附在工件上的签名。 + +现在举个例子。首先,用 OpenSSL 生成一个 2048 位的 RSA 密钥对: + +``` +openssl genpkey -out privkey.pem -algorithm rsa 2048 +``` + +在这个例子中,我们可以舍去 `-algorithm rsa` 标志,因为 `genpkey` 默认为 RSA 类型。文件的名称(`privkey.pem`)是任意的,但是隐私增强邮件Privacy Enhanced Mail(PEM)扩展名 `.pem` 是默认 PEM 格式的惯用扩展名。(如果需要的话,OpenSSL 有命令可以在各种格式之间进行转换。)如果需要更大的密钥大小(例如 4096),那么最后一个参数 `2048` 可以改成 `4096`。这些大小总是二的幂。 + +下面是产生的 `privkey.pem` 文件的一个片断,它是 base64 编码的: + +``` +-----BEGIN PRIVATE KEY----- +MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANnlAh4jSKgcNj/Z +JF4J4WdhkljP2R+TXVGuKVRtPkGAiLWE4BDbgsyKVLfs2EdjKL1U+/qtfhYsqhkK +... +-----END PRIVATE KEY----- +``` + +接下来的命令就会从私钥中提取出这对密钥的公钥: + +``` +openssl rsa -in privkey.pem -outform PEM -pubout -out pubkey.pem +``` + +由此产生的 `pubkey.pem` 文件很小,可以在这里完整地显示出来: + +``` +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZ5QIeI0ioHDY/2SReCeFnYZJY +z9kfk11RrilUbT5BgIi1hOAQ24LMilS37NhHYyi9VPv6rX4WLKoZCmkeYaWk/TR5 +4nbH1E/AkniwRoXpeh5VncwWMuMsL5qPWGY8fuuTE27GhwqBiKQGBOmU+MYlZonO +O0xnAKpAvysMy7G7qQIDAQAB +-----END PUBLIC KEY----- +``` + +现在,有了密钥对,数字签名就很容易了 —— 在本例中,源文件 `client.c` 是要签名的工件: + +``` +openssl dgst -sha256 -sign privkey.pem -out sign.sha256 client.c +``` + +`client.c` 源文件的摘要是 SHA256,私钥在前面创建的 `privkey.pem` 文件中。由此产生的二进制签名文件是 `sign.sha256`,这是一个任意的名字。要得到这个文件的可读版本(比如 base64),后续命令是: + +``` +openssl enc -base64 -in sign.sha256 -out sign.sha256.base64 +``` + +文件 `sign.sha256.base64` 现在包含如下内容: + +``` +h+e+3UPx++KKSlWKIk34fQ1g91XKHOGFRmjc0ZHPEyyjP6/lJ05SfjpAJxAPm075 +VNfFwysvqRGmL0jkp/TTdwnDTwt756Ej4X3OwAVeYM7i5DCcjVsQf5+h7JycHKlM +o/Jd3kUIWUkZ8+Lk0ZwzNzhKJu6LM5KWtL+MhJ2DpVc= +``` + +或者,可执行文件 `client` 也可以被签名,由此产生的 base64 编码签名将如预期的不同: + +``` +VMVImPgVLKHxVBapJ8DgLNJUKb98GbXgehRPD8o0ImADhLqlEKVy0HKRm/51m9IX +xRAN7DoL4Q3uuVmWWi749Vampong/uT5qjgVNTnRt9jON112fzchgEoMb8CHNsCT +XIMdyaPtnJZdLALw6rwMM55MoLamSc6M/MV1OrJnk/g= +``` + +这一过程的最后一步是用公钥验证数字签名。作为验证的一个重要步骤,应重新计算用于签署工件(在本例中,是可执行的 `client` 程序)的哈希值,因为验证过程应表明工件在签署后是否发生了变化。 + +有两个 OpenSSL 命令用于这个目的。第一条命令是对 base64 签名进行解码。 + +``` +openssl enc -base64 -d -in sign.sha256.base64 -out sign.sha256 +``` + +第二条是核实签名: + +``` +openssl dgst -sha256 -verify pubkey.pem -signature sign.sha256 client +``` + +第二条命令的输出,应该是这样的: + +``` +Verified OK +``` + +为了了解验证失败时的情况,一个简短但有用的练习是将最后一个 OpenSSL 命令中的可执行的 `client` 文件替换为源文件 `client.c`,然后尝试验证。另一个练习是改变 `client` 程序,无论多么轻微,然后再试一次。 + +### 数字证书 + +数字证书digital certificate汇集了到目前为止所分析的各个部分:哈希值、密钥对、数字签名和加密/解密。生产级证书的第一步是创建一个证书签名请求certificate signing request(CSR),然后将其发送给证书颁发机构certificate authority(CA)。在 OpenSSL 的例子中,要做到这一点,请运行: + +``` +openssl req -out myserver.csr -new -newkey rsa:4096 -nodes -keyout myserverkey.pem +``` + +这个例子生成了一个 CSR 文档,并将该文档存储在文件 `myserver.csr`(base64 文本)中。这里的目的是:CSR 文档要求 CA 保证与指定域名相关联的身份,域名也就是 CA 所说的通用名common name(CN)。 + +尽管可以使用现有的密钥对,但这个命令也会生成一个新的密钥对。请注意,在诸如 `myserver.csr` 和 `myserverkey.pem` 等名称中使用 `server` 暗示了数字证书的典型用途:作为与 www.google.com 等域名相关的 Web 服务器的身份担保。 + +然而,无论数字证书如何使用,同样使用这个命令都会创建一个 CSR。它还会启动一个问题/回答的交互式会话,提示有关域名的相关信息,以便与请求者的数字证书相连接。这个交互式会话可以通过在命令中提供基本的信息,用反斜杠来续行一步完成。`-subj` 标志提供了所需的信息。 + +``` +% openssl req -new \ +-newkey rsa:2048 -nodes -keyout privkeyDC.pem \ +-out myserver.csr \ +-subj "/C=US/ST=Illinois/L=Chicago/O=Faulty Consulting/OU=IT/CN=myserver.com" +``` + +产生的 CSR 文件在发送给 CA 之前可以进行检查和验证。这个过程可以创建具有所需格式(如 X509)、签名、有效期等的数字证书。 + +``` +openssl req -text -in myserver.csr -noout -verify +``` + +这是输出的一个片断: + +``` +verify OK +Certificate Request: +Data: +Version: 0 (0x0) +Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com +Subject Public Key Info: +Public Key Algorithm: rsaEncryption +Public-Key: (2048 bit) +Modulus: +00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e:de:73: +… +Exponent: 65537 (0x10001) +Attributes: +a0:00 +Signature Algorithm: sha256WithRSAEncryption +… +``` + +### 自签证书 + +在开发 HTTPS 网站的过程中,手头有一个不用经过 CA 流程的数字证书是很方便的。在 HTTPS 握手的认证阶段,自签证书self-signed certificate就能满足要求,尽管任何现代浏览器都会警告说这样的证书毫无价值。继续这个例子,自签证书的 OpenSSL 命令(有效期为一年,使用 RSA 公钥)如下: + +``` +openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:4096 -keyout myserver.pem -out myserver.crt +``` + +下面的 OpenSSL 命令呈现了生成的证书的可读版本: + +``` +openssl x509 -in myserver.crt -text -noout +``` + +这是自签证书的部分输出: + +``` +Certificate: +Data: +Version: 3 (0x2) +Serial Number: 13951598013130016090 (0xc19e087965a9055a) +Signature Algorithm: sha256WithRSAEncryption +Issuer: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com +Validity +Not Before: Apr 11 17:22:18 2019 GMT +Not After : Apr 10 17:22:18 2020 GMT +Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com +Subject Public Key Info: +Public Key Algorithm: rsaEncryption +Public-Key: (4096 bit) +Modulus: +00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e:de:73: +... +Exponent: 65537 (0x10001) +X509v3 extensions: +X509v3 Subject Key Identifier: +3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 +X509v3 Authority Key Identifier: +keyid:3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 + + X509v3 Basic Constraints: + CA:TRUE +Signature Algorithm: sha256WithRSAEncryption + 3a:eb:8d:09:53:3b:5c:2e:48:ed:14:ce:f9:20:01:4e:90:c9: + ... +``` + +如前所述,RSA 私钥包含的值是用来生成公钥的。但是,给定的公钥**不会**泄露匹配的私钥。关于底层数学理论的介绍,见 。 + +数字证书与用于生成该证书的密钥对之间存在着重要的对应关系,即使证书只是自签的: + +* 数字证书包含构成公钥的指数和模数值。这些值是最初生成的 PEM 文件中密钥对的一部分,在本例中,是文件 `myserver.pem`。 +* 指数exponent几乎总是 65,537(如本例中),所以可以忽略。 +* 密钥对的模数modulus应该与数字证书的模数相匹配。 + +模数是一个很大的值,为了便于阅读,可以进行哈希处理。下面是两个 OpenSSL 命令,它们检查相同的模数,从而确认数字证书是基于 PEM 文件中的密钥对。 + +``` +% openssl x509 -noout -modulus -in myserver.crt | openssl sha1 ## 证书中的模数 +(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 + +% openssl rsa -noout -modulus -in myserver.pem | openssl sha1 ## 密钥中的模数 +(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 +``` + +所产生的哈希值匹配,从而确认数字证书是基于指定的密钥对。 + +### 回到密钥分发问题上 + +让我们回到第一部分末尾提出的一个问题:`client` 程序和 Google Web 服务器之间的 TLS 握手。握手协议有很多种,即使是用在 `client` 例子中的 Diffie-Hellman 版本也有不同的方式。尽管如此,`client` 例子遵循了一个共同的模式。 + +首先,在 TLS 握手过程中,`client` 程序和 Web 服务器就加密套件cipher suite达成一致,其中包括要使用的算法。在本例中,该套件是 `ECDHE-RSA-AES128-GCM-SHA256`。 + +现在值得关注的两个要素是 RSA 密钥对算法和 AES128 块密码,用于在握手成功的情况下对消息进行加密和解密。关于加密/解密,这个过程有两种流派:对称symmetric非对称asymmetric。在对称流派中,加密和解密使用的是*相同的*密钥,这首先就引出了密钥分发问题key distribution problem。如何将密钥安全地分发给双方?在非对称流派中,一个密钥用于加密(在这种情况下,是 RSA 公钥),但另一个密钥用于解密(在这种情况下,是来自同一对密钥的 RSA 私钥)。 + +`client` 程序拥有来认证证书的 Google Web 服务器的公钥,而 Web 服务器拥有来自同一对密钥的私钥。因此,`client` 程序可以向 Web 服务器发送加密信息,而 Web 服务器可以单独对该通信进行解密。 + +在 TLS 的情况下,对称方式有两个显著的优势: + +* 在 `client` 程序与 Google Web 服务器之间的互动中,认证是单向的。Google Web 服务器向 `client` 程序发送三张证书,但 `client` 程序并没有向 Web 服务器发送证书,因此,Web 服务器没有来自客户端的公钥,无法加密发给客户端的消息。 +* 使用 AES128 的对称加密/解密比使用 RSA 密钥的非对称加密/解密快了**近千倍**。 + +TLS 握手将两种加密/解密方式巧妙地结合在一起。在握手过程中,`client` 程序会生成随机位,即所谓的预主密pre-master secret(PMS)。然后,`client` 程序用服务器的公钥对 PMS 进行加密,并将加密后的 PMS 发送给服务器,服务器再用 RSA 密钥对的私钥对 PMS 信息进行解密: + +``` + +-------------------+ encrypted PMS +--------------------+ +client PMS--->|server’s public key|--------------->|server’s private key|--->server PMS + +-------------------+ +--------------------+ +``` + +在这个过程结束时,`client` 程序和 Google Web 服务器现在拥有相同的 PMS 位。每一方都使用这些位生成一个主密码master secret,并立即生成一个称为会话密钥session key的对称加密/解密密钥。现在有两个不同但等价的会话密钥,连接的每一方都有一个。在 `client` 的例子中,会话密钥是 AES128 类的。一旦在 `client` 程序和 Google Web 服务器两边生成了会话密钥,每一边的会话密钥就会对双方的对话进行保密。如果任何一方(例如,`client` 程序)或另一方(在这种情况下,Google Web 服务器)要求重新开始握手,握手协议(如 Diffie-Hellman)允许整个 PMS 过程重复进行。 + +### 总结 + +在命令行上说明的 OpenSSL 操作也可以通过底层库的 API 完成。这两篇文章重点使用了这个实用程序,以保持例子的简短,并专注于加密主题。如果你对安全问题感兴趣,OpenSSL 是一个很好的开始地方,并值得深入研究。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) +[2]: https://linux.cn/article-11810-1.html +[3]: https://en.wikipedia.org/wiki/HMAC +[4]: https://en.wikipedia.org/wiki/Length_extension_attack +[5]: https://en.wikipedia.org/wiki/Birthday_problem +[6]: http://www.google.com diff --git a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md b/published/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md similarity index 60% rename from sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md rename to published/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md index fc3818c344..59ebd1255b 100644 --- a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md +++ b/published/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md @@ -1,42 +1,38 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12477-1.html) [#]: subject: (Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux) [#]: via: (https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux +实用脚本:检查高 CPU / 内存消耗进程 ====== -In the past, we have written three different articles to identify this using Linux commands. +![](https://img.linux.net.cn/data/attachment/album/202008/01/205420jllu1nsngu9qszu5.jpg) -You can access them immediately by going to the relevant URLs below. +过去,我们写了三篇不同的文章来使用 Linux 命令来识别这些进程。 - * **[How to Find High CPU Consumption Processes in Linux][1]** - * **[How to Find Out Top Memory Consuming Processes in Linux][2]** - * **[Five Ways to Check How Long a Process Has Been Running in Linux][3]** +你可以通过下面相关的 URL 立即访问: + * [如何在 Linux 中找出 CPU 占用高的进程][1] + * [如何在 Linux 中找出内存消耗最大的进程][2] + * [在 Linux 中如何查找一个命令或进程的执行时间][3] +本教程中包含两个脚本,它们可以帮助你确定 Linux 上高 CPU/内存消耗进程的运行时间。 -Two scripts are included in this tutorial, which helps you to identify how long the high CPU/memory consumption processes are running on Linux. +该脚本将显示进程 ID、进程的所有者、进程的名称以及进程的运行时间。这将帮助你确定哪些(必须事先完成)作业正在超时运行。这可以使用 `ps` 命令来实现。 -The script will show you the process ID, the owner of the process, the name of the process and how long the processes are running. +### 什么是 ps 命令 -This will help you identify which jobs are running overtime (which must be completed beforehand). +`ps` 是进程状态processes status,它显示有关系统上活动/正在运行的进程的信息。 -This can be achieved using the ps command. +它提供了当前进程的快照以及详细信息,例如用户名、用户 ID、CPU 使用率、内存使用率、进程开始日期和时间等。 -### What’s ps Command +#### 1)检查高 CPU 消耗进程在 Linux 上运行了多长时间的 Bash 脚本 -ps stands for processes status, it display the information about the active/running processes on the system. - -It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. - -### 1) Bash Script to Check How Long the High CPU Consumption Processes Runs on Linux - -This script will help you to identify how long the high CPU consumption processes has been running on Linux. +该脚本将帮助你确定高 CPU 消耗进程在 Linux 上运行了多长时间。 ``` # vi /opt/scripts/long-running-cpu-proc.sh @@ -56,13 +52,13 @@ done | column -t echo "--------------------------------------------------" ``` -Set an executable **[Linux file permission][4]** to **“long-running-cpu-proc.sh”** file. +给 `long-running-cpu-proc.sh` 设置可执行的 [Linux 文件权限][4]。 ``` # chmod +x /opt/scripts/long-running-cpu-proc.sh ``` -When you run this script, you will get an output like the one below. +运行此脚本时,你将获得类似以下的输出: ``` # sh /opt/scripts/long-running-cpu-proc.sh @@ -82,9 +78,9 @@ daygeek 6301 Web 57:40 ---------------------------------------------------- ``` -### 2) Bash Script to Check How Long the High Memory Consumption Processes Runs on Linux +#### 2)检查高内存消耗进程在 Linux 上运行了多长时间的 Bash 脚本 -This script will help you to identify how long the top memory consumption processes has been running on Linux. +该脚本将帮助你确定最大的内存消耗进程在 Linux 上运行了多长时间。 ``` # sh /opt/scripts/long-running-memory-proc.sh @@ -104,13 +100,13 @@ done | column -t echo "--------------------------------------------------" ``` -Set an executable Linux file permission to **“long-running-memory-proc.sh”** file. +给 `long-running-memory-proc.sh` 设置可执行的 Linux 文件权限。 ``` # chmod +x /opt/scripts/long-running-memory-proc.sh ``` -When you run this script, you will get an output like the one below. +运行此脚本时,你将获得类似以下的输出: ``` # sh /opt/scripts/long-running-memory-proc.sh @@ -136,14 +132,14 @@ via: https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/ -[2]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ -[3]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ +[1]: https://linux.cn/article-11678-1.html +[2]: https://linux.cn/article-11542-1.html +[3]: https://linux.cn/article-10261-1.html [4]: https://www.2daygeek.com/understanding-linux-file-permissions/ diff --git a/published/20170918 Fun and Games in Emacs.md b/published/202003/20170918 Fun and Games in Emacs.md similarity index 100% rename from published/20170918 Fun and Games in Emacs.md rename to published/202003/20170918 Fun and Games in Emacs.md diff --git a/published/20180306 Exploring free and open web fonts.md b/published/202003/20180306 Exploring free and open web fonts.md similarity index 100% rename from published/20180306 Exploring free and open web fonts.md rename to published/202003/20180306 Exploring free and open web fonts.md diff --git a/published/20180522 Advanced use of the less text file viewer in Linux.md b/published/202003/20180522 Advanced use of the less text file viewer in Linux.md similarity index 100% rename from published/20180522 Advanced use of the less text file viewer in Linux.md rename to published/202003/20180522 Advanced use of the less text file viewer in Linux.md diff --git a/translated/tech/20180708 Building a Messenger App- Conversations.md b/published/202003/20180708 Building a Messenger App- Conversations.md similarity index 92% rename from translated/tech/20180708 Building a Messenger App- Conversations.md rename to published/202003/20180708 Building a Messenger App- Conversations.md index 8ab0e2c083..722383745d 100644 --- a/translated/tech/20180708 Building a Messenger App- Conversations.md +++ b/published/202003/20180708 Building a Messenger App- Conversations.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (PsiACE) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12056-1.html) [#]: subject: (Building a Messenger App: Conversations) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversations/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) @@ -10,16 +10,18 @@ 构建一个即时消息应用(三):对话 ====== +![](https://img.linux.net.cn/data/attachment/album/202003/30/193824w7xsj2ixs8frsal8.jpg) + 本文是该系列的第三篇。 * [第一篇:模式][1] * [第二篇:OAuth][2] -在我们的即时消息应用中,消息表现为两个参与者对话的堆叠。如果你想要开始异常对话,就应该向应用提供你想要交谈的用户,而当对话创建后(如果该对话此前并不存在),就可以向该对话发送消息。 +在我们的即时消息应用中,消息表现为两个参与者对话的堆叠。如果你想要开始一场对话,就应该向应用提供你想要交谈的用户,而当对话创建后(如果该对话此前并不存在),就可以向该对话发送消息。 就前端而言,我们可能想要显示一份近期对话列表。并在此处显示对话的最后一条消息以及另一个参与者的姓名和头像。 -在这篇帖子中,我们将会编写一些端点(endpoints)来完成像「创建对话」、「获取对话列表」以及「找到单个对话」这样的任务。 +在这篇帖子中,我们将会编写一些端点endpoint来完成像“创建对话”、“获取对话列表”以及“找到单个对话”这样的任务。 首先,要在主函数 `main()` 中添加下面的路由。 @@ -45,7 +47,7 @@ func requireJSON(handler http.HandlerFunc) http.HandlerFunc { } ``` -如果请求(request)不是 JSON 格式,那么它会返回 `415 Unsupported Media Type`(不支持的媒体类型)错误。 +如果请求request不是 JSON 格式,那么它会返回 `415 Unsupported Media Type`(不支持的媒体类型)错误。 ### 创建对话 @@ -58,7 +60,7 @@ type Conversation struct { } ``` -就像上面的代码那样,对话中保持对另一个参与者和最后一条消息的引用,还有一个 bool 类型的字段,用来告知是否有未读消息。 +就像上面的代码那样,对话中保持对另一个参与者和最后一条消息的引用,还有一个 `bool` 类型的字段,用来告知是否有未读消息。 ```go type Message struct { @@ -188,7 +190,7 @@ type Errors struct { } ``` -然后,我们开始执行 SQL 事务。收到的仅仅是用户名,但事实上,我们需要知道实际的用户 ID 。因此,事务的第一项内容是查询另一个参与者的 ID 和头像。如果找不到该用户,我们将会返回 `404 Not Found`(未找到) 错误。另外,如果找到的用户恰好和「当前已验证用户」相同,我们应该返回 `403 Forbidden`(拒绝处理)错误。这是由于对话只应当在两个不同的用户之间发起,而不能是同一个。 +然后,我们开始执行 SQL 事务。收到的仅仅是用户名,但事实上,我们需要知道实际的用户 ID 。因此,事务的第一项内容是查询另一个参与者的 ID 和头像。如果找不到该用户,我们将会返回 `404 Not Found`(未找到) 错误。另外,如果找到的用户恰好和“当前已验证用户”相同,我们应该返回 `403 Forbidden`(拒绝处理)错误。这是由于对话只应当在两个不同的用户之间发起,而不能是同一个。 然后,我们试图找到这两个用户所共有的对话,所以需要使用 `INTERSECT` 语句。如果存在,只需要通过 `/api/conversations/{conversationID}` 重定向到该对话并将其返回。 @@ -265,11 +267,11 @@ func getConversations(w http.ResponseWriter, r *http.Request) { } ``` -该处理程序仅对数据库进行查询。它通过一些联接来查询对话表……首先,从消息表中获取最后一条消息。然后依据「ID 与当前已验证用户不同」的条件,从参与者表找到对话的另一个参与者。然后联接到用户表以获取该用户的用户名和头像。最后,再次联接参与者表,并以相反的条件从该表中找出参与对话的另一个用户,其实就是当前已验证用户。我们会对比消息中的 `messages_read_at` 和 `created_at` 两个字段,以确定对话中是否存在未读消息。然后,我们通过 `user_id` 字段来判定该消息是否属于「我」(指当前已验证用户)。 +该处理程序仅对数据库进行查询。它通过一些联接来查询对话表……首先,从消息表中获取最后一条消息。然后依据“ID 与当前已验证用户不同”的条件,从参与者表找到对话的另一个参与者。然后联接到用户表以获取该用户的用户名和头像。最后,再次联接参与者表,并以相反的条件从该表中找出参与对话的另一个用户,其实就是当前已验证用户。我们会对比消息中的 `messages_read_at` 和 `created_at` 两个字段,以确定对话中是否存在未读消息。然后,我们通过 `user_id` 字段来判定该消息是否属于“我”(指当前已验证用户)。 注意,此查询过程假定对话中只有两个用户参与,它也仅仅适用于这种情况。另外,该设计也不很适用于需要显示未读消息数量的情况。如果需要显示未读消息的数量,我认为可以在 `participants` 表上添加一个`unread_messages_count` `INT` 字段,并在每次创建新消息的时候递增它,如果用户已读则重置该字段。 -接下来需要遍历每一条记录,通过扫描每一个存在的对话来建立一个对话切片(an slice of conversations)并在最后进行响应。 +接下来需要遍历每一条记录,通过扫描每一个存在的对话来建立一个对话切片slice of conversations并在最后进行响应。 ### 找到单个对话 @@ -329,7 +331,7 @@ func getConversation(w http.ResponseWriter, r *http.Request) { 在下一篇帖子中,我们将会看到如何创建并列出消息。 -[Souce Code][3] +- [源代码][3] -------------------------------------------------------------------------------- @@ -338,7 +340,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] 译者:[PsiACE](https://github.com/PsiACE) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20181231 Troubleshooting hardware problems in Linux.md b/published/202003/20181231 Troubleshooting hardware problems in Linux.md similarity index 100% rename from published/20181231 Troubleshooting hardware problems in Linux.md rename to published/202003/20181231 Troubleshooting hardware problems in Linux.md diff --git a/published/20190113 Editing Subtitles in Linux.md b/published/202003/20190113 Editing Subtitles in Linux.md similarity index 100% rename from published/20190113 Editing Subtitles in Linux.md rename to published/202003/20190113 Editing Subtitles in Linux.md diff --git a/translated/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md b/published/202003/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md similarity index 66% rename from translated/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md rename to published/202003/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md index 6e9b6ba2a1..0663005ce5 100644 --- a/translated/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md +++ b/published/202003/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md @@ -1,18 +1,20 @@ [#]: collector: "lujun9972" [#]: translator: "FSSlc" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12051-1.html" [#]: subject: "ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client" [#]: via: "https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/" [#]: author: "Vinoth Kumar https://www.2daygeek.com/author/vinoth/" -ffsend - 在 Linux 命令行中通过 FireFox Send 服务来简单安全地分享文件 +ffsend:在命令行中通过 FireFox Send 分享文件 ====== -Linux 用户更偏爱使用 `scp` 或 `rsync` 来进行文件或目录的复制拷贝。很多新的可选方式正发生在 Linux 上,因为 Linux 是开源的,所以任何人都可以为 Linux 开发一个安全软件。 +![](https://img.linux.net.cn/data/attachment/album/202003/29/202308w7ormrouomij2dzq.jpg) -在过去我们已经写了多篇有关安全分享这个话题的文章,它们分别是 **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** 和 **[Dcp – Dat Copy][4]**. +Linux 用户偏爱使用 `scp` 或 `rsync` 来进行文件或目录的复制拷贝。不过在 Linux 上正出现了许多新的可选方式,因为 Linux 是开源的,所以任何人都可以为 Linux 开发一个安全软件。 + +在过去我们已经写了多篇有关安全分享这个话题的文章,它们分别是 [OnionShare][1]、[Magic Wormhole][2]、[Transfer.sh][3] 和 [Dcp – Dat Copy][4]。 今天我们甚至还将继续讨论这个话题,我们将介绍名为 `ffsend` 的工具。 @@ -22,33 +24,33 @@ Linux 用户更偏爱使用 `scp` 或 `rsync` 来进行文件或目录的复制 它允许我们通过一个安全、私密、加密的链接,使用一个简单的命令来轻易安全地分享文件和目录。 -使用 Firefox 的 Send 服务,文件可以被共享,最大允许的文件大小为 2GB(译者注:现在官网上写的是最大 1GB,登录后最大 2.5GB)。其他人可以通过这个工具或者网页浏览器来下载这些被分享的文件。 +通过 Firefox 的 Send 服务共享的文件最大大小为 2GB(LCTT 译注:现在官网上写的是最大 1GB,登录后最大 2.5GB)。其他人可以通过这个工具或者网页浏览器来下载这些分享的文件。 -所有的文件总是在客户端被加密,并且秘钥将不会被远程主机所分享。另外,你还可以为上传的文件设置密码。 +所有的文件都是在客户端加密的,并且秘钥将不会被共享到远程主机。另外,你还可以为上传的文件额外设置一个密码。 -被上传的文件在被下载(默认被下载 1 次,最多可被下载 10 次)后或者 24 小时后,它们将被自动删除。这将确保你的文件不会永远的保留在网络上。 +上传的文件在下载(默认被下载 1 次,最多可被下载 10 次)后或者 24 小时后,就会自动删除。这将确保你的文件不会一直保留在网络上。 -该工具当前处于 alpha 阶段,使用时请自担风险。而且,当前只有有限个安装选项可用。 +该工具当前处于 alpha 阶段,使用时请自担风险。而且,当前只有有限的安装方式可用。 ### ffsend 的特点: - * 全功能且友好的命令行工具 - * 安全地上传和下载文件与目录 - * 在客户端总是被加密 - * 额外的密码保护,密码生成和可配置下载次数限制 - * 内置文件或目录的打包和解压 - * 可以简单地管理你的历史分享记录 - * 能够使用你自己的发送主机 - * 查看或者删除共享文件 + * 全功能且使用友好的命令行工具 + * 可以安全地上传和下载文件与目录 + * 总是在客户端加密 + * 可用额外的密码进行保护、密码生成和可配置下载次数限制 + * 内置的文件或目录的打包和解压 + * 可以轻松地管理你的历史分享记录 + * 能够使用你自己的 Send 主机 + * 审查或者删除共享文件 * 精准的错误报告 - * 由加密或上传下载导致的低内存消耗 - * 无需集成就可被用在脚本中 + * 低内存消耗,用于加密或上传下载 + * 无需交互,可以集成在脚本中 ### 如何在 LInux 中安装 ffsend 呢? -当前除了 Debian 和 Arch Linux 系统,其他发行版还没有相应的安装包(译者注:这个信息已过时,最新内容请看[这里](https://github.com/timvisee/ffsend#install))。然而,我们可以轻易地根据我们自己的操作系统和架构下载到相应的预编译二进制文件。 +当前除了 Debian 和 Arch Linux 系统,其他发行版还没有相应的安装包(LCTT 译注:这个信息已过时,最新内容请看[这里](https://github.com/timvisee/ffsend#install))。然而,我们可以轻易地根据我们自己的操作系统和架构下载到相应的预编译二进制文件。 -运行下面的命令来为你的操作系统下载 `ffsend` 最新可用的版本(译者注:当前最新版本为 v0.2.58): +运行下面的命令来为你的操作系统下载 `ffsend` 最新可用的版本(LCTT 译注:当前最新版本为 v0.2.58): ``` $ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend-v0.1.2-linux-x64.tar.gz @@ -91,20 +93,20 @@ To show all subcommands, features and other help: ffsend help [SUBCOMMAND] ``` -对于使用基于 Arch Linux 系统的用户可以简单地借助 **[AUR Helper][6]** 来安装它,因为这个包已经在 AUR 软件仓库中了。 +对于使用基于 Arch Linux 系统的用户可以简单地借助 [AUR 助手][6]来安装它,因为这个包已经在 AUR 软件仓库中了。 ``` $ yay -S ffsend ``` -对于使用 **`Debian/Ubuntu`** 系统的用户,使用 **[DPKG 命令][7]** 来安装 `ffsend`。 +对于使用 Debian/Ubuntu 系统的用户,使用 [DPKG 命令][7]来安装 `ffsend`。 ``` $ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend_0.1.2_amd64.deb $ sudo dpkg -i ffsend_0.1.2_amd64.deb ``` -### 如何使用 ffsend 来发送文件? +### 如何使用 ffsend 这并不复杂,我们可以简单地通过下面的语法来发送文件。 @@ -240,56 +242,19 @@ $ ffsend delete https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf File deleted ``` -另外,你还可以通过使用 firefox 浏览其打开 https://send.firefox.com/ 来完成相应的分享。 +### 如何在浏览器中使用 Send + +另外,你还可以通过使用 firefox 浏览器打开 https://send.firefox.com/ 来完成相应的分享。 只需要拖拽该文件就可以上传它: + ![][11] 一旦该文件被下载,它将展示 100% 的下载状态。 + ![][12] -想查看其他的可能选项,请浏览它对应的 man 信息或者帮助页: - -``` -$ ffsend --help -ffsend 0.1.2 -Tim Visee -Easily and securely share files from the command line. -A fully featured Firefox Send client. - -USAGE: - ffsend [FLAGS] [OPTIONS] [SUBCOMMAND] - -FLAGS: - -f, --force Force the action, ignore warnings - -h, --help Prints help information - -i, --incognito Don't update local history for actions - -I, --no-interact Not interactive, do not prompt - -q, --quiet Produce output suitable for logging and automation - -V, --version Prints version information - -v, --verbose Enable verbose information and logging - -y, --yes Assume yes for prompts - -OPTIONS: - -H, --history Use the specified history file [env: FFSEND_HISTORY] - -t, --timeout Request timeout (0 to disable) [env: FFSEND_TIMEOUT] - -T, --transfer-timeout Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT] - -SUBCOMMANDS: - upload Upload files [aliases: u, up] - download Download files [aliases: d, down] - debug View debug information [aliases: dbg] - delete Delete a shared file [aliases: del] - exists Check whether a remote file exists [aliases: e] - help Prints this message or the help of the given subcommand(s) - history View file history [aliases: h] - info Fetch info about a shared file [aliases: i] - parameters Change parameters of a shared file [aliases: params] - password Change the password of a shared file [aliases: pass, p] - -The public Send service that is used as default host is provided by Mozilla. -This application is not affiliated with Mozilla, Firefox or Firefox Send. -``` +想查看其他的可能选项,请浏览它对应的 man 信息或者帮助页。 -------------------------------------------------------------------------------- @@ -298,16 +263,16 @@ via: https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-com 作者:[Vinoth Kumar][a] 选题:[lujun9972][b] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/vinoth/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/onionshare-secure-way-to-share-files-sharing-tool-linux/ +[1]: https://linux.cn/article-9177-1.html [2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ [3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ -[4]: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ +[4]: https://linux.cn/article-10516-1.html [5]: https://github.com/timvisee/ffsend [6]: https://www.2daygeek.com/category/aur-helper/ [7]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/ diff --git a/published/20190422 9 ways to save the planet.md b/published/202003/20190422 9 ways to save the planet.md similarity index 100% rename from published/20190422 9 ways to save the planet.md rename to published/202003/20190422 9 ways to save the planet.md diff --git a/published/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md b/published/202003/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md similarity index 100% rename from published/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md rename to published/202003/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md diff --git a/published/20190731 How to structure a multi-file C program- Part 2.md b/published/202003/20190731 How to structure a multi-file C program- Part 2.md similarity index 100% rename from published/20190731 How to structure a multi-file C program- Part 2.md rename to published/202003/20190731 How to structure a multi-file C program- Part 2.md diff --git a/published/20190813 Building a non-breaking breakpoint for Python debugging.md b/published/202003/20190813 Building a non-breaking breakpoint for Python debugging.md similarity index 100% rename from published/20190813 Building a non-breaking breakpoint for Python debugging.md rename to published/202003/20190813 Building a non-breaking breakpoint for Python debugging.md diff --git a/published/20190925 Debugging in Emacs- The Grand Unified Debugger.md b/published/202003/20190925 Debugging in Emacs- The Grand Unified Debugger.md similarity index 100% rename from published/20190925 Debugging in Emacs- The Grand Unified Debugger.md rename to published/202003/20190925 Debugging in Emacs- The Grand Unified Debugger.md diff --git a/published/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/published/202003/20191126 Calculator N- is an open source scientific calculator for your smartphone.md similarity index 100% rename from published/20191126 Calculator N- is an open source scientific calculator for your smartphone.md rename to published/202003/20191126 Calculator N- is an open source scientific calculator for your smartphone.md diff --git a/published/20191223 10 articles to learn Linux your way.md b/published/202003/20191223 10 articles to learn Linux your way.md similarity index 100% rename from published/20191223 10 articles to learn Linux your way.md rename to published/202003/20191223 10 articles to learn Linux your way.md diff --git a/published/20191223 Prioritizing simplicity in your Python code.md b/published/202003/20191223 Prioritizing simplicity in your Python code.md similarity index 100% rename from published/20191223 Prioritizing simplicity in your Python code.md rename to published/202003/20191223 Prioritizing simplicity in your Python code.md diff --git a/published/20191226 10 Linux command tutorials for beginners and experts.md b/published/202003/20191226 10 Linux command tutorials for beginners and experts.md similarity index 100% rename from published/20191226 10 Linux command tutorials for beginners and experts.md rename to published/202003/20191226 10 Linux command tutorials for beginners and experts.md diff --git a/published/20200113 How to setup a DNS server with bind.md b/published/202003/20200113 How to setup a DNS server with bind.md similarity index 100% rename from published/20200113 How to setup a DNS server with bind.md rename to published/202003/20200113 How to setup a DNS server with bind.md diff --git a/published/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/published/202003/20200121 Syncthing- Open Source P2P File Syncing Tool.md similarity index 100% rename from published/20200121 Syncthing- Open Source P2P File Syncing Tool.md rename to published/202003/20200121 Syncthing- Open Source P2P File Syncing Tool.md diff --git a/published/20200123 6 things you should be doing with Emacs.md b/published/202003/20200123 6 things you should be doing with Emacs.md similarity index 100% rename from published/20200123 6 things you should be doing with Emacs.md rename to published/202003/20200123 6 things you should be doing with Emacs.md diff --git a/published/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md b/published/202003/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md similarity index 100% rename from published/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md rename to published/202003/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md diff --git a/published/20200129 Use Emacs to get social and track your todo list.md b/published/202003/20200129 Use Emacs to get social and track your todo list.md similarity index 100% rename from published/20200129 Use Emacs to get social and track your todo list.md rename to published/202003/20200129 Use Emacs to get social and track your todo list.md diff --git a/published/20200130 4 open source productivity tools on my wishlist.md b/published/202003/20200130 4 open source productivity tools on my wishlist.md similarity index 100% rename from published/20200130 4 open source productivity tools on my wishlist.md rename to published/202003/20200130 4 open source productivity tools on my wishlist.md diff --git a/published/20200204 DevOps vs Agile- What-s the difference.md b/published/202003/20200204 DevOps vs Agile- What-s the difference.md similarity index 100% rename from published/20200204 DevOps vs Agile- What-s the difference.md rename to published/202003/20200204 DevOps vs Agile- What-s the difference.md diff --git a/published/20200211 Basic kubectl and Helm commands for beginners.md b/published/202003/20200211 Basic kubectl and Helm commands for beginners.md similarity index 100% rename from published/20200211 Basic kubectl and Helm commands for beginners.md rename to published/202003/20200211 Basic kubectl and Helm commands for beginners.md diff --git a/published/20200212 Extend the life of your SSD drive with fstrim.md b/published/202003/20200212 Extend the life of your SSD drive with fstrim.md similarity index 100% rename from published/20200212 Extend the life of your SSD drive with fstrim.md rename to published/202003/20200212 Extend the life of your SSD drive with fstrim.md diff --git a/published/20200214 How to set up your own fast, private open source mesh network.md b/published/202003/20200214 How to set up your own fast, private open source mesh network.md similarity index 100% rename from published/20200214 How to set up your own fast, private open source mesh network.md rename to published/202003/20200214 How to set up your own fast, private open source mesh network.md diff --git a/published/20200214 Linux is our love language.md b/published/202003/20200214 Linux is our love language.md similarity index 100% rename from published/20200214 Linux is our love language.md rename to published/202003/20200214 Linux is our love language.md diff --git a/published/20200214 PHP Development on Fedora with Eclipse.md b/published/202003/20200214 PHP Development on Fedora with Eclipse.md similarity index 100% rename from published/20200214 PHP Development on Fedora with Eclipse.md rename to published/202003/20200214 PHP Development on Fedora with Eclipse.md diff --git a/published/202003/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md b/published/202003/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md new file mode 100644 index 0000000000..2a6b8e91d7 --- /dev/null +++ b/published/202003/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (mengxinayan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12053-1.html) +[#]: subject: (Basic Vim Commands You Need to Know to Work in Vim Editor) +[#]: via: (https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +必知必会的 Vim 编辑器基础命令 +====== + +如果你是一名系统管理员或者开发者,当你在终端工作时有时会需要编辑一个文件。在 Linux 系统中有几种文件编辑器,你可以根据需求选择合适的文件编辑器。在这里,我想推荐 Vim 编辑器。 + +### 为什么推荐 Vim 编辑器 + +相对于创建新文件,你更多是修改已经存在的文件。在这种情况下,Vim 快捷键可以有效地满足你的需求。 + +下列文章可以帮助你了解对文件和目录的操作。 + +- [Linux 基础:对文件和目录进行操作的 Linux 和 Unix 命令][1] +- [在 Linux 中查看不同文件格式的 10 种方法][2] + +### 什么是 Vim + +Vim 是被 Linux 管理员和开发者广泛使用的最流行和功能强大的编辑器之一。它可以通过高度的自定义配置来提高文本编辑效率。它是在众多 Unix 默认安装的 Vi 编辑器的升级版。 + +Vim 通常被称为“程序员的编辑器”,但并不限于此,它也可用于编辑任何类型的文件。它具有许多功能,例如:多次撤销、多窗口和缓冲区、语法高亮、命令行编辑、文件名补全、可视选择等等。你可以使用 `:help` 命令来获取在线帮助。 + +### 理解 Vim 的模式 + +Vim 有两种模式,详细介绍如下: + +**命令模式:** 当启动 Vim 编辑器后,默认处在命令模式下。你可以在文件中移动并且修改内容,剪切、复制和粘贴文件的一部分,同时发出命令执行更多操作(按 `ESC` 键进入命令模式) + +**插入模式:** 插入模式用于在给定的文档位置插入文本(按 `i` 键进入插入模式) + +### 我如何知道我正使用哪种 Vim 模式呢? + +如果你正在使用插入模式,你会在编辑器的底部看到 `INSERT`。如果编辑器底部没有显示任何内容,或者在编辑器底部显示了文件名,则处于 “命令模式”。 + +### 命令模式下的光标移动 + +Vim 快捷键允许你使用不同的方式来移动光标: + + * `G` – 跳转到文件最后一行 + * `gg` – 跳转到文件首行 + * `$` – 跳转到行末尾 + * `0`(数字 0) – 跳转到行开头 + * `w` – 跳转到下一个单词的开始(单词的分隔符可以是空格或其他符号) + * `W` – 跳转到下一个单词的开始(单词的分隔符只能是空格) + * `b` – 跳转到下一个单词的末尾(单词的分隔符可以是空格或其他符号) + * `B` – 跳转到下一个单词的末尾(单词的分隔符只能是空格) + + * `PgDn` 键 – 向下移动一页 + * `PgUp` 键 – 向上移动一页 + * `Ctrl+d` – 向下移动半页 + * `Ctrl+u` – 向上移动半页 + +### 插入模式:插入文字 + +下面的 Vim 快捷键允许你根据需要在光标的不同位置插入内容。 + + * `i` – 在光标之前插入 + * `a` – 在光标之后插入 + * `I` – 在光标所在行的开头插入。当光标位于行中间时,这个键很有用 + * `A` – 在光标所在行的末尾插入。 + * `o` – 在光标所在行的下面插入新行 + * `O` – 在光标所在行的上面插入新行 + * `ea` – 在单词的末尾插入 + +### 拷贝、粘贴和删除一行 + + * `yy` – 复制一行 + * `p` / `P` – 将内容粘贴到光标之后 / 之前 + * `dd` – 删除一行 + * `dw` – 删除一个单词 + +### 在 Vim 中搜索和替换匹配的模式 + + * `/模式` – 向后搜索给定的模式 + * `?模式` – 向前搜索给定的模式 + * `n` – 向后重复搜索之前给定的模式 + * `N` – 向前重复搜索之前给定的模式 + * `:%s/旧模式/新模式/g` – 将文件中所有的旧模式替换为新模式 + * `:s/旧模式/新模式/g` – 将当前行中所有的旧模式替换为新模式 + * `:%s/旧模式/新模式/gc` – 逐个询问是否文件中的旧模式替换为新模式 + +### 如何在 Vim 编辑器中跳转到特定行 + +你可以根据需求以两种方式达到该目的,如果你不知道行号,建议采用第一种方法。 + +通过打开文件并运行下面的命令来显示行号 + +``` +:set number +``` + +当你设置好显示行号后,按 `:n` 跳转到相应的行号。例如,如果你想跳转到第 15 行,请输入: + +``` +:15 +``` + +如果你已经知道行号,请使用以下方法在打开文件时直接跳转到相应行。例如,如果在打开文件时直接跳转到 20 行,请输入下面的命令: + +``` +$ vim +20 [文件名] +``` + +### 撤销操作/恢复上一次操作/重复上一次操作 + + * `u` – 撤销更改 + * `Ctrl+r` – 恢复更改 + * `.` – 重复上一条命令 + +### 保存和退出 Vim + + * `:w` – 保存更改但不退出 vim + * `:wq` – 写并退出 + * `:q!` – 强制退出 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[萌新阿岩](https://github.com/mengxinayan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-basic-commands-file-directory-manipulation/ +[2]: https://www.2daygeek.com/unix-linux-command-to-view-file/ diff --git a/published/20200219 Here Are The Most Beautiful Linux Distributions in 2020.md b/published/202003/20200219 Here Are The Most Beautiful Linux Distributions in 2020.md similarity index 100% rename from published/20200219 Here Are The Most Beautiful Linux Distributions in 2020.md rename to published/202003/20200219 Here Are The Most Beautiful Linux Distributions in 2020.md diff --git a/published/20200219 How to find what you-re looking for on Linux with find.md b/published/202003/20200219 How to find what you-re looking for on Linux with find.md similarity index 100% rename from published/20200219 How to find what you-re looking for on Linux with find.md rename to published/202003/20200219 How to find what you-re looking for on Linux with find.md diff --git a/published/20200219 Try this Bash script for-large filesystems.md b/published/202003/20200219 Try this Bash script for-large filesystems.md similarity index 100% rename from published/20200219 Try this Bash script for-large filesystems.md rename to published/202003/20200219 Try this Bash script for-large filesystems.md diff --git a/published/20200219 Waterfox- Firefox Fork With Legacy Add-ons Options.md b/published/202003/20200219 Waterfox- Firefox Fork With Legacy Add-ons Options.md similarity index 100% rename from published/20200219 Waterfox- Firefox Fork With Legacy Add-ons Options.md rename to published/202003/20200219 Waterfox- Firefox Fork With Legacy Add-ons Options.md diff --git a/published/20200220 Tools for SSH key management.md b/published/202003/20200220 Tools for SSH key management.md similarity index 100% rename from published/20200220 Tools for SSH key management.md rename to published/202003/20200220 Tools for SSH key management.md diff --git a/published/20200224 Using C and C-- for data science.md b/published/202003/20200224 Using C and C-- for data science.md similarity index 100% rename from published/20200224 Using C and C-- for data science.md rename to published/202003/20200224 Using C and C-- for data science.md diff --git a/published/20200224 What developers need to know about domain-specific languages.md b/published/202003/20200224 What developers need to know about domain-specific languages.md similarity index 100% rename from published/20200224 What developers need to know about domain-specific languages.md rename to published/202003/20200224 What developers need to know about domain-specific languages.md diff --git a/published/20200225 3 eBook readers for the Linux desktop.md b/published/202003/20200225 3 eBook readers for the Linux desktop.md similarity index 100% rename from published/20200225 3 eBook readers for the Linux desktop.md rename to published/202003/20200225 3 eBook readers for the Linux desktop.md diff --git a/published/20200225 7 tips for writing an effective technical resume.md b/published/202003/20200225 7 tips for writing an effective technical resume.md similarity index 100% rename from published/20200225 7 tips for writing an effective technical resume.md rename to published/202003/20200225 7 tips for writing an effective technical resume.md diff --git a/published/20200226 Use logzero for simple logging in Python.md b/published/202003/20200226 Use logzero for simple logging in Python.md similarity index 100% rename from published/20200226 Use logzero for simple logging in Python.md rename to published/202003/20200226 Use logzero for simple logging in Python.md diff --git a/published/20200228 Converting between uppercase and lowercase on the Linux command line.md b/published/202003/20200228 Converting between uppercase and lowercase on the Linux command line.md similarity index 100% rename from published/20200228 Converting between uppercase and lowercase on the Linux command line.md rename to published/202003/20200228 Converting between uppercase and lowercase on the Linux command line.md diff --git a/published/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/published/202003/20200302 How to Add New Brushes in GIMP -Quick Tip.md similarity index 100% rename from published/20200302 How to Add New Brushes in GIMP -Quick Tip.md rename to published/202003/20200302 How to Add New Brushes in GIMP -Quick Tip.md diff --git a/published/20200302 Install GNU Emacs on Windows.md b/published/202003/20200302 Install GNU Emacs on Windows.md similarity index 100% rename from published/20200302 Install GNU Emacs on Windows.md rename to published/202003/20200302 Install GNU Emacs on Windows.md diff --git a/published/20200303 Getting started with the Rust package manager, Cargo.md b/published/202003/20200303 Getting started with the Rust package manager, Cargo.md similarity index 100% rename from published/20200303 Getting started with the Rust package manager, Cargo.md rename to published/202003/20200303 Getting started with the Rust package manager, Cargo.md diff --git a/published/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md b/published/202003/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md similarity index 100% rename from published/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md rename to published/202003/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md diff --git a/published/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/published/202003/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md similarity index 100% rename from published/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md rename to published/202003/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md diff --git a/published/20200305 Install and Use Wireshark on Ubuntu Linux.md b/published/202003/20200305 Install and Use Wireshark on Ubuntu Linux.md similarity index 100% rename from published/20200305 Install and Use Wireshark on Ubuntu Linux.md rename to published/202003/20200305 Install and Use Wireshark on Ubuntu Linux.md diff --git a/published/20200306 Communicating with other users on the Linux command line.md b/published/202003/20200306 Communicating with other users on the Linux command line.md similarity index 100% rename from published/20200306 Communicating with other users on the Linux command line.md rename to published/202003/20200306 Communicating with other users on the Linux command line.md diff --git a/published/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md b/published/202003/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md similarity index 100% rename from published/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md rename to published/202003/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md diff --git a/published/20200309 6 Raspberry Pi tutorials to try out.md b/published/202003/20200309 6 Raspberry Pi tutorials to try out.md similarity index 100% rename from published/20200309 6 Raspberry Pi tutorials to try out.md rename to published/202003/20200309 6 Raspberry Pi tutorials to try out.md diff --git a/published/20200310 2020 Will Be a Year of Hindsight for SD-WAN.md b/published/202003/20200310 2020 Will Be a Year of Hindsight for SD-WAN.md similarity index 100% rename from published/20200310 2020 Will Be a Year of Hindsight for SD-WAN.md rename to published/202003/20200310 2020 Will Be a Year of Hindsight for SD-WAN.md diff --git a/published/20200310 Basilisk- A Firefox Fork For The Classic Looks and Classic Extensions.md b/published/202003/20200310 Basilisk- A Firefox Fork For The Classic Looks and Classic Extensions.md similarity index 100% rename from published/20200310 Basilisk- A Firefox Fork For The Classic Looks and Classic Extensions.md rename to published/202003/20200310 Basilisk- A Firefox Fork For The Classic Looks and Classic Extensions.md diff --git a/published/20200310 Containers vs. VMs, Istio in production, and more industry news.md b/published/202003/20200310 Containers vs. VMs, Istio in production, and more industry news.md similarity index 100% rename from published/20200310 Containers vs. VMs, Istio in production, and more industry news.md rename to published/202003/20200310 Containers vs. VMs, Istio in production, and more industry news.md diff --git a/translated/tech/20200310 Run Kubernetes on a Raspberry Pi with k3s.md b/published/202003/20200310 Run Kubernetes on a Raspberry Pi with k3s.md similarity index 81% rename from translated/tech/20200310 Run Kubernetes on a Raspberry Pi with k3s.md rename to published/202003/20200310 Run Kubernetes on a Raspberry Pi with k3s.md index e0b3ad324c..79b42ade4d 100644 --- a/translated/tech/20200310 Run Kubernetes on a Raspberry Pi with k3s.md +++ b/published/202003/20200310 Run Kubernetes on a Raspberry Pi with k3s.md @@ -1,29 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12049-1.html) [#]: subject: (Run Kubernetes on a Raspberry Pi with k3s) [#]: via: (https://opensource.com/article/20/3/kubernetes-raspberry-pi-k3s) [#]: author: (Lee Carpenter https://opensource.com/users/carpie) 使用 K3s 在树莓派上运行 Kubernetes 集群 ====== -> 跟随接下来的介绍,自己搭建一个三节点的 Kubernetes 集群。 -![A ship wheel with someone steering][1] +> 跟随接下来的介绍,自己搭建一个三节点的 Kubernetes 集群。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/121559p44e3dfrerf3zver.jpg) 我对在树莓派上搭建 [Kubernetes][2] 集群已经感兴趣很长时间了,只要照着网上的教程,我可以在由三个树莓派组成的集群中搭建一套 Kubernetes 并正常运行。但在这种情况下,主节点上的内存和 CPU 资源捉襟见肘,执行 Kubernetes 任务的时候往往性能不佳,想要升级 Kubernetes 就更不可能了。 -这个时候,我发现了 [K3s][3] 这个项目。K3s 誉为可用于资源受限环境下的轻量级 Kubernetes,它还针对 ARM 处理器做出了优化,这让 Kubernetes 集群可以在树莓派上运行得更好。在下文中,我们将会使用 K3s 来创建一个 Kubernetes 集群。 +这个时候,我非常激动地发现了 [K3s][3] 这个项目。K3s 被誉为在可用于资源受限环境下的轻量级 Kubernetes,它还针对 ARM 处理器做出了优化,这让 Kubernetes 集群可以在树莓派上运行得更好。在下文中,我们将会使用 K3s 来创建一个 Kubernetes 集群。 + +- [video](https://youtu.be/6PqxJhV-t1s) ### 准备 要按照本文介绍的方式创建 Kubernetes 集群,首先需要准备: - * 至少一个树莓派(包括 SD 卡和电源) - * 网线 - * 将所有树莓派连接到一起的交换机或路由器 +* 至少一个树莓派(包括 SD 卡和电源) +* 网线 +* 将所有树莓派连接到一起的交换机或路由器 我们会通过在线安装的方式安装 K3s,因此还需要可以连接到互联网。 @@ -35,7 +38,6 @@ 为了不需要通过 IP 来引用某一个节点,我们将每个节点的主机名记录到 PC 的 `/etc/hosts` 文件当中: - ``` echo -e "192.168.0.50\tkmaster" | sudo tee -a /etc/hosts echo -e "192.168.0.51\tknode1" | sudo tee -a /etc/hosts @@ -48,20 +50,17 @@ echo -e "192.168.0.52\tknode2" | sudo tee -a /etc/hosts 在主节点上安装 Raspbian 完成后,启动树莓派并通过 `ssh` 连接上去: - ``` ssh pi@kmaster ``` -执行以下命令安装 K3s: - +在主节点上执行以下命令安装 K3s: ``` curl -sfL https://get.k3s.io | sh - ``` -等到命令跑完以后,一个单节点集群就已经运行起来了。还在这个树莓派上执行: - +等到命令跑完以后,一个单节点集群就已经运行起来了。让我们检查一下,还在这个树莓派上执行: ``` sudo kubectl get nodes @@ -69,7 +68,6 @@ sudo kubectl get nodes 就会看到这样的输出: - ``` NAME STATUS ROLES AGE VERSION kmaster Ready master 2m13s v1.14.3-k3s.1 @@ -77,8 +75,7 @@ kmaster Ready master 2m13s v1.14.3-k3s.1 ### 获取连接令牌join token -之后我们需要部署工作节点。在工作节点上安装 K3s 的时候,会需要用到连接令牌,它放置在主节点的文件系统上。首先把连接令牌打印出来保存以便后续使用: - +之后我们需要部署工作节点。在工作节点上安装 K3s 的时候,会需要用到连接令牌,它放置在主节点的文件系统上。首先把连接令牌保存出来以便后续使用: ``` sudo cat /var/lib/rancher/k3s/server/node-token @@ -90,17 +87,15 @@ sudo cat /var/lib/rancher/k3s/server/node-token 启动主机名为 `knode1` 的树莓派,通过 `ssh` 连接上去: - ``` ssh pi@knode1 ``` 在这个树莓派上,安装 K3s 的过程和之前差不多,但需要另外加上一些参数,表示它是一个工作节点,需要连接到一个已有的集群上: - ``` -curl -sfL | K3S_URL= \ -K3S_TOKEN=<刚才保存下来的连接令牌> sh - +curl -sfL http://get.k3s.io | K3S_URL=https://192.168.0.50:6443 \ +K3S_TOKEN=刚才保存下来的连接令牌 sh - ``` `K3S_TOKEN` 的值需要替换成刚才保存下来的实际的连接令牌。完成之后,在主机名为 `knode2` 的树莓派上重复这个安装过程。 @@ -109,20 +104,17 @@ K3S_TOKEN=<刚才保存下来的连接令牌> sh - 现在如果我们想要查看或者更改集群,都必须 `ssh` 到集群的主节点才能使用 `kubectl`,这是比较麻烦的。因此我们会将 `kubectl` 放到 PC 上使用。首先,在主节点上获取一些必要的配置信息,`ssh` 到 `kmaster` 上执行: - ``` sudo cat /etc/rancher/k3s/k3s.yaml ``` -复制上面命令的输出,创建一个目录用来放置配置文件: - +复制上面命令的输出,然后在你的 PC 上创建一个目录用来放置配置文件: ``` mkdir ~/.kube ``` -将复制好的内容写入到 `~/.kube/config` 文件中,然后将 - +将复制好的内容写入到 `~/.kube/config` 文件中,然后编辑该文件,将 ``` server: https://localhost:6443 @@ -130,26 +122,22 @@ server: https://localhost:6443 改为 - ``` server: https://kmaster:6443 ``` 出于安全考虑,只对自己保留这个配置文件的读写权限: - ``` chmod 600 ~/.kube/config ``` 如果 PC 上还没有安装 `kubectl` 的话,就可以开始安装了。Kubernetes 官方网站上有各种平台安装 `kubectl` 的[方法说明][5],我使用的是 Ubuntu 的衍生版 Linux Mint,所以我的安装方法是这样的: - ``` sudo apt update && sudo apt install -y apt-transport-https -curl -s | sudo apt-key add - -echo "deb kubernetes-xenial main" | \ -sudo tee -a /etc/apt/sources.list.d/kubernetes.list +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - +echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list sudo apt update && sudo apt install kubectl ``` @@ -157,14 +145,12 @@ sudo apt update && sudo apt install kubectl 现在在 PC 上就可以查看 Kubernetes 集群了: - ``` kubectl get nodes ``` 输出大概会是这样: - ``` NAME STATUS ROLES AGE VERSION kmaster Ready master 12m v1.14.3-k3s.1 @@ -176,11 +162,10 @@ knode1 Ready worker 103s v1.14.3-k3s.1 ### K3s 的彩蛋 -如果执行 `kubectl get pods --all-namespaces`,就会看到其它服务的一些 pod,比如 [Traefik][6]。Traefik 在这里起到是反向代理和负载均衡器的作用,它可以让流量从单个入口进入集群后引导到集群中的各个服务。Kubernetes 支持这种机制,但 Kubernetes 本身不提供这个功能,因此 Traefik 是一个不错的选择,K3s 安装后立即可用的优点也得益于此。 +如果执行 `kubectl get pods --all-namespaces`,就会看到其它服务的一些 Pod,比如 [Traefik][6]。Traefik 在这里起到是反向代理和负载均衡器的作用,它可以让流量从单个入口进入集群后引导到集群中的各个服务。Kubernetes 支持这种机制,但 Kubernetes 本身不提供这个功能,因此 Traefik 是一个不错的选择,K3s 安装后立即可用的优点也得益于此。 在后续的文章中,我们会继续探讨 Traefik 在 Kubernetes ingress 中的应用,以及在集群中部署其它组件。敬请关注。 - -------------------------------------------------------------------------------- via: https://opensource.com/article/20/3/kubernetes-raspberry-pi-k3s @@ -188,7 +173,7 @@ via: https://opensource.com/article/20/3/kubernetes-raspberry-pi-k3s 作者:[Lee Carpenter][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20200311 How to install pip to manage PyPI packages easily.md b/published/202003/20200311 How to install pip to manage PyPI packages easily.md similarity index 100% rename from published/20200311 How to install pip to manage PyPI packages easily.md rename to published/202003/20200311 How to install pip to manage PyPI packages easily.md diff --git a/published/20200312 Amazon Has Launched Its Own Linux Distribution But It-s Not for Everyone.md b/published/202003/20200312 Amazon Has Launched Its Own Linux Distribution But It-s Not for Everyone.md similarity index 100% rename from published/20200312 Amazon Has Launched Its Own Linux Distribution But It-s Not for Everyone.md rename to published/202003/20200312 Amazon Has Launched Its Own Linux Distribution But It-s Not for Everyone.md diff --git a/published/202003/20200312 How to write effective documentation for your open source project.md b/published/202003/20200312 How to write effective documentation for your open source project.md new file mode 100644 index 0000000000..1635591917 --- /dev/null +++ b/published/202003/20200312 How to write effective documentation for your open source project.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12052-1.html) +[#]: subject: (How to write effective documentation for your open source project) +[#]: via: (https://opensource.com/article/20/3/documentation) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +如何为你的开源项目编写实用的文档 +====== + +> 一份优质的文档可以让很多用户对你的项目路人转粉。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/215343srdknc1o8kplbu8z.jpg) + +好的代码很多时候并不代表一切。或许你能用最精巧的代码解决了世界上最迫切需要解决的问题,但如果你作为一个开源开发者,没能用准确的语言将你的作品公之于世,你的代码也只能成为沧海遗珠。因此,技术写作和文档编写是很重要的技能。 + +一般来说,项目中的文档是最受人关注的部分,很多用户会通过文档来决定自己是否应该对某个项目开始学习或研究。所以,我们不能忽视技术写作和文档编写的工作,尤其要重点关注其中的“入门Getting Started”部分,这会对你项目的发展起到关键性的作用。 + +对于很多人来说,写作是一件令人厌烦甚至恐惧的事情。我们这些工程师出身的人,更多学习的是“写代码”而不是学习“为代码写文档”。不少人会把英语作为自己的第二语言或者第三语言,他们可能会对英语写作感到不自信甚至害怕(我的母语是汉语,英语是作为我的第二语言学习的,所以我也能感受到这种痛苦)。 + +但如果你希望自己的项目能在全球范围内产生一定的影响力,英语就是你必须使用的语言,这是一个无法避免的现实。但不必害怕,我在写这篇文章的时候就考虑到了这些可能带来的挑战,并给出了我的一些建议。 + +### 五条有用的写作建议 + +这五条建议你马上就可以用起来,尽管看起来似乎有些浅显,但在技术写作时却经常被忽视。 + +1. **使用主动语态**:感受一下[主动语态][2]下的“你可以这样更改配置(You can change these configurations by...)”和被动语态下的“配置可以这样更改(These configurations can be changed by…)”有什么不同之处。 +2. **使用简洁明了的句子**:可以借助 [Hemingway App][3] 或者 [Grammarly][4] 这样的工具,尽管它们并不开源。 +3. **保持条理性**:你可以在文档中通过写标题、划重点、引链接等方式,把各类信息划分为不同的部分,避免将所有内容都杂糅在一大段冗长的文字当中。 +4. **提高可读性**:除了单纯的文字之外,运用图表也是从多种角度表达的手段之一。 +5. **注意拼写和语法**:必须记得检查文档中是否有拼写错误或者语法错误。 + +只要在文档的写作和编辑过程中应用到这些技巧,你就能够和读者建立起沟通和信任。 + +* **高效沟通**:对于工程师们来说,阅读长篇大论的冗长文字,还不如去看小说。在阅读技术文档时,他们总是希望能够从中快速准确地获取到有用的信息。因此,技术文档的最佳风格应该是精简而有效的,不过这并不代表文档中不能出现类似幽默、emoji 甚至段子这些东西,这些元素可以当你的文档更有个性、更使人印象深刻。当然,具体的实现方式就因人而异了 +* **建立信任**:你需要取得文档读者们的信任,这在一个项目的前期尤为重要。读者对你的信任除了来源于你代码的质量,还跟你文档编写的质量有关。所以你不仅要打磨代码,还要润色好相关的文档,这也是上面第 5 点建议拼写和语法检查的原因。 + +### 从编写“入门”文档开始 + +现在,最需要花费功夫的应该就是“入门”部分了,这是一篇技术文档最重要的部分,[二八定律][5]在这里得到了充分体现:访问一个项目的大部分流量都会落在项目文档上,而访问项目文档的大部分流量则会落在文档的“入门”部分中。因此,如果文档的“入门”部分写得足够好,项目就会吸引到很多用户,反之,用户会对你的项目敬而远之。 + +那么如何写好“入门”部分呢?我建议按照以下三步走: + +1. **任务化**:入门指南应该以任务为导向。这里的任务指的是对于开发者来说可以完成的离散的小项目,而不应该包含太多涉及到体系结构、核心概念等的抽象信息,因此在“入门”部分只需要提供一个简单明了的概述就可以了。也不要在“入门”部分大谈这个项目如何优秀地解决了问题,这个话题可以放在文档中别的部分进行说明。总而言之,“入门”部分最好是给出一些主要的操作步骤,这样显得开门见山。 +2. **30 分钟内能够完成**:这一点的核心是耗时尽可能短,不宜超过 30 分钟,这个时间上限是考虑到用户可能对你的项目并不了解。这一点很重要,大部分愿意浏览文档的人都是有技术基础的,但对你的项目也仅仅是一知半解。首先让这些读者尝试进行一些相关操作,在收到一定效果后,他们才会愿意花更多时间深入研究整个项目。因此,你可以从耗时这个角度来评估你的文档“入门”部分有没有需要改进之处。 +3. **有意义的任务**:这里“有意义”的含义取决于你的开源项目。最重要的是认真思考并将“入门”部分严格定义为一项任务,然后交给你的读者去完成。这个项目的价值应该在这项有意义的任务中有所体现,不然读者可能会感觉这是一个浪费时间的行为。 + +提示:假如你的项目是一个分布式数据库,那么达到“整个集群在某些节点故障的情况下可以不中断地保持可用”的目标就可以认为是“有意义”的;假如你的项目是一个数据分析工具或者是商业智能工具,“有意义”的目标也可以是“加载数据后能快速生成多种可视化效果的仪表板”。总之,无论你的项目需要达到什么“有意义”的目标,都应该能在笔记本电脑上本地快速实现。 + +[Linkerd 入门][6]就是一个很好的例子。Linkerd 是一个开源的 Kubernetes 服务网格Service Mesh,当时我对 Kubernetes 了解并不多,也不熟悉服务网格。但我在自己的笔记本电脑上很轻松地就完成了其中的任务,同时也加深了对服务网格的理解。 + +上面提到的三步过程是一个很有用的框架,对一篇文档“入门”部分的设计和量化评估很有帮助。今后你如果想将你的[开源项目产品化][7],这个框架还可能对实现价值的时间time-to-value产生影响。 + +### 其它核心部分 + +认真写好“入门”部分之后,你的文档中还需要有这五个部分:架构设计、生产环境使用指导、使用案例、参考资料以及未来展望,这五个部分在一份完整的文档中是必不可少的。 + +* **架构设计**:这一部分需要深入探讨整个项目架构设计的依据,“入门”部分中那些一笔带过的关键细节就应该在这里体现。在产品化过程中,这个部分将会是[产品推广计划][8]的核心,因此通常会包含一些可视化呈现的内容,期望的效果是让更多用户长期参与到项目中来。 +* **生产环境使用指导**:对于同一个项目,在生产环境中部署比在笔记本电脑上部署要复杂得多。因此,指导用户认真使用就尤为重要。同时,有些用户可能对项目很感兴趣,但对生产环境下的使用有所顾虑,而指导和展示的过程则正好能够吸引到这类潜在的用户。 +* **使用案例**:社会认同social proof的力量是有目共睹的,所以很有必要列出正在生产环境使用这个项目的其他用户,并把这些信息摆放在显眼的位置。这个部分的浏览量甚至仅次于“入门”部分。 +* **参考资料**:这个部分是对项目的一些详细说明,让用户得以进行详细的研究以及查阅相关信息。一些开源作者会在这个部分事无巨细地列出项目中的每一个细节和边缘情况edge case,这种做法可以理解,但不推荐在项目初期就在这个部分花费过多的时间。你可以采取更折中的方式,在质量和效率之间取得平衡,例如提供一些相关社区的链接、Stack Overflow 上的标签或单独的 FAQ 页面。 +* **未来展望**:你需要制定一个简略的时间表,规划这个项目的未来发展方向,这会让用户长期保持兴趣。尽管项目在当下可能并不完美,但要让用户知道你仍然有完善这个项目的计划。这个部分也能让整个社区构建一个强大的生态,因此还要向用户提供表达他们对未来展望的看法的交流区。 + +以上这几个部分或许还没有在你的文档中出现,甚至可能会在后期才能出现,尤其是“使用案例”部分。尽管如此,还是应该在文档中逐渐加入这些部分。如果用户对“入门”部分已经感觉良好,那以上这几个部分将会提起用户更大的兴趣。 + +最后,请在“入门”部分、README 文件或其它显眼的位置注明整个项目所使用的许可证。这个细节会让你的项目更容易通过最终用户的审核。 + +### 花 20% 的时间写作 + +一般情况下,我建议把整个项目 10% 到 20% 的时间用在文档写作上。也就是说,如果你是全职进行某一个项目的,文档写作需要在其中占半天到一天。 + +再细致一点,应该将写作纳入到常规的工作流程中,这样它就不再是一件孤立的琐事,而是日常的事务。文档写作应该随着工作进度同步进行,切忌将所有写作任务都堆积起来最后完成,这样才可以帮助你的项目达到最终目标:吸引用户、获得信任。 + +* * * + +*特别鸣谢云原生计算基金会的布道师 [Luc Perkins][9] 给出的宝贵意见。* + +*本文首发于 [COSS Media][10] 并经许可发布。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/documentation + +作者:[Kevin Xu][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kevin-xu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-docdish-typewriter-pink.png?itok=OXJBtyYf (A pink typewriter) +[2]: https://www.grammar-monster.com/glossary/active_voice.htm +[3]: http://www.hemingwayapp.com/ +[4]: https://www.grammarly.com/ +[5]: https://en.wikipedia.org/wiki/Pareto_principle +[6]: https://linkerd.io/2/getting-started/ +[7]: https://opensource.com/article/19/11/products-open-source-projects +[8]: https://opensource.com/article/20/2/product-marketing-open-source-project +[9]: https://twitter.com/lucperkins +[10]: https://coss.media/open-source-documentation-technical-writing-101/ diff --git a/published/20200313 6 Best AUR (Arch User Repository) Helpers for Arch Linux.md b/published/202003/20200313 6 Best AUR (Arch User Repository) Helpers for Arch Linux.md similarity index 100% rename from published/20200313 6 Best AUR (Arch User Repository) Helpers for Arch Linux.md rename to published/202003/20200313 6 Best AUR (Arch User Repository) Helpers for Arch Linux.md diff --git a/published/20200313 GNOME 3.36 Released With Visual - Performance Improvements.md b/published/202003/20200313 GNOME 3.36 Released With Visual - Performance Improvements.md similarity index 100% rename from published/20200313 GNOME 3.36 Released With Visual - Performance Improvements.md rename to published/202003/20200313 GNOME 3.36 Released With Visual - Performance Improvements.md diff --git a/published/20200313 How to Change MAC Address in Linux.md b/published/202003/20200313 How to Change MAC Address in Linux.md similarity index 100% rename from published/20200313 How to Change MAC Address in Linux.md rename to published/202003/20200313 How to Change MAC Address in Linux.md diff --git a/published/20200314 How to Install Netbeans on Ubuntu and Other Linux.md b/published/202003/20200314 How to Install Netbeans on Ubuntu and Other Linux.md similarity index 100% rename from published/20200314 How to Install Netbeans on Ubuntu and Other Linux.md rename to published/202003/20200314 How to Install Netbeans on Ubuntu and Other Linux.md diff --git a/published/20200316 Connect your Google Drive to Fedora Workstation.md b/published/202003/20200316 Connect your Google Drive to Fedora Workstation.md similarity index 100% rename from published/20200316 Connect your Google Drive to Fedora Workstation.md rename to published/202003/20200316 Connect your Google Drive to Fedora Workstation.md diff --git a/published/20200317 Coronavirus challenges remote networking.md b/published/202003/20200317 Coronavirus challenges remote networking.md similarity index 100% rename from published/20200317 Coronavirus challenges remote networking.md rename to published/202003/20200317 Coronavirus challenges remote networking.md diff --git a/published/20200317 Viewing and configuring password aging on Linux.md b/published/202003/20200317 Viewing and configuring password aging on Linux.md similarity index 100% rename from published/20200317 Viewing and configuring password aging on Linux.md rename to published/202003/20200317 Viewing and configuring password aging on Linux.md diff --git a/published/20200318 Top 10 open source tools for working from home.md b/published/202003/20200318 Top 10 open source tools for working from home.md similarity index 100% rename from published/20200318 Top 10 open source tools for working from home.md rename to published/202003/20200318 Top 10 open source tools for working from home.md diff --git a/translated/tech/20200319 4 Markdown tools for the Linux command line.md b/published/202003/20200319 4 Markdown tools for the Linux command line.md similarity index 55% rename from translated/tech/20200319 4 Markdown tools for the Linux command line.md rename to published/202003/20200319 4 Markdown tools for the Linux command line.md index bb6a4944fe..0aa052696b 100644 --- a/translated/tech/20200319 4 Markdown tools for the Linux command line.md +++ b/published/202003/20200319 4 Markdown tools for the Linux command line.md @@ -1,36 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12048-1.html) [#]: subject: (4 Markdown tools for the Linux command line) [#]: via: (https://opensource.com/article/20/3/markdown-apps-linux-command-line) [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) 4 个 Linux 命令行下的 Markdown 工具 ====== -命令行 Markdown 工具快速、强大、灵活。以下是 4 个值得试一下的工具。 -![A person working.][1] -在处理 [Markdown][2] 格式的文件时,命令行工具会占据主导地位。它们轻巧、快速、强大、灵活,它们大多数都遵循 Unix 哲学只做好一件事。 +> 命令行 Markdown 工具快速、强大、灵活。以下是 4 个值得试一下的工具。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/112110pbd22dku6b2g6ku6.jpg) + +(在 Linux 上)在处理 [Markdown][2] 格式的文件时,命令行工具会占据主导地位。它们轻巧、快速、强大、灵活,它们大多数都遵循 Unix 哲学只做好一件事。 看一下这四个程序,它们可以帮助你在命令行中更有效地处理 Markdown 文件。 ### mdless -如果你使用过一段时间的 Linux 命令行,那么你可能对名为 [less][3] 的文本查看器很熟悉。当然,你可以使用 less 查看 Markdown 文件,但结果有点枯燥。如何在终端中查看 Markdown 文件效果更好一点?来使用 [mdless][4]。 +如果你使用过一段时间的 Linux 命令行,那么你可能对名为 [less][3] 的文本查看器很熟悉。当然,你可以使用 `less` 查看 Markdown 文件,但结果有点枯燥。如何在终端中查看 Markdown 文件效果更好一点?来使用 [mdless][4]。 ![mdless][5] -你可以使用键盘上的箭头键四处移动,并且 mdless 提供了很好的搜索功能。 +你可以使用键盘上的箭头键四处移动,并且 `mdless` 提供了很好的搜索功能。 -mdless 不仅会显示文本,而且还会渲染标题、粗体和斜体等格式。它还可以显示表格并语法高亮代码块。你还可以创建一个或多个主题文件来[定制][6] mdless 的外观。 +`mdless` 不仅会显示文本,而且还会渲染标题、粗体和斜体等格式。它还可以显示表格并语法高亮代码块。你还可以创建一个或多个主题文件来[定制][6] `mdless` 的外观。 ### Markdown lint 工具 你在快速输入时会犯错误。如果你在使用 Markdown(或其他任何标记语言)时丢失了一些格式,那么在将文件转换为另一种格式时可能会有问题。 -程序员通常使用名为 _linter_ 的工具来检查语法是否正确。你可以使用 [Markdown lint 工具][7]对 Markdown 执行相同的操作。 +程序员通常使用名为 linter 的工具来检查语法是否正确。你可以使用 [Markdown lint 工具][7]对 Markdown 执行相同的操作。 在你对 Markdown 文件运行该工具时,它会根据[规则集][8]检查格式。这些规则控制着文档的结构,包括标题级别的顺序、不正确的缩进和间距、代码块问题、文件中存在 HTML 等等。 @@ -40,25 +42,25 @@ mdless 不仅会显示文本,而且还会渲染标题、粗体和斜体等格 ### mdmerge -合并任何类型的文件可能会很痛苦。例如,我在整理一本电子书。它是一篇文章集,最初发布在我的[每周邮件][10]中。这些文章都放在单独的文件中,作为受虐狂,我以凌乱,手动的方式将它们组合在一起。 +合并任何类型的文件可能会很痛苦。例如,我在整理一本电子书。它是一篇文章集,最初发布在我的[每周邮件][10]中。这些文章都放在单独的文件中,作为受虐狂,我以凌乱、手动的方式将它们组合在一起。 -我希望在开始项目之前就了解了 [mdmerge][11]。这样我可以节省很多时间和精力。 +我希望在开始这个项目之前就知道 [mdmerge][11]。这样我可以节省很多时间和精力。 -mdmerge,你可能已经从名称中猜到了它的作用,它将两个或多个 Markdown 文件合并为一个文件。你无需在命令行中输入文件名。相反,你可以将它们添加到名为 book.txt 的文件中,并将其用作 mdmerge 的输入文件。 +`mdmerge`,你可能已经从名称中猜到了它的作用,它将两个或多个 Markdown 文件合并为一个文件。你无需在命令行中输入文件名。相反,你可以将它们添加到名为 `book.txt` 的文件中,并将其用作 `mdmerge` 的输入文件。 -这并不是 mdmerge 能做的一切。你可以添加对另一个文档的引用(使用 Markdown 格式引用或一段源代码),然后将其放入主文档中。这样一来,你就可以创建针对特定受众定制的[主文档] [12]。 +这并不是 `mdmerge` 能做的一切。你可以添加对另一个文档的引用(使用 Markdown 格式引用或一段源代码),然后将其放入主文档中。这样一来,你就可以创建针对特定受众定制的[主文档][12]。 -mdmerge 不会是你一直使用的程序之一。当你需要时,你会很高兴硬盘上有它。 +`mdmerge` 不会是你经常使用的程序。但当你需要时,你会很高兴硬盘上有它。 ### bashblog -[bashblog][13] 并不是严格上的 Markdown 工具。它获取 Markdown 文件,并使用它们来构建简单的博客或网站。你可以将 bashblog 视为[静态站点生成器][14],但是它没有很多脆弱的依赖关系。一切几乎都在一个不到 50KB 的 shell 脚本中。 +严格说 [bashblog][13] 并不是 Markdown 工具。它获取 Markdown 文件,并使用它们来构建简单的博客或网站。你可以将 bashblog 视为[静态站点生成器][14],但是它没有很多脆弱的依赖关系。一切几乎都在一个不到 50KB 的 shell 脚本中。 -要使用 bashblog,只需在计算机上安装 Markdown 处理器即可。在此,你可以编辑 Shell 脚本添加有关博客的信息,例如标题、名字、社交媒体链接等。然后运行脚本。之后会在默认文本编辑器中新建一篇文章。开始输入。 +要使用 bashblog,只需在计算机上安装 Markdown 处理器即可。在此,你可以编辑 Shell 脚本添加有关博客的信息,例如标题、名字、社交媒体链接等。然后运行该脚本。之后会在默认文本编辑器中新建一篇文章。开始输入。 保存文章后,你可以发布它或将其另存为草稿。如果你选择发布文章,那么 bashblog 会将你的博客、文章和所有内容生成为一组 HTML 文件,你可以将它们上传到 Web 服务器。 -它开箱即用,你的博客会平淡无奇,但可以使用。你可以根据自己喜好编辑站点的 CSS 文件来改变外观。 +它开箱即用,你的博客或许会平淡无奇,但可以使用。你可以根据自己喜好编辑站点的 CSS 文件来改变外观。 ![bashblog][15] @@ -66,12 +68,12 @@ mdmerge 不会是你一直使用的程序之一。当你需要时,你会很高 当然,Panddoc 是一个非常强大的工具,可以将 Markdown 文件转换为其他标记语言。但是,在命令行上使用 Markdown 要比 Pandoc 多。 -如果你需要 Pandoc 修复,请查看我们在 Opensource.com 上发布的文章: +如果你需要 Pandoc,请查看我们发布的文章: - * [使用 Pandoc 在命令行中转换文件][16] -  * [使用 Pandoc 将你的书变成网站和 ePub] [17] -  * [如何使用 Pandoc 生成论文] [18] -  * [使用 Pandoc 将 Markdown 文件转换为 word 文档] [19] +* [在命令行使用 Pandoc 进行文件转换][16] +* [使用 Pandoc 将你的书转换成网页和电子书][17] +* [用 Pandoc 生成一篇调研论文][18] +* [使用 pandoc 将 Markdown 转换为格式化文档][19] @@ -82,7 +84,7 @@ via: https://opensource.com/article/20/3/markdown-apps-linux-command-line 作者:[Scott Nesbitt][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -103,7 +105,7 @@ via: https://opensource.com/article/20/3/markdown-apps-linux-command-line [13]: https://github.com/cfenollosa/bashblog [14]: https://en.wikipedia.org/wiki/Web_template_system#Static_site_generators [15]: https://opensource.com/sites/default/files/uploads/bashblog.png (bashblog) -[16]: https://opensource.com/article/18/9/intro-pandoc -[17]: https://opensource.com/article/18/10/book-to-website-epub-using-pandoc -[18]: https://opensource.com/article/18/9/pandoc-research-paper -[19]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc +[16]: https://linux.cn/article-10228-1.html +[17]: https://linux.cn/article-10287-1.html +[18]: https://linux.cn/article-10179-1.html +[19]: https://linux.cn/article-11160-1.html diff --git a/published/202003/20200319 7 open hardware projects working to solve COVID-19.md b/published/202003/20200319 7 open hardware projects working to solve COVID-19.md new file mode 100644 index 0000000000..3b3f5cf23e --- /dev/null +++ b/published/202003/20200319 7 open hardware projects working to solve COVID-19.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12047-1.html) +[#]: subject: (7 open hardware projects working to solve COVID-19) +[#]: via: (https://opensource.com/article/20/3/open-hardware-covid19) +[#]: author: (Harris Kenny https://opensource.com/users/harriskenny) + +应对新冠病毒的 7 个开源硬件项目 +====== + +> 开源硬件解决方案可以为抵御新型冠状病毒的传播和痛苦做出贡献。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/103909f50gm91z22twuv23.jpg) + +开源[硬件][2]运动长期以来一直主张维修权的重要性,完全拥有所购买的技术,并能够像音乐一样重新组合和复制部件。因此,在这个充满挑战的时期内,开源硬件为由冠状病毒大流行引起的一些问题提供了一些答案。 + +### 背景概述 + +首先,全球的硬件开发人员正在努力使用开源解决供应链中的弱点,在过去 30 年中,这种理念推动了新软件技术的大量涌现。过去在硬件运动方面的成功,如 [RepRap Project][3]、[Open Source Ecology][4] 和 [Open Source Beehives][5],证明了这一点是可以做到的。 + +对于使用 3D 打印和其他技术按需生产安全设备和按需制造它的替换零件,创客们的兴趣日益增加。例如,香港理工大学实验室为医院工作人员提供 [3D 打印面罩][6]。意大利初创公司 Isinnova 与米兰 FabLab 合作,为受重灾的意大利北部提供用于呼吸机的 [3D 打印替换阀][7]。公司们还发布了设计以适应我们的物理接触需求,例如 Materialise 的 [3D 打印免提开门器][8]。这些更换零件和解决问题的示例是一个很好的起点,为挽救生命做出了努力。 + +另一种传统的硬件技术正在加速发展:缝纫。法新社报道说,全球急需口罩,来自世界卫生组织的指导也指明了其重要性。随着一次性口罩要优先供给于医护人员,捷克共和国的人们[开始缝制自己的口罩][9]。(重复使用的口罩确实会带来细菌问题。)Facebook 小组“捷克缝制口罩”开始在他们的国家解决这个问题,成千上万的成员开始用起了他们的家用缝纫机。 + +开源硬件设备和机械项目也越来越受欢迎。首先,有一些测试性设备具备高精度且功能强大。其次,在没有其他选择方案的情况下,有一些医疗设备(顶多)可以归类为现场级。这些项目将在下面详细概述。 + +为了解更多信息,我与总部位于芝加哥的 [Tapster Robotics][10] 的创始人兼首席执行官 Jason Huggins 进行了交谈。Tapster Robotics 使用 3D 打印、计算机数控(CNC)加工和 [Arduino][11] 等开源电子产品设计和制造台式机器人。他兼具技术知识和工业能力,具有很高的影响力。他想投入自己公司的资源来帮助这场斗争。 + +“基本上,我们现在正处于第二次世界大战的动员时刻。即使我不是医生,我们仍然应该遵循希波克拉底誓言。无论我做什么,我都不想让问题变得更糟”,Huggins 解释,他认为:“作为对策,世卫组织执行主任 Michael Ryan 博士发表了这样的评论:‘速度胜过完美’。” + +> 哇! +> +> 这个人是疾病传播的全球权威。如果您是领导者(无论以何种身份),请注意。如果不是,也请注意。 +> +> [pic.twitter.com/bFogaekehM][12] +> +> — Jim RichardsSh🎙wgram(@JIMrichards1010)[2020 年 3 月 15 日][13] + +Huggins 在应需提供方面具有丰富的经验。他的努力有助于 [Healthcare.gov][14] 在挑战性的最初启动后得以扩展。他还创建了软件行业标准的测试框架 Selenium 和 Appium。有了这一经验,他的建议非常值得考虑。 + +我还与 [Tyson Law][15] 的西雅图律师 Mark Tyson 进行了交谈,他的合作对象是初创公司和小型企业。他在快速发展的行业中与敏捷公司合作有着直接的经验。在阐述整个问题时,Tyson 说到: + +> 《善良的撒玛利亚人法Good Samaritan law》保护志愿者(即“好撒玛利亚人”)免于因其在紧急情况下提供援助的决定而承担责任。尽管这些法律的具体内容因州而异,但它们具有共同的公共政策依据:即鼓励旁观者帮助遇到紧急情况的其他人。可以想象,除了传统的把车祸的受害者从伤害中拉出来之外,这种理论依据可以证明在不太传统的环境中应用这类法律的合理性。 + +对于这种特定情况,Tyson 指出: + +> “在采取行动之前,创客们明智的做法是与律师沟通一下,以针对特定的州进行风险评估。还应谨慎地要求大型机构(例如医院或保险公司)通过合同接受潜在的责任风险,例如,通过使用赔偿协议,使医院或其保险人同意赔偿创客们的责任。” + +Tyson 明白情况的紧迫性和严重性。使用合同的这种选择并不意味着障碍。相反,这可能是一种帮助其大规模采用的方法,以更快地产生更大的变化。这取决于你或你的机构。 + +综上所述,让我们探索正在使用或正在开发中的项目(可能很快就可以部署)。 + +### 7 个与新冠病毒对抗的开源硬件项目 + +#### Opentrons + +[Opentrons][16] 的开源实验室自动化平台由一套开源硬件、经过验证的实验室器具、消耗品、试剂和工作站组成。Opentrons 表示,其产品可以“在下订单后几天内每天自动进行多达 2400 个测试”的系统,可以极大地帮助提高[新冠病毒测试规模][17]。它计划在 7 月 1 日之前提升到多达 100 万个测试样本。 + +![Opentrons roadmap graphic][18] + +*来自 Opentrons [网站][17],版权所有* + +该公司已经在与联邦和地方政府机构合作,以确定其系统是否可以在[紧急使用授权][19]下用于临床诊断。 Opentrons 在 [Apache 2.0 许可证][20]下共享。我最初是从与该项目有联系的生物学家 Kristin Ellis 那里得知它的。 + +#### Chai 的 Open qPCR + +Chai 的 [Open qPCR][21] 设备使用[聚合酶链反应][22](PCR)快速检测物品表面(例如,门把手和电梯按钮)上的拭子,以查看是否存在新型冠状病毒。这种在 [Apache 2.0 许可证][23]下共享的开源硬件使用 [BeagleBone][24] 低功耗 Linux 计算机。Chai 的 Open qPCR 提供的数据可以使公共卫生、公民和企业领导者做出有关清洁、缓解、关闭设施、接触追踪和测试的更明智的决策。 + +#### OpenPCR + +[OpenPCR][25] 是 Chai Open qPCR 的创建者 Josh Perfetto 和 Jessie Ho 的 PCR 测试设备套件。与他们的前一个项目相比,这更像是一种 DIY 开源设备,但它具有相同的使用场景:使用环境测试来识别野外冠状病毒。正如该项目页面所指出的那样,“能够检测这些病原体的传统实时 PCR 设备通常花费超过 30,000 美元,而且不适合在现场使用。”由于 OpenPCR 是用户构建的工具包,并且在 [GPLv3.0 许可证][26]下共享,因此该设备旨在使分子诊断的访问大众化。 + +![OpenPCR][27] + +*来自 OpenPCR [网站][25],版权所有* + +而且,就像任何优秀的开源项目一样,它也有一个衍生产品!瑞士的 [Gaudi Labs][29] 推出的 [WildOpenPCR][28] 也以 [GPLv3.0 许可证][30]共享。 + +#### PocketPCR + +Gaudi Labs 的 [PocketPCR][31] 热循环仪可通过升高和降低小试管中液体的温度来激活生物反应。它可以通过简单的 USB 电源适配器供电,该适配器可以绑定到设备上,也可以单独使用,不使用计算机或智能手机时可使用预设参数。 + +![PocketPCR][32] + +*来自 PocketPCR [网站][31],版权所有* + +与本文所述的其他 PCR 产品一样,此设备可能有助于对冠状病毒进行环境测试,尽管其项目页面并未明确说明。PocketPCR 在 [GPLv3.0 许可证][33]下共享。 + +#### Open Lung 低资源呼吸机 + +[Open Lung 低资源呼吸机][34]是一种快速部署的呼吸机,它以[气囊阀罩][35](BVM)(也称为 Ambu 气囊)为核心组件。Ambu 气囊已批量生产,经过认证,体积小,机械简单,并且适用于侵入性导管和口罩。 Open Lung 呼吸机使用微电子技术来感测和控制气压和流量,以实现半自主运行。 + +![Open Lung ventilator][36] + +*Open Lung,[GitLab][37]* + +这个早期项目拥有一支由数百名贡献者组成的大型团队,领导者包括:Colin Keogh、David Pollard、Connall Laverty 和 Gui Calavanti。它是以 [GPLv3.0 许可证][38]共享的。 + +#### Pandemic 呼吸机 + +[Pandemic 呼吸机][39]是 DIY 呼吸机的原型。像 RepRap 项目一样,它在设计中使用了常用的硬件组件。该项目已由用户 Panvent 于 10 多年前上传到 Instructables,并且有六个主要的生产步骤。该项目是以 [CC BY-NC-SA 许可证][39]共享的。 + +#### Folding at Home + +[Folding at Home][40] 是一个分布式计算项目,用于模拟蛋白质动力学,包括蛋白质折叠的过程以及与多种疾病有关的蛋白质运动。这是一个面向公民科学家、研究人员和志愿者的行动呼吁,类似于退役的 [SETI@Home 项目][41]使用家中的计算机来运行解码计算。如果你是具备强大计算机硬件功能的技术人员,那么这个项目适合你。 + +![Markov state model][42] + +*Vincent Voelz,CC BY-SA 3.0* + +Folding at Home 项目使用马尔可夫状态模型(如上所示)来建模蛋白质可能采取的形状和折叠途径,以寻找新的治疗机会。你可以在华盛顿大学生物物理学家 Greg Bowman 的帖子《[它是如何运作的以及如何提供帮助][43]》中找到有关该项目的更多信息。 + +该项目涉及来自许多国家和地区(包括香港、克罗地亚、瑞典和美国)的财团的学术实验室、贡献者和公司赞助者。 在 [GitHub][45] 上,[在混合了 GPL 和专有许可证][44]下共享,并且可以在 Windows、macOS 和 GNU/Linux(例如 Debian、Ubuntu、Mint、RHEL、CentOS、Fedora)。 + +### 许多其他有趣的项目 + +这些项目只是在开源硬件领域中解决或治疗新冠病毒活动中的一小部分。在研究本文时,我发现了其他值得探索的项目,例如: + +* Coronavirus Tech Handbook 提供的[开源呼吸机、氧气浓缩器等][46] +* 来自 ProjectOpenAir 的 [有用的工程][47] +* Hackaday 上的[开源呼吸机黑客马拉松][48] +* 约翰·霍普金斯急诊医学住院医师 Julian Botta 的[简单开源机械呼吸机规范][49] +* [与冠状病毒有关的网络钓鱼、恶意软件和随机软件正在增加][50],作者:Shannon Morse +* [将低成本的 CPAP 鼓风机转换为基本呼吸机][51],作者: jcl5m1 +* [A.I.R.E. 论坛上关于开源呼吸器和风扇的讨论][52](西班牙语) +* [关于新冠病毒的开源医疗硬件的特殊问题][53],作者:Elsevier HardwareX + +这些项目遍布全球,而这种全球合作正是我们所需要的,因为病毒无视国界。新冠病毒大流行在不同时期以不同方式影响国家,因此我们需要一种分布式方法。 + +正如我和同事 Steven Abadie 在 [OSHdata 2020 报告][54]中所写的那样,开源硬件运动是全球性运动。参与该认证项目的个人和组织遍布全球 35 个国家地区和每个半球。 + +![Open source hardware map][55] + +*OSHdata,CC BY-SA 4.0 国际版* + +如果你有兴趣加入这场与全球开源硬件开发人员的对话,请加入[开源硬件峰会的 Discord][56] 服务器,并通过专用渠道进行有关新冠病毒的讨论。你在这里可以找到机器人专家、设计师、艺术家、固件和机械工程师、学生、研究人员以及其他共同为这场战争而战的人。希望可以看到你。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-hardware-covid19 + +作者:[Harris Kenny][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/harriskenny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/health_heartbeat.png?itok=P-GXea-p (open on blue background with heartbeat symbol) +[2]: https://opensource.com/resources/what-open-hardware +[3]: https://reprap.org/wiki/RepRap +[4]: https://www.opensourceecology.org/ +[5]: https://www.osbeehives.com/ +[6]: https://www.scmp.com/news/hong-kong/health-environment/article/3052135/polytechnic-university-lab-3d-printing-face +[7]: https://www.3dprintingmedia.network/covid-19-3d-printed-valve-for-reanimation-device/ +[8]: https://www.3dprintingmedia.network/materialise-shows-3d-printed-door-opener-for-coronavirus-containment-efforts/ +[9]: https://news.yahoo.com/stitch-time-czechs-sew-combat-virus-mask-shortage-205213804.html +[10]: http://tapster.io/ +[11]: https://opensource.com/life/15/5/arduino-or-raspberry-pi +[12]: https://t.co/bFogaekehM +[13]: https://twitter.com/JIMrichards1010/status/1239140710558969857?ref_src=twsrc%5Etfw +[14]: http://Healthcare.gov +[15]: https://www.marktysonlaw.com/ +[16]: https://opentrons.com/ +[17]: https://blog.opentrons.com/testing-for-covid-19-with-opentrons/ +[18]: https://opensource.com/sites/default/files/uploads/opentrons.png (Opentrons roadmap graphic) +[19]: https://www.fda.gov/regulatory-information/search-fda-guidance-documents/policy-diagnostics-testing-laboratories-certified-perform-high-complexity-testing-under-clia-prior +[20]: https://github.com/Opentrons/opentrons/blob/edge/LICENSE +[21]: https://www.chaibio.com/openqpcr +[22]: https://en.wikipedia.org/wiki/Polymerase_chain_reaction +[23]: https://github.com/chaibio/chaipcr +[24]: https://beagleboard.org/bone +[25]: https://openpcr.org/ +[26]: https://github.com/jperfetto/OpenPCR/blob/master/license.txt +[27]: https://opensource.com/sites/default/files/uploads/openpcr.png (OpenPCR) +[28]: https://github.com/GenericLab/WildOpenPCR +[29]: http://www.gaudi.ch/GaudiLabs/?page_id=328 +[30]: https://github.com/GenericLab/WildOpenPCR/blob/master/license.txt +[31]: http://gaudi.ch/PocketPCR/ +[32]: https://opensource.com/sites/default/files/uploads/pocketpcr.png (PocketPCR) +[33]: https://github.com/GaudiLabs/PocketPCR/blob/master/LICENSE +[34]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor +[35]: https://en.wikipedia.org/wiki/Bag_valve_mask +[36]: https://opensource.com/sites/default/files/uploads/open-lung.png (Open Lung ventilator) +[37]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor/-/blob/master/images/CONCEPT_1_MECH.png +[38]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor/-/blob/master/LICENSE +[39]: https://www.instructables.com/id/The-Pandemic-Ventilator/ +[40]: https://foldingathome.org/ +[41]: https://setiathome.ssl.berkeley.edu/ +[42]: https://opensource.com/sites/default/files/uploads/foldingathome.png (Markov state model) +[43]: https://foldingathome.org/2020/03/15/coronavirus-what-were-doing-and-how-you-can-help-in-simple-terms/ +[44]: https://en.wikipedia.org/wiki/Folding@home +[45]: https://github.com/FoldingAtHome +[46]: https://coronavirustechhandbook.com/hardware +[47]: https://app.jogl.io/project/121#about +[48]: https://hackaday.com/2020/03/12/ultimate-medical-hackathon-how-fast-can-we-design-and-deploy-an-open-source-ventilator/ +[49]: https://docs.google.com/document/d/1FNPwrQjB1qW1330s5-S_-VB0vDHajMWKieJRjINCNeE/edit?fbclid=IwAR3ugu1SGMsacwKi6ycAKJFOMduInSO4WVM8rgmC4CgMJY6cKaGBNR14mpM +[50]: https://www.youtube.com/watch?v=dmQ1twpPpXA +[51]: https://github.com/jcl5m1/ventilator +[52]: https://foro.coronavirusmakers.org/ +[53]: https://www.journals.elsevier.com/hardwarex/call-for-papers/special-issue-on-open-source-covid19-medical-hardware +[54]: https://oshdata.com/2020-report +[55]: https://opensource.com/sites/default/files/uploads/oshdata-country.png (Open source hardware map) +[56]: https://discord.gg/duAtG5h diff --git a/published/20200319 Fedora 32 Release Date, New Features and Everything Else.md b/published/202003/20200319 Fedora 32 Release Date, New Features and Everything Else.md similarity index 100% rename from published/20200319 Fedora 32 Release Date, New Features and Everything Else.md rename to published/202003/20200319 Fedora 32 Release Date, New Features and Everything Else.md diff --git a/published/20200319 Manually rotating log files on Linux.md b/published/202003/20200319 Manually rotating log files on Linux.md similarity index 100% rename from published/20200319 Manually rotating log files on Linux.md rename to published/202003/20200319 Manually rotating log files on Linux.md diff --git a/published/20200322 Linus Torvalds- Advice on Working From Home during Coronavirus Lockdown.md b/published/202003/20200322 Linus Torvalds- Advice on Working From Home during Coronavirus Lockdown.md similarity index 100% rename from published/20200322 Linus Torvalds- Advice on Working From Home during Coronavirus Lockdown.md rename to published/202003/20200322 Linus Torvalds- Advice on Working From Home during Coronavirus Lockdown.md diff --git a/published/202003/20200322 Meet DebianDog - Puppy sized Debian Linux.md b/published/202003/20200322 Meet DebianDog - Puppy sized Debian Linux.md new file mode 100644 index 0000000000..c5b50c7670 --- /dev/null +++ b/published/202003/20200322 Meet DebianDog - Puppy sized Debian Linux.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12059-1.html) +[#]: subject: (Meet DebianDog – Puppy sized Debian Linux) +[#]: via: (https://itsfoss.com/debiandog/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +体验 DebianDog:Puppy 式的 Debian Linux +====== + +不久前,我偶然发现了一个有趣的 Linux 项目。这个项目旨在为 Debian 和基于 Debian 的系统创建一个小型的现场版 CD,类似于 [Puppy Linux 项目][1] 。让我们看看 DebianDog 。 + +### DebianDog 是什么? + +正如字面所述,[DebianDog][2] “是一个被塑造成一个外观和动作都像 Puppy Linux 的小型 Debian 现场版 CD。没有改动 Debian 结构和方式,Debian 的文档对 DebianDog 来说是完全有效的。你可以使用 `apt-get` 或 synaptic 来访问所有的 Debian 存储库。” + +![DebianDog][3] + +对于那些不熟悉 [Puppy Linux][1] 的人来说,该项目是 “多个 Linux 发行版的一个集合,建立在相同的共享准则之上”。这些准则能够实现快速、小型(300 MB 或更少)、易于使用。这里有为支持 Ubuntu, Slackware 和 Raspbian 软件包构建的 Puppy Linux 变种。 + +DebianDog 和 Puppy Linux 之间最大的不同是,Puppy Linux 有其自己的软件包管理器 [Puppy 软件包管理器][4] 。如上所述,DebianDog 使用 Debian 软件包管理器及其软件包。甚至 DebianDog 网站也试图澄清这一点:“它不是 Puppy Linux,并且也与基于 Debian 的 Puppy 无关。” + +### 为什么一些人使用 DebianDog ? + +安装 DebianDog(或其任何衍生产品)的主要原因是让一台较旧电脑重焕新生。在 DebianDog 上的每个版本都有一个 32 位版本。它们还有更轻量级的桌面环境/窗口管理器,例如 [Openbox][5] 或 [Trinity Desktop][6] 环境。它们中大多数也都有一个 systemd 的可替代版本。它们也安装更轻的应用程序,例如 [PCManFM][7] 。 + +### DebianDog 有哪些可用的变体版本? + +尽管 DebianDog 在本系列中是第一个,但是该项目被称为 ‘Dog Linux’ ,提供各种基于Debian 和 Ubuntu的流行发行版的 ‘Dog 变体’。 + +#### DebianDog Jessie + +DebianDog 的第一个(也是最初的)版本是 DebianDog Jessie。它有两个 [32 位版本][8] ,一个使用 [Joe’s Window Manager (JWM)][9] 作为默认桌面环境,另一个使用 XFCE 作为默认桌面环境。systemd 和 sysvinit 都是可用的。它还有一个 [64 位版本][10]。DebianDog Jessie 基于 Debian 8.0(Jessie)。Debian 8.0 的支持将于 2020 年 6 月 30 日结束,因此安装需谨慎。 + +#### StretchDog + +[StretchDog][12] 基于 Debian 9.0(Stretch)。它有 32 位和 64 位两种版本可用。Openbox 是默认的窗口管理器,但是我们可以切换到 JWM 。Debian 9.0 的支持将于 2022 年 6 月 30 日结束。 + +#### BusterDog + +[BusterDog][13] 是很有趣的。它基于 [Debian 10][14](Buster)。它不使用 systemd,反而像 [AntiX][16] 一样使用 [elogind][15] 。Debian 10.0 的支持将于 2024 年 6 月结束。 + +#### MintPup + +[MintPup][17] 基于 [Linux Mint][18] 17.1。现场版 CD 仅有 32 位版本。你也可以使用 “apt-get 或 synaptic 访问 Ubuntu/Mint 的存储库”。考虑到 Mint 17 已经到了生命的尽头,这一版本必须避免使用。 + +#### XenialDog + +XenialDog 有 [32 位][19]和 [64 位][20] 两种变种,基于 Ubuntu 16.04 LTS 。两个变种都使用 Openbox 作为默认版本,JWM 可选。Ubuntu 16.04 LTS 的支持将于 2021 年 4 月结束, 因此安装需谨慎。 + +#### TrinityDog + +[TrintyDog][21] 有两种变体。一个基于 Debian 8 ,另一个基于 Debian 9 。两种变体都有 32 位版本,并且都使用 [Trinity Desktop Environment][6] ,以此得名。 + +![TrinityDog][11] + +#### BionicDog + +你应该能够从名称猜到。[BionicDog][23] 基于 [Ubuntu 18.04 LTS][24]。主要版本有 32 位和 64 位两个版本,Openbox 是默认的窗口管理器。这里也有一个使用 [Cinnamon desktop][25] 的版本,并且只有 64 位版本。 + +![BionicDog][22] + +### 结束语 + +我喜欢任何 [想让较旧电脑系统有用的 Linux 项目][26]。但是,通过 DebianDog 项目提供的大多数操作系统不再受支持,或者接近它们的生命尽头。从长远来看,这就不那么有用了。 + +**我不建议在你的主计算机上使用它。**在现场版 USB 中或一台闲置的系统上尝试它。此外,如果你想使用较新的基础系统,[你可以创建][27]你自己的现场版 CD 。 + +似乎冥冥中自有天意,我总是在探索鲜为人知的 Linux 发行版的路上艰难地前行,像 [FatDog64][28]、[4M Linux][29] 以及 [Vipper Linux][30] 。虽然我不建议使用它们,但是知晓这些项目的存在的意义总是好的。 + +你对 DebianDog 有什么看法?你最最喜欢的 Puppy 式的操作系统是什么?请在下面的评论区中告诉我们。 + +如果你觉得这篇文章很有趣,请花点时间在社交媒体、黑客新闻或 Reddit 上分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/debiandog/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: http://puppylinux.com/ +[2]: https://debiandog.github.io/doglinux/ +[3]: https://www.linuxinsider.com/article_images/2017/84328_990x556.jpg +[4]: http://wikka.puppylinux.com/PPM?redirect=no +[5]: http://openbox.org/wiki/Main_Page +[6]: https://www.trinitydesktop.org/ +[7]: https://wiki.lxde.org/en/PCManFM +[8]: https://debiandog.github.io/doglinux/zz01debiandogjessie.html +[9]: https://en.wikipedia.org/wiki/JWM +[10]: https://debiandog.github.io/doglinux/zz02debiandog64.html +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/TrinityDog.jpg?ssl=1 +[12]: https://debiandog.github.io/doglinux/zz02stretchdog.html +[13]: https://debiandog.github.io/doglinux/zz03busterdog.html +[14]: https://itsfoss.com/debian-10-buster/ +[15]: https://github.com/elogind/elogind +[16]: https://antixlinux.com/ +[17]: https://debiandog.github.io/doglinux/zz04mintpup.html +[18]: https://linuxmint.com/ +[19]: https://debiandog.github.io/doglinux/zz05xenialdog.html +[20]: https://debiandog.github.io/doglinux/zz05zxenialdog.html +[21]: https://debiandog.github.io/doglinux/zz06-trinitydog.html +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/BionicDog.jpg?ssl=1 +[23]: https://debiandog.github.io/doglinux/zz06-zbionicdog.html +[24]: https://itsfoss.com/ubuntu-18-04-released/ +[25]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) +[26]: https://itsfoss.com/lightweight-linux-beginners/ +[27]: https://github.com/DebianDog/MakeLive +[28]: https://itsfoss.com/fatdog64-linux-review/ +[29]: https://itsfoss.com/4mlinux-review/ +[30]: https://itsfoss.com/viperr-linux-review/ +[31]: https://reddit.com/r/linuxusersgroup diff --git a/published/20200322 Purism Librem Mini- A Privacy-First Linux-Based Mini PC.md b/published/202003/20200322 Purism Librem Mini- A Privacy-First Linux-Based Mini PC.md similarity index 100% rename from published/20200322 Purism Librem Mini- A Privacy-First Linux-Based Mini PC.md rename to published/202003/20200322 Purism Librem Mini- A Privacy-First Linux-Based Mini PC.md diff --git a/published/202003/20200327 How open source software is fighting COVID-19.md b/published/202003/20200327 How open source software is fighting COVID-19.md new file mode 100644 index 0000000000..28429de34e --- /dev/null +++ b/published/202003/20200327 How open source software is fighting COVID-19.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12057-1.html) +[#]: subject: (How open source software is fighting COVID-19) +[#]: via: (https://opensource.com/article/20/3/open-source-software-covid19) +[#]: author: (Jeff Stern https://opensource.com/users/jeffstern) + +开源软件在应对新冠病毒中的贡献 +====== + +> 在新冠疫情爆发之际,涌现了数以千计的开源项目,今天我们来了解其中四个。 + +![](https://img.linux.net.cn/data/attachment/album/202003/30/210613wchojyc5rrwh8y5k.jpg) + +在当前紧张的疫情环境下,保持专注和积极性是一个很大的挑战。而研究开源社区如何应对这一次疫情爆发,对于我来说却成为了一种宣泄。 + +从今年一月底开始,整个开源社区已经贡献了数以千计关于冠状病毒或新冠病毒的[开源软件仓库][2],其中涉及的内容包括但不限于数据集、模型、可视化、Web 应用、移动应用,且大多数都使用了 JavaScript 和 Python 编写。 + +之前我们分享过一些关于[开源硬件创客们在帮助][3]遏制冠状病毒传播方面做的贡献,现在将继续分享四个由开源社区作出的应对冠状病毒和新冠病毒的项目,这体现了开发者们和整个开源社区在当下对整个世界的影响力。 + +### 1. PennSignals:CHIME + +![CHIME by PennSignals][4] + +新冠病毒流行病医院影响模型COVID-19 Hospital Impact Model for Epidemics([CHIME][5])是由宾夕法尼亚大学 Penn Medicine 机构的数据科学家们建立的开源在线应用,它可以让医院更好地了解本次新型冠状病毒对医院需求的影响。 + +医院的管理人员可以通过 CHIME 来大致预测未来几天和几周内将会有多少患者需要住院治疗,并推算 ICU 和呼吸机的需求量。只需要输入当前住院患者数以及一些相关的变量,就可以看到未来几天内需求的变化情况。 + +CHIME 主要使用 Python 开发,并通过 [Pandas][6] 这个开源库实现了大部分的数据转换和数值计算,最终得出相关的估计值。Pandas 的背后有一个强大的团队进行支持,它是在数据分析方面被广泛使用的 Python 库之一。和很多其它的开源项目一样,Pandas 团队的收入大部分来源于[用户的资金支持][7]。 + +### 2. Locale.ai:实时新冠病毒可视化 + +![Locale.ai COVID-19 visualization][8] + +实时显示世界各地病例数量分布的地图可以让我们直观了解新冠病毒的规模和扩散程度。Locale.ai 就开发了这样一个开源、可交互的[新冠病毒已知病例可视化分布图][9],这个图会根据最新的可靠数据实时进行更新。 + +这个项目有趣的地方在于,它的数据是是通过 GitHub 用户 ExpDev07 创建的[开源 API][10] 进行检索的,这个 API 的数据来源是[约翰·霍普金斯大学的开源数据集][11],而约翰·霍普金斯大学这份聚合了多个来源的数据集则是 GitHub 上新冠病毒相关的最受欢迎的项目。这就是开源领域中分支带来的一大好处。 + +Locale.ai 的这个图表通过 [Vue.js][11] 开发。Vue.js 是一个在 Web 应用开发方面非常流行的框架,它是由[尤雨溪][12]创造并维护的。值得一提的是,尤雨溪是少数以全职参与开源项目维护的人之一。 + +### 3. BlankerL:DXY-COVID-19-Crawler + +![BlankerL DXY-COVID-19-Crawler][13] + +[DXY-COVID-19-Crawler][14] 建立于今年 1 月份,是开源社区对新冠病毒最早发起响应的项目之一。当时该病毒主要在中国范围内传播,中国医学界通过[丁香园][15]网站来进行病例的报告和跟踪。为了使这些疫情信息具有更高的可读性和易用性,GitHub 用户 BlankerL 开发了一个爬虫,系统地从丁香园网站获取数据,并通过 API 和数据仓库的方式对外公开。这些数据也被学术研究人员用于研究病毒传播趋势和制作相关的可视化图表。到目前为止,DXY-COVID-19-Crawler 这个项目已经获得了超过 1300 个星标和近 300 次的复刻。 + +BlankerL 使用 Python 和 [Beautiful Soup][16] 库开发了这个爬虫。Beautiful Soup 是 Python 开发者用于从页面 HTML DOM 中提取信息的库,它由 Leonard Richardson 维护,这位作者另外还全职担任软件架构师。 + +### 4. 东京新冠病毒工作组网站 + +![City of Tokyo's COVID-19 Task Force site][17] + +世界各地很多城市都在网络上持续更新当地的新冠病毒信息。东京都政府则为此创建了一个[综合性的网站][18],让东京当地居民、在东京设有办事处的公司以及到东京的游客了解最新情况,并采取相应的预防措施。 + +这个网站的不同之处在于它是由东京都政府[开源][19]的。这个项目受到了来自 180 多名用户的贡献,日本的[长野市、千叶市、福冈市][20]还对这个网站进行了改造。这个项目是城市公共建设更好地服务大众的有力示范。 + +这个开源网站也使用了很多开源技术。通过 [Tidelift][21],我留意到项目中存在了 1365 个依赖项,而这都是由 38 个由开发者明确使用的直接依赖项所依赖的。也就是说,超过一千多个开源项目(包括 [Nuxt.js][22]、[Prettier][23]、[Babel][24]、[Ajv][25] 等等)都为东京向市民共享信息提供了帮助。 + +![Dependencies in Tokyo's COVID-19 Task Force site][26] + +### 其它项目 + +除此以外,还有很多[应对新冠病毒的重要项目][27]正在公开进行当中。在这次研究中,开源社区应对流行病以及利用开源技术开展工作的方式让我深受启发。接下来的一段时间都是应对疫情的关键时期,我们也可以继续在开源社区中寻找到更大的动力。 + +如果你也参与到了新冠病毒相关的开源项目当中,欢迎在评论区分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-source-software-covid19 + +作者:[Jeff Stern][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jeffstern +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Medical%20costs.jpg?itok=ke57j6cs (symbols showing healthcare) +[2]: https://github.com/search?q=coronavirus+OR+covid19 +[3]: https://linux.cn/article-12047-1.html +[4]: https://opensource.com/sites/default/files/uploads/chime_pennsignals.png (CHIME by PennSignals) +[5]: http://penn-chime.phl.io/ +[6]: https://tidelift.com/subscription/pkg/pypi-pandas +[7]: https://pandas.pydata.org/about/sponsors.html +[8]: https://opensource.com/sites/default/files/uploads/locale-ai-visualization.png (Locale.ai COVID-19 visualization) +[9]: https://github.com/localeai/covid19-live-visualization +[10]: https://github.com/CSSEGISandData/COVID-19 +[11]: https://tidelift.com/subscription/pkg/npm-vue +[12]: https://blog.tidelift.com/vuejs-evan-you-javascript-framework +[13]: https://opensource.com/sites/default/files/uploads/dxy-covid-19-crawler.png (BlankerL DXY-COVID-19-Crawler) +[14]: https://github.com/BlankerL/DXY-COVID-19-Crawler +[15]: https://dxy.cn +[16]: https://blog.tidelift.com/beautiful-soup-is-now-part-of-the-tidelift-subscription +[17]: https://opensource.com/sites/default/files/uploads/tokyo-covid19-task-force.png (City of Tokyo's COVID-19 Task Force site) +[18]: https://stopcovid19.metro.tokyo.lg.jp/en/ +[19]: https://github.com/tokyo-metropolitan-gov/covid19 +[20]: https://github.com/tokyo-metropolitan-gov/covid19/issues/1802 +[21]: https://tidelift.com/ +[22]: https://tidelift.com/subscription/pkg/npm-nuxt +[23]: https://blog.tidelift.com/prettier-is-now-part-of-the-tidelift-subscriptions +[24]: https://tidelift.com/subscription/pkg/npm-babel +[25]: https://blog.tidelift.com/ajv-is-now-part-of-the-tidelift-subscription +[26]: https://opensource.com/sites/default/files/uploads/tokyo-dependencies.png (Dependencies in Tokyo's COVID-19 Task Force site) +[27]: https://github.com/soroushchehresa/awesome-coronavirus diff --git a/published/20200318 Share data between C and Python with this messaging library.md b/published/20200318 Share data between C and Python with this messaging library.md new file mode 100644 index 0000000000..83c68e0bdb --- /dev/null +++ b/published/20200318 Share data between C and Python with this messaging library.md @@ -0,0 +1,627 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12499-1.html) +[#]: subject: (Share data between C and Python with this messaging library) +[#]: via: (https://opensource.com/article/20/3/zeromq-c-python) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +使用 ZeroMQ 消息库在 C 和 Python 间共享数据 +====== + +> ZeroMQ 是一个快速灵活的消息库,用于数据收集和不同编程语言间的数据共享。 + +![](https://img.linux.net.cn/data/attachment/album/202008/08/202106uale11l1qf11slzw.jpg) + +作为软件工程师,我有多次在要求完成指定任务时感到浑身一冷的经历。其中有一次,我必须在一些新的硬件基础设施和云基础设施之间写一个接口,这些硬件需要 C 语言,而云基础设施主要是用 Python。 + +实现的方式之一是 [用 C 写扩展模块][2],Python 支持 C 扩展的调用。快速浏览文档后发现,这需要编写大量的 C 代码。这样做的话,在有些情况下效果还不错,但不是我喜欢的方式。另一种方式就是将两个任务放在不同的进程中,并使用 [ZeroMQ 消息库][3] 在两者之间交换消息。 + +在发现 ZeroMQ 之前,遇到这种类型的情况时,我选择了编写扩展的方式。这种方式不算太差,但非常费时费力。如今,为了避免那些问题,我将一个系统细分为独立的进程,通过 [通信套接字][4] 发送消息来交换信息。这样,不同的编程语言可以共存,每个进程也变简单了,同时也容易调试。 + +ZeroMQ 提供了一个更简单的过程: + +1. 编写一小段 C 代码,从硬件读取数据,然后把发现的东西作为消息发送出去。 +2. 使用 Python 编写接口,实现新旧基础设施之间的对接。 + +[Pieter Hintjens][5] 是 ZeroMQ 项目发起者之一,他是个拥有 [有趣视角和作品][6] 的非凡人物。 + +### 准备 + +本教程中,需要: + +* 一个 C 编译器(例如 [GCC][7] 或 [Clang][8]) +* [libzmq 库][9] +* [Python 3][10] +* [ZeroMQ 的 Python 封装][11] + +Fedora 系统上的安装方法: + +``` +$ dnf install clang zeromq zeromq-devel python3 python3-zmq +``` + +Debian 和 Ubuntu 系统上的安装方法: + +``` +$ apt-get install clang libzmq5 libzmq3-dev python3 python3-zmq +``` + +如果有问题,参考对应项目的安装指南(上面附有链接)。 + +### 编写硬件接口库 + +因为这里针对的是个设想的场景,本教程虚构了包含两个函数的操作库: + +* `fancyhw_init()` 用来初始化(设想的)硬件 +* `fancyhw_read_val()` 用于返回从硬件读取的数据 + +将库的完整代码保存到文件 `libfancyhw.h` 中: + +``` +#ifndef LIBFANCYHW_H +#define LIBFANCYHW_H + +#include +#include + +// This is the fictitious hardware interfacing library + +void fancyhw_init(unsigned int init_param) +{ + srand(init_param); +} + +int16_t fancyhw_read_val(void) +{ + return (int16_t)rand(); +} + +#endif +``` + +这个库可以模拟你要在不同语言实现的组件间交换的数据,中间有个随机数发生器。 + +### 设计 C 接口 + +下面从包含管理数据传输的库开始,逐步实现 C 接口。 + +#### 需要的库 + +开始先加载必要的库(每个库的作用见代码注释): + +``` +// For printf() +#include +// For EXIT_* +#include +// For memcpy() +#include +// For sleep() +#include + +#include + +#include "libfancyhw.h" +``` + +#### 必要的参数 + +定义 `main` 函数和后续过程中必要的参数: + +``` +int main(void) +{ +    const unsigned int INIT_PARAM = 12345; +    const unsigned int REPETITIONS = 10; +    const unsigned int PACKET_SIZE = 16; +    const char *TOPIC = "fancyhw_data"; + +    ... +``` + +#### 初始化 + +所有的库都需要初始化。虚构的那个只需要一个参数: + +``` +fancyhw_init(INIT_PARAM); +``` + +ZeroMQ 库需要实打实的初始化。首先,定义对象 `context`,它是用来管理全部的套接字的: + +``` +void *context = zmq_ctx_new(); + +if (!context) +{ + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} +``` + +之后定义用来发送数据的套接字。ZeroMQ 支持若干种套接字,各有其用。使用 `publish` 套接字(也叫 `PUB` 套接字),可以复制消息并分发到多个接收端。这使得你可以让多个接收端接收同一个消息。没有接收者的消息将被丢弃(即不会入消息队列)。用法如下: + +``` +void *data_socket = zmq_socket(context, ZMQ_PUB); +``` + +套接字需要绑定到一个具体的地址,这样客户端就知道要连接哪里了。本例中,使用了 [TCP 传输层][15](当然也有 [其它选项][16],但 TCP 是不错的默认选择): + +``` +const int rb = zmq_bind(data_socket, "tcp://*:5555"); + +if (rb != 0) +{ + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} +``` + +下一步, 计算一些后续要用到的值。 注意下面代码中的 `TOPIC`,因为 `PUB` 套接字发送的消息需要绑定一个主题。主题用于供接收者过滤消息: + +``` +const size_t topic_size = strlen(TOPIC); +const size_t envelope_size = topic_size + 1 + PACKET_SIZE * sizeof(int16_t); + +printf("Topic: %s; topic size: %zu; Envelope size: %zu\n", TOPIC, topic_size, envelope_size); +``` + +#### 发送消息 + +启动一个发送消息的循环,循环 `REPETITIONS` 次: + +``` +for (unsigned int i = 0; i < REPETITIONS; i++) +{ + ... +``` + +发送消息前,先填充一个长度为 `PACKET_SIZE` 的缓冲区。本库提供的是 16 个位的有符号整数。因为 C 语言中 `int` 类型占用空间大小与平台相关,不是确定的值,所以要使用指定宽度的 `int` 变量: + +``` +int16_t buffer[PACKET_SIZE]; + +for (unsigned int j = 0; j < PACKET_SIZE; j++) +{ + buffer[j] = fancyhw_read_val(); +} + +printf("Read %u data values\n", PACKET_SIZE); +``` + +消息的准备和发送的第一步是创建 ZeroMQ 消息,为消息分配必要的内存空间。空白的消息是用于封装要发送的数据的: + +``` +zmq_msg_t envelope; + +const int rmi = zmq_msg_init_size(&envelope, envelope_size); +if (rmi != 0) +{ + printf("ERROR: ZeroMQ error occurred during zmq_msg_init_size(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; +} +``` + +现在内存空间已分配,数据保存在 ZeroMQ 消息 “信封”中。函数 `zmq_msg_data()` 返回一个指向封装数据缓存区顶端的指针。第一部分是主题,之后是一个空格,最后是二进制数。主题和二进制数据之间的分隔符采用空格字符。需要遍历缓存区的话,使用类型转换和 [指针算法][18]。(感谢 C 语言,让事情变得直截了当。)做法如下: + +``` +memcpy(zmq_msg_data(&envelope), TOPIC, topic_size); +memcpy((void*)((char*)zmq_msg_data(&envelope) + topic_size), " ", 1); +memcpy((void*)((char*)zmq_msg_data(&envelope) + 1 + topic_size), buffer, PACKET_SIZE * sizeof(int16_t)) +``` + +通过 `data_socket` 发送消息: + +``` +const size_t rs = zmq_msg_send(&envelope, data_socket, 0); +if (rs != envelope_size) +{ + printf("ERROR: ZeroMQ error occurred during zmq_msg_send(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; +} +``` + +使用数据之前要先解除封装: + +``` +zmq_msg_close(&envelope); + +printf("Message sent; i: %u, topic: %s\n", i, TOPIC); +``` + +#### 清理 + +C 语言不提供 [垃圾收集][20] 功能,用完之后记得要自己扫尾。发送消息之后结束程序之前,需要运行扫尾代码,释放分配的内存: + +``` +const int rc = zmq_close(data_socket); + +if (rc != 0) +{ + printf("ERROR: ZeroMQ error occurred during zmq_close(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} + +const int rd = zmq_ctx_destroy(context); + +if (rd != 0) +{ + printf("Error occurred during zmq_ctx_destroy(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} + +return EXIT_SUCCESS; +``` + +#### 完整 C 代码 + +保存下面完整的接口代码到本地名为 `hw_interface.c` 的文件: + +``` +// For printf() +#include +// For EXIT_* +#include +// For memcpy() +#include +// For sleep() +#include + +#include + +#include "libfancyhw.h" + +int main(void) +{ + const unsigned int INIT_PARAM = 12345; + const unsigned int REPETITIONS = 10; + const unsigned int PACKET_SIZE = 16; + const char *TOPIC = "fancyhw_data"; + + fancyhw_init(INIT_PARAM); + + void *context = zmq_ctx_new(); + + if (!context) + { + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + void *data_socket = zmq_socket(context, ZMQ_PUB); + + const int rb = zmq_bind(data_socket, "tcp://*:5555"); + + if (rb != 0) + { + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + const size_t topic_size = strlen(TOPIC); + const size_t envelope_size = topic_size + 1 + PACKET_SIZE * sizeof(int16_t); + + printf("Topic: %s; topic size: %zu; Envelope size: %zu\n", TOPIC, topic_size, envelope_size); + + for (unsigned int i = 0; i < REPETITIONS; i++) + { + int16_t buffer[PACKET_SIZE]; + + for (unsigned int j = 0; j < PACKET_SIZE; j++) + { + buffer[j] = fancyhw_read_val(); + } + + printf("Read %u data values\n", PACKET_SIZE); + + zmq_msg_t envelope; + + const int rmi = zmq_msg_init_size(&envelope, envelope_size); + if (rmi != 0) + { + printf("ERROR: ZeroMQ error occurred during zmq_msg_init_size(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; + } + + memcpy(zmq_msg_data(&envelope), TOPIC, topic_size); + + memcpy((void*)((char*)zmq_msg_data(&envelope) + topic_size), " ", 1); + + memcpy((void*)((char*)zmq_msg_data(&envelope) + 1 + topic_size), buffer, PACKET_SIZE * sizeof(int16_t)); + + const size_t rs = zmq_msg_send(&envelope, data_socket, 0); + if (rs != envelope_size) + { + printf("ERROR: ZeroMQ error occurred during zmq_msg_send(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; + } + + zmq_msg_close(&envelope); + + printf("Message sent; i: %u, topic: %s\n", i, TOPIC); + + sleep(1); + } + + const int rc = zmq_close(data_socket); + + if (rc != 0) + { + printf("ERROR: ZeroMQ error occurred during zmq_close(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + const int rd = zmq_ctx_destroy(context); + + if (rd != 0) + { + printf("Error occurred during zmq_ctx_destroy(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} +``` + +用如下命令编译: + +``` +$ clang -std=c99 -I. hw_interface.c -lzmq -o hw_interface +``` + +如果没有编译错误,你就可以运行这个接口了。贴心的是,ZeroMQ `PUB` 套接字可以在没有任何应用发送或接受数据的状态下运行,这简化了使用复杂度,因为这样不限制进程启动的次序。 + +运行该接口: + +``` +$ ./hw_interface +Topic: fancyhw_data; topic size: 12; Envelope size: 45 +Read 16 data values +Message sent; i: 0, topic: fancyhw_data +Read 16 data values +Message sent; i: 1, topic: fancyhw_data +Read 16 data values +... +... +``` + +输出显示数据已经通过 ZeroMQ 完成发送,现在要做的是让一个程序去读数据。 + +### 编写 Python 数据处理器 + +现在已经准备好从 C 程序向 Python 应用传送数据了。 + +#### 库 + +需要两个库帮助实现数据传输。首先是 ZeroMQ 的 Python 封装: + +``` +$ python3 -m pip install zmq +``` + +另一个就是 [struct 库][21],用于解码二进制数据。这个库是 Python 标准库的一部分,所以不需要使用 `pip` 命令安装。 + +Python 程序的第一部分是导入这些库: + +``` +import zmq +import struct +``` + +#### 重要参数 + +使用 ZeroMQ 时,只能向常量 `TOPIC` 定义相同的接收端发送消息: + +``` +topic = "fancyhw_data".encode('ascii') + +print("Reading messages with topic: {}".format(topic)) +``` + +#### 初始化 + +下一步,初始化上下文和套接字。使用 `subscribe` 套接字(也称为 `SUB` 套接字),它是 `PUB` 套接字的天生伴侣。这个套接字发送时也需要匹配主题。 + +``` +with zmq.Context() as context: +    socket = context.socket(zmq.SUB) + +    socket.connect("tcp://127.0.0.1:5555") +    socket.setsockopt(zmq.SUBSCRIBE, topic) + +    i = 0 + +    ... +``` + +#### 接收消息 + +启动一个无限循环,等待接收发送到 `SUB` 套接字的新消息。这个循环会在你按下 `Ctrl+C` 组合键或者内部发生错误时终止: + +``` +    try: +        while True: + +            ... # we will fill this in next + +    except KeyboardInterrupt: +        socket.close() +    except Exception as error: +        print("ERROR: {}".format(error)) +        socket.close() +``` + +这个循环等待 `recv()` 方法获取的新消息,然后将接收到的内容从第一个空格字符处分割开,从而得到主题: + + +``` +binary_topic, data_buffer = socket.recv().split(b' ', 1) +``` + +#### 解码消息 + +Python 此时尚不知道主题是个字符串,使用标准 ASCII 编解码器进行解码: + +``` +topic = binary_topic.decode(encoding = 'ascii') + +print("Message {:d}:".format(i)) +print("\ttopic: '{}'".format(topic)) +``` + +下一步就是使用 `struct` 库读取二进制数据,它可以将二进制数据段转换为明确的数值。首先,计算数据包中数值的组数。本例中使用的 16 个位的有符号整数对应的是 `struct` [格式字符][22] 中的 `h`: + +``` +packet_size = len(data_buffer) // struct.calcsize("h") + +print("\tpacket size: {:d}".format(packet_size)) +``` + +知道数据包中有多少组数据后,就可以通过构建一个包含数据组数和数据类型的字符串,来定义格式了(比如“`16h`”): + +``` +struct_format = "{:d}h".format(packet_size) +``` + +将二进制数据串转换为可直接打印的一系列数字: + +``` +data = struct.unpack(struct_format, data_buffer) + +print("\tdata: {}".format(data)) +``` + +#### 完整 Python 代码 + +下面是 Python 实现的完整的接收端: + +``` +#! /usr/bin/env python3 + +import zmq +import struct + +topic = "fancyhw_data".encode('ascii') + +print("Reading messages with topic: {}".format(topic)) + +with zmq.Context() as context: + socket = context.socket(zmq.SUB) + + socket.connect("tcp://127.0.0.1:5555") + socket.setsockopt(zmq.SUBSCRIBE, topic) + + i = 0 + + try: + while True: + binary_topic, data_buffer = socket.recv().split(b' ', 1) + + topic = binary_topic.decode(encoding = 'ascii') + + print("Message {:d}:".format(i)) + print("\ttopic: '{}'".format(topic)) + + packet_size = len(data_buffer) // struct.calcsize("h") + + print("\tpacket size: {:d}".format(packet_size)) + + struct_format = "{:d}h".format(packet_size) + + data = struct.unpack(struct_format, data_buffer) + + print("\tdata: {}".format(data)) + + i += 1 + + except KeyboardInterrupt: + socket.close() + except Exception as error: + print("ERROR: {}".format(error)) + socket.close() +``` + +将上面的内容保存到名为 `online_analysis.py` 的文件。Python 代码不需要编译,你可以直接运行它。 + +运行输出如下: + +``` +$ ./online_analysis.py +Reading messages with topic: b'fancyhw_data' +Message 0: +        topic: 'fancyhw_data' +        packet size: 16 +        data: (20946, -23616, 9865, 31416, -15911, -10845, -5332, 25662, 10955, -32501, -18717, -24490, -16511, -28861, 24205, 26568) +Message 1: +        topic: 'fancyhw_data' +        packet size: 16 +        data: (12505, 31355, 14083, -19654, -9141, 14532, -25591, 31203, 10428, -25564, -732, -7979, 9529, -27982, 29610, 30475) +... +... +``` + +### 小结 + +本教程介绍了一种新方式,实现从基于 C 的硬件接口收集数据,并分发到基于 Python 的基础设施的功能。借此可以获取数据供后续分析,或者转送到任意数量的接收端去。它采用了一个消息库实现数据在发送者和处理者之间的传送,来取代同样功能规模庞大的软件。 + +本教程还引出了我称之为“软件粒度”的概念,换言之,就是将软件细分为更小的部分。这种做法的优点之一就是,使得同时采用不同的编程语言实现最简接口作为不同部分之间沟通的组件成为可能。 + +实践中,这种设计使得软件工程师能以更独立、合作更高效的方式做事。不同的团队可以专注于数据分析的不同方面,可以选择自己中意的实现工具。这种做法的另一个优点是实现了零代价的并行,因为所有的进程都可以并行运行。[ZeroMQ 消息库][3] 是个令人赞叹的软件,使用它可以让工作大大简化。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/zeromq-c-python + +作者:[Cristiano L. Fontana][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/译者ID) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://docs.python.org/3/extending/extending.html +[3]: https://zeromq.org/ +[4]: https://en.wikipedia.org/wiki/Network_socket +[5]: https://en.wikipedia.org/wiki/Pieter_Hintjens +[6]: http://hintjens.com/ +[7]: https://gcc.gnu.org/ +[8]: https://clang.llvm.org/ +[9]: https://github.com/zeromq/libzmq#installation-of-binary-packages- +[10]: https://www.python.org/downloads/ +[11]: https://zeromq.org/languages/python/ +[12]: http://www.opengroup.org/onlinepubs/009695399/functions/srand.html +[13]: http://www.opengroup.org/onlinepubs/009695399/functions/rand.html +[14]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[15]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol +[16]: http://zguide.zeromq.org/page:all#Plugging-Sockets-into-the-Topology +[17]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html +[18]: https://en.wikipedia.org/wiki/Pointer_%28computer_programming%29%23C_and_C++ +[19]: http://www.opengroup.org/onlinepubs/009695399/functions/memcpy.html +[20]: https://en.wikipedia.org/wiki/Garbage_collection_(computer_science) +[21]: https://docs.python.org/3/library/struct.html +[22]: https://docs.python.org/3/library/struct.html#format-characters diff --git a/published/20200331 How failure-driven development makes you successful.md b/published/20200331 How failure-driven development makes you successful.md new file mode 100644 index 0000000000..6b6bc55b96 --- /dev/null +++ b/published/20200331 How failure-driven development makes you successful.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12479-1.html) +[#]: subject: (How failure-driven development makes you successful) +[#]: via: (https://opensource.com/article/20/3/failure-driven-development) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +屡屡失败犯错的我为什么没有被开除 +====== + +> 我是词典里 “失败” 一词旁边的插图,这就是为什么我擅长我的工作的原因。 + +![](https://img.linux.net.cn/data/attachment/album/202008/02/212013q5jjc78ihwd72cij.jpg) + +我的职称是高级软件工程师,但我最亲近的同事并不这么称呼我。由于我摧毁一切,他们管我叫“樱桃炸弹”(正巧我姓“樱桃”)。我定期会遇到的失败已经可以影响到我们的季度性收益和停机时间。简单的来说,我就是你所听说过的生产灾难:“别动,啥都别做,无论何时何地。” + +我的职业生涯始于支持服务台,在那里我写了一些循环,破坏了高端客户的服务器。我曾在没有警告的情况下将生产应用程序关闭了长达八个小时,并且在试图使得情况好转的过程中摧毁了无数个集群,有几次只是因为我打错了字。 + +我是我们在 [Kubernetes][2] 中设有灾难恢复(DR)集群的原因。我是个混乱的工程师,我们有一个应用程序,它的故障恢复计划还从未测试过,而我在没有警告的情况下,就教人们如何快速行动和排除故障。我作为可能失败的最好例子而存在,这实际上是有史以来最酷的事情。 + +### 我和消失的 K8s 集群 + +我的正式职责之一涉及到我们的应用架构。对于任何形式的架构改动,我都要进行代码的编写与测试,看看有什么可能性。近来,据说这成了我老板史诗级的痛苦,这只是轻描淡写。 + +我们在 Kubernetes 上运行我们的大多数基础架构,Kubernetes 以其弹性著称。尽管有这样的声誉,我还是使得两个集群,好吧,消失了。你可能会好奇我是怎么做到的,很容易,`terraform destroy`。我们通过 [Terraform][3] 以代码的方式管理我们的基础架构,并且不需要任何软件知识就知道 `destroy` 可做坏事。在你惊慌失措之前,好吧,是开发集群,所以我还活着。 + +鉴于此,你们肯定会问我为什么还没丢掉饭碗,以及为什么我要写下这些事情。这很好回答:我仍然有工作,是因为我更新的基础架构代码比起起初的代码工作得更好更快了。我写下这些是因为每个人都会经常性地遭遇失败,这是非常非常正常的。如果你没有时不时遭遇失败,我认为你并没有足够努力地学习。 + +### 破坏东西并培训人们 + +你可能还会认为永远不会有人让我去培训任何人。那是最糟糕的主意,因为(就像我的团队开玩笑说的)你永远都不应该做我所做的事情。但是我的老板却让我定期去训练新人。我甚至为整个团队提供使用我们的基础设施或代码的培训,教人们如何建立自己的基础设施。 + +原因是这样的:失败是你迈向成功的第一步。失败的教训绝不只是“备份是个绝佳的主意”。不,从失败中,你学会了更快地恢复、更快地排除故障并且在你工作中取得惊人的进步。当你在工作中变得惊人的时候,你就可以培训其他人,教给他们什么事情不要做,并且帮助他们去理解一切是如何工作的。由于你的经验,他们会比你开始时更进一步 —— 而且他们也很可能以新的、惊人的、史诗般的方式失败,每个人都可以从中学到东西。 + +### 你的成功取决于你的失败 + +没有人生来就具有软件工程和云基础架构方面的天赋,就像没有人天生就会走路。我们都是从滚动和翻爬开始的。从那时起,我们学会爬行,然后能够站立一会儿。当我们开始走路后,我们会跌倒并且擦伤膝盖,撞到手肘,还有,比如像我哥哥,走着走着撞上桌子的尖角,然后在眉毛中间缝了针。 + +凡事都需要时间去学习。一路上阅读手边能获得的一切来帮助你,但这永远只是个开始。完美是无法实现的幻想,你必须通过失败来取得成功。 + +每走一步,我的失败都教会我如何把事情做得更好。 + +最终,你的成功和你累积的失败一样多,这标志着你成功的程度。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/failure-driven-development + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) +[2]: https://www.redhat.com/en/topics/containers/what-is-kubernetes +[3]: https://github.com/hashicorp/terraform diff --git a/published/202004/20190107 Different Ways To Update Linux Kernel For Ubuntu.md b/published/202004/20190107 Different Ways To Update Linux Kernel For Ubuntu.md new file mode 100644 index 0000000000..50e1bb7e16 --- /dev/null +++ b/published/202004/20190107 Different Ways To Update Linux Kernel For Ubuntu.md @@ -0,0 +1,220 @@ +[#]: collector: "lujun9972" +[#]: translator: "mr-ping" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12125-1.html" +[#]: subject: "Different Ways To Update Linux Kernel For Ubuntu" +[#]: via: "https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/" +[#]: author: "SK https://www.ostechnix.com/author/sk/" + +升级 Ubuntu Linux 内核的几种不同方法 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/ubuntu-linux-kernel-720x340.png) + +这个指南里介绍了 7 种为 Ubuntu 升级 Linux 内核的不同方法。这 7 种方法里,有 5 种需要重启系统来使新内核生效,其他两种则不用。升级之前,**强烈建议你将重要数据进行备份!** 这里提到的所有方法只在 Ubuntu 中测试过。我们并不确定这些方法是不是也能适用于其他 Ubuntu 的特色发行版(如: Xubuntu)和衍生发行版(如:Linux Mint)。 + +### 第一部分:需要重启的内核升级 + +以下方法需要你重启系统以便新的内核生效。以下所有方法都建议在个人系统或测试系统中进行。重要的事儿再说一遍,请备份好你 Ubuntu 中的重要数据、配置文件和其他重要的东西。 + +#### 方法 1 - 使用 dpkg 升级 Linux 内核(手动方式) + +这个方法可以帮助你从 [kernel.ubuntu.com][1] 网站手动下载可用的最新 Linux 内核。如果你打算安装最新版(而不是稳定版或者正式发布版),那这种方法对你会很有用。从以上链接下载 Linux 内核版本。编写这个指南的时候,最新的可用版本是 **5.0-rc1**,最新的稳定版是 **v4.20**。 + +![][3] + +点击你所选择的 Linux 内核版本链接,找到你对应的架构(“Build for XXX”)的那部分。然后下载符合以下格式的两个文件(其中 X.Y.Z 是最高版本号): + + 1. linux-image-*X.Y.Z*-generic-*.deb + 2. linux-modules-X.Y.Z*-generic-*.deb + +在终端中改变到文件所在的目录,然后执行此命令手动安装内核: + +``` +$ sudo dpkg --install *.deb +``` + +重启系统,使用新内核: + +``` +$ sudo reboot +``` + +检查是否如你所愿: + +``` +$ uname -r +``` + +对于分步的说明,请查看下列链接中对应的部分。 + ++ [在基于 RPM 和 DEB 的系统中安装 Linux 内核 4.15](https://www.ostechnix.com/install-linux-kernel-4-15-rpm-deb-based-systems/) + +以上的指南是针对的是 4.15 版本,不过安装最新版本的所有的步骤都是一样的。 + +**优势:** 不必联网(你可以从任何系统中下载 Linux 内核来使用) + +**缺点:** 手动更新,需要重启系统。 + +#### 方法 2 - 用 apt-get 来升级 Linux 内核(推荐方法) + +这是在类 Ubuntu 系统中升级 Linux 内核的推荐方法。不同于上一个方法,这种方法会从 Ubuntu 官方仓库下载、安装内核版本,而不是从 **kernel.ubuntu.com**网站。 + +要升级包括内核的整个系统,只需要执行: + +``` +$ sudo apt-get update +$ sudo apt-get upgrade +``` + +如果只希望升级内核,运行: + +``` +$ sudo apt-get upgrade linux-image-generic +``` + +**优势:** 简单。推荐方法。 + +**缺点:** 需要联网,需要重启。 + +从官方库中升级内核是最接近开箱即用的方法,并且不会出什么问题。如果是生产环境的系统,这是最为推荐的升级 Linux 内核的方法。 + +方法 1 和方法 2 都需要用户去介入到升级 Linux 内核的过程中。而下边的方法(3、 4、 5)则几乎是全自动的。 + +#### 方法 3 - 使用 Ukuu 升级 Linux 内核 + +**Ukuu**是一个 Gtk GUI 和命令行工具,它可以从 kernel.ubuntu.com 下载最新的 Linux 主线内核,并自动安装到你的 Ubuntu 桌面版和服务器版中。Ukku 不仅简化了手动下载和安装新内核的过程,同时也会帮助你安全地移除旧的和不再需要的内核。更多细节可以参照以下指南。 + ++ [Ukuu:在 Ubuntu 系统中安装和升级 Linux 内核的简单方法](https://www.ostechnix.com/ukuu-an-easy-way-to-install-and-upgrade-linux-kernel-in-ubuntu-based-systems/) + +**优势:** 易于安装使用。自动安装主线内核。 + +**缺点:** 需要联网,需要重启。 + +#### 方法 4 - 使用 UKTools 升级 Linux 内核 + +跟 Ukuu 差不多,**UKTools** 也会从 kernel.ubuntu.com 网站获取最新的稳定内核并且自动安装到 Ubuntu 以及类似于 Linux Mint 的延伸发行版中。关于UKTools的更多详情,请参见下面的链接。 + ++ [UKTools:升级Ubuntu及其衍生产品中的最新Linux内核](https://www.ostechnix.com/uktools-upgrade-latest-linux-kernel-in-ubuntu-and-derivatives/) + +**优势:** 简单,自动。 + +**缺点:** 需要联网,需要重启。 + +#### 方法 5 - 使用 Linux 内核实用程序更新 Linux 内核 + +**Linux 内核实用程序**是目前另一个用于升级类 Ubuntu 系统 Linux 内核的程序。实质上,它是一个由一系列 Bash 脚本构成的合集,用于编译并且可以选择性地为 Debian(LCTT 译注:Ubuntu 的上游发行版)及其衍生发行版升级内核。它包含三个实用程序,一个用于手动编译、安装来自于 [http://www.kernel.org][4] 网站的源码内核,另一个用于安装来自 网站的预编译的内核,第三个脚本用于移除旧内核。更多细节请浏览以下链接。 + ++ [Linux 内核实用程序:编译和更新最新的 Linux 内核的脚本,适用于 Debian 及其衍生产品](https://www.ostechnix.com/linux-kernel-utilities-scripts-compile-update-latest-linux-kernel-debian-derivatives/) + +**优势:** 简单,自动。 + +**缺点:** 需要联网,需要重启。 + +### 第二部分:无需重启的内核升级 + +我之前说过,上边所有的方法都需要你重启服务器(LCTT 译注:也可以是桌面版)来启用新内核。如果是个人系统或者测试系统,可以这么办。但对于无法停机的生产环境系统该怎么办呢?一点问题没有,这时候实时补丁livepatching就派上用场了。 + +**实时补丁**(或者叫热补丁)允许你在不重启的情况下安装 Linux 更新或补丁,使你的服务器处于最新的安全级别。这对 web 主机、游戏服务器这类需要不间断在线的服务器来说是很有价值的。事实上,任何情况下,服务器都应该保持在不间断运行的状态下。由于 Linux 供应商只会在出于修复安全漏洞的目的下维护补丁,所以如果安全性是你最关注的问题时,这种方式再适合不过了。 + +以下两种方法不需要重启,对于生产环境和执行关键任务的 Ubuntu 服务器的 Linux 内核更新非常有用。 + +#### 方法 6 – 使用 Canonical 实时补丁服务来更新 Linux 内核 + +![][5] + +[Canonical 实时补丁服务][6]可以在不需要重启 Ubuntu 系统的情况下自动应用内核更新、补丁和安全补丁。它可以减少Ubuntu系统的停机时间,并保证系统的安全。Canonical 实时补丁服务可以在安装过程当中或安装之后进行设置。如果你使用的是 Ubuntu 桌面版,软件更新器会自动检查内核补丁的更新,并通知你。在基于控制台的系统中,则需要你定期运行 `apt-get update` 命令来进行升级。由于需要你手动运行 `apt-get upgrade` 命令它才会安装内核的安全补丁,所以算是半自动的。 + +实时补丁对三个及以下系统免费,如果多于三个,你需要升级成名为 **Ubuntu Advantage** 的企业支持方案套件。这个套件包括 **Kernel 实时补丁**及以下服务: + + * 扩展安全维护 – Ubuntu 生命周期后的重要安全更新 + * Landscape – 针对大规模使用 Ubuntu 的系统管理工具 + * 知识库 – 由 Ubuntu 专家撰写的私人文章和教程 + * 电话和网站支持 + +**价格** + +Ubuntu Advantage 包含三种付费计划,即基本计划、标准计划和高级计划。最基础的计划(基本计划)从 **单物理节点 225 美元/年**和**单VPS 75美元/年**开始计价。对于 Ubuntu 服务器版和桌面版看上去没有按月订阅。你可以在[此处][7]浏览所有计划的细节信息。 + +**优势:** 简单。半自动化。无需重启。支持三个免费系统。 + +**缺点:** 4 个以上主机的话非常昂贵。没有补丁回滚。 + +##### 开启 Canonical 实时补丁 + +如果你想在安装后设置实时补丁服务,依照以下方法逐步执行: + +从 [https://auth.livepatch.canonical.com/][8] 获取一个密钥。 + +``` +$ sudo snap install canonical-livepatch +$ sudo canonical-livepatch enable your-key +``` + +#### 方法 7 - 使用 KernelCare 升级 Linux 内核 + +![][9] + +[KernelCare][10] 是最新的实时补丁方案。它是 [CloudLinux][11] 推出的产品。KernelCare 可以运行在 Ubuntu 和其他的 Linux 发行版中。它每四个小时检查一遍补丁的发布,并在无需确认的情况下安装它们。如果更新后存在问题,可以将补丁进行回滚。 + +**价格** + +费用,每台服务器:**4 美元/月**,**45 美元/年**。 + +跟 Ubuntu 实时补丁相比,KernelCare 看起来非常便宜、实惠。好的方面在于**也可以按月订阅**。另一个前者不具备的功能是支持其他 Linux 发行版,如 Red Hat、CentOS、Debian、Oracle Linux、Amazon Linux 以及 OpenVZ、Proxmox 等虚拟化平台。 + +你可以在[此处][12]了解 KernelCare 的所有特性和简介,以及所有的付费计划的细节。 + +**优势:** 简单。全自动化。覆盖范围更广的操作系统。补丁回滚。无需重启。对非营利组织提供免费许可。价格低廉。 + +**缺点:** 不是免费的(除了30天的试用期)。 + +##### 开启 KernelCare 服务 + +在 [https://cloudlinux.com/kernelcare-free-trial5][14] 获取一个 30 天免费试用密钥。 + +执行以下命令开启 KernelCare 并注册秘钥。 + +``` +$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash +$ sudo /usr/bin/kcarectl --register KEY +``` + +如果你正在寻找一种经济实惠且可靠的商业服务来保持 Linux 服务器上的 Linux 内核更新,那么 KernelCare 是个不错的选择。 + +*由来自 Cloud Linux 的技术撰稿人和内容作者 Paul A. Jacobs 提供。* + +到此,希望这边文章能对你有所帮助。如果你觉得还有其他的工具和方法需要列在这里,可以在留言区给我们留言。我会根据反馈检查和更新这篇指南的。 + +接下来会有更多好东西给大家呈现,敬请期待。 + +Cheers! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[mr-ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: http://kernel.ubuntu.com/~kernel-ppa/mainline/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/Ubuntu-mainline-kernel.png +[4]: http://www.kernel.org +[5]: http://www.ostechnix.com/wp-content/uploads/2019/01/Livepatch.png +[6]: https://www.ubuntu.com/livepatch +[7]: https://www.ubuntu.com/support/plans-and-pricing +[8]: https://auth.livepatch.canonical.com/ +[9]: http://www.ostechnix.com/wp-content/uploads/2019/01/KernelCare.png +[10]: https://www.kernelcare.com/ +[11]: https://www.cloudlinux.com/ +[12]: https://www.kernelcare.com/update-kernel-linux/ +[13]: https://www.kernelcare.com/pricing/ +[14]: https://cloudlinux.com/kernelcare-free-trial5 diff --git a/published/202004/20190116 Best Audio Editors For Linux.md b/published/202004/20190116 Best Audio Editors For Linux.md new file mode 100644 index 0000000000..a6977b7d73 --- /dev/null +++ b/published/202004/20190116 Best Audio Editors For Linux.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (MFGJT) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12095-1.html) +[#]: subject: (Best Audio Editors For Linux) +[#]: via: (https://itsfoss.com/best-audio-editors-linux) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux 上的最佳音频编辑工具推荐 +====== + +在 Linux 上,有很多种音频编辑器可供你选用。不论你是一个专业的音乐制作人,还是只想学学怎么做出超棒的音乐的爱好者,这些强大的音频编辑器都是很有用的工具。 + +对于专业级的使用,我总是建议使用 [DAW][1](数码音频工作站)。但并不是每个人都需要全部的功能,所以你也应该了解一些最简单的音频编辑器。 + +在本文中,我们将讨论几款 DAW 和基础的音频编辑器,而且它们都是在 Linux 和(可能)其它操作系统上可以使用的**自由开源**的解决方案。 + +### Linux 上的最佳音频编辑器 + +![Best audio editors and DAW for Linux][2] + +我们不会关注 DAW 提供的所有功能,而只是关注基本的音频编辑功能。不过,你仍然可以把以下内容看作是 Linux 的最佳 DAW 名单。 + +**安装说明:**你可以在 AppCenter 或软件中心中找到所有提到的音频编辑器或 DAW。如果你在这两个地方没有找到它们,请前往它们的官方网站获取更多信息。 + +#### 1、Audacity + +![Audacity audio editor][3] + +[Audacity](https://www.audacityteam.org/) 是 Linux 中最基本音频编辑器之一,但是它也很强大。它是一个自由开源的跨平台工具。肯定已经有很多人了解这个软件了。 + +现在的它相比它最初流行的时候有了很大的改进。我记得我以前试着通过从音频中去除人声来制作卡拉 OK 伴奏。现在有些时候,你仍然可以这么做。 + +**特性:** + +它还支持包含 VST 效果的插件。当然,你不应该期望它支持 VST 乐器。 + + * 通过麦克风或混音器进行现场录制 + * 支持同时从多种音频格式的多个文件中批量导出/导入内容 + * 支持 LADSPA、LV2、Nyquist、VST 和 Audio Unit 的效果插件 + * 使用简单,带有剪切、粘贴、删除和拷贝的功能 + * 可观测声音频率的频谱模式 + +#### 2、LMMS + +![LMMS audio editor][4] + +[LMMS](https://lmms.io/) 是一个自由开源的(跨平台)数码音频工作站。它包括所有基本的音频编辑功能以及许多高级功能。 + +你可以混音、组合音频,或使用 VST 设备创造音频。LMMS 支持这些功能。此外,它还自带一些样本音频、预设、VST 设备和特效来帮助你起步。此外,你还可以得到一个频谱分析仪,以便进行高级的音频编辑工作。 + +**特性:** + + * 基于 MIDI 的音符回放 + * 支持 VST 设备 + * 原生支持多采样 + * 内置压缩器、限制器、延迟功能、混响功能、失真功能和低音增强器 + +#### 3、Ardour + +![Ardour audio editor][5] + +[Ardour](https://ardour.org/) 是另一个自由开源的数码音频工作站。只要你有音频接口,Ardour 就支持它的使用。当然,你也可以无限地添加多声道音轨。这些多声道音轨也可以被指派到不同的混音带,以方便编辑和录音。 + +你也可以导入一个视频,编辑其中的音频,然后导出新的视频。它提供了许多内置插件,并且支持 VST 插件。 + +**特性:** + + * 非线性编辑 + * 垂直窗口堆叠,便于导航 + * 静默消除功能strip silence推拉修剪功能push-pull trimming,和用以短暂片段或基于基于音符开始的编辑的 Rhythm Ferret。 + +#### 4、Cecilia + +![Cecilia audio editor][6] + +[Cecilia](http://ajaxsoundstudio.com/software/cecilia/) 不是一个普通的音频编辑器。它的使用者一般是音效设计师或者正在努力成为音效设计师的人。 Cecilia 实际上是一个音频信号处理环境。它可以让你的作品余音绕梁。 + +你还可以得到内置的音效与合成模组和插件。Cecilia 为一个明确的目的而生:如果你正在找音效设计工具,这是你的不二之选! + +**特性:** + + * 利用模块来完成更多工作(UltimateGrainer —— 最先进的颗粒化处理工具,RandomAccumulator —— 记录变量速度的累加器,UpDistoRes——通过上采样和谐振低通滤波器创造失真效果的工具) + * 自动保存调制设定 + +#### 5、Mixxx + +![Mixxx audio DJ][7] + +如果你想要在混合和录制一些东西的同时能够有一个虚拟的 DJ 工具,[Mixxx](https://www.mixxx.org/) 将是完美的工具。你可以用到 BPM、音调,并使用主同步功能来匹配歌曲的节奏和节拍。另外,不要忘记它也是一个 Linux 的自由开源的软件。 + +它还支持自定义 DJ 设备。所以,如果你有 DJ 设备或者 MIDI,你可以用这个工具录制你的现场混音。 + +**特性:** + + * 播送和录制你的歌曲的 DJ 混音 + * 可以连接到你的设备并且现场演奏 + * 音调检测和 BPM 检测 + +#### 6、Rosegarden + +![Rosegarden audio editor][9] + +[Rosegarden](https://www.rosegardenmusic.com/) 是另一个令人赞叹的 Linux 的自由开源的音频编辑器。它既不是一个功能齐全的 DAW,也不是一个基本的音频编辑工具。它是两者的混合体,并带有一些缩减的功能。 + +我不会向专业人士推荐这款软件,但如果你经营家庭音乐工作室或只是想体验一下,这将是 Linux 上可以安装的最好的音频编辑器之一。 + +**特性:** + + * 乐谱编辑 + * 录音、混音以及采样 + +### 小结 + +这些是你可以找到的 Linux 上的最棒的一些音频编辑器了。不论你是需要 DAW,一个剪切/粘贴的编辑工具,或者仅仅想要一个拥有基础的混音和录音功能的音频编辑工具,上述软件都能够满足你的需求。 + +如果在这篇文章中我们遗漏了你最喜欢的一些音频工具,可以在原文下方评论中回复告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-audio-editors-linux + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[MFGJT](https://github.com/MFGJT) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Digital_audio_workstation +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors-800x450.jpeg?resize=800%2C450&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/audacity-audio-editor.jpg?fit=800%2C591&ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/lmms-daw.jpg?fit=800%2C472&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/ardour-audio-editor.jpg?fit=800%2C639&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/cecilia.jpg?fit=800%2C510&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/mixxx.jpg?fit=800%2C486&ssl=1 +[8]: https://itsfoss.com/dj-mixxx-2/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/rosegarden.jpg?fit=800%2C391&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors.jpeg?fit=800%2C450&ssl=1 diff --git a/published/202004/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/published/202004/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md new file mode 100644 index 0000000000..31ce0c27f0 --- /dev/null +++ b/published/202004/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12113-1.html) +[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) +[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +在 VirtualBox 上安装 Kali Linux:最快速和最安全的方法 +====== + +> 这篇教程向你展示如何在 Windows 和 Linux 中以最快的方式在 VirtualBox 上安装 Kali Linux。 + +[Kali Linux][1] 是 [最适合脆弱性测试和安全爱好者的 Linux 发行版][2] 之一。 + +因为它涉及一个像黑客之类的敏感话题,就像一把双刃剑。我们过去在详细的 Kali Linux 评论中讨论过,所以我不会再次赘述。 + +虽然你可以通过替换现有的操作系统的形式安装 Kali Linux,但是通过虚拟机来使用它可能会是更好、更安全的选择。 + +使用 VirtualBox,你可以在 Windows/Linux 系统中将 Kail Linux 作为常规应用程序使用。这和在系统中运行 VLC 或游戏几乎是一样的。 + +在虚拟机中使用 Kali Linux 是安全的。不管你在 Kali Linux 做什么都不会影响你的 ‘宿主系统’(即你原来的 Windows 或 Linux 操作系统)。你的实际操作系统将不会受到影响,并且在你的宿主系统中数据也是安全的。 + +![][3] + +### 如何在 VirtualBox 中安装 Kali Linux + +在这里我会使用 [VirtualBox][4]。它是一个非常好的开源虚拟化解决方案,几乎适合于任何人,无论是专业使用或个人使用。它是免费提供的。 + +在这篇文章中,我们将特别讨论 Kali Linux,但你也可以安装几乎任何其他的操作系统,只要有 ISO 文件或预建的虚拟机保存文件就可以安装。 + +**注意:**同样的步骤适用于运行 VirtualBox 的 Windows 或 Linux。 + +如上所述 ,你可以安装 Windows 或 Linux 作为你的宿主系统。但是,在我已安装 Windows 10 的情况下(别仇恨我!),我会尝试着在其上的 VirtualBox 中一步步地安装 Kali Linux 。 + +并且,最棒的是,即使你碰巧使用一个 Linux 发行版作为你的主要操作系统,也将使用同样的步骤! + +想知道如何做?让我们来看看… + +- [video](https://youtu.be/TGOiAsSdADs) + +### 在 VirtualBox 上安装 Kali Linux 的分步指南 + +我们将使用一个专门为 VirtualBox 定制的 Kali Linux 镜像。你也可以下载 Kali Linux 的 ISO 文件,并创建一个新的虚拟机,但是当你有一个简单的选择时,为什么还这样做呢? + +#### 1、下载并安装 VirtualBox + +第一件要做的事是从甲骨文的官方网站下载和安装 VirtualBox。 + +- [下载 VirtualBox][6] + +在你下载了安装器之后,只需要双击它来安装 VirtualBox。在 [Ubuntu][7]/Fedora Linux 安装 VirtualBox 也是一样的方式。 + +#### 2、下载即用型的 Kali Linux 虚拟镜像 + +在安装成功后,前往 [Offensive Security 的下载页面][8] 来下载适用于 VirtualBox 的虚拟机镜像。如果你改变主意使用 [VMware][9],那里也有适用的。 + +![][10] + +如你所见,文件大小大约 3 GB,你应该使用 torrent 方式,或者使用一个[下载管理器][11]来下载它。 + +- [下载 Kali Linux 虚拟镜像][8] + +#### 3、在 Virtual Box 上安装 Kali Linux + +当你安装 VirtualBox 并下载 Kali Linux 镜像后,你只需要将其导入到 VirtualBox 中就可以使其正常工作。 + +这里是如何导入 Kali Linux 的 VirtualBox 镜像: + +##### 步骤 1 + +启动 VirtualBox。你会看到一个导入Import 按钮,点击它。 + +![点击导入按钮][12] + +##### 步骤 2 + +接下来,浏览刚刚下载的文件,选择要导入的文件(如下图所示)。文件名应该以“kali linux”开始,以 .ova 扩展名结束。 + +![导入 Kali Linux 镜像][13] + +选择后,单击下一步Next继续进行。 + +##### 步骤 3 + +现在,你会看到要导入的虚拟机的设置。所以,你可以自定义它们或者不自定义,这是你的选择。采用默认设置也是可以的。 + +你需要选择一个有足够可用存储空间的路径。在 Windows 上,我绝不建议使用 C: 盘。 + +![将硬盘驱动器导入为 VDI][14] + +在这里,“将硬盘驱动器导入为 VDI”指的是通过分配存储器空间集来虚拟挂载硬盘驱动器。 + +在你完成设置后,单击导入Import,等待一段时间。 + +##### 步骤 4 + +你现在将看到它被列在虚拟机列表中。所以,只需点击开始Start来启动它。 + +你可能会在开始时得到一个 USB 2.0 端口控制器的错误,你可以禁用它来解决问题,或者只需按照屏幕上的指示来安装一个附加软件包修复问题。然后就大功告成了! + +![Kali Linux 运行在 VirtualBox 中][15] + +以前 Kali Linux 中的默认用户名是 root,默认密码是 toor。但从 2020 年 1 月起,Kali Linux 就不使用 root 账号了。现在,默认账号和密码都是 kali。 + +你应该可以用它来登录系统了。 + +请注意,在尝试安装一个新的应用程序或尝试破解 WiFi 密码之前,请先[更新 Kali Linux][16] 。 + +我希望这篇指南能帮助您在 VirtualBox 上很容易地安装 Kali Linux。当然,Kali Linux 有很多有用的渗透测试工具 – 祝你好运! + +**提示** : Kali Linux 和 Ubuntu 都是基于 Debian 的,如果你在使用 Kali Linux 时遇到任何问题或错误,你可以按照互联网上的 Ubuntu 和 Debian 的教程解决。 + +### 奖励: 免费的 Kali Linux 指南书 + +如果你刚刚开始使用 Kali Linux, 那么了解如何使用 Kali Linux 就很有必要了。 + +Kali Linux 背后的公司 Offensive Security 制作了一本指南书,讲解了 Linux 的基础知识、Kali Linux 的基础知识、配置和设置,书中还有一些关于渗透测试和安全工具的章节。 + +基本上,它包含你上手 Kali Linux 所需要的一切东西。更重要的是,这本书可以免费下载。 + +- [免费下载《揭秘 Kali Linux》][17] + +如果你在 VirtualBox 上使用 Kali Linux 时遇到问题,请在下面的评论中告诉我们,或者直接分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kali-linux-virtualbox/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.kali.org/ +[2]: https://itsfoss.com/linux-hacking-penetration-testing/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1 +[4]: https://www.virtualbox.org/ +[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[6]: https://www.virtualbox.org/wiki/Downloads +[7]: https://itsfoss.com/install-virtualbox-ubuntu/ +[8]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/ +[9]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1 +[11]: https://itsfoss.com/4-best-download-managers-for-linux/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1 +[16]: https://linuxhandbook.com/update-kali-linux/ +[17]: https://kali.training/downloads/Kali-Linux-Revealed-1st-edition.pdf diff --git a/published/202004/20190429 10 moments that shaped Linux history.md b/published/202004/20190429 10 moments that shaped Linux history.md new file mode 100644 index 0000000000..8dc04ce5de --- /dev/null +++ b/published/202004/20190429 10 moments that shaped Linux history.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12060-1.html) +[#]: subject: (10 moments that shaped Linux history) +[#]: via: (https://opensource.com/article/19/4/top-moments-linux-history) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +塑造 Linux 历史的 10 个时刻 +====== + +> 自 1991 年诞生以来,Linux 已经走了漫长的一段路,而这些事件标志着它的发展。 + +![](https://img.linux.net.cn/data/attachment/album/202004/01/093243wukmsiwdkkwfrg00.jpg) + +在 2018 年 8 月,Opensource.com 发布了一项包含七个选项的民意测验,询问读者:[Linux 历史上最重要的时刻是什么?][2]我觉得我需要扩大这个清单,并提出我认为的 10 个在塑造 Linux 历史上发挥了重要作用的时刻。 + +### 1、Linus 发布 Linux + +Linus Torvalds 最初是在 1991 年将 Linux 当成一个业余爱好发布到世上的。结果这个业余爱好成了他的职业! + +### 2、出现 Linux 发行版 + +1993 年,出现了几个 Linux 发行版,需要特别指出的有 [Debian][3]、[Red Hat][4] 和 [Slackware][5]。这个时刻之所以重要是因为它们证明了 Linux 在市场认可度和开发水平方面的成就,使其能够在 1990 年代动荡的操作系统战争、浏览器战争和协议战争中生存下来。相反,那时许多成熟的、商业的和专有的产品并没有活过千禧年之交! + +### 3、IBM 斥巨资投注 Linux + +2000 年,IBM 宣布将在 Linux 上投资 10 亿美元。Richard Richtmyer 在他的 CNN Money [有关投资的文章][6] 中写道:“这一声明强调了蓝色巨人对 Linux 的承诺,标志着将这个替代操作系统推向主流商业市场的重大进展。” + +### 4、好莱坞接纳 Linux + +在 2002 年,整个好莱坞电影业似乎都采用了 Linux。[迪尼斯][7]、[梦工厂][8] 和 [工业光魔][9] 都在那一年开始用 Linux 制作电影。 + +### 5、Linux 得到政府认可 + +2003 年,美国政府对 Linux 的接受是它的又一个重要时刻。红帽 Linux 被[授予][10]美国防部通用操作环境(COE)认证。这很重要,因为政府(特别是情报和军事机构)对计算机系统有非常严格的要求,以防止攻击和支持国家安全。这为其他机构使用 Linux 打开了大门。在那年晚些时候,[美国国家气象局宣布][11],它将用运行 Linux 的新计算机代替过时的系统。 + +### 6、我管理的系统 + +这个“时刻”确实是我个人经历的集合。随着在 2000 年代我的职业发展,我发现自己管理的几种类型的系统和设备都运行着 Linux。我在 VMware ESX、F5 Big-IP、Check Point UTM Edge、Cisco ASA 和 PIX 这些地方发现了 Linux。这使我意识到 Linux 确实可行并且可以继续存在下去。 + +### 7、Ubuntu + +2004 年,Mark Shuttleworth 创立了 Canonical,该公司基于 Debian 发行版提供了易于使用的 Linux 桌面:[Ubuntu Linux][12]。我认为 Ubuntu Linux 帮助扩展了桌面 Linux 安装基数。从休闲的家庭用户到专业软件开发人员,它使 Linux 出现在更多人面前。 + +### 8、Google 的 Linux + +Google 发行了两种基于 Linux 内核的操作系统:2008 年中期的 Android 移动操作系统和 2011 年在 Chromebook 上运行的 Chrome OS。在那之后,已经售出了数百万部 Android 手机和 Chromebook。 + +### 9、云计算即 Linux + +在过去这十年左右的时间里,云计算已经从互联网计算的宏伟愿景变成了我们如何个人和专业地使用计算机的全新方式。云计算领域中的主要参与者都是构建于 Linux 之上的,包括 [Amazon Web Services(AWS)][13]、[Google Cloud Services(GCS)][14] 和 [Linode][15]。即使在一些我们不能确信的地方(例如 Microsoft Azure),也很好地支持运行 Linux 工作负载。 + +### 10、我的汽车运行着 Linux + +你的也一样!许多汽车制造商几年前开始引入 Linux。这导致了名为 [汽车级 Linux(AGL)][16] 的协作开源项目的形成。丰田和斯巴鲁等主要汽车制造商已经联合开发基于 Linux 的汽车娱乐、导航和引擎管理系统。 + +### 分享你的最爱 + +这是我从贯穿我的职业生涯的 Linux 文章和事件的档案库中提取出来的主观清单,因此可能还有其他更值得注意的时刻。请分享你的评论吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/top-moments-linux-history + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://opensource.com/article/18/8/linux-history +[3]: https://www.debian.org/doc/manuals/project-history/ch-intro.en.html +[4]: https://brand.redhat.com/foundations/history +[5]: https://opensource.com/article/18/7/stackware-turns-25 +[6]: https://money.cnn.com/2000/12/12/technology/ibm_linux +[7]: https://www.nytimes.com/2002/06/18/business/technology-disney-shifting-to-linux-for-film-animation.html +[8]: https://www.linux.com/news/stallion-and-penguin-dreamworks-uses-linux-create-new-animated-film +[9]: https://www.linuxjournal.com/article/6011 +[10]: https://www.cnet.com/news/government-tips-hat-to-red-hat +[11]: https://www.computerworld.com/article/2574142/national-weather-service-migrates-to-linux-based-ibm-workstations.html +[12]: https://www.ubuntu.com/about +[13]: https://aws.amazon.com/amazon-linux-2 +[14]: https://cloud.google.com +[15]: https://www.linode.com/docs/getting-started +[16]: https://www.automotivelinux.org diff --git a/published/202004/20190523 Run your blog on GitHub Pages with Python.md b/published/202004/20190523 Run your blog on GitHub Pages with Python.md new file mode 100644 index 0000000000..ea62c62a04 --- /dev/null +++ b/published/202004/20190523 Run your blog on GitHub Pages with Python.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12064-1.html) +[#]: subject: (Run your blog on GitHub Pages with Python) +[#]: via: (https://opensource.com/article/19/5/run-your-blog-github-pages-python) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani) + +使用 Python 在 GitHub 上运行你的博客 +====== + +> 使用 Pelican 创建博客,这是一个基于 Python 的平台,与 GitHub 配合的不错。 + +![](https://img.linux.net.cn/data/attachment/album/202004/02/101030cy0t0f0e0jvf5e5e.jpg) + +[GitHub][2] 是一个非常流行的用于源代码控制的 Web 服务,它使用 [Git][3] 同步本地文件和 GitHub 服务器上保留的副本,这样你就可以轻松地共享和备份你的工作。 + +除了为代码仓库提供用户界面之外,GitHub 还运允许用户直接从仓库[发布网页][4]。GitHub 推荐的网站生成软件包是 [Jekll][5],是使用 Ruby 编写的。因为我是 [Python][6] 的忠实粉丝,所以我更喜欢 [Pelican][7],这是一个基于 Python 的博客平台,可与 GitHub 很好地协同工作。 + +Pelican 和 Jekll 都可以将 [Markdown][8] 或 [reStructuredText][9] 中编写的内容转换为 HTML 以生成静态网站,并且两个生成器都支持定制的主题。 + +在本文中,我将介绍如何安装 Pelican、设置 GitHub 仓库、运行快速入门帮助、编写一些 Markdown 文件以及发布第一篇博客。我假设你有一个 [GitHub 账户][10],熟悉[基础的 Git 命令][11],并且想使用 Pelican 发布博客。 + +### 安装 Pelican 并创建仓库 + +首先,你必须在本地计算机上安装 Pelican 和 `ghp-import`。使用 Python 软件包安装工具 [pip][12](你有,对吧?),这非常容易: + +``` +$ pip install pelican ghp-import Markdown +``` + +然后,打开浏览器并在 GitHub 上为你新鲜出炉的博客创建一个新仓库,命名如下(在此处以及整个教程中,用 GitHub 用户名替换 `username`): + +``` +https://GitHub.com/username/username.github.io +``` + +让它保持为空,稍后我们用引人注目的博客内容来填充它。 + +使用命令行(确保正确),将这个空 Git 仓库克隆到本地计算机: + +``` +$ git clone blog +$ cd blog +``` + +### 奇怪的把戏... + +在 GitHub 上发布 Web 内容有一个不太引入注意的技巧,对于托管在名为 `username.github.io` 的仓库的用户页面,其内容由 `master` 分支提供服务。 + +我强烈建议所有的 Pelican 配置文件和原始的 Markdown 文件都不要保留在 `master` 中,`master` 中只保留 Web 内容。因此,我将 Pelican 配置和原始内容保留在一个我喜欢称为 `content` 的单独分支中。(你可以随意创建一个分支,但以下内容沿用 `content`。)我喜欢这种结构,因为我可以放弃掉 `master` 中的所有文件,然后用 `content` 分支重新填充它。 + +``` +$ git checkout -b content +Switched to a new branch 'content' +``` + +### 配置 Pelican + +现在该进行内容配置了。Pelican 提供了一个很棒的初始化工具 `pelican-quickstart`,它会询问你有关博客的一系列问题。 + +``` +$ pelican-quickstart +Welcome to pelican-quickstart v3.7.1. + +This script will help you create a new Pelican-based website. + +Please answer the following questions so this script can generate the files +needed by Pelican. + +> Where do you want to create your new web site? [.] +> What will be the title of this web site? Super blog +> Who will be the author of this web site? username +> What will be the default language of this web site? [en] +> Do you want to specify a URL prefix? e.g., http://example.com (Y/n) n +> Do you want to enable article pagination? (Y/n) +> How many articles per page do you want? [10] +> What is your time zone? [Europe/Paris] US/Central +> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y +> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y +> Do you want to upload your website using FTP? (y/N) n +> Do you want to upload your website using SSH? (y/N) n +> Do you want to upload your website using Dropbox? (y/N) n +> Do you want to upload your website using S3? (y/N) n +> Do you want to upload your website using Rackspace Cloud Files? (y/N) n +> Do you want to upload your website using GitHub Pages? (y/N) y +> Is this your personal page (username.github.io)? (y/N) y +Done. Your new project is available at /Users/username/blog +``` + +你可以对每个问题都采用默认值,但除了以下这些问题: + +* 网站标题,应该唯一且特殊 +* 网站作者,可以是个人用户名或你的全名 +* 时区,可能你不在巴黎 +* 上传到 GitHub 页面,我们选择 `y` + +回答完所有问题后,Pelican 会在当前目录中留下以下内容: + +``` +$ ls +Makefile content/ develop_server.sh* +fabfile.py output/ pelicanconf.py +publishconf.py +``` + +你可以查看 [Pelican 文档][13]来了解如何使用这些文件,但**现在**我们要做的是完成手头的工作。说实话,我也没有阅读文档。 + +### 继续 + +将所有 Pelican 生成的文件添加到本地 Git 仓库的 `content` 分支,提交更改,然后将本地更改推送到 Github 上托管的远程仓库: + +``` +$ git add . +$ git commit -m 'initial pelican commit to content' +$ git push origin content +``` + +这件事情并不是特别令人兴奋,但是如果我们需要撤销这些文件之一的修改时,这将非常方便。 + +### 终于 + +终于,现在你得到一个博客了!你所有的博客文章、照片、图像、PDF 等都将位于 `content` 目录中,它最初是空的。要开始创建第一篇博客和关于页面,输入: + +``` +$ cd content +$ mkdir pages images +$ cp /Users/username/SecretStash/HotPhotoOfMe.jpg images +$ touch first-post.md +$ touch pages/about.md +``` + +接下来,在你喜欢的文本编辑器中打开 `first-post.md`,并添加以下内容: + +``` +title: First Post on My Sweet New Blog +date: +author: Your Name Here + +# I am On My Way To Internet Fame and Fortune! + +This is my first post on my new blog. While not super informative it +should convey my sense of excitement and eagerness to engage with you, +the reader! +``` + +前三行是 Pelican 用于组织内容的元数据。有很多不同的元数据可供你选择。再说一次,文档是你了解更多选项的最佳选择。 + +现在,打开空白文件 `pages/about.md` 并添加以下文本: + +``` +title: About +date: + +![So Schmexy][my_sweet_photo] + +Hi, I am and I wrote this epic collection of Interweb +wisdom. In days of yore, much of this would have been deemed sorcery +and I would probably have been burned at the stake. + +😆 + +[my_sweet_photo]: {static}/images/HotPhotoOfMe.jpg +``` + +现在,`content` 目录中将包含三个新的 Web 内容,在 `content` 分支中还有很多内容。 + +### 发布 + +不要急,马上要见到成果了! + +剩下要做的就是: + +* 运行 Pelican 以在 `output` 中生成静态 HTML 文件: + + ``` +$ pelican content -o output -s publishconf.py +``` +* 使用 `ghp-import` 将 `output` 目录的内容添加到 `master` 分支中: + + ``` +$ ghp-import -m "Generate Pelican site" --no-jekyll -b master output +``` +* 将本地 `master` 分支推送到远程仓库: + + ``` +$ git push origin master +``` +* 提交新内容并将其推送到 `content` 分支 + + ``` +$ git add content +$ git commit -m 'added a first post, a photo and an about page' +$ git push origin content +``` + +### OMG,我成功了 + +现在最激动的时候到了,当你想要看到你发布给大家的博客内容时,打开浏览器输入: + +``` +https://username.github.io +``` + +恭喜你可以在 GitHub 上发布自己的博客了!当你想添加更多页面或文章时,都可以按照上面的步骤来。希望你可以愉快地发布博客。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/5/run-your-blog-github-pages-python + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Raspberry Pi and Python) +[2]: https://github.com/ +[3]: https://git-scm.com +[4]: https://help.github.com/en/categories/github-pages-basics +[5]: https://jekyllrb.com +[6]: https://python.org +[7]: https://blog.getpelican.com +[8]: https://guides.github.com/features/mastering-markdown +[9]: http://docutils.sourceforge.net/docs/user/rst/quickref.html +[10]: https://github.com/join?source=header-home +[11]: https://git-scm.com/docs +[12]: https://pip.pypa.io/en/stable/ +[13]: https://docs.getpelican.com diff --git a/published/202004/20190605 What is GraphQL.md b/published/202004/20190605 What is GraphQL.md new file mode 100644 index 0000000000..49d68894b1 --- /dev/null +++ b/published/202004/20190605 What is GraphQL.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12070-1.html) +[#]: subject: (What is GraphQL?) +[#]: via: (https://opensource.com/article/19/6/what-is-graphql) +[#]: author: (Zach Lendon https://opensource.com/users/zachlendon) + +什么是 GraphQL? +====== + +> GraphQL 是一种查询语言、一个执行引擎,也是一种规范,它让开发人员重新思考如何构建客户端和 API 应用。 + +![](https://img.linux.net.cn/data/attachment/album/202004/04/112938odz6sbw6hzwsh7f6.jpg) + +GraphQL 是当今软件技术中最大的流行语之一。但它*究竟*是什么?是像 [SQL][2] 一样的查询语言吗?是像 [JVM][3] 这样的执行引擎?还是像 [XML][4] 这样的规范? + +如果你回答上面这些都是,那么你是对的![GraphQL][5] 是一种查询语言的语法、是一种编程语言无关的执行引擎,也是一种不断发展的规范。 + +让我们深入了解一下 GraphQL 如何成为所有这些东西的,并了解一下人们为什么对它感到兴奋。 + +### 查询语言 + +GraphQL 作为查询语言似乎是合理的 —— 毕竟 “QL” 似乎重要到出现在名称中。但是我们查询什么呢?看一个示例查询请求和相应的响应可能会有所帮助。 + +以下的用户查询: + +``` +{ + user(id: 4) { +    name +    email +    phoneNumber +  } +} +``` + +可能会返回下面的 JSON 结果: + +``` +{ +  "user": { +    "name": "Zach Lendon" +    “email”: “zach@hydrate.io” +    “phoneNumber”: “867-5309” +  } +} +``` + +想象一下,客户端应用查询用户详细信息、获取结果,并使用它填充配置屏幕。作为查询语言,GraphQL 的核心优势之一是客户端应用可以*只请求它需要*的数据,并期望以一致的方式返回这些数据。 + +那么 GraphQL 响应返回的*什么*呢?这就是执行引擎发挥的作用,通常是以 GraphQL 服务器的形式出现。 + +### 执行引擎 + +![GraphQL execution engine][7] + +GraphQL 执行引擎负责处理 GraphQL 查询并返回 JSON 响应。所有 GraphQL 服务器由两个核心组件组成,分别定义了执行引擎的结构和行为:模式和解析器。 + +GraphQL 模式是一种自定义类型语言,它公开哪些查询既允许(有效),又由 GraphQL 服务器实现处理。上面用户示例查询的模式可能如下所示: + +``` +type User { + name: String +    email: String +    phoneNumber: String +} + +type Query { +    user: User +} +``` + +此模式定义了一个返回用户的用户查询。客户端可以通过用户查询请求用户上的任何字段,并且 GraphQL 服务器将仅返回请求的字段。通过使用强类型模式,GraphQL 服务器可以根据定义的模式验证传入的查询,以确保是有效的。 + +确定查询有效后,就会由 GraphQL 服务器的解析器处理。解析器函数支持每个 GraphQL 类型的每个字段。我们的这个用户查询的示例解析器可能如下所示: + +``` +Query: { + user(obj, args, context, info) { + return context.db.loadUserById(args.id).then( + userData => new User(userData) + ) + } +} +``` + +虽然上面的例子是用 JavaScript 编写的,但 GraphQL 服务器可以用任意语言编写。这是因为 GraphQL 也是*也是*一种规范! + +### 规范 + +GraphQL 规范定义了 GraphQL 实现必须遵循的功能和特性。作为一个在开放网络基金会的最终规范协议([OWFa 1.0][8])下提供的开放规范,技术社区可以审查 GraphQL 实现必须符合规范的要求,并帮助制定 GraphQL 的未来。 + +虽然该规范对 GraphQL 的语法,什么是有效查询以及模式的工作方式进行了非常具体的说明,但它没有提供有关如何存储数据或 GraphQL 服务器应使用哪种编程语言实现的指导。这在软件领域是非常强大的,也是相对独特的。它允许以各种编程语言创建 GraphQL 服务器,并且由于它们符合规范,因此客户端会确切知道它们的工作方式。GraphQL 服务器已经有多种语言实现,人们不仅可以期望像 JavaScript、Java和 C# 这样的语言,还可以使用 Go、Elixir 和 Haskell 等。服务器实现所使用的语言不会成为采用过程的障碍。它不仅存在多种语言实现,而且它们都是开源的。如果没有你选择的语言的实现,那么可以自己实现。 + +### 总结 + +GraphQL 是开源 API 领域中一个令人兴奋的、相对较新的参与者。它将查询语言、执行引擎与开源规范结合在一起,它定义了 GraphQL 实现的外观和功能。 + +GraphQL 已经开始改变企业对构建客户端和 API 应用的看法。通过将 GraphQL 作为技术栈的一部分,前端开发人员可以自由地查询所需的数据,而后端开发人员可以将客户端应用需求与后端系统架构分离。通常,公司在使用 GraphQL 的过程中,首先会在其现有的后端服务之上构建一个 GraphQL API “层”。这使得客户端应用开始获得他们所追求的性能和运营效率,同时使后端团队有机会确定他们可能需要在 GraphQL 层后面的“幕后”进行哪些更改。通常,这些更改都是为了优化,这些优化有助于确保使用 GraphQL 的应用可以尽可能高效地运行。由于 GraphQL 提供了抽象性,因此系统团队可以进行更改的同时继续在其 GraphQL API 级别上遵守 GraphQL 的“合约”。 + +由于 GraphQL 相对较新,因此开发人员仍在寻找新颖而激动人心的方法来利用它构建更好的软件解决方案。GraphQL 将如何改变你构建应用的方式,它是否对得起众望所归?只有一种方法可以找到答案 —— 用 GraphQL 构建一些东西! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/what-is-graphql + +作者:[Zach Lendon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/zachlendon +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://opensource.com/article/18/2/getting-started-sql +[3]: https://www.cubrid.org/blog/understanding-jvm-internals/ +[4]: https://www.w3.org/TR/xml/ +[5]: http://graphql.org/ +[6]: mailto:zach@hydrate.io +[7]: https://opensource.com/sites/default/files/pictures/graphql-execution-engine.png (GraphQL execution engine) +[8]: http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0---patent-only diff --git a/published/202004/20190612 How to write a loop in Bash.md b/published/202004/20190612 How to write a loop in Bash.md new file mode 100644 index 0000000000..6649f2b926 --- /dev/null +++ b/published/202004/20190612 How to write a loop in Bash.md @@ -0,0 +1,262 @@ +[#]: collector: "lujun9972" +[#]: translator: "chunibyo-wly" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12088-1.html" +[#]: subject: "How to write a loop in Bash" +[#]: via: "https://opensource.com/article/19/6/how-write-loop-bash" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +如何在 Bash 中使用循环 +====== + +> 使用循环和查找命令批量自动对多个文件进行一系列的操作。 + +![](https://img.linux.net.cn/data/attachment/album/202004/08/225655by8i8k7uyppp18ph.jpg) + +人们希望学习批处理命令的一个普遍原因是要得到批处理强大的功能。如果你希望批量的对文件执行一些指令,构造一个可以重复运行在那些文件上的命令就是一种方法。在编程术语中,这被称作*执行控制*,`for` 循环就是其中最常见的一种。 + +`for` 循环可以详细描述你希望计算机对你指定的每个数据对象(比如说文件)所进行的操作。 + +### 一般的循环 + +使用循环的一个简单例子是对一组文件进行分析。这个循环可能没什么用,但是这是一个安全的证明自己有能力独立处理文件夹里每一个文件的方法。首先,创建一个文件夹然后拷贝一些文件(例如 JPEG、PNG 等类似的文件)至文件夹中生成一个测试环境。你可以通过文件管理器或者终端来完成创建文件夹和拷贝文件的操作: + +```bash +$ mkdir example +$ cp ~/Pictures/vacation/*.{png,jpg} example +``` + +切换到你刚创建的那个新文件夹,然后列出文件并确认这个测试环境是你需要的: + +``` +$ cd example +$ ls -1 +cat.jpg +design_maori.png +otago.jpg +waterfall.png +``` + +在循环中逐一遍历文件的语法是:首先声明一个变量(例如使用 `f` 代表文件),然后定义一个你希望用变量循环的数据集。在这种情况下,使用 `*` 通配符来遍历当前文件夹下的所有文件(通配符 `*` 匹配*所有文件*)。然后使用一个分号(`;`)来结束这个语句。 + +``` +$ for f in * ; +``` + +取决于你个人的喜好,你可以选择在这里按下回车键。在语法完成前,shell 是不会尝试执行这个循环的。 + +接下来,定义你想在每次循环中进行的操作。简单起见,使用 `file` 命令来得到 `f` 变量(使用 `$` 告诉 shell 使用这个变量的值,无论这个变量现在存储着什么)所存储着的文件的各种信息: + +``` +do file $f ; +``` + +使用另一个分号结束这一行,然后关闭这个循环: + +``` +done +``` + +按下回车键启动 shell 对当前文件夹下*所有东西*的遍历。`for` 循环将会一个一个的将文件分配给变量 `f` 并且执行你的命令: + +``` +$ for f in * ; do +> file $f ; +> done +cat.jpg: JPEG image data, EXIF standard 2.2 +design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +otago.jpg: JPEG image data, EXIF standard 2.2 +waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +``` + +你也可以用这种形式书写命令: + +``` +$ for f in *; do file $f; done +cat.jpg: JPEG image data, EXIF standard 2.2 +design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +otago.jpg: JPEG image data, EXIF standard 2.2 +waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +``` + +对你的 shell 来说,多行和单行的格式没有什么区别,并且会输出完全一样的结果。 + +### 一个实用的例子 + +下面是一个循环在日常使用中的实用案例。假如你拥有一堆假期拍的照片想要发给你的朋友。但你的照片太大了,无法通过电子邮件发送,上传到[图片分享服务][2]也不方便。因此你想为你的照片创建小型的 web 版本,但是你不希望花费太多时间在一个一个的压缩图片体积上。 + +首先,在你的 Linux、BSD 或者 Mac 上使用包管理器安装 ImageMagick 命令。例如,在 Fedora 和 RHEL 上: + +``` +$ sudo dnf install ImageMagick +``` + +在 Ubuntu 和 Debian 上: + +``` +$ sudo apt install ImageMagick +``` + +在 BSD 上,使用 `ports` 或者 [pkgsrc][3] 安装。在 Mac 上,使用 [Homebrew][4] 或者 [MacPorts][5] 安装。 + +在你安装了 ImageMagick 之后,你就拥有一系列可以用来操作图片的新命令了。 + +为你将要创建的文件建立一个目标文件夹: + +``` +$ mkdir tmp +``` + +使用下面的循环可以将每张图片减小至原来大小的 33%。 + +``` +$ for f in * ; do convert $f -scale 33% tmp/$f ; done +``` + +然后就可以在 `tmp` 文件夹中看到已经缩小了的照片了。 + +你可以在循环体中使用任意数量的命令,因此如果你需要对一批文件进行复杂的操作,可以将你的命令放在一个 `for` 循环的 `do` 和 `done` 语句之间。例如,假设你希望将所有处理过的图片拷贝至你的网站所托管的图片文件夹并且在本地系统移除这些文件: + +``` +$ for f in * ; do + convert $f -scale 33% tmp/$f + scp -i seth_web tmp/$f seth@example.com:~/public_html + trash tmp/$f ; +done +``` + +你的计算机会对 `for` 循环中处理的每一个文件自动的执行 3 条命令。这意味着假如你仅仅处理 10 张图片,也会省下输入 30 条指令和更多的时间。 + +### 限制你的循环 + +一个循环常常不需要处理所有文件。在示例文件夹中,你可能需要处理的只是 JPEG 文件: + +``` +$ for f in *.jpg ; do convert $f -scale 33% tmp/$f ; done +$ ls -m tmp +cat.jpg, otago.jpg +``` + +或者,你希望重复特定次数的某个操作而不仅仅只处理文件。`for` 循环的变量的值是被你赋给它的(不管何种类型的)数据所决定的,所以你可以创建一个循环遍历数字而不只是文件: + +``` +$ for n in {0..4}; do echo $n ; done +0 +1 +2 +3 +4 +``` + +### 更多循环 + +现在你了解的知识已经足够用来创建自己的循环体了。直到你对循环非常熟悉之前,尽可能的在需要处理的文件的*副本*上进行操作。使用内置的保护措施可以预防损坏自己的数据和制造不可复现的错误,例如偶然将一个文件夹下的所有文件重命名为同一个名字,就可能会导致他们的相互覆盖。 + +更进一步的 `for` 循环话题,请继续阅读。 + +### 不是所有的 shell 都是 Bash + +关键字 `for` 是内置在 Bash shell 中的。许多类似的 shell 会使用和 Bash 同样的关键字和语法,但是也有某些 shell ,比如 [tcsh][7],使用不同的关键字,例如 `foreach`。 + +tcsh 的语法与 Bash 类似,但是它更为严格。例如在下面的例子中,不要在你的终端的第 2、3 行键入 `foreach?` 。它只是提示你仍处在构建循环的过程中。 + +``` +$ foreach f (*) +foreach? file $f +foreach? end +cat.jpg: JPEG image data, EXIF standard 2.2 +design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +otago.jpg: JPEG image data, EXIF standard 2.2 +waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +``` + +在 tcsh 中,`foreach` 和 `end` 都必须单独的在一行中出现。因此你不能像 Bash 或者其他类似的 shell 一样只使用一行命令创建一个 `for` 循环。 + +### for 循环与 find 命令 + +理论上,你可能会用到不支持 `for` 循环的 shell,或者你只是更想使用其他命令的一些特性来完成和循环一样的工作。 + +使用 `find` 命令是另一个实现 `for` 循环功能的途径。这个命令提供了多种方法来定义循环中包含哪些文件的范围以及[并行][8]处理的选项。 + +`find` 命令顾名思义就是帮助你查询存储在硬盘里的文件。它的用法很简单:提供一个你希望它查询的位置的路径,接着 `find` 就会查询这个路径下面的所有文件和文件夹。 + +``` +$ find . +. +./cat.jpg +./design_maori.png +./otago.jpg +./waterfall.png +``` + +你可以通过添加名称的某些部分来过滤搜索结果: + +``` +$ find . -name "*jpg" +./cat.jpg +./otago.jpg +``` + +`find` 命令非常好的地方在于你可以通过 `-exec` 参数标志将它查询到的每一个文件放入循环中。例如,只对存放在你的 `example` 文件夹下的 PNG 图片进行体积压缩操作: + +``` +$ find . -name "*png" -exec convert {} -scale 33% tmp/{} \; +$ ls -m tmp +design_maori.png, waterfall.png +``` + +在 `-exec` 短语中,括号 `{}` 表示的是 `find` 正在处理的条目(换句话说,每一个被找到的以 PNG 结尾的文件)。`-exec` 短语必须使用分号结尾,但是 Bash 中常常也会使用分号。为了解决这个二义性问题,你的 `结束符` 可以使用反斜杠加上一个分号(`\;`),使得 `find` 命令可以知道这个结束符是用来标识自己结束使用的。 + +`find` 命令的操作非常棒,某些情况下它甚至可以表现得更棒。比如说,在一个新的进程中使用同一条命令查找 PNG 文件,你可能就会得到一些错误信息: + +``` +$ find . -name "*png" -exec convert {} -flip -flop tmp/{} \; +convert: unable to open image `tmp/./tmp/design_maori.png': +No such file or directory @ error/blob.c/OpenBlob/2643. +... +``` + +看起来 `find` 不只是定位了当前文件夹(`.`)下的所有 PNG 文件,还包括已经处理并且存储到了 `tmp` 下的文件。在一些情况下,你可能希望 `find` 查询当前文件夹下再加上其子文件夹下的所有文件。`find` 命令是一个功能强大的递归工具,特别体现在处理一些文件结构复杂的情境下(比如用来放置存满了音乐人音乐专辑的文件夹),同时你也可以使用 `-maxdepth` 选项来限制最大的递归深度。 + +只在当前文件夹下查找 PNG 文件(不包括子文件夹): + +``` +$ find . -maxdepth 1 -name "*png" +``` + +上一条命令的最大深度再加 1 就可以查找和处理当前文件夹及下一级子文件夹下面的文件: + +``` +$ find . -maxdepth 2 -name "*png" +``` + +`find` 命令默认是查找每一级文件夹。 + +### 循环的乐趣与收益 + +你使用的循环越多,你就可以越多的省下时间和力气,并且可以应对庞大的任务。虽然你只是一个用户,但是通过使用循环,可以使你的计算机完成困难的任务。 + +你可以并且应该就像使用其他的命令一样使用循环。在你需要重复处理单个或多个文件时,尽可能的使用这个命令。无论如何,这也算是一项需要被严肃对待的编程活动,因此如果你需要在一些文件上完成复杂的任务,你应该多花点时间在规划自己的工作流上面。如果你可以在一份文件上完成你的工作,接下来将操作包装进 `for` 循环里就相对简单了,这里面唯一的“编程”的需要只是理解变量是如何工作的并且进行充分的规划工作将已处理过的文件和未处理过的文件分开。经过一段时间的练习,你就可以从一名 Linux 用户升级成一位知道如何使用循环的 Linux 用户,所以开始让计算机为你工作吧! + +--- + +via: https://opensource.com/article/19/6/how-write-loop-bash + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[chunibyo-wly](https://github.com/chunibyo-wly) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux 中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth/users/goncasousa/users/howtopamm/users/howtopamm/users/seth/users/wavesailor/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U "bash logo on green background" +[2]: http://nextcloud.com +[3]: http://pkgsrc.org +[4]: http://brew.sh +[5]: https://www.macports.org +[6]: mailto:seth@example.com +[7]: https://en.wikipedia.org/wiki/Tcsh +[8]: https://opensource.com/article/18/5/gnu-parallel diff --git a/published/202004/20190612 Why use GraphQL.md b/published/202004/20190612 Why use GraphQL.md new file mode 100644 index 0000000000..b71cb64206 --- /dev/null +++ b/published/202004/20190612 Why use GraphQL.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12075-1.html) +[#]: subject: (Why use GraphQL?) +[#]: via: (https://opensource.com/article/19/6/why-use-graphql) +[#]: author: (Zach Lendon https://opensource.com/users/zachlendon/users/goncasousa/users/patrickhousley) + +为什么使用 GraphQL? +====== + +> 以下是 GraphQL 在标准 REST API 技术上获得发展的原因。 + +[](https://img.linux.net.cn/data/attachment/album/202004/05/105820rdnjrppprjdjddfd.jpg) + +正如我[以前][3]所写,[GraphQL][2] 是一种下一代 API 技术,它正在改变客户端应用程序与后端系统的通信方式以及后端系统的设计方式。 + +由于一开始就从创建它的组织 Facebook 获得了支持,并得到了其他技术巨头(如 Github、Twitter 和 AirBnB)的支持,因此 GraphQL 作为应用程序系统的关键技术的地位似乎是稳固的 —— 无论现在还是将来。 + +### GraphQL 的崛起 + +移动应用程序性能和组织敏捷性重要性的提高为 GraphQL 登上现代企业体系结构的顶端提供了助推器。 + +鉴于 [REST][4] 是一种非常流行的体系结构风格,早已提供了数据交互机制,与 [REST][4] 相比,GraphQL 这项新技术具有哪些优势呢?GraphQL 中的 “QL” 代表着查询语言,而这是一个很好的起点。 + +借助 GraphQL,组织内的不同客户端应用程序可以轻松地仅查询所需数据,这一点超越了其它 REST 方法,并带来了实际应用程序性能的提高。使用传统的 [REST][4] API 端点,客户端应用程序将详询服务器资源,并接受包含了与请求匹配的所有数据的响应。如果来自 [REST][4] API 端点的成功响应返回 35 个字段,那么客户端应用程序就会收到 35 个字段。 + +### 获取的问题 + +传统上,[REST][4] API 没有为客户端应用程序提供简便的方法来仅检索或只更新它们关心的数据。这通常被描述为“过度获取over-fetching”的问题。随着移动应用程序在人们的日常生活中的普遍使用,过度获取问题会给现实世界带来不良后果。移动应用程序发出的每个请求、每一个字节的接受和发送,对终端用户的性能影响越来越大。数据连接速度较慢的用户尤其会受到不太好的 API 设计方案的影响。使用移动应用程序而性能体验不佳的客户更有可能不购买产品或不使用服务。低效的 API 设计只会浪费企业的钱。 + +并非只有“过度获取”是问题,“欠缺获取”同样也是问题。默认情况下,端点只返回客户端实际需要的部分数据,这需要客户端进行额外的调用以满足其数据需求,这就产生了额外的 HTTP 请求。由于过度和欠缺的获取问题及其对客户端应用程序性能的影响,促进有效获取的 API 技术才有机会在市场上引起轰动 —— GraphQL 大胆地介入并填补了这一空白。 + +### REST 的应对 + +[REST][4] API 设计师不甘心不战而退,他们试图通过以下几种方式来应对移动应用程序性能问题: + +* “包含”和“排除”查询参数,允许客户端应用程序通过可能较长的查询格式来指定所需的字段。 +* “复合”服务,将多个端点组合在一起,以使客户端应用程序在其发出的请求数量和接收到的数据方面更高效。 +   +尽管这些模式是 [REST][4] API 社区为解决移动客户端所面临的挑战而做出的英勇尝试,但它们在以下几个关键方面仍存在不足: + +* 包含和排除查询键/值对很快就会变得混乱,特别是对于需要用嵌套“点表示法”语法(或类似方法)以对目标数据进行包含和排除的深层对象图而言,更是如此。此外,在此模型中调试查询字符串的问题通常需要手动分解 URL。 +* 包含和排除查询的服务器的实现往往是自定义的,因为基于服务器的应用程序没有标准的方式来处理包含和排除查询的使用,就像没有定义包含和排除查询的标准方式一样。 +* 复合服务的兴起形成了更加紧密耦合的后端和前端系统,这就需要加强协调以交付项目,并且将曾经的敏捷项目转回瀑布式开发。这种协调和耦合还有一个痛苦的副作用,那就是减宦了组织的敏捷性。此外,顾名思义,组合服务不是 RESTful。 +   +### GraphQL 的起源 + +对于 Facebook 来说,从其 2011-2012 年基于 HTML5 版本的旗舰移动应用程序中感受到的痛点和体验,才造就了 GraphQL。Facebook 工程师意识到提高性能至关重要,因此意识到他们需要一种新的 API 设计来确保最佳性能。可能考虑到上述 [REST][4] 的局限性,并且需要支持许多 API 客户端的不同需求,因此人们可以理解是什么导致其共同创建者 Lee Byron 和 Dan Schaeffer(那时尚是 Facebook 员工)创建了后来被称之为 GraphQL 的技术的早期种子。 + +通过 GraphQL 查询语言,客户端(通常是单个 GraphQL 端点)应用程序通常可以显著减少所需的网络调用数量,并确保仅检索所需的数据。在许多方面,这可以追溯到早期的 Web 编程模型,在该模型中,客户端应用程序代码会直接查询后端系统 —— 比如说,有些人可能还记得 10 到 15 年前在 JSP 上用 JSTL 编写 SQL 查询的情形吧! + +现在最大的区别是使用 GraphQL,我们有了一个跨多种客户端和服务器语言和库实现的规范。借助 GraphQL 这样一种 API 技术,我们通过引入 GraphQL 应用程序中间层来解耦后端和前端应用程序系统,该层提供了一种机制,以与组织的业务领域相一致的方式来访问组织数据。 + +除了解决软件工程团队遇到的技术挑战之外,GraphQL 还促进了组织敏捷性的提高,特别是在企业中。启用 GraphQL 的组织敏捷性通常归因于以下因素: + + * GraphQL API 设计人员和开发人员无需在客户端需要一个或多个新字段时创建新的端点,而是能够将这些字段包含在现有的图实现中,从而以较少的开发工作量和跨应用程序系统的较少更改的方式展示出新功能。 + * 通过鼓励 API 设计团队将更多的精力放在定义对象图上,而不是在专注于客户端应用程序交付上,前端和后端软件团队为客户交付解决方案的速度日益解耦。 +   +### 采纳之前的注意事项 + +尽管 GraphQL 具有引人注目的优势,但 GraphQL 并非没有实施挑战。一些例子包括: + +* 为 [REST][4] API 建立的缓存机制更加成熟。 +* 使用 [REST][4] 来构建 API 的模式更加完善。 +* 尽管工程师可能更喜欢 GraphQL 等新技术,但与 GraphQL 相比,市场上的人才库更多是从事于构建基于 [REST][4] 的解决方案。 + +### 结论 + +通过同时提高性能和组织敏捷性,GraphQL 在过去几年中被企业采纳的数量激增。但是,与 API 设计的 RESTful 生态系统相比,它确实还需要更成熟一些。 + +GraphQL 的一大优点是,它并不是作为替代 API 解决方案的批发替代品而设计的。相反,GraphQL 可以用来补充或增强现有的 API。因此,鼓励企业探索在 GraphQL 对其最有意义的地方逐步采用 GraphQL —— 在他们发现它对应用程序性能和组织敏捷性具有最大的积极影响的地方。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/why-use-graphql + +作者:[Zach Lendon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/zachlendon/users/goncasousa/users/patrickhousley +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_graph_stats_blue.png?itok=OKCc_60D +[2]: https://graphql.org/ +[3]: https://linux.cn/article-12070-1.html +[4]: https://en.wikipedia.org/wiki/Representational_state_transfer diff --git a/published/202004/20190712 What is Silverblue.md b/published/202004/20190712 What is Silverblue.md new file mode 100644 index 0000000000..7437135b98 --- /dev/null +++ b/published/202004/20190712 What is Silverblue.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12153-1.html) +[#]: subject: (What is Silverblue?) +[#]: via: (https://fedoramagazine.org/what-is-silverblue/) +[#]: author: (Tomáš Popela https://fedoramagazine.org/author/tpopela/) + +Silverblue 是什么? +====== + +![][1] + +Fedora Silverblue 在 Fedora 世界内外越来越受欢迎。因此,根据社区的反馈,以下是关于这个项目的一些有趣问题的答案。如果你有任何其他与 Silverblue 相关的问题,请在评论区留言,我们会在未来的文章中回答。 + +### Silverblue 是什么? + +Silverblue 是新一代桌面操作系统的代号,之前被称为 Atomic Workstation。该操作系统是通过利用 [rpm-ostree 项目][2]创建的映像来交付的。这种系统的主要优点是速度、安全性、原子更新和不变性。 + +### “Silverblue” 到底是什么意思? + +“Team Silverblue” 或简称 “Silverblue”,没有任何隐藏的含义。该项目以前被称为 Atomic Workstation,大约两个月后更名时选中了这个名字。在这个过程中,审查过 150 多个单词或单词组合。最终选择了 “Silverblue”,因为它有一个可用的域名以及社交网络账号。人们可以把它看成是 Fedora 的蓝色品牌的一个新的品牌形象,可以用在诸如“加油,Silverblue 团队!”或“想加入该团队,改进 Silverblue 吗?”这样的短语中。 + +### 何谓 ostree? + +[OSTree(或 libostree)是一个项目][3],它结合了一个类似 Git 的提交和下载可引导文件系统树的模型,以及用于部署它们和管理引导加载程序配置的层。OSTree 由 rpm-ostree 使用,这是 Silverblue 使用的一个基于包/镜像的混合系统。它原子化地复制了一个基础操作系统,并允许用户在需要时在基础操作系统之上“层叠”传统的 RPM。 + +### 为何使用 Silverblue? + +因为它可以让你专注于你的工作,而不是你正在运行的操作系统。因为系统的更新是原子式的,所以它更稳健。你唯一需要做的事情就是重新启动到新的镜像中。此外,如果当前启动的镜像有什么问题,你可以很容易地重启/回滚到之前可以工作的镜像,如果有的话。如果没有,你可以使用 `ostree` 命令下载并启动过去生成的任何其他镜像。 + +另一个好处是可以在不同的分支(或者用旧的语境说就是不同的 Fedora 风味版本)之间轻松切换。你可以轻松地尝试 [Rawhide][4] 或 [updates-testing][5] 分支,然后返回到包含当前稳定版本的分支。另外,如果你想尝试一些新奇的东西,也可以考虑试试 Silverblue。 + +### 不可变的操作系统有什么好处? + +其中一个主要的好处是安全。基础操作系统是以只读的形式挂载的,因此不能被恶意软件修改。唯一可以改变系统的方法是通过 `rpm-ostree` 实用程序。 + +另一个好处是健壮性。普通用户几乎不可能在不小心或无意中删除了一些系统库后,导致操作系统回到不启动或无法正常工作的状态。试着想想你过去的这些经历,就可以明白 Silverblue 可以如何帮助你。 + +### 如何在 Silverblue 中管理应用程序和包? + +对于图形化用户界面的应用程序,建议使用 [Flatpak][6] —— 如果应用程序是以 Flatpak 的形式提供的话。用户可以选择来自 Fedora 的 Flatpak,和从 Fedora 包及 Fedora 自己的基础架构中构建的 Flatpak,或者是目前有更广泛的交付品的 Flathub。用户可以通过已经支持 Fedora Silverblue 的 GNOME “软件”轻松安装它们。 + +用户首先发现的一件事就是操作系统中没有预装 `dnf`。主要原因是它不能在 Silverblue 上工作 —— 它的部分功能被 `rpm-ostree` 命令所取代。用户可以通过使用 `rpm-ostree install PACKAGE` 来层叠传统的软件包。但只有在没有其他方法的情况下,才应该使用这种方式。这是因为从存储库中提取新的系统镜像时,每次更改系统镜像时都必须重新构建系统镜像,以容纳层叠的包或从基础操作系统中删除及替换为其他版本的包。 + +Fedora Silverblue 自带的默认 GUI 应用程序集是基础操作系统的一部分。团队正在努力将它们移植到 Flatpak 上,这样它们就可以通过这种方式分发。其中一个好处是,基础操作系统将变得更小,更容易维护和测试,用户可以更容易修改他们的默认安装环境。如果你想看一下它是怎么做的,或者有什么帮助,可以看看官方的[文档][7]。 + +### 什么是 Toolbox? + +[Toolbox][8] 是一个让普通用户可以轻松使用容器的项目。它通过使用 podman 的无 root 容器环境来实现。Toolbox 可以让你在常规的 Fedora 环境中轻松、快速地创建一个容器,你可以在这个容器上折腾或开发,而与你的操作系统分离。 + +### Silverblue 有路线图吗? + +形式上没有,因为我们正在关注在测试过程中发现的问题和社区的反馈。我们目前正在使用 Fedora 的 [Taiga][9] 来进行规划。 + +### Silverblue 的发布周期是多少? + +它和普通的 Fedora Workstation 是一样的。每 6 个月发布一次新版本,支持期为 13 个月。团队计划每两周(或更长时间)发布一次更新,而不是像现在这样每天发布一次。这样一来,更新可以在发送给其他用户之前,由 QA 和社区志愿者进行更彻底的测试。 + +### 不可变操作系统的未来前景如何? + +从我们的角度来看,桌面的未来会走向到不可变的操作系统。这对用户来说是最安全的,Android、ChromeOS、ChromeOS、最近的 macOS Catalina 全都在底层采用了这种方式。而对于 Linux 桌面来说,一些第三方软件期望写到操作系统的问题还是存在的。HP 打印机驱动程序就是一个很好的例子。 + +另一个问题是系统中的部分软件如何分发和安装。字体就是一个很好的例子。目前在 Fedora 中,它们是以 RPM 包的形式分发的。如果你想使用它们,你必须层叠它们,然后重新启动到新创建的包含它们的镜像中。 + +### 标准版 Workstation 的前景如何? + +Silverblue 有可能会取代普通的 Workstation 版本。但 Silverblue 要提供与 Workstation 版本相同的功能和用户体验还有很长的路要走。在此期间,这两款桌面产品将同时推出。 + +### Atomic Workstation 或 Fedora CoreOS 与这些有什么关系? + +Atomic Workstation 是在更名为 Fedora Silverblue 之前的项目名称。 + +Fedora CoreOS 是一个不同但相似的项目。它与 Silverblue 共享一些基本技术,如 `rpm-ostree`、`toolbox` 等。尽管如此,CoreOS 是一个更简约、专注于容器、自动更新的操作系统。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/what-is-silverblue/ + +作者:[Tomáš Popela][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/tpopela/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/what-is-fedora-silverblue-816x345.jpg +[2]: https://rpm-ostree.readthedocs.io/en/latest/ +[3]: https://ostree.readthedocs.io/en/latest/ +[4]: https://fedoraproject.org/wiki/Releases/Rawhide +[5]: https://fedoraproject.org/wiki/QA:Updates_Testing +[6]: https://flatpak.org/ +[7]: https://docs.fedoraproject.org/en-US/flatpak/tutorial/ +[8]: https://github.com/debarshiray/toolbox +[9]: https://teams.fedoraproject.org/project/silverblue/ diff --git a/published/202004/20190814 9 open source cloud native projects to consider.md b/published/202004/20190814 9 open source cloud native projects to consider.md new file mode 100644 index 0000000000..0c2ffabd03 --- /dev/null +++ b/published/202004/20190814 9 open source cloud native projects to consider.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12135-1.html) +[#]: subject: (9 open source cloud native projects to consider) +[#]: via: (https://opensource.com/article/19/8/cloud-native-projects) +[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo) + +值得关注的 9 个开源云原生项目 +====== + +> 工作中用了容器?熟悉这些出自云原生计算基金会的项目吗? + +![](https://img.linux.net.cn/data/attachment/album/202004/21/222735oa1wib1wgypoiwpp.jpg) + +随着用容器来开发应用的实践变得流行,[云原生应用][2]也在增长。云原生应用的定义为: + +> “云原生技术用于开发使用打包在容器中的服务所构建的应用程序,以微服务的形式部署,并通过敏捷的 DevOps 流程和持续交付工作流在弹性基础设施上进行管理。” + +这个定义提到了构成云原生应用的不可或缺的四个元素: + + 1. 容器 + 2. 微服务 + 3. DevOps + 4. 持续集成和持续交付 (CI/CD) + +尽管这些技术各有各自独特的历史,但它们之间却相辅相成,在短时间内实现了云原生应用和工具的惊人的指数级增长。这个[云原生计算基金会(CNCF)][4]信息图呈现了当今云原生应用生态的规模和广度。 + +![Cloud-Native Computing Foundation applications ecosystem][5] + +*云原生计算基金会项目* + +我想说,瞧着吧!这仅仅是一个开始。正如 NodeJS 的出现引发了无数的 JavaScript 工具的爆炸式增长一样,容器技术的普及也推动了云原生应用的指数增长。 + +好消息是,有几个组织负责监管并将这些技术连接在一起。 其中之一是 [开放容器倡议][6]Open Containers Initiative(OCI),它是一个轻量级的、开放的治理机构(或项目),“它是在 Linux 基金会的支持下形成的,其明确目的是创建开放的行业标准的容器格式和运行时。” 另一个是 CNCF,它是“一个致力于使云原生计算普及和可持续发展的开源软件基金会”。 + +通常除了围绕云原生应用建立社区之外,CNCF 还帮助项目围绕其云原生应用建立结构化管理。CNCF 创建了成熟等级的概念(沙箱级、孵化级或毕业级),分别与下图中的“创新者”、“早期采用者”和“早期大量应用”相对应。 + +![CNCF project maturity levels][7] + +*CNCF 项目成熟等级* + +CNCF 为每个成熟等级制定了详细的[标准][8](为方便读者而列在下面)。获得技术监督委员会(TOC)三分之二的同意才能转为孵化或毕业级。 + +**沙箱级** + +> 要想成为沙箱级,一个项目必须至少有两个 TOC 赞助商。 有关详细过程,请参见《CNCF 沙箱指南 v1.0》。 + +**孵化级** + +> 注:孵化级是我们期望对项目进行全面的尽职调查的起点。 +> +> 要进入孵化级,项目除了满足沙箱级的要求之外还要满足: +> +> * 证明至少有三个独立的最终用户已成功将其用于生产,且 TOC 判断这些最终用户具有足够的质量和范围。 +> * 提交者的数量要合理。提交者定义为具有提交权的人,即可以接受部分或全部项目贡献的人。 +> * 显示出有大量持续提交和合并贡献。 +> * 由于这些指标可能会根据项目的类型、范围和大小而有很大差异,所以 TOC 有权决定是否满足这些标准的活动水平。 + +**毕业级** + +> 要从沙箱或孵化级毕业,或者要使一个新项目作为已毕业项目加入,项目除了必须满足孵化级的标准外还要满足: +> +> * 至少有两个来自组织的提交者。 +> * 已获得并保持了“核心基础设施计划最佳实践徽章”。 +> * 已完成独立的第三方安全审核,并发布了具有与以下示例类似的范围和质量的结果(包括已解决的关键漏洞):,并在毕业之前需要解决所有关键的漏洞。 +> * 采用《CNCF 行为准则》。 +> * 明确规定项目治理和提交流程。最好将其列在 `GOVERNANCE.md` 文件中,并引用显示当前提交者和荣誉提交者的 `OWNERS.md` 文件。 +> * 至少有一个主仓的项目采用者的公开列表(例如,`ADOPTERS.md` 或项目网站上的徽标)。 +> * 获得 TOC 的绝大多数票,进入毕业阶段。如果项目能够表现出足够的成熟度,则可以尝试直接从沙箱级过渡到毕业级。项目可以无限期保持孵化状态,但是通常预计它们会在两年内毕业。 + +### 值得关注的 9 个项目 + +本文不可能涵盖所有的 CNCF 项目,我将介绍最有趣的 9 个毕业和孵化的开源项目。 + +名称|授权类型|简要描述 +---|---|--- +[Kubernetes][9] | Apache 2.0 | 容器编排平台 +[Prometheus][10] | Apache 2.0 | 系统和服务监控工具 +[Envoy][11] | Apache 2.0 | 边缘和服务代理 +[rkt][12] | Apache 2.0 | Pod 原生的容器引擎 +[Jaeger][13] | Apache 2.0 | 分布式跟踪系统 +[Linkerd][14] | Apache 2.0 | 透明服务网格 +[Helm][15] | Apache 2.0 | Kubernetes 包管理器 +[Etcd][16] | Apache 2.0 | 分布式键值存储 +[CRI-O][17] | Apache 2.0 | 专门用于 Kubernetes 的轻量级运行时环境 + +我也创建了视频材料来介绍这些项目。 + +- [video](https://youtu.be/3cDxYO2GK4w) + +### 毕业项目 + +毕业的项目被认为是成熟的,已被许多组织采用的,并且严格遵守了 CNCF 的准则。以下是三个最受欢迎的开源 CNCF 毕业项目。(请注意,其中一些描述来源于项目的网站并被做了改编。) + +#### Kubernetes(希腊语“舵手”) + +Kubernetes! 说起云原生应用,怎么能不提 Kubernetes 呢? Google 发明的 Kubernetes 无疑是最著名的基于容器的应用程序的容器编排平台,而且它还是一个开源工具。 + +什么是容器编排平台?通常,一个容器引擎本身可以管理几个容器。但是,当你谈论数千个容器和数百个服务时,管理这些容器变得非常复杂。这就是容器编排引擎的用武之地。容器编排引擎通过自动化容器的部署、管理、网络和可用性来帮助管理大量的容器。 + +Docker Swarm 和 Mesosphere Marathon 也是容器编排引擎,但是可以肯定地说,Kubernetes 已经赢得了这场比赛(至少现在是这样)。Kubernetes 还催生了像 [OKD][18] 这样的容器即服务(CaaS)平台,它是 Kubernetes 的 Origin 社区发行版,并成了 [Red Hat OpenShift][19] 的一部分。 + +想开始学习,请访问 [Kubernetes GitHub 仓库][9],并从 [Kubernetes 文档][20]页面访问其文档和学习资源。 + +#### Prometheus(普罗米修斯) + +Prometheus 是 2012 年在 SoundCloud 上构建的一个开源的系统监控和告警工具。之后,许多公司和组织都采用了 Prometheus,并且该项目拥有非常活跃的开发者和用户群体。现在,它已经成为一个独立的开源项目,独立于公司之外进行维护。 + +![Prometheus’ architecture][21] + +*Prometheus 的架构* + +理解 Prometheus 的最简单方法是可视化一个生产系统,该系统需要 24(小时)x 365(天)都可以正常运行。没有哪个系统是完美的,也有减少故障的技术(称为容错系统),但是,如果出现问题,最重要的是尽快发现问题。这就是像 Prometheus 这样的监控工具的用武之地。Prometheus 不仅仅是一个容器监控工具,但它在云原生应用公司中最受欢迎。此外,其他开源监视工具,包括 [Grafana][22],都借助了 Prometheus。 + +开始使用 Prometheus 的最佳方法是下载其 [GitHub 仓库][10]。在本地运行 Prometheus 很容易,但是你需要安装一个容器引擎。你可以在 [Prometheus 网站][23]上查看详细的文档。 + +#### Envoy(使者) + +Envoy(或 Envoy 代理)是专为云原生应用设计的开源的边缘代理和服务代理。由 Lyft 创建的 Envoy 是为单一服务和应用而设计的高性能的 C++ 开发的分布式代理,同时也是为由大量微服务组成的服务网格架构而设计的通信总线和通用数据平面。Envoy 建立在 Nginx、HAProxy、硬件负载均衡器和云负载均衡器等解决方案的基础上,Envoy 与每个应用相伴(并行)运行,并通过提供平台无关的方式提供通用特性来抽象网络。 + +当基础设施中的所有服务流量都经过 Envoy 网格时,很容易就可以通过一致的可观测性来可视化问题域,调整整体性能,并在单个位置添加基础功能。基本上,Envoy 代理是一个可帮助组织为生产环境构建容错系统的服务网格工具。 + +服务网格应用有很多替代方案,例如 Uber 的 [Linkerd][24](下面会讨论)和 [Istio][25]。Istio 通过将其部署为 [Sidecar][26] 并利用了 [Mixer][27] 的配置模型,实现了对 Envoy 的扩展。Envoy 的显著特性有: + +* 包括所有的“入场筹码table stakes(LCTT 译注:引申为基础必备特性)”特性(与 Istio 这样的控制平面组合时) +* 带载运行时 99% 数据可达到低延时 +* 可以作为核心的 L3/L4 过滤器,提供了开箱即用的 L7 过滤器 +* 支持 gRPC 和 HTTP/2(上行/下行) +* 由 API 驱动,并支持动态配置和热重载 +* 重点关注指标收集、跟踪和整体可监测性 + +要想了解 Envoy,证实其能力并实现其全部优势,需要丰富的生产级环境运行的经验。你可以在其[详细文档][28]或访问其 [GitHub][11] 仓库了解更多信息。 + +### 孵化项目 + +下面是六个最流行的开源的 CNCF 孵化项目。 + +#### rkt(火箭) + +rkt, 读作“rocket”,是一个 Pod 原生的容器引擎。它有一个命令行接口用来在 Linux 上运行容器。从某种意义上讲,它和其他容器如 [Podman][29]、Docker 和 CRI-O 相似。 + +rkt 最初是由 CoreOS (后来被 Red Hat 收购)开发的,你可以在其网站上找到详细的[文档][30],以及在 [GitHub][12] 上访问其源代码。 + +#### Jaeger(贼鸥) + +Jaeger 是一个开源的端到端的分布式追踪系统,适用于云端应用。在某种程度上,它是像 Prometheus 这样的监控解决方案。但它有所不同,因为其使用场景有所扩展: + +* 分布式事务监控 +* 性能和延时优化 +* 根因分析 +* 服务依赖性分析 +* 分布式上下文传播 + +Jaeger 是一项 Uber 打造的开源技术。你可以在其网站上找到[详细文档][31],以及在 [GitHub][13] 上找到其源码。 + +#### Linkerd + +像创建 Envoy 代理的 Lyft 一样,Uber 开发了 Linkerd 开源解决方案用于生产级的服务维护。在某些方面,Linkerd 就像 Envoy 一样,因为两者都是服务网格工具,旨在提供平台级的可观测性、可靠性和安全性,而无需进行配置或代码更改。 + +但是,两者之间存在一些细微的差异。 尽管 Envoy 和 Linkerd 充当代理并可以通过所连接的服务进行上报,但是 Envoy 并不像 Linkerd 那样被设计为 Kubernetes Ingress 控制器。Linkerd 的显著特点包括: + +* 支持多种平台(Docker、Kubernetes、DC/OS、Amazon ECS 或任何独立的机器) +* 内置服务发现抽象,可以将多个系统联合在一起 +* 支持 gRPC、HTTP/2 和 HTTP/1.x请 求和所有的 TCP 流量 + +你可以在 [Linkerd 网站][32]上阅读有关它的更多信息,并在 [GitHub][14] 上访问其源码。 + +#### Helm(舵轮) + +Helm 基本上就是 Kubernetes 的包管理器。如果你使用过 Apache Maven、Maven Nexus 或类似的服务,你就会理解 Helm 的作用。Helm 可帮助你管理 Kubernetes 应用程序。它使用“Helm Chart”来定义、安装和升级最复杂的 Kubernetes 应用程序。Helm 并不是实现此功能的唯一方法;另一个流行的概念是 [Kubernetes Operators][33],它被 Red Hat OpenShift 4 所使用。 + +你可以按照其文档中的[快速开始指南][34]或 [GitHub 指南][15]来试用 Helm。 + +#### Etcd + +Etcd 是一个分布式的、可靠的键值存储,用于存储分布式系统中最关键的数据。其主要特性有: + +* 定义明确的、面向用户的 API(gRPC) +* 自动 TLS,可选的客户端证书验证 +* 速度(可达每秒 10,000 次写入) +* 可靠性(使用 Raft 实现分布式) + +Etcd 是 Kubernetes 和许多其他技术的默认的内置数据存储方案。也就是说,它很少独立运行或作为单独的服务运行;相反,它以集成到 Kubernetes、OKD/OpenShift 或其他服务中的形式来运作。还有一个 [etcd Operator][35] 可以用来管理其生命周期并解锁其 API 管理功能: + +你可以在 [etcd 文档][36]中了解更多信息,并在 [GitHub][16]上访问其源码。 + +#### CRI-O + +CRI-O 是 Kubernetes 运行时接口的 OCI 兼容实现。CRI-O 用于各种功能,包括: + +* 使用 runc(或遵从 OCI 运行时规范的任何实现)和 OCI 运行时工具运行 +* 使用容器/镜像进行镜像管理 +* 使用容器/存储来存储和管理镜像层 +* 通过容器网络接口(CNI)来提供网络支持 + +CRI-O 提供了大量的[文档][37],包括指南、教程、文章,甚至播客,你还可以访问其 [GitHub 页面][17]。 + +我错过了其他有趣且开源的云原生项目吗?请在评论中提醒我。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/cloud-native-projects + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://opensource.com/article/18/7/what-are-cloud-native-apps +[3]: https://thenewstack.io/10-key-attributes-of-cloud-native-applications/ +[4]: https://www.cncf.io +[5]: https://opensource.com/sites/default/files/uploads/cncf_1.jpg (Cloud-Native Computing Foundation applications ecosystem) +[6]: https://www.opencontainers.org +[7]: https://opensource.com/sites/default/files/uploads/cncf_2.jpg (CNCF project maturity levels) +[8]: https://github.com/cncf/toc/blob/master/process/graduation_criteria.adoc +[9]: https://github.com/kubernetes/kubernetes +[10]: https://github.com/prometheus/prometheus +[11]: https://github.com/envoyproxy/envoy +[12]: https://github.com/rkt/rkt +[13]: https://github.com/jaegertracing/jaeger +[14]: https://github.com/linkerd/linkerd +[15]: https://github.com/helm/helm +[16]: https://github.com/etcd-io/etcd +[17]: https://github.com/cri-o/cri-o +[18]: https://www.okd.io/ +[19]: https://www.openshift.com +[20]: https://kubernetes.io/docs/home +[21]: https://opensource.com/sites/default/files/uploads/cncf_3.jpg (Prometheus’ architecture) +[22]: https://grafana.com +[23]: https://prometheus.io/docs/introduction/overview +[24]: https://linkerd.io/ +[25]: https://istio.io/ +[26]: https://istio.io/docs/reference/config/networking/v1alpha3/sidecar +[27]: https://istio.io/docs/reference/config/policy-and-telemetry +[28]: https://www.envoyproxy.io/docs/envoy/latest +[29]: https://podman.io +[30]: https://coreos.com/rkt/docs/latest +[31]: https://www.jaegertracing.io/docs/1.13 +[32]: https://linkerd.io/2/overview +[33]: https://coreos.com/operators +[34]: https://helm.sh/docs +[35]: https://github.com/coreos/etcd-operator +[36]: https://etcd.io/docs/v3.3.12 +[37]: https://github.com/cri-o/cri-o/blob/master/awesome.md diff --git a/published/202004/20190822 How the Linux desktop has grown.md b/published/202004/20190822 How the Linux desktop has grown.md new file mode 100644 index 0000000000..0bfb102dd6 --- /dev/null +++ b/published/202004/20190822 How the Linux desktop has grown.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12068-1.html) +[#]: subject: (How the Linux desktop has grown) +[#]: via: (https://opensource.com/article/19/8/how-linux-desktop-grown) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Linux 桌面史话 +====== + +> 自 20 世纪 90 年代初以来,Linux 桌面已从一个简单的窗口管理器发展为一个完整的桌面。让我们一起来回顾一下 Linux 桌面的历史。 + +![](https://img.linux.net.cn/data/attachment/album/202004/03/142430kei55auvvv254aka.jpg) + +我第一次安装 Linux 是在 1993 年。那时,安装这种操作系统没有太多的选择。早期,许多人只是从别人那里复制一个运行中的镜像。然后有人有了一个很好的想法,创建一个 Linux 的“发行版”,让你可以自定义要安装的软件。这就是 Softlanding Linux 系统(SLS),也是我首次接触 Linux。 + +当时我的 386 PC 虽然内存不多,但已经足够了。SLS 1.03 需要 2MB 的内存才能运行,如果要编译程序,则需要 4MB 的内存。如果要运行 X 窗口系统,则需要多达 8MB 的内存!而我的电脑正好有足够的内存来运行 X 窗口系统。 + +因为我是在命令行中成长的,所以图形化的用户界面对我来说并不重要,但它确实很方便,我可以在不同的窗口中运行应用程序,并在任务间轻松切换。 + +从我第一次尝试 Linux 开始,我就迷上了它。从那以后,我一直在台式机上使用 Linux。和许多人一样,我也曾有一段时间以双引导配置运行 Linux,这样我就可以跳回到 MS-DOS 和 Windows 来运行某些程序。直到 1998 年,我终于冒了个险,全面投身于 Linux 之中。 + +在过去的 26 年中,我看着 Linux 桌面逐渐成熟。在这段时间里,我还尝试了各种有趣的桌面环境,下面我来分享一下 Linux 桌面的历史。 + +### X 和窗口管理器 + +Linux 上的第一个“桌面”还不是桌面。相反,它们是运行在 X 窗口系统上的“窗口管理器window manager”(WM)。X 提供了图形用户界面的基本构件,比如在屏幕上创建窗口,并提供键盘和鼠标输入。就其本身而言,X 的用处并不大。为了使 X 图形环境变得有用,你需要一种方法来管理会话中的所有窗口。这就出现了窗口管理器window manager。运行 xterm 或 xclock 之类的 X 程序就会在一个窗口中打开该程序。窗口管理器可以跟踪窗口并进行基本的内部管理,例如让你可以来回移动窗口并将其最小化。其余的事情取决于你自己。你可以通过将程序名列在 `~/.xinitrc` 文件中以在 X 开始时启动这些程序,但是通常,你会从 xterm 中运行新程序。 + +在 1993 年,最常见的窗口管理器是 TWM,它的历史可以追溯到 1988 年。TWM 相当简单,仅仅提供了基本的窗口管理功能。 + +![TWM on SLS 1.05][2] + +*SLS 1.05 上的 TWM,显示了 xterm、xclock 和 Emacs 编辑器* + +另一个早期的窗口管理器是 OpenLook 虚拟窗口管理器(OLVWM)。OpenLook 是 Sun 微系统公司在 20世纪 80 年代开发的图形用户界面,后来被移植到其它 Unix 平台。作为一个*虚拟*窗口管理器,OLVWM 支持多个工作区。 + +![OLVWM on SLS 1.05][3] + +*SLS 1.05 上的 OLVWM,显示了 xterm 和虚拟工作区选择器* + +当 Linux 开始流行起来的时候,没多久就有人创建出性能更流畅、界面更好的新窗口管理器。这些新的窗口管理器中首先出现的是虚拟窗口管理器 FVWM。FVWM 比 TWM 或 OLVWM 更具现代感。但是,我们仍然没有桌面。 + +![FVWM on SLS 1.05][4] + +*SLS 1.05 上的 FVWM,显示了 xterm 和文件管理器* + +以现代的眼光来看,TWM 和 FVWM 可能看起来很朴素。但重要的是要想想当时其它图形环境是什么样子。 Windows 当时的版本看起来也相当简单。Windows 版本 1 到版本 3 使用了一个称为“程序管理器”的普通启动器。 + +![Windows 3.11][5] + +*Windows 3.11,显示程序管理器和记事本编辑器* + +1995 年 8 月,微软发布了 Windows 95,改变了现代 PC 桌面的格局。当然,我当时对此印象很深刻。我曾觉得 Windows 3.x 笨拙而丑陋,但 Windows 95 却流畅而漂亮。更重要的是,我们现在将 Windows 95 视为“**桌面**”。新的“桌面”隐喻是一个巨大的进步。你可以在桌面上放置图标——事实上,Windows 95 提供了两个默认的桌面图标,分别是“我的电脑”(用于打开文件管理器)和“回收站”(用于放置以后要删除的文件)。 + +但是,更重要的是,Windows 95 桌面的意味着*整合*。程序管理器不见了,取而代之的是屏幕底部的任务栏,可让你使用更简单的“开始”菜单启动新程序。任务栏是多功能的,还通过一系列的按钮显示了你正在运行的程序,而托盘显示了时间、扬声器音量和其它简单的控件。你可以在这个新桌面上右键单击任何对象, Windows 95 会为你提供一个上下文相关的菜单,其中又你可以执行的操作。 + +![Windows 95][6] + +*Windows 95,显示了记事本编辑器* + +与以前版本的 Windows 甚至其它 Linux 窗口管理器相比,Windows 95 的界面更加流畅并且易于使用。值得一提的是,Linux 开发人员创建了一个模仿 Windows 95 界面的 FVWM 的新版本。名为 FVWM95 的新窗口管理器仍然不是桌面,但它看起来非常漂亮。新的任务栏让你可以使用“开始”菜单启动新的 X 程序。任务栏还可以使用类似于 Windows 95 的按钮显示了正在运行的程序。 + +![FVWM95 on Red Hat Linux 5.2][7] + +*在 Red Hat Linux 5.2 上的 FVWM95,显示了 xterm 和一个带有 xterm 图标、文件管理器和其他程序的快速访问程序启动器* + +虽然 FVWM95 和其他窗口管理器都在改进,但核心问题仍然存在:Linux 并没有真正的桌面。它具有一堆窗口管理器,仅此而已。使用图形用户界面的 Linux 应用程序(基本上意味着它们是 X 应用程序)看起来形态各异且工作方式也不同。除了 X 窗口系统提供的简单的纯文本复制/粘贴功能外,你不能从一个应用程序复制和粘贴到另一个应用程序里。Linux 真正需要的是在其图形用户界面中进行彻底的重新打造,以创建它的第一个桌面。 + +### Linux 桌面之初啼 + +在 1996 年,Matthias Ettrich 有感于 X 之下 Linux 应用程序体验不一致的困扰。他想使找个更易于使用的图形环境,而且更重要的是,他想让所有东西都“集成”在一起,就像真正的桌面一样。 + +Matthias 开始了K 桌面环境K Desktop Environment(KDE)的工作。那个 K 代表着 “Kool”(LCTT 译注:即 Cool)。但是 KDE 这个名字也意味着可以类似通用桌面环境Common Desktop Environment(CDE)的做法,而 CDE 是“大 Unix”世界的标准。尽管到了 1996 年,CDE 看起来已经有点过时了。CDE 基于 Motif 部件集,这也是 FVWM 所模仿的设计。KDE 1.0 于 1998 年 7 月完成,与 FVWM95 等普通窗口管理器相比,它有了明显改进。 + +![KDE 1.0][8] + +*K 桌面环境(KDE)版本 1.0。图片来源:Paul Brown / KDE* + +KDE 是 Linux 向前迈出的一大步。最终,Linux 有了一个真正的桌面,集成了应用程序和更多现代的桌面图标。KDE 的设计与 Windows 95 并无不同。屏幕底部有一个任务栏,它提供了相当于 Windows 95 的“开始”菜单以及一些应用程序的快捷键。KDE 还支持虚拟桌面,这些桌面被巧妙地标记为 “One”、“ Two”、“Three” 和 “Four”。正在运行的应用程序通过位于屏幕顶部单独的任务栏的按钮表示。 + +但并不是每个人都对 KDE 感到满意。为了将 GUI 从系统中抽象出来,KDE 使用了 Trolltech 的 Qt 工具套件库。不幸的是,Qt 并不是以自由软件的许可证进行分发的。Trolltech 允许 Qt 在自由软件应用程序中免费使用,但在商业或专有应用程序中要收取使用费。而且这种二分法与自由软件不符。这给 Linux 发行版带来了问题:它们应该包括 KDE 吗?还是默认使用 FVWM 这样老式但属于自由软件的图形用户界面? + +面对这种情况,Miguel de Icaza 和 Federico Mena 于 1997 年开始开发新的 Linux 桌面上。这个新项目被称为 GNOME,即GNU 网络对象模型环境GNU Network Object Model Environment的缩写。GNOME 旨在成为一个完全自由的软件,并使用了一个不同的工具套件库 —— 来自 GIMP 图像编辑器的 GTK。GTK 从字面上的意思 GIMP 工具套件GIMP Tool Kit。当 GNOME 1.0 终于在 1999 年发布时,Linux 又多了一个现代化的桌面环境。 + +![GNOME 1.0][9] + +*GNOME 1.0 版。图片来源:GNOME 文档项目* + +有两个 Linux 桌面环境固然很棒,但“KDE 与 GNOME”之争仍持续了一段时间。到了 1999 年,Trolltech 以新的公共许可证 Q 公共许可证Q Public License(QPL)重新发布了 Qt 库。但是,新许可证有其自身的包袱—-QPL 仅适用于 Qt 在开源软件项目中的使用,而不适用于商业项目。因此,自由软件基金会Free Software Foundation(FSF)认为 QPL 与 GNU 通用公共许可证GNU General Public License(GNU GPL)[不兼容][10]。这个许可证问题一直持续到 2000 年 Trolltech 在 GNU GPL v2 下重新发布 Qt 库。 + +### 随着时间的发展 + +Linux 桌面继续走向成熟。KDE 和 GNOME 进行了一场友好的竞争,促使双方都在增加了新的功能,还互相交流了思想和观念。到了 2004 年,GNOME 和 KDE 都取得了长足的进步,但只是给用户界面带来了渐进式的变化。 + +KDE 2 和 3 继续依赖屏幕底部的任务栏概念,但并入了用于运行应用程序的按钮。KDE 最明显的变化之一是添加了 Konqueror 浏览器,该浏览器首次出现在 KDE 2 中。 + +![KDE 2.2.2 \(2001\) showing the Konqueror browser][11] + +*KDE 2.2.2(2001),显示了 Konqueror 浏览器。图片来源:Paul Brown / KDE* + +![KDE 3.2.2][12] + +*Fedora Core 2 上的 KDE 3.2.2(2004),显示了 Konqueror 文件管理器(使用 Fedora Core 2 主题)* + +GNOME 2 也使用了任务栏概念,但将任务栏一分为二:屏幕顶部的任务栏用于启动应用程序并响应桌面提示,屏幕底部的任务栏用于显示正在运行的应用程序。我把这两个任务栏称之为“你可以做的事情”(顶部)和“你正在做的事情”(底部)。除了精简的用户界面外,GNOME 还添加了由 Eazel 开发的更新过的文件管理器,名为 Nautilus。 + +![GNOME 2.6.0][13] + +*Fedora Core 2 上的 GNOME 2.6.0(2004),显示了 Nautilus 文件管理器(使用 Fedora Core 2 主题)* + +随着时间的流逝,KDE 和 GNOME 走了不同的道路。两者都提供了功能丰富、健壮且现代化的桌面环境,但是却具有不同的用户界面目标。2011 年,GNOME 和 KDE 在桌面界面上出现了很大的偏差。KDE 4.6(2011 年 1 月)和 KDE 4.7(2011 年 7 月)提供了更传统的桌面感受,同时继续根植于许多用户熟悉的任务栏概念。当然,KDE 的底层发生很多变化,但是它仍然保留了熟悉的外观。 + +![KDE 4.6][14] + +*KDE 4.6,显示 Gwenview 图像查看器。图片来源:KDE* + +2011 年,GNOME 以一个新的桌面概念彻底改变了走向。GNOME 3 旨在创建一个更简单、更精简的桌面体验,使用户能够专注于自己的工作。任务栏消失了,取而代之的是屏幕顶部的黑色状态栏,其中包括音量和网络控件,显示了时间和电池状态,并允许用户通过重新设计过的菜单启动新程序。 + +菜单的变化最具最戏剧性。单击“活动”菜单或将鼠标移到“活动”的“热角”,所有打开的应用程序会显示为单独的窗口。用户还可以从“概述”中单击“应用程序”选项卡以启动新程序。“概述”还提供了一个内部集成的搜索功能。 + +![GNOME 3.0][15] + +*GNOME 3.0,显示 GNOME 图片应用程序。图片来源:GNOME* + +![GNOME 3.0][16] + +*GNOME 3.0,显示活动概述。图片来源:GNOME* + +### 你的桌面之选 + +拥有两个 Linux 桌面意味着用户有很大的选择余地。有些人喜欢 KDE,而另一些人喜欢 GNOME。没关系,选择最适合你的桌面就行。 + +可以肯定的是,KDE 和 GNOME 都有拥护者和批评者。例如,GNOME 因为放弃任务栏而改成“活动概述”而受到了不少批评。也许最著名的批评者是 Linus Torvalds,他在 2011 年[大声斥责并抛弃了][17]新的 GNOME,将其视为“邪恶的烂摊子”,然后在两年后又[回到了][18] GNOME。 + +其他人也对 GNOME 3 提出了类似的批评,以至于一些开发人员复刻 GNOME 2 的源代码创建了 MATE 桌面。MATE(是MATE 高级传统环境MATE Advanced Traditional Environment的递归缩写)延续了 GNOME 2 的传统任务栏界面。 + +无论如何,毫无疑问当今两个最受欢迎的 Linux 桌面是 KDE 和 GNOME。它们的当前版本非常成熟,功能也很丰富。KDE 5.16(2019)和 GNOME 3.32(2019)都试图简化和精简 Linux 桌面体验,但是方式有所不同。GNOME 3.32 继续致力于极简外观,删除所有分散用户注意力的用户界面元素,以便用户可以专注于其应用程序和工作。KDE 5.16 采用了更为熟悉的任务栏方法,但也增加了其他视觉上的改进和亮点,尤其是改进的小部件处理和图标。 + +![KDE 5.16 Plasma][19] + +*KDE 5.16 Plasma。图片来源:KDE* + +![GNOME 3.32][20] + +*GNOME 3.32。图片来源:GNOME* + +同时,你也不会完全失去它们之间的兼容性。每个主要的 Linux 发行版都提供了兼容性库,因此你可以在运行 GNOME 的同时来运行 KDE 应用程序。当你真正想使用的应用程序是为其他桌面环境编写的,这一点非常有用。你可以在 GNOME 上运行 KDE 应用程序,反之亦然。 + +我认为这种态势不会很快改变,这是一件好事。KDE 和 GNOME 之间的良性竞争使这两个阵营的开发人员可以避免故步自封。无论你使用 KDE 还是 GNOME,你都将拥有一个集成度很高的现代化桌面。而最重要的是,这意味着 Linux 拥有自由软件最好的特点:选择。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-linux-desktop-grown + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hallhttps://opensource.com/users/jason-bakerhttps://opensource.com/users/jlacroixhttps://opensource.com/users/doni08521059https://opensource.com/users/etc-eterahttps://opensource.com/users/marcobravohttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://opensource.com/sites/default/files/uploads/twm-sls105.png (TWM on SLS 1.05) +[3]: https://opensource.com/sites/default/files/uploads/olvwm-sls105.png (OLVWM on SLS 1.05) +[4]: https://opensource.com/sites/default/files/uploads/fvwm-sls105.png (FVWM on SLS 1.05) +[5]: https://opensource.com/sites/default/files/uploads/win311.png (Windows 3.11) +[6]: https://opensource.com/sites/default/files/uploads/win95.png (Windows 95) +[7]: https://opensource.com/sites/default/files/uploads/fvwm95-rh52.png (FVWM95 on Red Hat Linux 5.2) +[8]: https://opensource.com/sites/default/files/uploads/kde1.png (KDE 1.0) +[9]: https://opensource.com/sites/default/files/uploads/gnome10.png (GNOME 1.0) +[10]: https://www.linuxtoday.com/developer/2000090500121OPLFKE +[11]: https://opensource.com/sites/default/files/uploads/kde_2.2.2.png (KDE 2.2.2 (2001) showing the Konqueror browser) +[12]: https://opensource.com/sites/default/files/uploads/kde322-fc2.png (KDE 3.2.2) +[13]: https://opensource.com/sites/default/files/uploads/gnome26-fc2.png (GNOME 2.6.0) +[14]: https://opensource.com/sites/default/files/uploads/kde46.png (KDE 4.6) +[15]: https://opensource.com/sites/default/files/uploads/gnome30.png (GNOME 3.0) +[16]: https://opensource.com/sites/default/files/uploads/gnome30-overview.png (GNOME 3.0) +[17]: https://www.theregister.co.uk/2011/08/05/linus_slams_gnome_three/ +[18]: https://www.phoronix.com/scan.php?page=news_item&px=MTMxNjc +[19]: https://opensource.com/sites/default/files/uploads/kde516.png (KDE 5.16 Plasma) +[20]: https://opensource.com/sites/default/files/uploads/gnome332.png (GNOME 3.32) diff --git a/published/202004/20191014 How to make a Halloween lantern with Inkscape.md b/published/202004/20191014 How to make a Halloween lantern with Inkscape.md new file mode 100644 index 0000000000..1cd31042d1 --- /dev/null +++ b/published/202004/20191014 How to make a Halloween lantern with Inkscape.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12152-1.html) +[#]: subject: (How to make a Halloween lantern with Inkscape) +[#]: via: (https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +如何使用 Inkscape 制作万圣节灯笼 +====== + +> 使用开源软件为你最喜欢的万圣节鬼屋制作一个有趣和怪异的装饰品。 + +![万圣节 - 背光飞行的蝙蝠][1] + +使用开源软件装饰一个独一无二的万圣节灯笼! + +通常,灯笼的一部分结构体是不透明的,以阻挡内部的光线。灯笼之所以成为灯笼,是因为其去掉了一些东西 :从结构体上切开的窗口,这样光线就可以射出。虽然对于照明来说不实用,但是一个有着怪异形状窗口和隐藏暗色轮廓的灯笼却可以令人兴奋,并创造出很多乐趣。 + +这篇演示如何使用 [Inkscape][2] 创建你自己的灯笼。如果还没有 Inkscape ,在 Linux 上,你可以从软件库中安装它,在 MacOS 和 Windows 上,你可以从[Inkscape 网站][3] 上下载它. + +### 使用材料 + + * 模板([A4][4] 或[信纸][5]大小) + * 卡片纸(黑色是传统色) + * 描图纸(可选) + * 裁纸刀、尺子、切割垫板(可使用工艺切割机/激光切割机代替) + * 工艺胶 + * LED 茶灯"蜡烛" + +安全注意事项:这个项目只使用电池操作的蜡烛。 + +### 理解模板 + +首先,从上面的链接下载你所在区域(A4 或信纸)的合适的模板,然后在 Inkscape 中打开它。 + +![灯笼模板荧光屏][6] + +灰白色的棋盘格背景是透明的(从技术角度来说,它是 alpha 通道。) + +黑色基板构成了灯笼。现在,没有窗口可以让光线穿过;灯笼有一个非镂空的黑色基板。你将在 Inkscape 中使用**并集**和**差集**选项来数字化的设计窗口。 + +蓝色虚线表示折线。橙色实线表示参考线。采光窗口不应该放在橙色盒子的外面。 + +模板的左侧是你可以在你设计中使用的一些预先制作好的对象。 + +### 创建一个窗口或形状 + +1. 创建一个看起来像你想要的窗口样式的对象。可以使用 Inkscape 左侧工具栏中的一些形状工具来创建对象。此外,你可以下载共创或公共领域的剪贴画,并导入 PNG 文件到你的项目中。 +2. 当你对对象的形状满意时,在顶部菜单中选择“路径” -> “对象转化成路径” 将其转换为一个路径(而不是一个形状,Inkscape 视其为两种不同的对象)。 + + ![对象到路径 菜单][7] + +3. 在基板形状的上面放置对象。 +4. 选择对象和黑色基板。通过先单击一个,并按住 `Shift` 按键,再选择另一个来完成。 +5. 从顶部菜单选择“路径” -> “差集” 来从基板的对象中移除形状。这将创建灯笼中的一个窗口。 + + ![路径 > 差集 菜单][8] + +### 添加对象到窗口中 + +在制作了一个窗口后,你可以添加对象到其中来创建一个场景。 + +提示: + +* 所有的对象,包括文本,必须连接到灯笼的基板,否则,在切割后会掉落下来,并留下一片空白。 +* 避免小而复杂的细微之处。即使使用激光切割机或工艺切割机等机器,也很难切割这些细微之处。 + +1. 创建或导入一个对象。 +2. 放置对象到窗口内,以便它至少接触基板的两侧。 +3. 选择对象后,从顶部菜单选择“连接” -> “对象转化成路径”。 + + ![对象到路径 菜单][9] + +4. 选择对象和黑色基板,通过在按住 `Shift` 按键的同时单击每一个来完成。 +5. 选择“路径” -> “并集”来使对象和基板合二为一。 + +### 添加文本 + +文本既可以从基板剪出文字来创建一个窗口(就像我对星星所做的那样),或者也可以添加到一个窗口上(它可以阻挡来自灯笼内部的光线)。如果你要创建一个窗口,只需要执行下面的步骤 1 和步骤 2,然后使用“差集”来从基板移除文本。 + +1. 从左侧边栏中选择文本工具来创建文本。粗体字体效果最好。 + + ![文本工具][10] + +2. 选择你的文本,然后从顶部菜单选择“路径” -> “对象转化成路径”。这将转换文本对象为一个路径。注意,这个步骤意味着你将不能再编辑该文本,所以,*只有当*你确定你拥有想要的单词后,执行这个步骤。 +3. 在你转换文本后,你可以按键盘上的 `F2` 来激活节点编辑器工具,当选择使用这个工具时,可以清楚地显示文本的节点。 + + ![选中的文本使用节点编辑器][11] + +4. 取消文本分组。 +5. 调整每个字母,以便使其与相邻字母或基板稍微重叠。 + + ![重叠文本][12] + +6. 为将所有的字母彼此连接,并连接到基板,重新选择所有文本和基板,然后选择“路径” -> “并集”。 + + ![使用 路径 > 并集 连接字母和基板][13] + +### 准备打印 + +下面是手工切割灯笼的说明。如果使用激光切割机或工艺切割机,遵循硬件所需要的技巧来准备好你的文件。 + +1. 在“图层”面板中,单击“安全”图层旁边的“眼睛”图标来隐藏安全线。如果你看不到图层面板,通过顶部菜单选择“图层” -> “图层”来显示它。 +2. 选择黑色基板。在“填充和笔划”面板中,设置填充为“X”(意味着*不填充*),设置“笔划”为纯黑色(对于喜欢十六进制的粉丝来说是 `#000000ff` )。 + + ![设置填充和笔划][14] + +3. 使用“文件” -> “打印”来打印你的图案。 +4. 使用一把工艺刀和直尺,小心地绕着每一条黑线切割。在蓝色虚线上轻划,然后折叠。 + + ![裁剪灯笼][15] + +5. 要完成窗口的制作,剪切描图纸为每个窗口的大小,然后粘贴它到灯笼的内侧。 + + ![添加描图纸][16] + +6. 在折条处把灯笼的边粘在一起。 +7. 接通电池供电的 LED 蜡烛,并放置它到你灯笼中。 + + ![完成灯笼][17] + +现在你的灯笼已经完成了,准备好点亮你的鬼屋了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape + +作者:[Jess Weichler][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/halloween_bag_bat_diy.jpg?itok=24M0lX25 (Halloween - backlit bat flying) +[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners +[3]: http://inkscape.org +[4]: https://www.dropbox.com/s/75qzjilg5ak2oj1/papercraft_lantern_A4_template.svg?dl=0 +[5]: https://www.dropbox.com/s/8fswdge49jwx91n/papercraft_lantern_letter_template%20.svg?dl=0 +[6]: https://opensource.com/sites/default/files/uploads/lanterntemplate_screen.png (Lantern template screen) +[7]: https://opensource.com/sites/default/files/uploads/lantern1.png (Object to path menu) +[8]: https://opensource.com/sites/default/files/uploads/lantern2.png (Object > Difference menu) +[9]: https://opensource.com/sites/default/files/uploads/lantern3.png (Object to path menu) +[10]: https://opensource.com/sites/default/files/uploads/lantern4.png (Text tool) +[11]: https://opensource.com/sites/default/files/uploads/lantern5.png (Text selected with Node editor) +[12]: https://opensource.com/sites/default/files/uploads/lantern6.png (Overlapping the text) +[13]: https://opensource.com/sites/default/files/uploads/lantern7.png (Connecting letters and base with Path > Union) +[14]: https://opensource.com/sites/default/files/uploads/lantern8.png (Setting fill and stroke) +[15]: https://opensource.com/sites/default/files/uploads/lantern9.jpg (Cutting out the lantern) +[16]: https://opensource.com/sites/default/files/uploads/lantern10.jpg (Adding tracing paper) +[17]: https://opensource.com/sites/default/files/uploads/lantern11.jpg (Completed lantern) diff --git a/published/202004/20191209 Use the Fluxbox Linux desktop as your window manager.md b/published/202004/20191209 Use the Fluxbox Linux desktop as your window manager.md new file mode 100644 index 0000000000..d3eb78339e --- /dev/null +++ b/published/202004/20191209 Use the Fluxbox Linux desktop as your window manager.md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12082-1.html) +[#]: subject: (Use the Fluxbox Linux desktop as your window manager) +[#]: via: (https://opensource.com/article/19/12/fluxbox-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Fluxbox 桌面作为你的窗口管理器 +====== + +> 本文是 24 天 Linux 桌面特别系列的一部分。Fluxbox 对系统资源的占用非常轻量,但它拥有重要的 Linux 桌面功能,让你的用户体验轻松、高效、快捷。 + +![](https://img.linux.net.cn/data/attachment/album/202004/07/113105p0ng5skkn5kmvdm0.jpg) + +桌面的概念可谓是仁者见仁智者见智。很多人把桌面看作一个家的基地,或者一个舒适的客厅,甚至是一个字面意义上的桌面,在其中放置着他们经常使用的记事本、最好的笔和铅笔,还有他们最喜欢的咖啡杯。KDE、 GNOME、Pantheon 等等在 Linux 上提供了这种舒适的生活方式。 + +但是对一些用户来说,桌面只是一个空荡荡的显示器空间,这是还没有任何可以自由浮动的应用程序窗口直接投射到他们的视网膜上的副作用。对于这些用户来说,桌面是一个空的空间,他们可以在上面运行应用程序 —— 无论是大型办公软件和图形套件,还是一个简单的终端窗口,或是来管理服务的托盘小程序。这种操作 [POSIX][2] 计算机的模式由来已久,该家族树的一支是 *box 窗口管理器:Blackbox、Fluxbox 和 Openbox。 + +[Fluxbox][3] 是一个 X11 系统的窗口管理器,它基于一个较老的名为 Blackbox 的项目。当我发现 Linux 时,Blackbox 的开发已进入衰退期,因此我就喜欢上了 Fluxbox ,此后我至少在一个以上的常用的系统上使用过它。它是用 C++ 编写的,并在 MIT 开源许可证下授权。 + +### 安装 Fluxbox + +你很可能会在你的 Linux 发行版的软件库中找到 Fluxbox,但是你也可以在 [Fluxbox.org][4] 上找到它。如果你正在运行另外一个桌面,在同一个系统上安装 Fluxbox 是安全的,因为 Fluxbox 不会预设任何配置或附带的应用程序。 + +在安装 Fluxbox 后,注销你当前的桌面会话,以便你可以登录一个新的桌面会话。默认情况下,你的桌面会话管理器 (KDM、GDM、LightDM 或 XDM,取决于你的安装设置) 将继续让登录到之前的桌面,所以你在登录前必需要覆盖上一个桌面。 + +使用 GDM 覆盖一个桌面: + +![在 GDM 中选择你的桌面会话][5] + +或者使用 KDM: + +![使用 KDM 选择你的桌面会话][6] + +### 配置 Fluxbox 桌面 + +当你第一次登录到桌面时,屏幕基本是空的,因为 Fluxbox 提供的所有东西是面板(用于任务栏、系统托盘等等)和用于应用程序窗口的窗口装饰品。 + +![在 CentOS 7 上的默认 Fluxbox 配置][7] + +如果你的发行版提供一个简单的 Fluxbox 桌面,你可以使用 `feh` 命令(你可能需要从你的发行版的软件库中安装它)来为你的桌面设置背景。这个命令有几个用于设置背景的选项,包括使用你选择的墙纸来填充屏幕的 `--bg-fill` 选项,来按比例缩放的 `--bg-scale` 等等选项。 + +``` +$ feh --bg-fill ~/photo/oamaru/leaf-spiral.jpg +``` + +![应用主题的 Fluxbox ][8] + +默认情况下,Fluxbox 自动生成一个菜单,在桌面上任意位置右键单击可用该菜单,这给予你访问应用程序的能力。根据你的发行版的不同,这个菜单可能非常小,也可能列出 `/usr/share/applications` 目录中的所有启动程序。 + +Fluxbox 配置是在文本文件中设置的,这些文本文件包含在 `$HOME/.fluxbox` 目录中。你可以: + +* 在 `keys` 中设置键盘快捷键 +* 在 `startup` 中启动的服务和应用程序 +* 在 `init` 设置桌面首选项(例如工作区数量、面板位置等等) +* 在 `menu` 中设置菜单项 + +该文本配置文件非常易于推断,但是你也可以(并且是应该)阅读 Fluxbox 的[文档][9]。 + +例如,这是我的典型菜单(或者说至少有它的基本结构): + +``` +# 为使用你自己的菜单,复制这些文本到 ~/.fluxbox/menu,然后编辑 +# ~/.fluxbox/init ,并更改 session.menuFile 文件路径到 ~/.fluxbox/menu + +[begin] (fluxkbox) + [submenu] (apps) {} + [submenu] (txt) {} + [exec] (Emacs 23 (text\)) { x-terminal-emulator -T "Emacs (text)" -e /usr/bin/emacs -nw} <> + [exec] (Emacs (X11\)) {/usr/bin/emacs} <> + [exec] (LibreOffice) {/usr/bin/libreoffice} + [end] + [submenu] (code) {} + [exec] (qtCreator) {/usr/bin/qtcreator} + [exec] (eclipse) {/usr/bin/eclipse} + [end] + [submenu] (graphics) {} + [exec] (ksnapshot) {/usr/bin/ksnapshot} + [exec] (gimp) {/usr/bin/gimp} + [exec] (blender) {/usr/bin/blender} + [end] + [submenu] (files) {} + [exec] (dolphin) {/usr/bin/dolphin} + [exec] (konqueror) { /usr/bin/kfmclient openURL $HOME } + [end] + [submenu] (network) {} + [exec] (firefox) {/usr/bin/firefox} + [exec] (konqueror) {/usr/bin/konqueror} + [end] + [end] +## 更改窗口管理器或工作环境 +[submenu] (environments) {} + [restart] (flux) {/usr/bin/startfluxbox} + [restart] (ratpoison) {/usr/bin/ratpoison} + [exec] (openIndiana) {/home/kenlon/qemu/startSolaris.sh} +[end] + +[config] (config) + [submenu] (styles) {} + [stylesdir] (/usr/share/fluxbox/styles) + [stylesdir] (~/.fluxbox/styles) + [end] +[workspaces] (workspaces) +[reconfig] (reconfigure) +[restart] (restart) +[exit] (exeunt) +[end] +``` + +该菜单也提供一些首选项设置,例如,选择一个主题,从 Fluxbox 会话中重启或注销的能力。 + +我使用键盘快捷键来启动大多数的应用程序,这些快捷键写入到 `keys` 配置文件中。这里有一些示例(`Mod4` 按键是 `Super` 键,我使用其来指定全局快捷键): + +``` +# 打开应用程序 +Mod4 t :Exec konsole +Mod4 k :Exec konqueror +Mod4 z :Exec fbrun +Mod4 e :Exec emacs +Mod4 f :Exec firefox +Mod4 x :Exec urxvt +Mod4 d :Exec dolphin +Mod4 q :Exec xscreensaver-command -activate +Mod4 3 :Exec ksnapshot +``` + +在这些快捷方式和一个打开的终端之间,在我工作日的大部分时间内很少使用鼠标,因此从一个控制器切换到另一个控制器不会浪费时间。并且因为 Fluxbox 很好地避开了控制器之间切换的方法,因此在其中操作没有一丝干扰。 + +### 为什么你应该使用 Fluxbox + +Fluxbox 对系统资源的占用非常轻量,但是它拥有重要的功能,可以使你的用户体验轻松、快速、高效。它很容易定制,并且允许你定义你自己的工作流。你不必使用 Fluxbox 的面板,因为还有其它优秀的面板。你甚至可以鼠标中键点击并拖动两个独立的应用程序窗口到彼此之中,以便它们成为一个窗口,每个窗口都有自己的选项卡。 + +可能性是无穷的,所以今天就在你的 Linux 上尝试一下 Fluxbox 的简单稳定吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/fluxbox-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: http://fluxbox.org +[4]: http://fluxbox.org/download/ +[5]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[6]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[7]: https://opensource.com/sites/default/files/advent-fluxbox-default.jpg (Default Fluxbox configuration on CentOS 7) +[8]: https://opensource.com/sites/default/files/advent-fluxbox-green.jpg (Fluxbox with a theme applied) +[9]: http://fluxbox.org/features/ diff --git a/published/202004/20191216 Relive Linux history with the ROX desktop.md b/published/202004/20191216 Relive Linux history with the ROX desktop.md new file mode 100644 index 0000000000..72c2993473 --- /dev/null +++ b/published/202004/20191216 Relive Linux history with the ROX desktop.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12123-1.html) +[#]: subject: (Relive Linux history with the ROX desktop) +[#]: via: (https://opensource.com/article/19/12/linux-rox-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 ROX 桌面重温 Linux 历史 +====== + +> 这篇文章是 Linux 桌面 24 天特别系列的一部分。如果你想来一次有趣的时光之旅,ROX 桌面非常值得一试。 + +![](https://img.linux.net.cn/data/attachment/album/202004/18/151533n196wag64gwhs0ga.jpg) + +[ROX][2] 桌面已经不再积极开发,而它的遗留问题至今仍然存在,但即使在它活跃开发的时候,它也是一个另类的 Linux 桌面。当其他的桌面感觉与旧式的 Unix 或 Windows 界面大致相似时,ROX 则属于 BeOS、AmigaOS 和 [RISC OS][3] 桌面阵营。 + +它专注于拖放式操作(这使得它的可访问性对某些用户来说并不理想)、点击式操作、弹出式上下文菜单,以及一个独特的应用程序目录系统,无需安装即可运行本地应用程序。 + +### 安装 ROX + +如今,ROX 基本上都被遗弃了,只剩下一点残渣碎片留给用户自己去收集整理。幸运的是,这个难题相对来说比较容易解决,但是当你在发行版的软件仓库中找到 ROX 桌面的碎片时,不要被迷惑了,因为那并不是 ROX 桌面全部的碎片。ROX 常用的部分 —— 文件管理器([ROX-Filer][4])和终端([ROXTerm][5]) —— 似乎在大多数流行的发行版软件仓库中都有存在,你可以将它们作为独立的应用程序安装(并使用)。然而,要运行 ROX 桌面,你必须同时安装 ROX-Session 和它所依赖的库。 + +我在 Slackware 14.2 上安装了 ROX,但它应该可以在任何 Linux 或 BSD 系统上运行。 + +首先,你必须从其版本库中安装 [ROX-lib2][6]。你要安装 ROX-lib2,按照它的理念,只需下载tarball、[解压][7],然后将 `ROX-lib` 目录移动到 `/usr/local/lib` 下就行。 + +接下来,你要安装 [ROX-Session][8]。这可能需要从源码中编译,因为它很可能不在你的软件仓库中。编译过程需要编译工具,这些工具在 Slackware 上是默认提供的,但在其他发行版中往往会被省略,以节省初始下载空间。根据你的发行版不同,你必须安装的包的名称也不同,所以请参考文档来了解具体内容。例如,在 Debian 发行版中,你可以在 [Debian 的 wiki][9] 中了解构建需求,而在 Fedora 发行版中,请参考 [Fedora 的文档][10]。安装了构建工具后,执行自定义的 ROX-Session 构建脚本。 + +``` +$ ./AppRun +``` + +这个脚本会自己管理构建和安装,并提示你需要 root 权限,以在你的登录屏上将其添加为一个选项。 + +如果你还没有从你的软件库中安装 ROX-Filer,请在继续之前安装。 + +这些组件共同组成了一个完整的 ROX 桌面。要登录到新桌面,请从当前桌面会话中注销。默认情况下,你的会话管理器(KDM、GDM、LightDM 或 XDM,视你的设置而定)会继续登录到你之前的桌面,所以在登录前必须覆盖。 + +使用 SDDM: + +![][11] + +使用 GDM: + +![][12] + +### ROX 桌面特性 + +ROX 桌面默认情况下很简单,屏幕底部有一个面板,桌面上有一个通往主目录的快捷方式图标。面板中包含了一些常用位置的快捷方式。这就是 ROX 桌面的全部功能,至少在安装后就是这样。如果你想要时钟、日历或系统托盘,你需要找到提供这些功能的应用程序。 + +![Default ROX desktop][13] + +虽然没有任务栏,但当你将窗口最小化时,它就会成为桌面上的一个临时图标。你可以点击该图标,将其窗口恢复到以前的大小和位置。 + +面板也可以进行一些修改。你可以在其中放置不同的快捷方式,甚至可以创建自己的小程序。 + +它没有应用菜单,也没有上下文菜单中的应用快捷方式。相反,你可以手动导航到 `/usr/share/applications`,或者你可以将你的应用目录或目录添加到 ROX 面板中。 + +![ROX desktop][14] + +ROX 桌面的工作流程集中在鼠标驱动上,让人联想到 Mac OS 7.5 和 8 系统。通过 ROX-filer,你可以管理权限、文件管理、内省introspection、脚本启动、后台设置,以及几乎所有你能想到的东西,只要你有足够的耐心,就可以实现点击式的交互。对于高级用户来说,这似乎很慢,但 ROX 设法让它变得相对无痛,而且非常直观。 + +### 应用程序目录、AppRun 和 AppImage + +ROX 桌面有一个优雅的惯例,按照此惯例,包含一个名为 `AppRun` 的脚本的目录就可以像一个应用程序一样被执行。这意味着,要制作一个 ROX 应用程序,你所要做的就是将代码编译到一个目录中,将一个名为`AppRun` 的脚本放在该目录的根目录下,来执行你所编译的二进制文件,然后将该目录标记为可执行即可。ROX-Filer 会按照你设置的方式来显示一个目录,并以特殊的图标和颜色显示一个目录。当你点击一个应用程序目录,ROX-Filer 会自动运行里面的 `AppRun` 脚本。它的外观和行为就像一个已经安装好的应用程序,但它是在用户的主目录下的本地目录,不需要特殊的权限。 + +这是一个方便的功能,但它是那些你使用时感觉很好的小功能之一,因为它很容易做到。它绝不是必要的,它只是比在本地建立一个应用程序,将目录隐藏在某个不显眼的地方,并建立一个快速的 `.desktop` 文件作为你的启动器,要领先了几步。然而,应用程序目录的概念已经当做灵感被 [AppImage][16] 打包系统所 [借鉴][15]。 + +### 为什么应该试试 ROX 桌面 + +把 ROX 设置好并使用是有些困难的,它似乎真的被抛弃了。然而,它的遗产在今天以多种方式继续存在,它是 Linux 历史上的一段迷人而有趣的历史。它可能不会成为你的主要桌面,但如果你想来一次有趣的回溯之旅,那么 ROX 非常值得一试。探索它、定制它,看看它包含了哪些巧妙的想法。也许还有一些隐藏的宝石可以让开源社区受益。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-rox-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: http://rox.sourceforge.net/desktop/ +[3]: https://www.riscosopen.org/content/ +[4]: http://rox.sourceforge.net/desktop/ROX-Filer +[5]: http://roxterm.sourceforge.net/ +[6]: http://rox.sourceforge.net/desktop/ROX-Lib +[7]: https://opensource.com/article/17/7/how-unzip-targz-file +[8]: http://rox.sourceforge.net/desktop/ROX-Session.html +[9]: https://wiki.debian.org/BuildingTutorial +[10]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html +[11]: https://opensource.com/sites/default/files/advent-kdm_0.jpg +[12]: https://opensource.com/sites/default/files/advent-gdm_1.jpg +[13]: https://opensource.com/sites/default/files/uploads/advent-rox.jpg (Default ROX desktop) +[14]: https://opensource.com/sites/default/files/uploads/advent-rox-custom.jpg (ROX desktop) +[15]: https://github.com/AppImage/AppImageKit/wiki/AppDir +[16]: https://appimage.org/ diff --git a/published/202004/20191220 The Difference Between DNF and YUM, Why is Yum Replaced by DNF.md b/published/202004/20191220 The Difference Between DNF and YUM, Why is Yum Replaced by DNF.md new file mode 100644 index 0000000000..8521ab4291 --- /dev/null +++ b/published/202004/20191220 The Difference Between DNF and YUM, Why is Yum Replaced by DNF.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12161-1.html) +[#]: subject: (The Difference Between DNF and YUM, Why is Yum Replaced by DNF?) +[#]: via: (https://www.2daygeek.com/comparison-difference-between-dnf-vs-yum/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +DNF 和 Yum 的区别,为什么 Yum 会被 DNF 取代? +====== + +由于 Yum 中许多长期存在的问题仍未得到解决,因此 [Yum 包管理器][1]已被 [DNF 包管理器][2]取代。这些问题包括性能差、内存占用过多、依赖解析速度变慢等。 + +DNF 使用 `libsolv` 进行依赖解析,由 SUSE 开发和维护,旨在提高性能。 + +Yum 主要是用 Python 编写的,它有自己的应对依赖解析的方法。它的 API 没有完整的文档,它的扩展系统只允许 Python 插件。 + +Yum 是 RPM 的前端工具,它管理依赖关系和资源库,然后使用 RPM 来安装、下载和删除包。 + +为什么他们要建立一个新的工具,而不是修复现有的问题呢? + +Ales Kozamblak 解释说,这个修复在技术上是不可行的,而且 Yum 团队还没有准备好立即接受修改。 + +另外,最大的挑战是,Yum 有 56000 行代码,但 DNF 只有 29000 行代码。 + +所以除了分叉,没有办法解决。 + +不过 Yum 的运行情况还算可以。 + + +编号 | DNF(Dandified YUM) | YUM(Yellowdog Updater, Modified) +---|---|--- +1 | DNF 使用 libsolv 来解析依赖关系,由 SUSE 开发和维护 | YUM 使用公开的 API 来解析依赖关系 +2 | API 有完整的文档 | API 没有完整的文档 +3 | 由 C、C++、Python 编写的 | 只用 Python 编写 +4 | DNF 目前在 Fedora、RHEL 8、CentOS 8、OEL 8 和 Mageia 6/7 中使用 | YUM 目前在 RHEL 6/7、CentOS 6/7、OEL 6/7 中使用 +5 | DNF 支持各种扩展 | Yum 只支持基于 Python 的扩展 +6 | API 有良好的文档,因此很容易创建新的功能 | 因为 API 没有正确的文档化,所以创建新功能非常困难 +7 | DNF 在同步存储库的元数据时,使用的内存较少 | 在同步存储库的元数据时,YUM 使用了过多的内存 +8 | DNF 使用满足性算法来解决依赖关系解析(它是用字典的方法来存储和检索包和依赖信息)| 由于使用公开 API 的原因,Yum 依赖性解析变得迟钝 +9 | 从内存使用量和版本库元数据的依赖性解析来看,性能都不错 | 总的来说,在很多因素的影响下,表现不佳 +10 | DNF 更新:在 DNF 更新过程中,如果包中包含不相关的依赖,则不会更新 | YUM 将在没有验证的情况下更新软件包 +11 | 如果启用的存储库没有响应,DNF 将跳过它,并继续使用可用的存储库处理事务 | 如果有存储库不可用,YUM 会立即停止 +12 | `dnf update` 和 `dnf upgrade` 是等价的 | 在 Yum 中则不同 +13 | 安装包的依赖关系不更新 | Yum 为这种行为提供了一个选项 +14 | 清理删除的包:当删除一个包时,DNF 会自动删除任何没有被用户明确安装的依赖包 | Yum 不会这样做 +15 | 存储库缓存更新计划:默认情况下,系统启动后 10 分钟后,DNF 每小时会对配置的存储库检查一次更新。这个动作由系统定时器单元 `dnf-makecache.timer` 控制 | Yum 也会这样做 +16 | 内核包不受 DNF 保护。不像 Yum,你可以删除所有的内核包,包括运行中的内核包 | Yum 不允许你删除运行中的内核 +17 | libsolv:用于解包和读取资源库。hawkey: 为 libsolv 提供简化的 C 和 Python API 库。librepo: 提供 C 和 Python(类似 libcURL)API 的库,用于下载 Linux 存储库元数据和软件包。libcomps: 是 yum.comps 库的替代品。它是用纯 C 语言编写的库,有 Python 2 和 Python 3 的绑定。| Yum 不使用单独的库来执行这些功能 +18 | DNF 包含 29000 行代码 | Yum 包含 56000 行代码 +19 | DNF 由 Ales Kozumplik 开发 | YUM 由 Zdenek Pavlas、Jan Silhan 和团队成员开发 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/comparison-difference-between-dnf-vs-yum/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[2]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ diff --git a/translated/tech/20191224 Why your Python code should be flat and sparse.md b/published/202004/20191224 Why your Python code should be flat and sparse.md similarity index 56% rename from translated/tech/20191224 Why your Python code should be flat and sparse.md rename to published/202004/20191224 Why your Python code should be flat and sparse.md index d1d59b5fc6..5f9bf864e6 100644 --- a/translated/tech/20191224 Why your Python code should be flat and sparse.md +++ b/published/202004/20191224 Why your Python code should be flat and sparse.md @@ -1,27 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (caiichenr) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12087-1.html) [#]: subject: (Why your Python code should be flat and sparse) [#]: via: (https://opensource.com/article/19/12/zen-python-flat-sparse) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) 为何你的 Python 代码应是扁平与稀疏的 ====== -本文是 Python 之禅特别系列当中的一篇,此篇着眼于其中第五与第六条原则:扁平与稀疏。 -![Digital creative of a browser on the internet][1] -[Python之禅][2] 得名如此,正是由于它那简明扼要的规则被设计出的意图在于让读者进行深入地思考,而绝不单是为编程提供一份易于遵守的指南。 +> 本文是 Python 之禅特别系列的第三篇,此篇着眼于其中第五与第六条原则:扁平与稀疏。 -读后不去三思其意,断然难以体会 Python 之禅的妙处。倘若 Python 之禅仅仅罗列出一组清晰的法则,那法则之间的矛盾只能算作一种错误。然而用作引导读者去为最优方案沉思的工具,矛盾却是绝佳的。 +![](https://img.linux.net.cn/data/attachment/album/202004/08/191645uiniiy56keig95gi.jpg) -### 扁平胜过嵌套 Flat is better than nested. +[Python 之禅][2] 之所以得名,正是由于它那简明扼要的规则被设计出的意图在于让读者进行深入地思考,而绝不单是为编程提供一份易于遵守的指南。 -迫于对缩进的强硬要求,Python 对“扁平化”的需求显然远超它者。其余编程语言为了缓解对缩进的需求,通常会在嵌套结构里加入一种“欺诈”的手段。用以说明此点,不妨一同看看JavaScript。 +读后不去三思其意,断然难以体会 Python 之禅的妙处。倘若 Python 之禅仅仅罗列出一组清晰的法则,那法则之间的矛盾是一种缺憾,然而作为引导读者沉思最优方案沉思的工具,矛盾却是绝佳的。 -JavaScript 是原生异步的,这意味着程序员用 JavaScript 写的代码会用到大量的回调函数。 +### 扁平胜过嵌套Flat is better than nested +迫于对缩进的强硬要求,Python 对“扁平化”的需求显然远超它者。其余编程语言为了缓解对缩进的需求,通常会在嵌套结构里加入一种“作弊”的手段。为了理解这一点,不妨一同来看看 JavaScript。 + +JavaScript 本质上是异步的,这意味着程序员用 JavaScript 写的代码会用到大量的回调函数。 ``` a(function(resultsFromA) { @@ -33,8 +34,7 @@ a(function(resultsFromA) { } ``` -忽略这段代码的具体内容,只去观察这段代码的形状与缩进带来极右点的方式。这种独特的“箭头”图形在我们扫看代码时格外扎眼,这种写法也因此被视作不可取,甚至得到了“回调地狱”的绰号。不过,在 JavaScript 中,这种反映嵌套关系的缩进可以通过“欺诈”来回避。 - +忽略这段代码的具体内容,只去观察这段代码的形状与缩进带来一个最右边的点的方式。这种独特的“箭头”图形在我们扫看代码时格外扎眼,这种写法也因此被视作不可取,甚至得到了“回调地狱”的绰号。不过,在 JavaScript 中,这种反映嵌套关系的缩进可以通过“作弊”来回避。 ``` a(function(resultsFromA) { @@ -46,10 +46,9 @@ c(resultsFromC, }}} ``` -Python 并没有提供这种欺诈手段:每一级嵌套在代码中都如实的对应着一层缩进。因此,Python 深层的嵌套关系在_视觉_上也一定是深层嵌套的。这使得“回调地狱”的问题对于 Python 而言要比在 JavaScript 中严重得多:嵌套的回调函数必定带来缩进,而绝无使用花括号来“欺诈”的可能。 - -这项挑战与 Python 之禅的指导原则相结合后,在我参与的库中催生出了一个优雅的解决方案。我们在 [Twisted][3] 框架里提出了 _deferred_ 抽象,日后 JavaScript 中流行的 _promise_ 抽象亦是受其启发而生。正是由于 Python 对整洁代码的坚守,方能推动 Python 开发者去发掘新的,强力的抽象。 +Python 并没有提供这种作弊手段:每一级嵌套在代码中都如实的对应着一层缩进。因此,Python 深层的嵌套关系在*视觉*上也一定是深层嵌套的。这使得“回调地狱”的问题对于 Python 而言要比在 JavaScript 中严重得多:嵌套的回调函数必定带来缩进,而绝无使用花括号来“作弊”的可能。 +这项挑战与 Python 之禅的指导原则相结合后,在我参与的库中催生出了一个优雅的解决方案。我们在 [Twisted][3] 框架里提出了 deferred 抽象,日后 JavaScript 中流行的 promise 抽象亦是受其启发而生。正是由于 Python 对整洁代码的坚守,方能推动 Python 开发者去发掘新的、强力的抽象。 ``` future_value = future_result() @@ -58,11 +57,11 @@ future_value.addCallback(b) future_value.addCallback(c) ``` -(现代 JavaScript 程序员也许会觉得这段代码十分眼熟:Promises 着实受到了 Twisted 里 deferreds 抽象的深远影响。) +(现代 JavaScript 程序员也许会觉得这段代码十分眼熟:promise 着实受到了 Twisted 里 deferred 抽象的深远影响。) -### 稀疏胜过密集 Sparse is better than dense. +### 稀疏胜过密集Sparse is better than dense -最易降低代码密集程度的方法是引入嵌套。这种习惯也正是有关稀疏的原则要随着前一条提出的原因:在竭尽所能地降低代码密集性之后,我们往往会遗留下_密集_的代码或数据结构。此处的密集,是指塞进过量信息的小段代码,它们会导致错误发生后的解析变得困难。 +最易降低代码密集程度的方法是引入嵌套。这种习惯也正是有关稀疏的原则要随着前一条提出的原因:在竭尽所能地减少嵌套之后,我们往往会遗留下*密集的*代码或数据结构。此处的密集,是指塞进过量信息的小段代码,它们会导致错误发生后的解析变得困难。 这种密集性唯有通过创造性的思考方可改善,此外别无捷径。Python 之禅并不为我们提供简单的解决方案,它只会指明改善代码的方向,而非提供“如何”去做的向导。 @@ -75,7 +74,7 @@ via: https://opensource.com/article/19/12/zen-python-flat-sparse 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[caiichenr](https://github.com/caiichenr) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202004/20200211 Navigating man pages in Linux.md b/published/202004/20200211 Navigating man pages in Linux.md new file mode 100644 index 0000000000..98ca0579ed --- /dev/null +++ b/published/202004/20200211 Navigating man pages in Linux.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12127-1.html) +[#]: subject: (Navigating man pages in Linux) +[#]: via: (https://www.networkworld.com/article/3519853/navigating-man-pages-in-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 中遨游手册页的海洋 +====== + +> Linux 系统上的手册页可以做的不仅仅是提供特定命令的信息。它们可以帮助你发现你没有意识到的命令。 + +![Hello I'm Nik][1] + +手册页提供了关于 Linux 命令的基本信息,很多用户经常参考它,但手册页的内容比我们很多人意识到的要多得多。 + +你总是可以输入一个像 `man who` 这样的命令,然后得到 `who` 命令的工作原理的漂亮描述,但是探索你可能不知道的命令可能会更有启发。例如,你可以使用 `man` 命令来帮助找到一些处理非常具有挑战性的任务的命令,或者显示一些选项,这些选项可以帮助你以新的更好的方式使用你已经知道的命令。 + +让我们来浏览一些选项,看看最终的结果是什么。 + +### 用 man 去识别命令 + +`man` 命令可以帮助你按主题查找命令。例如,如果你要找一个计算文件中的行数的命令,你可以提供一个关键字。在下面的例子中,我们把关键字 “count” 放在了引号中,并添加了空格,这样我们就不会得到与 “accounts” 或 “accounting” 相关的命令,而是得到那些可以为我们做一些计算的命令。 + +``` +$ man -k ' count ' +anvil (8postfix) - Postfix session count and request rate control +cksum (1) - checksum and count the bytes in a file +sum (1) - checksum and count the blocks in a file +timer_getoverrun (2) - get overrun count for a POSIX per-process timer +``` + +为了显示与新用户账户相关的命令,我们可以尝试使用这样的命令。 + +``` +$ man -k "new user" +newusers (8) - update and create new users in batch +useradd (8) - create a new user or update default new user information +zshroadmap (1) - informal introduction to the zsh manual The Zsh Manual, … +``` + +需要说明的是,上面的第三项只是提到 “new users” 类似的内容,并不是设置、删除或配置用户账号的命令。`man` 命令只是在命令描述中匹配了一些词,作用很像 `apropos` 命令。注意上面列出的每个命令后面的括号中的数字。这些数字与包含这些命令的手册页的分区有关。 + +### 确定手册页的分区 + +`man` 命令的分区将其内容划分为不同的类别。要列出这些类别,请键入 `man man`,并查看类似下面的描述。你的系统中很可能没有第 9 分区的命令。 + +- `1`:可执行程序或 shell 命令 +- `2`:系统调用(内核提供的函数) +- `3`:库调用(程序库内的函数) +- `4`:特殊文件(通常在可以 `/dev` 中找到) +- `5`:文件格式和惯例,例如 `/etc/passwd` +- `6`:游戏 +- `7`:杂项(包括宏包和约定),例如 `man`(7)、`groff`(7) +- `8`:系统管理命令(通常只由 root 用户使用) +- `9`:内核例程(非标准) + +手册页涵盖了比我们通常认为的“命令”更多的内容。从上面的描述中可以看到,它们涵盖了系统调用、库调用、特殊文件等等。 + +下面的列表显示了 Linux 系统中的手册页的实际存储位置。这些目录上的日期会有所不同,因为随着更新,其中一些分区会有新的内容,而另一些则不会。 + +``` +$ ls -ld /usr/share/man/man? +drwxr-xr-x 2 root root 98304 Feb 5 16:27 /usr/share/man/man1 +drwxr-xr-x 2 root root 65536 Oct 23 17:39 /usr/share/man/man2 +drwxr-xr-x 2 root root 270336 Nov 15 06:28 /usr/share/man/man3 +drwxr-xr-x 2 root root 4096 Feb 4 10:16 /usr/share/man/man4 +drwxr-xr-x 2 root root 28672 Feb 5 16:25 /usr/share/man/man5 +drwxr-xr-x 2 root root 4096 Oct 23 17:40 /usr/share/man/man6 +drwxr-xr-x 2 root root 20480 Feb 5 16:25 /usr/share/man/man7 +drwxr-xr-x 2 root root 57344 Feb 5 16:25 /usr/share/man/man8 +``` + +注意,为了节省空间,手册页文件一般都是 gzip 压缩的。每当你使用 `man` 命令时,`man` 命令会根据需要解压。 + +``` +$ ls -l /usr/share/man/man1 | head -10 +total 12632 +lrwxrwxrwx 1 root root 9 Sep 5 06:38 [.1.gz -> test.1.gz +-rw-r--r-- 1 root root 563 Nov 7 05:07 2to3-2.7.1.gz +-rw-r--r-- 1 root root 592 Apr 23 2016 411toppm.1.gz +-rw-r--r-- 1 root root 2866 Aug 14 10:36 a2query.1.gz +-rw-r--r-- 1 root root 2361 Sep 9 15:13 aa-enabled.1.gz +-rw-r--r-- 1 root root 2675 Sep 9 15:13 aa-exec.1.gz +-rw-r--r-- 1 root root 1142 Apr 3 2018 aaflip.1.gz +-rw-r--r-- 1 root root 3847 Aug 14 10:36 ab.1.gz +-rw-r--r-- 1 root root 2378 Aug 23 2018 ac.1.gz +``` + +### 按分区列出的手册页 + +即使只看第 1 分区的前 10 个手册页(如上所示),你也可能会看到一些新的命令 —— 也许是 `a2query` 或 `aaflip`(如上所示)。 + +探索命令的更好策略是按分区列出命令,不查看文件本身,而是使用 `man` 命令向你显示命令并提供每个命令的简要说明。 + +在下面的命令中,`-s 1` 指示 `man` 显示第 1 分区中的命令信息。`-k .` 使该命令对所有命令都有效,而不是指定一个特定的关键字;如果没有这个,`man` 命令就会回过头来问:“你想要什么手册页?”所以,使用关键字来选择一组相关的命令,或者使用点来显示一个分区中的所有命令。 + +``` +$ man -s 1 -k . +2to3-2.7 (1) - Python2 to Python3 converter +411toppm (1) - convert Sony Mavica .411 image to ppm +as (1) - the portable GNU assembler. +baobab (1) - A graphical tool to analyze disk usage +busybox (1) - The Swiss Army Knife of Embedded Linux +cmatrix (1) - simulates the display from "The Matrix" +expect_dislocate (1) - disconnect and reconnect processes +red (1) - line-oriented text editor +enchant (1) - a spellchecker +… +``` + +### 有多少手册页? + +如果你对每个分区中有多少手册页感到好奇,可以使用以下命令按分区对它们进行计数: + +``` +$ for num in {1..8} +> do +> man -s $num -k . | wc -l +> done +2382 +493 +2935 +53 +441 +11 +245 +919 +``` + +确切的数量可能有所不同,但是大多数 Linux 系统的命令数量差不多。如果我们使用命令将这些数字加在一起,我们可以看到运行该命令的系统上有将近 7500 个手册页。有很多命令,系统调用等。 + +``` +$ for num in {1..8} +> do +> num=`man -s $num -k . | wc -l` +> tot=`expr $num + $tot` +> echo $tot +> done +2382 +2875 +5810 +5863 +6304 +6315 +6560 +7479 <=== total +``` + +阅读手册页可以学到很多东西,但是以其他方式浏览手册页可以帮助你了解系统上可能不知道的命令。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3519853/navigating-man-pages-in-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/10/field-note_play-book_playbook_map_navigation_journey_by-hello-i-m-nik-via-unsplash-100813507-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/slideshow/153439/linux-best-desktop-distros-for-newbies.html#tk.nww-infsb +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md b/published/202004/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md new file mode 100644 index 0000000000..9ae4ee5618 --- /dev/null +++ b/published/202004/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12156-1.html) +[#]: subject: (Manage complex Git workspaces with Great Teeming Workspaces) +[#]: via: (https://opensource.com/article/20/2/git-great-teeming-workspaces) +[#]: author: (Daniel Gryniewicz https://opensource.com/users/dang) + +使用 GTWS 管理复杂的 Git 工作空间 +====== + +> GTWS 是一系列脚本,它使我们在开发环境中管理不同的项目和项目的各个版本变得很容易。 + +![](https://img.linux.net.cn/data/attachment/album/202004/27/182149xh9s7kb5bkf5875b.jpg) + +[Great Teeming Workspaces][2](GTWS)是一个 Git 的复杂工作空间管理工具包,它使我们在开发环境中管理不同的项目和项目的各个版本变得很容易。 + +有点像 Python 的 [venv][3],但不是为 Python 语言准备的。GTWS 用来管理多个项目的多个版本的工作空间。你可以很容易地创建、更新、进入和离开工作空间,每个项目或版本的组合(最多)有一个本地的 origin,用来与 upstream 同步 — 其余的所有工作空间都从本地的 origin 更新。 + +### 部署 + +``` +${GTWS_ORIGIN}//[/] +${GTWS_BASE_SRCDIR}////{[,...]} +``` + +源代码目录的每一级(包括全局的家目录)可以包含一个 `.gtwsrc` 文件,这个文件中维护与当前级相关的设置和 bash 代码。每一级的配置会覆盖上一级。 + +### 安装 + +用下面的命令检出 GTWS: + +``` +git clone https://github.com/dang/gtws.git +``` + +配置你的 `${HOME}/.gtwsrc`。它应该包含 `GTWS_ORIGIN`,也可以再包含 `GTWS_SETPROMPT`。 + +把仓库目录加到环境变量中: + +``` +export PATH="${PATH}:/path/to/gtws +``` + +### 配置 + +通过级联 `.gtwsrc` 文件来进行配置。它从根目录向下遍历,会执行在每级目录中找到的 `.gtwsrc` 文件。下级目录的文件会覆盖上一级。 + +在你最上层的文件 `~/.gtws/.gtwsrc` 中进行如下设置: + + * `GTWS_BASE_SRCDIR`:所有项目源文件目录树的基目录。默认为 `$HOME/src`。 + * `GTWS_ORIGIN`: 指定 origin git 目录树的路径。默认为 `$HOME/origin`。 + * `GTWS_SETPROMPT`: 可选配置。如果配置了这个参数,shell 提示符会有工作空间的名字。 + * `GTWS_DEFAULT_PROJECT`: 不指定项目或项目未知时默认的项目名。如果不指定,使用命令行时必须指明项目。 + * `GTWS_DEFAULT_PROJECT_VERSION`: 检出的默认版本。默认为 `master`。 + +在每个项目的根目录进行以下设置: + + * `GTWS_PROJECT`: 项目的名字(和基目录)。 + * `gtws_project_clone`: 这个函数用于克隆一个项目的指定版本。如果未定义,它会假定项目的 origin 对每一个版本都有一个单独的目录,这样会导致克隆一堆 Git 仓库。 + * `gtws_project_setup`: 在克隆完所有的仓库后,可以选择是否调用这个函数,调用后可以对项目进行必要的配置,如在 IDE 中配置工作空间。 + +在项目版本级进行以下设置: + + * `GTWS_PROJECT_VERSION:` 项目的版本。用于正确地从 origin 拉取代码。类似 Git 中的分支名字。 + +下面这些参数可以在目录树的任意地方进行配置,如果能生效,它们可以被重写多次: + + * `GTWS_PATH_EXTRA`: 这些是工作空间中加到路径后的额外的路径元素。 + * `GTWS_FILES_EXTRA`: 这些是不在版本控制内,但应该在工作空间中被检出的额外的文件。这些文件包括 `.git/info/exclude`,每个文件都与仓库的基目录相关联。 + +### origin 目录 + +`GTWS_ORIGIN` (大部分脚本中)指向拉取和推送的原始 Git 检出目录。 + +`${GTWS_ORIGIN}` 部署: + + * `/` + * 这是一个项目的仓库的基目录。 + * 如果指定了 `gtws_project_clone`,你可以配置任意的部署路径。 + * 如果没有指定 `gtws_project_clone`,这个路径下必须有个名为 `git` 的子目录,且 `git` 目录下有一系列用来克隆的裸 Git 仓库。 + +### 工作流示例 + +假设你有一个项目名为 `Foo`,它的 upstream 为 `github.com/foo/foo.git`。这个仓库有个名为 `bar` 的子模块,它的 upstream 是 `github.com/bar/bar.git`。Foo 项目在 master 分支开发,使用稳定版本的分支。 + +为了能在 Foo 中使用 GTWS,你首先要配置目录结构。本例中假设你使用默认的目录结构。 + + * 配置你最上层的 `.gtwsrc`: + * `cp ${GTWS_LOC}/examples/gtwsrc.top ~/.gtwsrc` + * 根据需要修改 `~/.gtwsrc`。 + * 创建顶级目录: + * `mkdir -p ~/origin ~/src` + * 创建并配置项目目录: + * `mkdir -p ~/src/foo` + + `cp ${GTWS_LOC}/examples/gtwsrc.project ~/src/foo/.gtwsrc` + * 根据需要修改 `~/src/foo/.gtwsrc`。 + * 创建并配置 master 版本目录: + * `mkdir -p ~/src/foo/master` + + `cp ${GTWS_LOC}/examples/gtwsrc.version ~/src/foo/master/.gtwsrc` + * 根据需要修改 `~/src/foo/master/.gtwsrc`。 + * 进入版本目录并创建一个临时工作空间来配置镜像: + * `mkdir -p ~/src/foo/master/tmp` + + `cd ~/src/foo/master/tmp` + + `git clone --recurse-submodules git://github.com/foo/foo.git` + + `cd foo` + + `gtws-mirror -o ~/origin -p foo`(译注:这个地方原文有误,不加 `-s` 参数会报错) + * 上面命令会创建 `~/origin/foo/git/foo.git` 和 `~/origin/foo/submodule/bar.git`。 + * 以后的克隆操作会从这些 origin 而不是 upstream 克隆。 + * 现在可以删除工作空间了。 + +到现在为止,Foo 的 master 分支的工作可以结束了。假设你现在想修复一个 bug,名为 `bug1234`。你可以脱离你当前的工作空间为修复这个 bug 单独创建一个工作空间,之后在新创建的工作空间中开发。 + + * 进入版本目录,创建一个新的工作空间: + * `cd ~/src/foo/master` + + `mkws bug1234` + * 上面的命令创建了 `bug1234/`,在这个目录下检出了 Foo(和它的子模块 `bar`),并创建了 `build/foo` 来构建它。 + * 有两种方式进入工作空间: + * `cd ~/src/foo/master/bug1234` + + `startws` + + 或者 + + `cd ~/src/foo/master/` + + `startws bug1234` + * 上面的命令在 `bug1234` 工作空间中开启了一个子 shell。这个 shell 有 GTWS 的环境和你在各级 `.gtwsrc` 文件中设置的环境。它也把你工作空间的基目录加入到了 CD,因此你可以从 base 路径 `cd` 到相关的目录中。 + * 现在你可以修复 `bug1234` 了,构建、测试、提交你的修改。当你可以把代码推送到 upstream 时,执行下面的命令: + + `cd foo` + + `wspush`  + * `wspush` 会把代码推送到与你工作空间相关的分支 — 先推送到本地的 origin,再推送到 upstream。 + * 当 upstream 有修改时,你可以用下面的命令同步到本地: + + `git sync` + * 上面的命令调用了 GTWS 的 `git-sync` 脚本,会从本地 origin 更新代码。使用下面的命令来更新本地的 origin: + + `git sync -o`  + * 上面的命令会更新你本地的 origin 和子模块的镜像,然后用那些命令来更新你的检出仓库的代码。`git-sync` 也有一些其他的很好的工鞥。 + * 当要结束工作空间中的工作时,直接退出 shell: + + `exit` + * 你可以在任何时间重复进入工作空间,也可以在同一时间在相同的工作空间中开多个 shell。 + * 当你不需要某个工作空间时,你可以使用 `rmws` 来删除它,或者直接删除它的目录树。 + * 还有一个脚本 `tmws` 使用 tmux 进入工作空间,能创建一系列的窗口/窗格,这完美契合我的工作流。你可以根据你自己的需求来修改它。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/git-great-teeming-workspaces + +作者:[Daniel Gryniewicz][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dang +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://github.com/dang/gtws +[3]: https://docs.python.org/3/library/venv.html diff --git a/published/202004/20200228 Getting started with Linux firewalls.md b/published/202004/20200228 Getting started with Linux firewalls.md new file mode 100644 index 0000000000..a8a9749395 --- /dev/null +++ b/published/202004/20200228 Getting started with Linux firewalls.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12130-1.html) +[#]: subject: (Getting started with Linux firewalls) +[#]: via: (https://opensource.com/article/20/2/firewall-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 防火墙入门教程 +====== + +> 防火墙是你的计算机防止网络入侵的第一道屏障。为确保你的安全,请下载我们的备忘单。 + +![](https://img.linux.net.cn/data/attachment/album/202004/20/104205paugcytauqctqw6c.jpg) + +合理的防火墙是你的计算机防止网络入侵的第一道屏障。你在家里上网,通常互联网服务提供会在路由中搭建一层防火墙。当你离开家时,那么你计算机上的那层防火墙就是仅有的一层,所以配置和控制好你 Linux 电脑上的防火墙很重要。如果你维护一台 Linux 服务器,那么知道怎么去管理你的防火墙同样重要,只要掌握了这些知识你才能保护你的服务器免于本地或远程非法流量的入侵。 + +### 安装防火墙 + +很多 Linux 发行版本已经自带了防火墙,通常是 `iptables`。它很强大并可以自定义,但配置起来有点复杂。幸运的是,有开发者写出了一些前端程序来帮助用户控制防火墙,而不需要写冗长的 iptables 规则。 + +在 Fedora、CentOS、Red Hat 和一些类似的发行版本上,默认安装的防火墙软件是 `firewalld`,通过 `firewall-cmd` 命令来配置和控制。在 Debian 和大部分其他发行版上,可以从你的软件仓库安装 firewalld。Ubuntu 自带的是简单防火墙Uncomplicated Firewall(ufw),所以要使用 firewalld,你必须启用 `universe` 软件仓库: + +``` +$ sudo add-apt-repository universe +$ sudo apt install firewalld +``` + +你还需要停用 ufw: + +``` +$ sudo systemctl disable ufw +``` + +没有理由*不用* ufw。它是一个强大的防火墙前端。然而,本文重点讲 firewalld,因为大部分发行版都支持它而且它集成到了 systemd,systemd 是几乎所有发行版都自带的。 + +不管你的发行版是哪个,都要先激活防火墙才能让它生效,而且需要在启动时加载: + +``` +$ sudo systemctl enable --now firewalld +``` + +### 理解防火墙的域 + +Firewalld 旨在让防火墙的配置工作尽可能简单。它通过建立zone来实现这个目标。一个域是一组的合理、通用的规则,这些规则适配大部分用户的日常需求。默认情况下有九个域。 + + * `trusted`:接受所有的连接。这是最不偏执的防火墙设置,只能用在一个完全信任的环境中,如测试实验室或网络中相互都认识的家庭网络中。 + * `home`、`work`、`internal`:在这三个域中,接受大部分进来的连接。它们各自排除了预期不活跃的端口进来的流量。这三个都适合用于家庭环境中,因为在家庭环境中不会出现端口不确定的网络流量,在家庭网络中你一般可以信任其他的用户。 + * `public`:用于公共区域内。这是个偏执的设置,当你不信任网络中的其他计算机时使用。只能接收选定的常见和最安全的进入连接。 + * `dmz`:DMZ 表示隔离区。这个域多用于可公开访问的、位于机构的外部网络、对内网访问受限的计算机。对于个人计算机,它没什么用,但是对某类服务器来说它是个很重要的选项。 + * `external`:用于外部网络,会开启伪装(你的私有网络的地址被映射到一个外网 IP 地址,并隐藏起来)。跟 DMZ 类似,仅接受经过选择的传入连接,包括 SSH。 + * `block`:仅接收在本系统中初始化的网络连接。接收到的任何网络连接都会被 `icmp-host-prohibited` 信息拒绝。这个一个极度偏执的设置,对于某类服务器或处于不信任或不安全的环境中的个人计算机来说很重要。 + * `drop`:接收的所有网络包都被丢弃,没有任何回复。仅能有发送出去的网络连接。比这个设置更极端的办法,唯有关闭 WiFi 和拔掉网线。 + +你可以查看你发行版本的所有域,或通过配置文件 `/usr/lib/firewalld/zones` 来查看管理员设置。举个例子:下面是 Fefora 31 自带的 `FedoraWorkstation` 域: + +``` +$ cat /usr/lib/firewalld/zones/FedoraWorkstation.xml + + + Fedora Workstation + Unsolicited incoming network packets are rejected from port 1 to 1024, except for select network services. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed. + + + + + + +``` + +### 获取当前的域 + +任何时候你都可以通过 `--get-active-zones` 选项来查看你处于哪个域: + +``` +$ sudo firewall-cmd --get-active-zones +``` + +输出结果中,会有当前活跃的域的名字和分配给它的网络接口。笔记本电脑上,在默认域中通常意味着你有个 WiFi 卡: + +``` +FedoraWorkstation +  interfaces: wlp61s0 +``` + +### 修改你当前的域 + +要更改你的域,请将网络接口重新分配到不同的域。例如,把例子中的 `wlp61s0` 卡修改为 public 域: + +``` +$ sudo firewall-cmd --change-interface=wlp61s0 --zone=public +``` + +你可以在任何时候、任何理由改变一个接口的活动域 —— 无论你是要去咖啡馆,觉得需要增加笔记本的安全策略,还是要去上班,需要打开一些端口进入内网,或者其他原因。在你凭记忆学会 `firewall-cmd` 命令之前,你只要记住了关键词 `change` 和 `zone`,就可以慢慢掌握,因为按下 `Tab` 时,它的选项会自动补全。 + +### 更多信息 + +你可以用你的防火墙干更多的事,比如自定义已存在的域,设置默认域,等等。你对防火墙越了解,你在网上的活动就越安全,所以我们创建了一个[备忘单][2]便于速查和参考。 + +- 下载你的 [防火墙备忘单][2]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/firewall-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/downloads/firewall-cmd-cheat-sheet diff --git a/published/202004/20200309 Fish - A Friendly Interactive Shell.md b/published/202004/20200309 Fish - A Friendly Interactive Shell.md new file mode 100644 index 0000000000..cb7b6cb62d --- /dev/null +++ b/published/202004/20200309 Fish - A Friendly Interactive Shell.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12069-1.html) +[#]: subject: (Fish – A Friendly Interactive Shell) +[#]: via: (https://fedoramagazine.org/fish-a-friendly-interactive-shell/) +[#]: author: (Michal Konečný https://fedoramagazine.org/author/zlopez/) + +Fish:一个友好的交互式 Shell +====== + +![Fish — A Friendly Interactive Shell][1] + +你是否正在寻找 bash 的替代品?你是否在寻找更人性化的东西?不用再看了,因为你刚发现了 fish! + +Fish(友好的交互式 shell)是一个智能且用户友好的命令行 shell,可在 Linux、MacOS 和其他操作系统上运行。可以将其用于终端的日常工作和脚本编写。用 fish 编写的脚本比相同的 bash 版本具有更少的神秘性。 + +### Fish 的用户友好功能 + +* **建议**:Fish 会提示你之前写过的命令。当经常输入相同命令时,这样可以提高生产率。 +* **健全的脚本能力**:Fish 避免使用那些隐秘字符。这提供了更清晰和更友好的语法。 +* **基于手册页的补全**:Fish 会根据命令的手册页自动补全参数。 +* **语法高亮**:Fish 会高亮显示命令语法以使其在视觉上友好。 + +### 安装 + +#### Fedora 工作站 + +使用 `dnf` 命令安装 fish: + +``` +$ sudo dnf install fish +``` + +安装 `util-linux-user` 包,然后使用适当的参数运行 `chsh`(更改 shell 程序)命令,将 fish 设置为默认 shell 程序: + +``` +$ sudo dnf install util-linux-user +$ chsh -s /usr/bin/fish +``` + +你需要注销然后重新登录,更改才能生效。 + +#### Fedora Silverblue + +由于它不是 GUI 应用,因此你需要使用 `rpm-ostree` 将其加到层内。使用以下命令在 Fedora Silverblue 上安装 fish: + +``` +$ rpm-ostree install fish +``` + +在 Fedora Silverblue 上,你需要重启 PC 才能切换到新的 ostree 镜像。 + +如果你想在 Fedora Silverblue 用 fish 作为主要 shell,最简单的方法是更新 `/etc/passwd` 文件。找到你的用户,并将 `/bin/bash` 更改为 `/usr/bin/fish`。 + +你需要 [root 权限][2]来编辑 `/etc/passwd` 文件。另外,你需要注销并重新登录才能使更改生效。 + +### 配置 + +fish 的用户配置文件在 `~/.config/fish/config.fish`。要更改所有用户的配置,请编辑 `/etc/fish/config.fish`。 + +用户配置文件必须手动创建。安装脚本不会创建 `~/.config/fish/config.fish`。 + +以下是两个个配置示例以及它们的 bash 等效项,以帮助你入门: + +#### 创建别名 + +* `~/.bashrc`:`alias ll='ls -lh'` +* `~/.config/fish/config.fish`: `alias ll='ls -lh'` + +#### 设置环境变量 + + * `~/.bashrc`:`export PATH=$PATH:~/bin` + * `~/.config/fish/config.fish`:`set -gx PATH $PATH ~/bin` + +### 使用 fish 工作 + +将 fish 配置为默认 shell 程序后,命令提示符将类似于下图所示。如果尚未将 fish 配置为默认 shell,只需运行 `fish` 命令以在当前终端会话中启动。 + +![][3] + +在你开始输入命令时,你会注意到语法高亮显示: + +![][4] + +很酷,不是吗?🙂 + +你还将在输入时看到建议的命令。例如,再次开始输入上一个命令: + +![][5] + +注意输入时出现的灰色文本。灰色文本显示建议之前编写的命令。要自动补全,只需按 `CTRL+F`。 + +通过输入连接号(`–`)然后使用 `TAB` 键,它会根据前面命令的手册页获取参数建议: + +![][6] + +如果你按一次 `TAB`,它将显示前几个建议(或所有建议,如果只有少量参数可用)。如果再次按 `TAB`,它将显示所有建议。如果连续三次按 `TAB`,它将切换到交互模式,你可以使用箭头键选择一个参数。 + +除此之外,fish 的工作与大多数其他 shell 相似。其他差异已经写在文档中。因此,找到你可能感兴趣的其他功能应该不难。 + +### 让 fish 变得更强大 + +使用 [powerline][7] 使 fish 变得更强大。Powerline 可以为 fish 的界面添加命令执行时间、彩色化 git 状态、当前 git 分支等。 + +在安装 powerline 之前,你必须先安装 [Oh My Fish][8]。Oh My Fish 扩展了 fish 的核心基础架构,以支持安装其他插件。安装 Oh My Fish 的最简单方法是使用 `curl` 命令: + +``` +> curl -L https://get.oh-my.fish | fish +``` + +如果你不想直接将安装命令管道传给 `fish`,请参见 Oh My Fish 的 [README][9] 的安装部分,以了解其他安装方法。 + +Fish 的 powerline 插件是 [bobthefish][7]。Bobthefish 需要 `powerline-fonts` 包。 + +在 Fedora 工作站上: + +``` +> sudo dnf install powerline-fonts +``` + +在 Fedora Silverblue 上: + +``` +> rpm-ostree install powerline-fonts +``` + +在 Fedora Silverblue 上,你必须重启以完成字体的安装。 + +安装 `powerline-fonts` 之后,安装 `bobthefish`: + +``` +> omf install bobthefish +``` + +现在你可以通过 powerline 体验 fish 的全部奇妙之处: + +![][10] + +### 更多资源 + +查看这些网页,了解更多 fish 内容: + + * [官网][11] + * [文档][12] + * [教程][13] + * [常见问题][14] + * [在线体验][15] + * [邮件列表][16] + * [GitHub][17] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fish-a-friendly-interactive-shell/ + +作者:[Michal Konečný][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/zlopez/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/fish-816x345.jpg +[2]: https://fedoramagazine.org/howto-use-sudo/ +[3]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-00-35.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-19-24.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-25-31.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-58-07.png +[7]: https://github.com/oh-my-fish/theme-bobthefish +[8]: https://github.com/oh-my-fish/oh-my-fish +[9]: https://github.com/oh-my-fish/oh-my-fish/blob/master/README.md#installation +[10]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-15-38-07.png +[11]: https://fishshell.com/ +[12]: https://fishshell.com/docs/current/index.html +[13]: https://fishshell.com/docs/current/tutorial.html +[14]: https://fishshell.com/docs/current/faq.html +[15]: https://rootnroll.com/d/fish-shell/ +[16]: https://sourceforge.net/projects/fish/lists/fish-users +[17]: https://github.com/fish-shell/fish-shell/ diff --git a/published/202004/20200311 Directing Kubernetes traffic with Traefik.md b/published/202004/20200311 Directing Kubernetes traffic with Traefik.md new file mode 100644 index 0000000000..c9cc3c3f8e --- /dev/null +++ b/published/202004/20200311 Directing Kubernetes traffic with Traefik.md @@ -0,0 +1,381 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12049-1.html) +[#]: subject: (Directing Kubernetes traffic with Traefik) +[#]: via: (https://opensource.com/article/20/3/kubernetes-traefik) +[#]: author: (Lee Carpenter https://opensource.com/users/carpie) + +使用 Traefik 引导 Kubernetes 流量 +====== + +> 将流量引入 Kubernetes 树莓派集群的分步指南。 + +![Digital creative of a browser on the internet][1] + +在本文中,我们将部署几个简单的网站,并学习如何使用 Traefik 将来自外部世界的流量引入到我们的集群中。之后,我们还将学习如何删除 Kubernetes 资源。让我们开始吧! + +- [video](https://img.linux.net.cn/static/video/Ingressing%20with%20k3s-QcC-5fRhsM8.mp4) + +### 准备 + +要继续阅读本文,你只需要我们在上一篇文章中构建的 [k3s 树莓派集群][2]。由于你的集群将从网络上拉取镜像,因此该集群需要能够访问互联网。 + +出于解释目的,本文将显示一些配置文件和示例 HTML 文件。所有示例文件都可以在[此处][3]下载。 + +### 部署一个简单的网站 + +之前,我们使用 `kubectl` 进行了直接部署。但是,这不是典型的部署方法。一般情况都会使用 YAML 配置文件,这也是我们要在本文中使用的配置文件。我们将从顶部开始,并以自顶向下的方式创建该配置文件。 + +### 部署配置 + +首先是部署配置。配置如下所示,并在下面进行说明。我通常以 [Kubernetes 文档][4]中的示例为起点,然后根据需要对其进行修改。例如,下面的配置是复制了[部署文档][5]中的示例后修改的。 + +创建一个文件 `mysite.yaml`,其内容如下: + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mysite-nginx + labels: + app: mysite-nginx +spec: + replicas: 1 + selector: + matchLabels: + app: mysite-nginx + template: + metadata: + labels: + app: mysite-nginx + spec: + containers: + - name: nginx + image: nginx + ports: + - containerPort: 80 +``` + +其中大部分是样板。重要的部分,我们会将该部署命名为 `mysite-nginx`,并为其加上同名的 `app` 标签。我们指定了一个副本replica,这意味着将只创建一个 Pod。我们还指定了一个容器,我们将其命名为 `nginx`。我们将镜像image指定为 `nginx`。这意味着在部署时,k3s 将从 DockerHub 下载 `nginx` 镜像并从中创建一个 Pod。最后,我们指定了容器端口containerPort为 `80`,这只意味着在容器内部 Pod 会监听 `80` 端口。 + +我在上面强调了“在容器内部”,因为这是一个重要的区别。由于我们是按容器配置的,因此只能在容器内部访问它,并且进一步将其限制为内部网络。这对于允许多个容器在同一容器端口上监听所是必要的。换句话说,通过这种配置,其他一些 Pod 也可以在其容器端口 80 上侦听,并且不会与此容器冲突。为了提供对该 Pod 的正式访问权限,我们需要一个服务service配置。 + +### 服务配置 + +在 Kubernetes 中,服务service是一种抽象。它提供了一种访问 Pod 或 Pod 集合的方法。当连接到服务时,服务会路由到单个 Pod,或者如果定义了多个 Pod 副本,会通过负载均衡路由到多个 Pod。 + +可以在同一配置文件中指定该服务,这就是我们将在此处要做的。用 `---` 分隔配置区域,将以下内容添加到 `mysite.yaml` 中: + +``` +--- +apiVersion: v1 +kind: Service +metadata: + name: mysite-nginx-service +spec: + selector: + app: mysite-nginx + ports: + - protocol: TCP + port: 80 +``` + +在此配置中,我们将服务命名为 `mysite-nginx-service`。我们提供了一个选择器selector:`app: mysite-nginx`。这是服务选择其路由到的应用程序容器的方式。请记住,我们为容器提供了 `app` 标签:`mysite-nginx` 。这就是服务用来查找我们的容器的方式。最后,我们指定服务协议为 `TCP`,在端口 `80` 上监听。 + +### 入口配置 + +入口Ingress配置指定了如何将流量从集群外部传递到集群内部的服务。请记住,k3s 预先配置了 Traefik 作为入口控制器。因此,我们将编写特定于 Traefik 的入口配置。将以下内容添加到 `mysite.yaml` 中(不要忘了用 `---` 分隔): + +``` +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: mysite-nginx-ingress + annotations: + kubernetes.io/ingress.class: "traefik" +spec: + rules: + - http: + paths: + - path: / + backend: + serviceName: mysite-nginx-service + servicePort: 80 +``` + +在此配置中,我们将入口记录命名为 `mysite-nginx-ingress`。我们告诉 Kubernetes,我们希望 `traefik` 成为我们的入口控制器,再加上 `kubernetes.io/ingress.class` 的注解。 + +在规则rules部分中,我们基本上是说,当 `http` 流量进入时,并且 `path` 匹配 `/`(或其下的任何内容),将其路由到由 `serviceName mysite-nginx-service` 指定的后端backend服务中,并将其路由到 `servicePort 80`。这会将传入的 HTTP 流量连接到我们之前定义的服务。 + +### 需要部署的东西 + +就配置而言,就是这样了。如果我们现在部署,我们将获得默认的 nginx 页面,但这不是我们想要的。让我们创建一些简单但可自定义的部署方式。创建具有以下内容的文件 `index.html`: + +``` + +K3S! + + + +
Hello from K3S!
+ + +``` + +我们尚未介绍 Kubernetes 中的存储机制,因此在这里我们偷懒一下,仅将该文件存储在 Kubernetes 配置映射中。这不是我们推荐的部署网站的方式,但对于我们的目的来说是可行的。运行以下命令: + +``` +kubectl create configmap mysite-html --from-file index.html +``` + +该命令从本地文件 `index.html` 创建名为 `mysite-html` 的配置映射configmap资源。这实际上是在 Kubernetes 资源中存储一个文件(或一组文件),我们可以在配置中调出该文件。它通常用于存储配置文件(因此而得名),我们在这里稍加滥用。在以后的文章中,我们将讨论 Kubernetes 中适当的存储解决方案。 + +创建配置映射后,让我们将其挂载在我们的 `nginx` 容器中。我们分两个步骤进行。首先,我们需要指定一个volume来调出配置映射。然后我们需要将该卷挂载到 `nginx` 容器中。通过在 `mysite.yaml` 中的 `container` 后面的 `spec` 标签下添加以下内容来完成第一步: + +``` +      volumes: +      - name: html-volume +        configMap: +          name: mysite-html +``` + +这告诉 Kubernetes 我们要定义一个名为 `html-volume` 的卷,并且该卷应包含名为 `html-volume`(我们在上一步中创建的)的配置映射的内容。 + +接下来,在 `nginx` 容器规范中的端口ports下方,添加以下内容: + +``` +        volumeMounts: +        - name: html-volume +          mountPath: /usr/share/nginx/html +``` + +这告诉 Kubernetes,对于 `nginx` 容器,我们想在容器中的 `/usr/share/nginx/html` 路径上挂载名为 `html-volume` 的卷。 为什么要使用 `/usr/share/nginx/html`?那个位置就是 `nginx` 镜像提供 HTML 服务的地方。通过在该路径上挂载卷,我们用该卷内容替换了默认内容。 + +作为参考,配置文件的 `deployment` 部分现在应如下所示: + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: +  name: mysite-nginx +  labels: +    app: mysite-nginx +spec: +  replicas: 1 +  selector: +    matchLabels: +      app: mysite-nginx +  template: +    metadata: +      labels: +        app: mysite-nginx +    spec: +      containers: +      - name: nginx +        image: nginx +        ports: +        - containerPort: 80 +        volumeMounts: +        - name: html-volume +          mountPath: /usr/share/nginx/html +      volumes: +      - name: html-volume +        configMap: +          name: mysite-html +``` + +### 部署它! + +现在我们准备部署! 我们可以这样做: + +``` +kubectl apply -f mysite.yaml +``` + +你应该看到类似于以下内容: + +``` +deployment.apps/mysite-nginx created +service/mysite-nginx-service created +ingress.networking.k8s.io/mysite-nginx-ingress created +``` + +这意味着 Kubernetes 为我们指定的三个配置分别创建了资源。使用以下方法检查 Pod 的状态: + +``` +kubectl get pods +``` + +如果看到状态为 `ContainerCreating`,请给它一些时间并再次运行 `kubectl get pods`。通常,第一次会花一些时间,因为 k3s 必须下载 `nginx` 镜像来创建 Pod。一段时间后,你应该看到 `Running` 的状态。 + +### 尝试一下! + +Pod 运行之后,就该尝试了。打开浏览器,然后在地址栏中输入 `kmaster`。 + +![][6] + +恭喜你!你已经在 k3s 集群上部署了一个网站! + +### 另一个 + +因此,现在我们有了一个运行单个网站的整个 k3s 集群。但是我们可以有更多的网站!如果我们要在同一集群中提供另一个网站怎么办?让我们看看如何做到这一点。 + +同样,我们需要部署一些东西。碰巧我的狗有一条她想让全世界都知道的信息,她想了好久了。因此,我专门为她制作了一些 HTML(可从示例 zip 文件中获得)。同样,我们将使用配置映射的技巧来托管这些 HTML。这次我们将把整个目录(`html` 目录)放到配置映射中,但是调用是相同的。 + +``` +kubectl create configmap mydog-html --from-file html +``` + +现在,我们需要为此站点创建一个配置文件。它几乎与用于 `mysite.yaml` 的完全相同,因此首先将 `mysite.yaml` 复制为 `mydog.yaml`。现在将 `mydog.yaml` 修改为: + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mydog-nginx + labels: + app: mydog-nginx +spec: + replicas: 1 + selector: + matchLabels: + app: mydog-nginx + template: + metadata: + labels: + app: mydog-nginx + spec: + containers: + - name: nginx + image: nginx + ports: + - containerPort: 80 + volumeMounts: + - name: html-volume + mountPath: /usr/share/nginx/html + volumes: + - name: html-volume + configMap: + name: mydog-html +--- +apiVersion: v1 +kind: Service +metadata: + name: mydog-nginx-service +spec: + selector: + app: mydog-nginx + ports: + - protocol: TCP + port: 80 +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: mydog-nginx-ingress + annotations: + kubernetes.io/ingress.class: "traefik" + traefik.frontend.rule.type: PathPrefixStrip +spec: + rules: + - http: + paths: + - path: /mydog + backend: + serviceName: mydog-nginx-service + servicePort: 80 +``` + +我们只需进行搜索并将 `mysite` 替换为 `mydog`即可完成大多数修改。其他两个修改在入口部分中。我们将 `path` 更改为 `/mydog`,并添加了一个注解 `traefik.frontend.rule.type: PathPrefixStrip`。 + +`/mydog` 路径的规范指示 Traefik 将以 `/mydog` 路径开头的所有传入请求路由到 `mydog-nginx-service`。任何其他路径将继续路由到 `mysite-nginx-service`。 + +新的注解 `PathPrefixStrip` 告诉 Traefik 在将请求发送到 `mydog-nginx-service` 之前先去除前缀 `/mydog`。我们这样做是因为 `mydog-nginx` 应用程序不需要前缀。这意味着我们可以简单地通过更改入口记录中的前缀来更改挂载的服务的位置。 + +现在我们可以像以前一样进行部署: + +``` +kubectl apply -f mydog.yaml +``` + +现在,我的狗的消息应该可以在 上找到。 + +![][7] + + +呼!消息发出去了!也许今晚我们都可以睡一觉。 + +因此,现在,我们有了一个 k3s 集群,该集群托管了两个网站,Traefik 根据路径名决定将请求传递给哪个服务!但是,不仅限于基于路径的路由,我们也可以使用基于主机名的路由,我们将在以后的文章中进行探讨。 + +另外,我们刚刚托管的网站是标准的未加密 HTML 网站,而如今的所有内容都使用 SSL/TLS 加密。在我们的下一篇文章中,我们将为 k3s 集群添加支持以托管 SSL/TLS HTTPS 站点! + +### 清理 + +在开始之前,由于本文主要涉及的是示例站点,因此我想向你展示如何删除内容,以防万一你不希望将这些示例丢在集群中。 + +对于大多数配置,只需使用与部署时使用的相同配置文件运行 `delete` 命令即可撤消配置。因此,让我们同时清理 `mysite` 和 `mydog`。 + +``` +kubectl delete -f mysite.yaml +kubectl delete -f mydog.yaml +``` + +由于我们是手动创建配置映射的,因此我们也需要手动删除它们。 + +``` +kubectl delete configmap mysite-html +kubectl delete configmap mydog-html +``` + +现在,如果我们执行 `kubectl get pods`,我们应该看到我们的 nginx Pod 不存在了。 + +``` +$ kubectl get pods +No resources found in default namespace. +``` + +一切都清理了。 + +请在下面的评论中告诉我你对这个项目有什么想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/kubernetes-traefik + +作者:[Lee Carpenter][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/carpie +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://linux.cn/article-12049-1.html +[3]: https://gitlab.com/carpie/ingressing_with_k3s/-/archive/master/ingressing_with_k3s-master.zip +[4]: https://kubernetes.io/docs/ +[5]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#creating-a-deployment +[6]: https://opensource.com/sites/default/files/uploads/mysite.jpg +[7]: https://opensource.com/sites/default/files/uploads/mydog.jpg diff --git a/published/202004/20200311 What you need to know about variables in Emacs.md b/published/202004/20200311 What you need to know about variables in Emacs.md new file mode 100644 index 0000000000..a53c1200ed --- /dev/null +++ b/published/202004/20200311 What you need to know about variables in Emacs.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (cycoe) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12150-1.html) +[#]: subject: (What you need to know about variables in Emacs) +[#]: via: (https://opensource.com/article/20/3/variables-emacs) +[#]: author: (Clemens Radermacher https://opensource.com/users/clemera) + +关于 Emacs 中的变量你需要知道的事情 +====== + +> 学习 Elisp 是如何处理变量的,以及如何在你的脚本与配置中使用它们。 + +![](https://img.linux.net.cn/data/attachment/album/202004/25/190905pq1qfk1f8f9qs9v8.jpg) + +GNU Emacs 是由 C 和 Emacs Lisp(Elisp,Lisp 编程语言的一种方言)写成,它是一个编辑器的同时,又碰巧是 Elisp 的沙盒。因此,理解 Elisp 中的一些基本编程概念会对你有一些帮助。 + +如果你是 [Emacs][2] 新手,请先阅读 Sacha Chua 的《[给 Emacs 新手的资源][3]》精品帖。本篇文章假定你熟悉常见的 Emacs 术语,并且能够阅读并求值 Elisp 代码的简单片段。最好你也听说过变量作用域的概念,知道它在其它编程语言中的作用。本篇文章中的示例假定你使用的是相对较新的 Emacs 版本([v.25 之后的版本][4])。 + +[Elisp 手册][5] 包含了 Elisp 的方方面面,但它是写给那些有明确查找目标的人们的(它在这方面也做得相当棒)。但是很多人想要能够在更高的层次上解释 Elisp 概念的材料,同时将信息压缩成最精华的部分。本篇文章也正是我回应这种呼声的一次尝试,为读者描绘基础的大体轮廓。使他们能在配置中用上这些技巧,也让他们在手册中查询细节变得更容易。 + +### 全局变量 + +用 `defcustom` 定义的用户设置和用 `defvar` 或 `defconst` 定义的变量是全局的。使用 `defcustom` 或 `defvar` 声明变量的一个非常重要的原因是,当一个变量已经被绑定bind,对它们进行重新求值不会覆盖掉已有的值。举个栗子,如果你在初始化文件中对 `my-var` 进行如下绑定: + +``` +(setq my-var nil) +``` + +对如下表达式求值不会将变量覆盖为 `t`: + +``` +(defvar my-var t) +``` + +注意此处有*一个例外*:如果你用 `C-M-x` 快捷键对上述声明求值,它将调用 `eval-defun` 函数,并将变量覆盖为 `t`。通过此方式,你可以按需将变量强制覆盖。这种行为是刻意而为之的:你可能知道,Emacs 中的许多特性是按需加载的,也可以称为自动加载。如果那些文件中的声明将变量覆盖为它们的默认值,那它也就覆盖了你初始化文件中的设置。 + +### 用户选项 + +用户选项就是使用 `defcustom` 声明的全局变量。与使用 `defvar` 声明的变量不同,这些变量可以用 `M-x customize` 界面来配置。据我所知,大部分人因为觉得它开销较大而不经常使用。一旦你知道如何在你的初始化文件中设置变量,也就没有理由一定要去使用它了。许多用户没有意识到的一个细节是,通过 `customize` 的方式设置用户选项能够执行代码,有的时间可用来运行一些附加的配置说明: + +``` +(defcustom my-option t +  "My user option." +  :set (lambda (sym val) +         (set-default sym val) +         (message "Set %s to %s" sym val))) +``` + +若你对这段代码求值,并键入 `M-x customize-option RET my-option RET` 运行 `customize` 界面,lambda 匿名函数就会被调用,回显区域就会显示出该选项的符号名与值。 + +如果你在初始化文件中使用 `setq` 改变该选项的值,那么匿名函数不会运行。要想在 Elisp 中正确设置一个选项,你需要使用函数 `customize-set-variable`。或者,人们在他们的配置文件中使用了各种版本的 `csetq` 宏来自动处理(如你所愿,你可以通过 GitHub 的代码搜索发现更复杂的变体)。 + +``` +(defmacro csetq (sym val) +  `(funcall (or (get ',sym 'custom-set) 'set-default) ',sym ,val)) +``` + +若你正在使用 [use-package][6] 宏,`:custom` 关键字会替你处理好以上这些。 + +在你将以上代码放入到你的初始化文件中之后,你便可以使用 `csetq` 宏在设置变量的同时运行任何现存的 `setter` 函数。要证明这点,你可以使用此宏来改变上面定义的选项,并观察回显区域的消息输出。 + +``` +(csetq my-option nil) +``` + +### 动态绑定与词法绑定 + +当你在使用其它编程语言时,你可能不会意识到动态绑定与词法绑定的区别。当今的大部分编程语言使用词法绑定,并且在学习变量作用域与变量查找时也没有必要去了解它们之间的区别。 + +如此看来,Emacs Lisp 比较特殊因为动态绑定是默认选项,词法绑定需要显式启用。这里有一些历史遗留原因,但在实际使用中,你应该*时刻*启用词法绑定,因为它更快并且不容易出错。要启用词法绑定,只需将如下的注释行作为你的 Emacs Lisp 文件的第一行: + +``` +;;; -*- lexical-binding: t; -*- +``` + +另一种方式,你可以调用 `add-file-local-variable-prop-line`,在你选择将变量 `lexical-binding` 置为 `t` 后,会自动插入如上的注释行。 + +在加载包含如上特殊格式行的文件时,Emacs 会相应地设置变量,这意味着该缓冲区中的代码加载时启用了词法绑定。若要采用交互式的方式,你可以调用 `M-x eval-buffer` 命令,它会将词法绑定考虑在内。 + +既然你已经知道了如何启用词法绑定,那么了解这些术语的含义就很明智了。对于动态绑定,在程序执行期间建立的最后一个绑定将用于变量查找。你可以通过将以下代码放入空缓冲区并执行 `M-x eval buffer`,以对此进行测试: + +``` +(defun a-exists-only-in-my-body (a) +  (other-function)) + +(defun other-function () +  (message "I see `a', its value is %s" a)) + +(a-exists-only-in-my-body t) +``` + +你可能会很惊讶地发现,在 `other-function` 中查找变量 `a` 竟然成功了。 + +若你在顶部添加了特殊的词法绑定注释后,重新运行前面的示例,这段代码将抛出 `variable is void` 错误,因为 `other-functioin` 无法识别变量 `a`。如果你使用的是其它编程语言,这才是你所期望的行为。 + +启用词法绑定后,作用域会由周围的代码所定义。这并不单单是性能原因,时间也已经表明了词法绑定才是更受喜爱的。 + +### 特殊变量与动态绑定 + +如你所知,`let` 用于临时建立局部绑定: + +``` +(let ((a "I'm a") +      (b "I'm b")) +  (message "Hello, %s. Hello %s" a b)) +``` + +接下来有趣的是——使用 `defcustom`、`defvar` 以及 `defconst` 定义的变量被称为*特殊变量*,不论词法绑定是否启用,它们都将使用动态绑定: + +``` +;;; -*- lexical-binding: t; -*- + +(defun some-other-function () +  (message "I see `c', its value is: %s" c)) + +(defvar c t) + +(let ((a "I'm lexically bound") +      (c "I'm special and therefore dynamically bound")) +  (some-other-function) +  (message "I see `a', its values is: %s" a)) +``` + +通过 `C-h e` 切换至 `Messages` 缓冲区,查看上述示例输出的消息。 + +使用 `let` 或者函数参数绑定的局部变量会遵循由 `lexical-binding` 变量定义的查找规则,但使用 `defvar`、`defconst` 或 `defcustom` 定义的全局变量,能够沿着调用栈在 `let` 表达式中被修改。 + +这种技巧允许方便地进行特殊定制,并且经常在 Emacs 中被使用。这并不奇怪,毕竟 Emacs Lisp 最开始只提供动态绑定作为唯一选择。下面是一个常见的示例,说明如何向只读缓冲区临时写入数据: + +``` +(let ((inhibit-read-only t)) +  (insert ...)) +``` + +这是另一个常见的示例,如何进行大小写敏感的搜索: + +``` +(let ((case-fold-search nil)) +  (some-function-which-uses-search ...)) +``` + +动态绑定允许你采用作者未曾预料的方式对函数进行修改。对于像 Emacs 这样设计使用的程序来说,这是个强大的工具与特性。 + +有一点需要注意:你可能会意外地使用局部变量名,该变量在其他地方被声明为特殊变量。防止这种冲突的一个技巧是避免在局部变量名中使用下划线。在我当前的 Emacs 会话中,以下代码只留下少数潜在冲突的候选: + +``` +(let ((vars ())) + (mapatoms + (lambda (cand) + (when (and (boundp cand) + (not (keywordp cand)) + (special-variable-p cand) + (not (string-match "-" + (symbol-name cand)))) + (push cand vars)))) + vars) ;; => (t obarray noninteractive debugger nil) +``` + +### 缓冲区局部变量 + +每个缓冲区都能够拥有变量的一个局部绑定。这就意味着对于任何变量,都会首先在当前缓冲区中查找缓冲区局部变量取代默认值。局部变量是 Emacs 中一个非常重要的特性,比如它们被主模式用来建立缓冲区范围内的行为与设置。 + +事实上你已经在本文中见过*缓冲区局部变量*——也就是将 `lexical-binding` 在缓冲区范围内设置为 `t` 的特殊注释行。在 Emacs 中,在特殊注释行中定义的缓冲区局部变量也被称为*文件局部变量*。 + +任何的全局变量都可以用缓冲区局部变量来遮掩,比如上面定义的变量 `my-var`,你可用如下方式设置局部变量: + +``` +(setq-local my-var t) +;; or (set (make-local-variable 'my-var) t) +``` + +此时 `my-var` 对于你在对上述代码进行求值时对应的缓冲区来说就是局部变量。若你对它调用 `describe-variable`,文档会同时告诉你局部与全局的值。从编程的角度来讲,你可以分别用 `buffer-local-value` 获取局部值,用 `default-value` 获取全局值。若要移除局部值,你可以调用 `kill-local-variable`。 + +另一个需要注意的重要性质就是,一旦一个变量成为缓冲区局部变量,后续在该缓冲区中使用的 `setq` 都将只能设置局部的值。要想设置默认值,你需要使用 `setq-default`。 + +因为局部变量意味着对缓冲区的定制,它们也就经常被用于模式钩子中。一个典型的例子如下所示: + +``` +(add-hook 'go-mode-hook +          (defun go-setup+ () +            (setq-local compile-command +              (if (string-suffix-p "_test.go" buffer-file-name) +                  "go test -v" +                (format "go run %s" +                        (shell-quote-argument +                         (file-name-nondirectory buffer-file-name))))))) +``` + +这将设置 `go-mode` 缓冲区中 `M-x compile` 使用的编译命令。 + +另一个重要的方面就是一些变量会*自动*成为缓冲区局部变量。这也就意味着当你使用 `setq` 设置这样一个变量时,它会针对当前缓冲区设置局部绑定。这个特性不应该被经常使用,因为这种隐式的行为并不好。不过如果你想的话,你可以使用如下方法创建自动局部变量: + +``` +(defvar-local my-automatical-local-var t) +;; or (make-variable-buffer-local 'my-automatical-local-var) +``` + +变量 `indent-tabs-mode` 就是 Emacs 内建的一个例子。如果你在初始化文件中使用 `setq` 改变变量的值,根本不会影响默认值。只有在你加载初始化文件时正处在当前的缓冲区的局部值会被改变。因此,你需要使用 `setq-default` 来改变 `indent-tabs-mode` 的默认值。 + +### 结语 + +Emacs 是一个强大的编辑器,并且随着你的定制它将变得更加强大。现在,你知道了 Elisp 是如何处理变量的,以及你应如何在你自己的脚本与配置中使用它们。 + +*本篇文章此前采用 CC BY-NC-SA 4.0 许可证发布在 [With-Emacs][7] 上,经过修改(带有合并请求)并在作者允许的情况下重新发布。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/variables-emacs + +作者:[Clemens Radermacher][a] +选题:[lujun9972][b] +译者:[cycoe](https://github.com/cycoe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clemera +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) +[2]: https://www.gnu.org/software/emacs/ +[3]: http://sachachua.com/blog/p/27144 +[4]: https://www.gnu.org/software/emacs/download.html +[5]: https://www.gnu.org/software/emacs/manual/html_node/elisp/ +[6]: https://github.com/jwiegley/use-package#customizing-variables +[7]: https://with-emacs.com/posts/tutorials/almost-all-you-need-to-know-about-variables/ diff --git a/translated/tech/20200312 Make SSL certs easy with k3s.md b/published/202004/20200312 Make SSL certs easy with k3s.md similarity index 66% rename from translated/tech/20200312 Make SSL certs easy with k3s.md rename to published/202004/20200312 Make SSL certs easy with k3s.md index 241f8891f5..657d88123f 100644 --- a/translated/tech/20200312 Make SSL certs easy with k3s.md +++ b/published/202004/20200312 Make SSL certs easy with k3s.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12106-1.html) [#]: subject: (Make SSL certs easy with k3s) [#]: via: (https://opensource.com/article/20/3/ssl-letsencrypt-k3s) [#]: author: (Lee Carpenter https://opensource.com/users/carpie) @@ -12,31 +12,31 @@ > 如何在树莓派上使用 k3s 和 Let's Encrypt 来加密你的网站。 -![Files in a folder][1] +![](https://img.linux.net.cn/data/attachment/album/202004/13/153032ncp8q55pjwdj8ppj.jpg) -在[上一篇文章][2]中,我们在 k3s 集群上部署了几个简单的网站。那些是未加密的网站。很好,它们可以工作,但是未加密的网站有点太过时了!如今,大多数网站都是加密的。在本文中,我们将安装 [cert-manager][3] 并将其用于在集群上以部署采用 TLS 加密的网站。这些网站不仅会被加密,而且还会使用有效的公共证书,这些证书会从 [Let's Encrypt][4] 自动获取和更新!让我们开始吧! +在[上一篇文章][2]中,我们在 k3s 集群上部署了几个简单的网站。那些是未加密的网站。不错,它们可以工作,但是未加密的网站有点太过时了!如今,大多数网站都是加密的。在本文中,我们将安装 [cert-manager][3] 并将其用于在集群上以部署采用 TLS 加密的网站。这些网站不仅会被加密,而且还会使用有效的公共证书,这些证书会从 [Let's Encrypt][4] 自动获取和更新!让我们开始吧! -### 所需材料 +### 准备 -要继续阅读本文,你将需要我们在上一篇文章中构建的 [k3s 树莓派集群][5]。另外,你需要拥有一个公用静态 IP 地址,并有一个可以为其创建 DNS 记录的域名。如果你有一个动态 DNS 提供程序为你提供域名,可能也行。但是,在本文中,我们将使用静态 IP 和 [CloudFlare][6] 来手动创建 DNS 的 A 记录。 +要继续阅读本文,你将需要我们在上一篇文章中构建的 [k3s 树莓派集群][5]。另外,你需要拥有一个公用静态 IP 地址,并有一个可以为其创建 DNS 记录的域名。如果你有一个动态 DNS 提供程序为你提供域名,可能也行。但是,在本文中,我们使用静态 IP 和 [CloudFlare][6] 来手动创建 DNS 的 A 记录。 我们在本文中创建配置文件时,如果你不想键入它们,则可以在[此处][7]进行下载。 ### 我们为什么使用 cert-manager? -Traefik(预先捆绑了 k3s)实际上具有内置的 Let's Encrypt 支持,因此你可能想知道为什么我们要安装第三方软件包来做同样的事情。在撰写本文时,Traefik 中的 Let's Encrypt 支持检索证书并将其存储在文件中。cert-manager 会检索证书并将其存储在 Kubernetes 的 “机密信息secrets” 中。我认为,“机密信息”可以简单地按名称引用,因此更易于使用。这就是我们在本文中使用 cert-manager 的主要原因。 +Traefik(在 k3s 预先捆绑了)实际上具有内置的 Let's Encrypt 支持,因此你可能想知道为什么我们要安装第三方软件包来做同样的事情。在撰写本文时,Traefik 中的 Let's Encrypt 支持检索证书并将其存储在文件中。而 cert-manager 会检索证书并将其存储在 Kubernetes 的 “机密信息secret” 中。我认为,“机密信息”可以简单地按名称引用,因此更易于使用。这就是我们在本文中使用 cert-manager 的主要原因。 ### 安装 cert-manager 通常,我们只是遵循 cert-manager 的[文档][8]在 Kubernetes 上进行安装。但是,由于我们使用的是 ARM 体系结构,因此我们需要进行一些更改,以便我们可以完成这个操作。 -第一步是创建 cert-manager 命名空间。命名空间有助于将 cert-manager 的吊舱Pod排除在我们的默认命名空间之外,因此当我们使用自己的“吊舱”执行 `kubectl get pods` 之类的操作时,我们不必看到它们。创建名称空间很简单: +第一步是创建 cert-manager 命名空间。命名空间有助于将 cert-manager 的 Pod 排除在我们的默认命名空间之外,因此当我们使用自己的 Pod 执行 `kubectl get pods` 之类的操作时,我们不必看到它们。创建名称空间很简单: ``` kubectl create namespace cert-manager ``` -这份安装说明会告诉你下载 cert-manager 的 YAML 配置文件并将其一步全部应用到你的集群。我们需要将其分为两个步骤,以便为基于 ARM 的树莓派修改文件。我们将下载文件并一步一步进行转换: +安装说明会让你下载 cert-manager 的 YAML 配置文件并将其一步全部应用到你的集群。我们需要将其分为两个步骤,以便为基于 ARM 的树莓派修改文件。我们将下载文件并一步一步进行转换: ``` curl -sL \ @@ -44,8 +44,7 @@ https://github.com/jetstack/cert-manager/releases/download/v0.11.0/cert-manager. sed -r 's/(image:.*):(v.*)$/\1-arm:\2/g' > cert-manager-arm.yaml ``` -这会下载配置文件,并将所有包含的 docker 镜像更新为 ARM 版本。来检查一下它做了什么: - +这会下载配置文件,并将包含的所有 docker 镜像更新为 ARM 版本。来检查一下它做了什么: ``` $ grep image: cert-manager-arm.yaml @@ -54,23 +53,23 @@ $ grep image: cert-manager-arm.yaml           image: "quay.io/jetstack/cert-manager-webhook-arm:v0.11.0" ``` -如我们所见,三个镜像现在在镜像名称上添加了 `-arm`。现在我们有了正确的文件,我们只需将其应用于集群: +如我们所见,三个镜像现在在镜像名称上添加了 `-arm`。现在我们有了正确的文件,我们只需将其应用于集群: ``` kubectl apply -f cert-manager-arm.yaml ``` -这将安装所有的 cert-manager。我们可以通过 `kubectl --namespace cert-manager get pods` 来检查安装何时完成,直到所有“吊舱”都处于 `Running` 状态。 +这将安装 cert-manager 的全部。我们可以通过 `kubectl --namespace cert-manager get pods` 来检查安装何时完成,直到所有 Pod 都处于 `Running` 状态。 -这实际上就完成了 cert-manager 的安装! +这就完成了 cert-manager 的安装! ### Let's Encrypt 概述 -Let's Encrypt 的好处是,它们免费为我们提供了经过公共验证的 TLS 证书!这意味着我们可以拥有一个完全有效的、可供任何人访问的 TLS 加密网站,这些家庭或业余的爱好活动挣不到钱,也无需自己掏腰包购买 TLS 证书!以及,当通过 cert-manager 使用 Let's Encrypt 的证书时,获得证书的整个过程是自动化的,证书的续订也是自动的! +Let's Encrypt 的好处是,它免费为我们提供了经过公共验证的 TLS 证书!这意味着我们可以拥有一个完全有效的、可供任何人访问的 TLS 加密网站,这些家庭或业余的爱好活动挣不到钱,也无需自己掏腰包购买 TLS 证书!以及,当通过 cert-manager 使用 Let's Encrypt 的证书时,获得证书的整个过程是自动化的,证书的续订也是自动的! -但它是如何工作的?下面是该过程的简化说明。我们(或代表我们的 cert-manager)向 Let's Encrypt 发出我们拥有的域名的证书请求。Let's Encrypt 通过使用 ACME DNS 或 HTTP 验证机制来验证我们是否拥有该域。如果验证成功,则 Let's Encrypt 将向我们提供证书,这些证书将由 cert-manager 安装在我们的网站(或其他 TLS 加密的终结点)中。在需要重复此过程之前,这些证书可以使用 90 天。但是,cert-manager 会自动为我们更新证书。 +但它是如何工作的?下面是该过程的简化说明。我们(或代表我们的 cert-manager)向 Let's Encrypt 发出我们拥有的域名的证书请求。Let's Encrypt 通过使用 ACME DNS 或 HTTP 验证机制来验证我们是否拥有该域。如果验证成功,则 Let's Encrypt 将向我们提供证书,这些证书将由 cert-manager 安装在我们的网站(或其他 TLS 加密的端点)中。在需要重复此过程之前,这些证书可以使用 90 天。但是,cert-manager 会自动为我们更新证书。 -在本文中,我们将使用 HTTP 验证方法,因为它更易于设置并且适用于大多数情况。以下是幕后将发生的基本过程。cert-manager 将向 Let's Encrypt 发出证书请求。作为回应,Let's Encrypt 将发出所有权验证的质询challenges。这个质询是将一个 HTTP 资源放在请求证书的域名下的一个特定 URL 上。从理论上讲,如果我们可以将该资源放在该 URL 上,并且让 Let's Encrypt 可以远程获取它,那么我们实际上必须是该域的所有者。否则,要么我们无法将资源放置在正确的位置,要么我们无法操纵 DNS 以使 Let's Encrypt 访问它。在这种情况下,cert-manager 会将资源放在正确的位置,并自动创建一个临时的 `Ingress` 记录,以将流量路由到正确的位置。如果 Let's Encrypt 可以读到该质询要求的资源并正确无误,它将把证书发回给 cert-manager。然后,cert-manager 将证书存储为“机密信息”,然后我们的网站(或其他任何网站)将使用这些证书通过 TLS 保护我们的流量。 +在本文中,我们将使用 HTTP 验证方法,因为它更易于设置并且适用于大多数情况。以下是幕后发生的基本过程。cert-manager 向 Let's Encrypt 发出证书请求。作为回应,Let's Encrypt 发出所有权验证的质询challenges。这个质询是将一个 HTTP 资源放在请求证书的域名下的一个特定 URL 上。从理论上讲,如果我们可以将该资源放在该 URL 上,并且让 Let's Encrypt 可以远程获取它,那么我们实际上必须是该域的所有者。否则,要么我们无法将资源放置在正确的位置,要么我们无法操纵 DNS 以使 Let's Encrypt 访问它。在这种情况下,cert-manager 会将资源放在正确的位置,并自动创建一个临时的 `Ingress` 记录,以将流量路由到正确的位置。如果 Let's Encrypt 可以读到该质询要求的资源并正确无误,它将把证书发回给 cert-manager。cert-manager 将证书存储为“机密信息”,然后我们的网站(或其他任何网站)将使用这些证书通过 TLS 保护我们的流量。 ### 为该质询设置网络 @@ -78,11 +77,11 @@ Let's Encrypt 的好处是,它们免费为我们提供了经过公共验证的 为了使质询过程正常运行,我们需要一个我们要申请证书的域名,以将其路由到端口 80 上的 k3s 集群。为此,我们需要告诉世界上的 DNS 系统它的位置。因此,我们需要将域名映射到我们的公共 IP 地址。如果你不知道你的公共 IP 地址是什么,可以访问 [WhatsMyIP][9] 之类的地方,它会告诉你。接下来,我们需要输入 DNS 的 A 记录,该记录将我们的域名映射到我们的公共 IP 地址。为了使此功能可靠地工作,你需要一个静态的公共 IP 地址,或者你可以使用动态 DNS 提供商。一些动态 DNS 提供商会向你颁发一个域名,你可以按照以下说明使用它。我没有尝试过,所以不能肯定地说它适用于所有提供商。 -对于本文,我们将假设有一个静态公共 IP 并使用 CloudFlare 来设置 DNS 的 A 记录。如果愿意,可以使用自己的 DNS 提供程序。重要的是你可以设置 A 记录。 +对于本文,我们假设有一个静态公共 IP,并使用 CloudFlare 来设置 DNS 的 A 记录。如果愿意,可以使用自己的 DNS 服务器。重要的是你可以设置 A 记录。 -在本文的其余部分中,我将使用 [k3s.carpie.net][10] 作为示例域,因为这是我拥有的域。你显然会用自己拥有的任何域替换它。 +在本文的其余部分中,我将使用 [k3s.carpie.net][10] 作为示例域名,因为这是我拥有的域。你显然会用自己拥有的任何域名替换它。 -为示例起见,假设我们的公共 IP 地址是 198.51.100.42。我们将转到我们的 DNS 提供商的 DNS 记录部分,并添加一个名为 [k3s.carpie.net][10] 的类型为 `A` 的记录(CloudFlare 已经假定了域的部分,因此我们只需输入 `k3s`),然后输入 `198.51.100.42` 作为 IPv4 地址。 +为示例起见,假设我们的公共 IP 地址是 198.51.100.42。我们转到我们的 DNS 提供商的 DNS 记录部分,并添加一个名为 [k3s.carpie.net][10] 的类型为 `A` 的记录(CloudFlare 已经假定了域的部分,因此我们只需输入 `k3s`),然后输入 `198.51.100.42` 作为 IPv4 地址。 ![][11] @@ -95,17 +94,17 @@ $ dig +short k3s.carpie.net 198.51.100.42 ``` -继续运行以上命令,直到可以返回 IP 才行。关于 CloudFlare 有个小注释:ClouldFlare 提供了通过代理流量来隐藏你的实际 IP 的服务。在这种情况下,我们取回的是 CloudFlare 的 IP,而不是我们的 IP。 但对于我们的目的,这应该可以正常工作。 +继续运行以上命令,直到可以返回 IP 才行。关于 CloudFlare 有个小注释:ClouldFlare 提供了通过代理流量来隐藏你的实际 IP 的服务。在这种情况下,我们取回的是 CloudFlare 的 IP,而不是我们的 IP。但对于我们的目的,这应该可以正常工作。 网络配置的最后一步是配置路由器,以将端口 80 和 443 上的传入流量路由到我们的 k3s 集群。可悲的是,路由器配置页面的差异很大,因此我无法确切地说明你的外观是什么样子。大多数时候,我们需要的管理页面位于“端口转发”或类似内容下。我甚至看到过它列在“游戏”之下(显然是端口转发主要用于的游戏)!让我们看看我的路由器的配置如何。 ![][12] -如果你和我的设置一样,则转到 192.168.0.1 登录到路由器管理应用程序。对于此路由器,它位于 “ NAT / QoS” -> “端口转发”。在这里,我们将端口 80/TCP 协议设置为转发到 192.168.0.50(主节点 `kmaster` 的 IP)的端口 80。我们还将端口 443 设置为也映射到 `kmaster`。从技术上讲,这对于质询来说并不是必需的,但是在本文的结尾,我们将部署一个启用 TLS 的网站,并且需要映射 443 来进行访问。因此,现在进行映射很方便。我们保存并应用更改,应该一切顺利! +如果你和我的环境一样,则转到 192.168.0.1 登录到路由器管理应用程序。对于此路由器,它位于 “ NAT/QoS” -> “端口转发”。在这里,我们将端口 80/TCP 协议设置为转发到 192.168.0.50(主节点 `kmaster` 的 IP)的端口 80。我们还设置端口 443 也映射到 `kmaster`。从技术上讲,这对于质询来说并不是必需的,但是在本文的结尾,我们将部署一个启用 TLS 的网站,并且需要映射 443 来进行访问。因此,现在进行映射很方便。我们保存并应用更改,应该一切顺利! ### 配置 cert-manager 来使用 Let's Encrypt(暂存环境) -现在,我们需要配置 cert-manager 来通过 Let's Encrypt 颁发证书。Let's Encrypt 为我们提供了一个暂存(例如用于测试)环境,以便审视我们的配置。这样它更能容忍错误和请求的频率。如果我们对生产环境做了错误的操作,我们很快就好发现自己被暂时禁止访问了!因此,我们将使用暂存环境手动测试请求。 +现在,我们需要配置 cert-manager 来通过 Let's Encrypt 颁发证书。Let's Encrypt 为我们提供了一个暂存(例如用于测试)环境,以便审视我们的配置。这样它更能容忍错误和请求的频率。如果我们对生产环境做了错误的操作,我们很快就会发现自己被暂时禁止访问了!因此,我们将使用暂存环境手动测试请求。 创建一个文件 `letsencrypt-issuer-staging.yaml`,内容如下: @@ -132,7 +131,7 @@ spec: 请确保将电子邮件地址更新为你的地址。如果出现问题或我们弄坏了一些东西,这就是 Let's Encrypt 与我们联系的方式! -现在,我们使用以下方法创建发行者: +现在,我们使用以下方法创建发行者issuer: ``` kubectl apply -f letsencrypt-issuer-staging.yaml @@ -150,7 +149,6 @@ kubectl get clusterissuers 创建一个包含以下内容的证书请求文件 `le-test-certificate.yaml`: - ``` apiVersion: cert-manager.io/v1alpha2 kind: Certificate @@ -167,7 +165,7 @@ spec: - k3s.carpie.net ``` -该记录仅表示我们要使用名为 `letsencrypt-staging`(我们在上一步中创建的)的 `ClusterIssuer` 来请求域 [k3s.carpie.net][10] 的证书,并在 Kubernetes 的机密信息中名为 `k3s-carpie-net-tls` 文件中存储该证书。 +该记录仅表示我们要使用名为 `letsencrypt-staging`(我们在上一步中创建的)的 `ClusterIssuer` 来请求域 [k3s.carpie.net][10] 的证书,并在 Kubernetes 的机密信息中名为 `k3s-carpie-net-tls` 的文件中存储该证书。 像平常一样应用它: @@ -188,11 +186,11 @@ NAME                    READY   SECRET                  AGE k3s-carpie-net          True    k3s-carpie-net-tls      30s ``` -我们走在幸福之路!(这里的关键是`READY` 是 `True`)。 +我们走在幸福之路!(这里的关键是 `READY` 应该是 `True`)。 ### 解决证书颁发问题 -上面是幸福的道路。如果 `READY` 为 `False`,我们可以等等它,然后再次花点时间检查状态。如果它一直是 `False`,那么我们就有一个需要解决的问题。此时,我们可以遍历 Kubernetes 资源链,直到找到一条告诉我们问题的状态消息。 +上面是幸福的道路。如果 `READY` 为 `False`,我们可以等等它,然后再次花点时间检查状态。如果它一直是 `False`,那么我们就有需要解决的问题。此时,我们可以遍历 Kubernetes 资源链,直到找到一条告诉我们问题的状态消息。 假设我们执行了上面的请求,而 `READY` 为 `False`。我们可以从以下方面开始故障排除: @@ -200,7 +198,7 @@ k3s-carpie-net          True    k3s-carpie-net-tls      30s kubectl describe certificates k3s-carpie-net ``` -这将返回很多信息。通常,有用的内容位于 `Events:` 部分,该部分通常位于底部。假设最后一个事件是 `Created new CertificateRequest resource "k3s-carpie-net-1256631848`。然后我们描述 describe一些该请求: +这将返回很多信息。通常,有用的内容位于 `Events:` 部分,该部分通常位于底部。假设最后一个事件是 `Created new CertificateRequest resource "k3s-carpie-net-1256631848`。然后我们描述describe一下该请求: ``` kubectl describe certificaterequest k3s-carpie-net-1256631848 @@ -211,7 +209,7 @@ kubectl describe certificaterequest k3s-carpie-net-1256631848 那么,我们可以描述该顺序: ``` -`kubectl describe orders default/k3s-carpie-net-1256631848-2342473830` +kubectl describe orders default/k3s-carpie-net-1256631848-2342473830 ``` 假设有一个事件,事件为 `Created Challenge resource "k3s-carpie-net-1256631848-2342473830-1892150396" for domain "k3s.carpie.net"`。让我们描述一下该质询: @@ -220,7 +218,7 @@ kubectl describe certificaterequest k3s-carpie-net-1256631848 kubectl describe challenges k3s-carpie-net-1256631848-2342473830-1892150396 ``` -从这里返回的最后一个事件是 `Presented challenge using http-01 challenge mechanism`。看起来没问题,因此我们浏览一下描述的输出,并看到一条消息 `Waiting for http-01 challenge propagation: failed to perform self check GET request … no such host`。终于!我们发现了问题!在这种情况下,`no such host` 意味着 DNS 查找失败,因此我们需要返回并手动检查我们的 DNS 设置,正确解析域的 DNS,并进行所需的任何更改。 +从这里返回的最后一个事件是 `Presented challenge using http-01 challenge mechanism`。看起来没问题,因此我们浏览一下描述的输出,并看到一条消息 `Waiting for http-01 challenge propagation: failed to perform self check GET request ... no such host`。终于!我们发现了问题!在这种情况下,`no such host` 意味着 DNS 查找失败,因此我们需要返回并手动检查我们的 DNS 设置,正确解析域的 DNS,并进行所需的任何更改。 ### 清理我们的测试证书 @@ -231,9 +229,9 @@ kubectl delete certificates k3s-carpie-net kubectl delete secrets k3s-carpie-net-tls ``` -### 配置 cert-manager 以使用 Let's Encrypt(生产环境) +### 配置 cert-manager 以使用 Let's Encrypt(生产环境) -现在我们已经有了测试证书,是时候移动到生产环境了。就像我们在 Let's Encrypt 暂存环境中配置 cert-manager 一样,我们现在也需要对生产环境进行同样的操作。创建一个名为 `letsencrypt-issuer-production.yaml` 的文件(如果需要,可以复制和修改暂存环境的文件),其内容如下: +现在我们已经有了测试证书,是时候移动到生产环境了。就像我们在 Let's Encrypt 暂存环境中配置 cert-manager 一样,我们现在也需要对生产环境进行同样的操作。创建一个名为 `letsencrypt-issuer-production.yaml` 的文件(如果需要,可以复制和修改暂存环境的文件),其内容如下: ``` apiVersion: cert-manager.io/v1alpha2 @@ -266,7 +264,7 @@ kubectl apply -f letsencrypt-issuer-production.yaml ### 申请我们网站的证书 -重要的是要注意,我们到目前为止完成的所有步骤都是一次性设置的!对于将来的任何其他申请,我们可以从这个说明开始! +重要的是需要注意,我们到目前为止完成的所有步骤都只需要进行一次!而对于将来的任何其他申请,我们可以从这个说明开始! 让我们部署在[上一篇文章][13]中部署的同样站点。(如果仍然可用,则可以修改 YAML 文件。如果没有,则可能需要重新创建并重新部署它)。 @@ -296,7 +294,7 @@ spec: secretName: k3s-carpie-net-tls ``` -请注意,上面仅显示了 `mysite.yaml` 的 `Ingress` 部分。所做的更改是添加了注释 `cert-manager.io/cluster-issuer: letsencrypt-prod`。这告诉 traefik 创建证书时使用哪个发行者。 唯一的其他增加是 `tls:` 块。这告诉 traefik 我们希望在主机 [k3s.carpie.net][10] 上具有 TLS 功能,并且我们希望 TLS 证书文件存储在机密信息 `k3s-carpie-net-tls` 中。 +请注意,上面仅显示了 `mysite.yaml` 的 `Ingress` 部分。所做的更改是添加了注解 `cert-manager.io/cluster-issuer: letsencrypt-prod`。这告诉 traefik 创建证书时使用哪个发行者。 其他唯一增加的是 `tls:` 块。这告诉 traefik 我们希望在主机 [k3s.carpie.net][10] 上具有 TLS 功能,并且我们希望 TLS 证书文件存储在机密信息 `k3s-carpie-net-tls` 中。 请记住,我们没有创建这些证书!(好吧,我们创建了名称相似的测试证书,但我们删除了这些证书。)Traefik 将读取这些配置并继续寻找机密信息。当找不到时,它会看到注释说我们想使用 `letsencrypt-prod` 发行者来获取它。由此,它将提出请求并为我们安装证书到机密信息之中! @@ -311,17 +309,17 @@ via: https://opensource.com/article/20/3/ssl-letsencrypt-k3s 作者:[Lee Carpenter][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/carpie [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) -[2]: https://carpie.net/articles/ingressing-with-k3s +[2]: https://linux.cn/article-12081-1.html [3]: https://cert-manager.io/ [4]: https://letsencrypt.org/ -[5]: https://opensource.com/article/20/3/kubernetes-raspberry-pi-k3s +[5]: https://linux.cn/article-12049-1.html [6]: https://cloudflare.com/ [7]: https://gitlab.com/carpie/k3s_using_certmanager/-/archive/master/k3s_using_certmanager-master.zip [8]: https://cert-manager.io/docs/installation/kubernetes/ @@ -329,5 +327,5 @@ via: https://opensource.com/article/20/3/ssl-letsencrypt-k3s [10]: http://k3s.carpie.net [11]: https://opensource.com/sites/default/files/uploads/ep011_dns_example.png [12]: https://opensource.com/sites/default/files/uploads/ep011_router.png -[13]: https://carpie.net/articles/ingressing-with-k3s#deploying-a-simple-website +[13]:https://linux.cn/article-12081-1.html [14]: http://cert-manager.io/cluster-issuer diff --git a/published/202004/20200313 What is the internet backbone and how it works.md b/published/202004/20200313 What is the internet backbone and how it works.md new file mode 100644 index 0000000000..5e120b20da --- /dev/null +++ b/published/202004/20200313 What is the internet backbone and how it works.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12141-1.html) +[#]: subject: (What is the internet backbone and how it works) +[#]: via: (https://www.networkworld.com/article/3532318/what-is-the-internet-backbone-and-how-it-works.html) +[#]: author: (Tim Greene https://www.networkworld.com/author/Tim-Greene/) + +什么是互联网骨干网,它是怎样工作的 +====== + +> 一级互联网服务提供商(ISP)将其高速光纤网络连接在一起,形成互联网的骨干网,实现在不同地理区域之间高效地传输流量。 + +![](https://images.idgesg.net/images/article/2018/04/global_network_connections_by_gerd_altmann_cc0_via_pixabay_1200x800-100754306-large.jpg) + +互联网会产生大量的计算机到计算机的流量,要确保所有流量都可以在世界上任何地方之间传输,就需要大量汇聚的高速网络,这些网络统称为互联网骨干网,但是它是如何工作的呢? + +### 互联网的骨干网是什么? + +像任何其他网络一样,互联网由接入链路组成,这些接入链路将流量传输到高带宽路由器,路由器又将流量从源地址通过最佳可用路径传输到目的地址。其核心是由相互连接的、彼此对等的各个高速光纤网络而构成的互联网骨干网。 + +单个独立的核心网络由一级互联网服务提供商(ISP)所拥有。他们的网络连接在一起。这些提供商包括 AT&T、CenturyLink、Cogent Communications,、Deutsche Telekom、Global Telecom and Technology (GTT)、NTT Communications、Sprint、Tata Communications,、Telecom Italia Sparkle、Telia Carrier和 Verizon。 + +通过将这些长途网连接在一起,一级 ISP 们创建了一个他们可以访问整个路由表的单一的全球性网络,因此他们可以通过逐步层次化地增加本地 ISP 网络来有效地将流量传输到其目的地。 + +除了物理连接之外,这些骨干网提供商还通过一致的网络协议 TCP/IP 融合在一起,这实际上是两个协议,传输控制协议transport control protocol互联网协议internet protocol,它们在计算机之间建立连接,以确保连接可靠,并将消息格式化为数据包。 + +### 互联网交接点(IXP)将骨干网连接在一起 + +骨干网 ISP 在中立位置的对等点通过高速交换机和路由器连接其网络。这些通常由第三方(有时是非营利组织)提供,以促进骨干网的统一。 + +参与的一级 ISP 会帮助资助 IXP,但不向其他一级 ISP 收取流量传输费用,这种关系称为无结算对等。这种协议消除了可能导致互联网性能下降的潜在财务纠纷。 + +### 骨干网有多快? + +互联网骨干网由最快的路由器组成,可以提供 100Gbps 的线路速度。这些路由器由包括 Cisco、Extreme、华为、Juniper 和 Nokia 在内的供应商制造,使用边界网关协议(BGP)在彼此之间路由流量。 + +### 流量是如何进入骨干网的 + +在 1 级 ISP 之下是规模较小的 2 级和 3 级 ISP。 + +3 级 ISP 为企业和消费者提供了互联网接入服务。这些提供商自己没有接入互联网骨干网,因此,他们自己无法将其客户连接到数十亿台互联网上的计算机。 + +购买一级 ISP 提供商的接入非常昂贵。通常 3 级 ISP 与拥有自己网络的 2 级(区域)ISP 签订合同,利用 2 级 ISP 的网络将流量传输到有限的地理区域,但不能传输到所有互联网上的设备。 + +为此,2 级 ISP 与 1 级 ISP 签约以访问全球骨干网,并以这种方式使客户可以访问整个互联网。 + +这种方式使得来自世界一侧的计算机的流量能够连接到另一侧的计算机。流量从源计算机流向 3 级 ISP,再路由到 2 级 ISP,再路由到 1 级骨干网提供商,再路由到正确的 2 级 ISP,最后路由到提供该数据的 3 级接入提供商连接的目标计算机。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3532318/what-is-the-internet-backbone-and-how-it-works.html + +作者:[Tim Greene][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Tim-Greene/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/en/social-media-digitization-faces-3271592/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200320 Build a private social network with a Raspberry Pi.md b/published/202004/20200320 Build a private social network with a Raspberry Pi.md new file mode 100644 index 0000000000..8e9faaa8cc --- /dev/null +++ b/published/202004/20200320 Build a private social network with a Raspberry Pi.md @@ -0,0 +1,341 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12120-1.html) +[#]: subject: (Build a private social network with a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/3/raspberry-pi-open-source-social) +[#]: author: (Giuseppe Cassibba https://opensource.com/users/peppe8o) + +用树莓派搭建一个私人社交网络 +====== + +> 手把手教你怎样以低成本的硬件和简易步骤搭建自己的社交网络。 + +![Team of people around the world][1] + +近年来,社交网络已经革新了人们的生活习惯。人们每天都会使用社交频道与朋友和家人联系。但是涉及到隐私和数据安全时,仍有一些共同的问题。尽管社交网络创建了复杂的隐私策略来保护用户的信息,但如果你不想自己的信息被泄露,最好的办法还是把数据保存在自己的服务器上。 + +一个树莓派 — 多才多艺的 Raspbian Lite 版本就可以让你搭建很多有用的家庭服务(参照我的文章[树莓派项目][2])。通过搜索开源软件你就可以实现一些令人痴迷的功能,你也可以用这个神奇的设备来感受那些功能。其中一个有趣的尝试就是在你的树莓派上安装 OSSN。 + +### OSSN 是什么? + +[开源社交网络][3]OpenSource Social Network(OSSN)是用 PHP 写的一个快速开发社交网络软件,让你可以搭建自己的社交网站。OSSN 可以用来搭建不同类型的社交应用,如: + + * 私人内部网 + * 公用/公开网络 + * 社区 + +OSSN 支持的功能: + + * 照片 + * 个人资料 + * 朋友圈 + * 表情 + * 搜索 + * 聊天 + +OSSN 运行在 LAMP 服务器上。硬件需求很简单,却能提供强大的用户界面,也友好支持移动端。 + +### 我们需要准备什么 + +这个项目很简单,而且由于我们只安装远程 Web 服务,因此我们只需要一些便宜的零件就够了。我使用的是树莓派 3B+,但是用树莓派 3A+ 或其他更新的板应该也可以。 + +硬件: + + * 带有电源模块的树莓派 3B+ + * 一张 SD 卡(最好是性能好点的卡,至少 16 GB) + * 一台有 SFTP 软件(如免费的 [Filezilla][4])的桌面 PC,用来把安装包传到你的树莓派上 + +### 操作步骤 + +我们首先搭建一个传统的 LAMP 服务器,然后配置数据库用户和安装 OSSN。 + +#### 1、安装 Raspbian Buster Lite 操作系统 + +你可以直接参照我的文章[在你的树莓派上安装 Raspbian Buster Lite][5]。 + +为了确保你的系统是最新的,ssh 登录到树莓派后在终端输入下面的命令: + +```bash +sudo apt-get update +sudo apt-get upgrade +``` + +#### 2、安装 LAMP 服务 + +LAMP(Linux–Apache–Mysql–Php)服务通常与 MySQL 数据库配合。在我们的项目中,我们选择 MariaDB,因为它更轻量,完美支持树莓派。 + +安装 Apache 服务: + +``` +sudo apt-get install apache2 -y +``` + +你可以通过在浏览器输入 `http://<>` 来检查 Apache 是否安装正确: + +![][6] + +安装 PHP: + +``` +sudo apt-get install php -y +``` + +安装 MariaDB 服务和 PHP connector: + +``` +sudo apt-get install mariadb-server php-mysql -y +``` + +安装 phpMyAdmin: + +在 OSSN 中 phpMyAdmin 不是强制安装的,但我建议你安装,因为它可以简化数据库的管理。 + +``` +sudo apt-get install phpmyadmin +``` + +在 phpMyAdmin 配置界面,执行以下步骤: + + * 按下空格和 “OK” 选择 apache(强制)。 + * 在 dbconfig-common 选择“Yes”,配置 phpMyAdmin 的数据库。 + * 输入想设置的密码,按下 “OK”。 + * 再次输入 phpMyAdmin 密码来确认,按下 “OK”。 + +为 phpMyAdmin 用户添加数据库权限来管理数据库: + +我们用 root 用户连接 MariaDB(默认没有密码)来设置权限。 + +``` +sudo mysql -uroot -p +grant all privileges on *.* to 'phpmyadmin'@'localhost'; +flush privileges; +quit +``` + +最后,重启 Apache 服务: + +``` +sudo systemctl restart apache2.service +``` + +在浏览器输入 `http://<>/phpmyadmin/` 来检查 phpMyAdmin 是否正常: + +![][7] + +默认的 phpMyAdmin 登录凭证: + + * 用户名:`phpmyadmin` + * 密码:在 phpMyAdmin 安装步骤中你设置的密码 + +#### 3、安装 OSSN 所需的其他包和配置 PHP + +在第一次配置 OSSN 前,我们还需要在系统上安装一些所需的包: + + * PHP 版本 5.6、7.0 或 7.1 + * MYSQL 5 及以上 + * APACHE + * MOD_REWRITE + * 需要打开 PHP 扩展 cURL 和 Mcrypt + * PHP GD 扩展 + * PHP ZIP 扩展 + * 打开 PHP 设置 `allow_url_fopen` + * PHP JSON 支持 + * PHP XML 支持 + * PHP OpenSSL + +在终端输入以下命令来安装上述包: + +``` +sudo apt-get install php7.3-curl php7.3-gd php7.3-zip php7.3-json php7.3-xml +``` + +打开 mod_rewrite: + +``` +sudo a2enmod rewrite +``` + +修改默认的 Apache 配置,使用 mod_rewrite: + +``` +sudo nano /etc/apache2/sites-available/000-default.conf +``` + +在 `000-default.conf` 文件中添加下面的内容: + +```ini + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + # 需要添加的部分开始 -------------------------------- + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Require all granted + + # 需要添加的部分结束 -------------------------------- + +``` + +安装 Mcrypt: + +```bash +sudo apt install php-dev libmcrypt-dev php-pear +sudo pecl channel-update pecl.php.net +sudo pecl install mcrypt-1.0.2 +``` + +打开 Mcrypt 模块: + +在 `/etc/php/7.3/apache2/php.ini` 文件中 `extension=mcrypt.so`(或取消注释): + +```bash +sudo nano /etc/php/7.3/apache2/php.ini +``` + +`allow_url_fopen` 应该已经在 `/etc/php/7.3/apache2/php.ini` 文件中打开了。OpenSSL 应该在 php7.3 中安装了。 + +我建议的另一个设置是把 PHP 最大上传文件数修改为 16 MB: + +``` +sudo nano /etc/php/7.3/apache2/php.ini +``` + +搜索到 `upload_max_filesize` 所在的行,参照下面的设置: + +``` +upload_max_filesize = 16M +``` + +保存并退出,重启 Apache: + +``` +sudo systemctl restart apache2.service +``` + +#### 4、安装 OSSN + +##### 创建数据库,设置用户 + +回到 phpmyadmin web 页面(浏览器输入 `http://<>/phpmyadmin/`)并登录: + +- 用户名: `phpmyadmin` +- 密码:在 phpMyAdmin 安装步骤中你设置的密码 + +点击数据库标签页: + +![][8] + +创建一个数据库,记下数据库的名字,因为在之后的安装过程中,你要手动输入它。 + +![][9] + +现在为 OSSN 创建一个数据库用户,我使用下面的凭证: + +- 用户名: `ossn_db_user` +- 密码: `ossn_db_password` + +在终端输入下面的命令(如果你没有修改过密码,root 密码应该仍然是空): + +```bash +sudo mysql -uroot -p +CREATE USER 'ossn_db_user'@'localhost' IDENTIFIED BY 'ossn_db_password'; +GRANT ALL PRIVILEGES ON ossn_db.* TO 'ossn_db_user'@'localhost'; +flush privileges; +quit +``` + +##### 安装 OSSN 软件 + +在你 PC 上从 [OSSN 下载页面][10] 下载 OSSN 安装压缩文件,保存为文件 `ossn-v5.2-1577836800.zip`。 + +使用你习惯的 SFTP 软件把整个压缩文件通过 SFTP 传到树莓派的新目录 `/home/pi/download` 下。常用的(默认)SFP 连接参数是: + + * 主机:你树莓派的 IP 地址 + * 用户名:`pi` + * 密码:raspberry(如果没有修改过默认密码) + * 端口: 22 + +在终端输入: + +```bash +cd /home/pi/download/ # 进入上传的 OSSN 安装文件的目录。 +unzip ossn-v5.2-1577836800.zip # 从压缩包中提取所有文件 +cd /var/www/html/ # 进入 Apache Web 目录 +sudo rm index.html # 删除 Apache 默认页面 - 我们将使用 OSSN +sudo cp -R /home/pi/download/ossn-v5.2-1577836800/* ./ #Copy installation files to web directory +sudo chown -R www-data:www-data ./ +``` + +创建数据文件夹:OSSN 需要一个文件夹来存放数据。出于安全目的,OSSN 建议这个文件夹创建在公开文档根目录之外。所以,我们在 `/opt` 下创建。 + +```bash +sudo mkdir /opt/ossn_data +sudo chown -R www-data:www-data /opt/ossn_data/ +``` + +在浏览器输入 `http://<>` 来开始安装向导。 + +![][11] + +所有项都检查完后,点击页面最下面的下一步按钮。 + +![][12] + +阅读证书验证并点击页面最下面的下一步按钮来接受证书。 + +![][13] + +输入数据库用户名,密码和你选择的数据库名字,记得也要输入 OSSN 数据文件夹名称。点击安装。 + +![][14] + +输入你的管理员账号信息,点击创建按钮。 + +![][15] + +现在所有的工作应该都完成了。点击结束,进入管理员首页。 + +![][16] + +你可以通过 URL `http://<>/administrator` 进入管理员控制面板,普通用户可以访问链接是 `http://<>`。 + +![][17] + +本文首发在 [peppe8o.com][18]。已获得转载授权。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/raspberry-pi-open-source-social + +作者:[Giuseppe Cassibba][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/peppe8o +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) +[2]: https://peppe8o.com/2019/04/best-raspberry-pi-projects-with-open-source-software/ +[3]: https://www.opensource-socialnetwork.org/ +[4]: https://filezilla-project.org/ +[5]: https://peppe8o.com/2019/07/install-raspbian-buster-lite-in-your-raspberry-pi/ +[6]: https://opensource.com/sites/default/files/uploads/ossn_1_0.jpg +[7]: https://opensource.com/sites/default/files/uploads/ossn_2.jpg +[8]: https://opensource.com/sites/default/files/uploads/ossn_3.jpg +[9]: https://opensource.com/sites/default/files/uploads/ossn_4.jpg +[10]: https://www.opensource-socialnetwork.org/download +[11]: https://opensource.com/sites/default/files/uploads/ossn_5.jpg +[12]: https://opensource.com/sites/default/files/uploads/ossn_6.jpg +[13]: https://opensource.com/sites/default/files/uploads/ossn_7.jpg +[14]: https://opensource.com/sites/default/files/uploads/ossn_8.jpg +[15]: https://opensource.com/sites/default/files/uploads/ossn_9.jpg +[16]: https://opensource.com/sites/default/files/uploads/ossn_10.jpg +[17]: https://opensource.com/sites/default/files/uploads/ossn_11.jpg +[18]: https://peppe8o.com/private-social-network-with-raspberry-pi-and-opensource-social-network/ diff --git a/published/202004/20200320 Control the firewall at the command line.md b/published/202004/20200320 Control the firewall at the command line.md new file mode 100644 index 0000000000..4cf7283963 --- /dev/null +++ b/published/202004/20200320 Control the firewall at the command line.md @@ -0,0 +1,134 @@ +[#]: collector: "lujun9972" +[#]: translator: "tinyeyeser" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12103-1.html" +[#]: subject: "Control the firewall at the command line" +[#]: via: "https://fedoramagazine.org/control-the-firewall-at-the-command-line/" +[#]: author: "Paul W. Frields https://fedoramagazine.org/author/pfrields/" + +在 Fedora 命令行下玩转防火墙 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/12/123040ghxuicphyhsoppch.jpg) + +网络防火墙,顾名思义:为了阻止不需要的网络连接而设置的防护性屏障。在与外界建立连接或是提供网络服务时常常会用到。例如,在学校或是咖啡厅里使用笔记本电脑时,你一定不想某个陌生人窥探你的电脑。 + +每个 Fedora 系统都内置了一款防火墙。这是 Linux 内核网络功能的一部分。本文介绍如何通过 `firewall-cmd` 命令修改防火墙的配置。 + +### 网络基础 + +本文并不教授计算机网络的[所有知识][2],但还是会简单介绍一些网络基础。 + +网络中的所有计算机都有一个 *IP 地址*,可以把它想象成一个邮箱地址,有了邮箱地址,邮件才知道发往何处。每台计算机还会拥有一组*端口*,端口号范围从 0 到 65535。同样的,你可以把这些端口想象成用来连接邮箱地址的连接点。 + +通常情况下,端口会是一个标准端口号或是根据应用程序的应答要求选定的一个端口范围。例如,一台 Web 服务器通常会保留 80 端口用于 HTTP 通信,443 端口用于 HTTPS。小于 1024 的端口主要用于系统或常见用途,1024-49151 端口是已经注册的,49152 及以上端口多为临时使用(只限短时间使用)。 + +互联网传输中最常见的两个协议,[TCP][4] 和 [UDP][5]。当要传输的数据很重要,不能有丢包时,就使用 TCP 协议,如果数据包没有按顺序到达,还需要重组为正确的顺序。UDP 协议则更多用于对时间敏感的服务,为了保证时效性,有时允许丢失部分数据。 + +系统中运行的应用,例如 Web 服务器,会保留一些端口(例如上文提到的 80 和 443)。在网络传输过程中,主机会为传输的两端建立一个链接,一端是源地址和源端口,另一端是目的地址和目的端口。 + +网络防火墙就是基于地址、端口及其他标准的一组规则集,来对网络数据的传输进行屏蔽或阻断的。通过 `firewall-cmd` 命令,我们就可以查看或修改防火墙的工作配置。 + +### 防火墙域(zone) + +为了验证防火墙是否开启,使用 `firewall-cmd` 命令,输入时要加上 [sudo](https://fedoramagazine.org/howto-use-sudo/)。(通常,在运行了 [PolicyKit](https://en.wikipedia.org/wiki/Polkit) 的环境中,你也可以不加 `sudo`) + +``` +$ sudo firewall-cmd --state +running +``` + +firewalld 服务支持任意数量的域。每个域都可以拥有独立的配置和防护规则。一台 Fedora 工作站的外部接口(例如 WIFI 或有线网卡)其默认域为 `FedoraWorkstation`。 + +要看有哪些域是激活状态,可以使用 `-–get-active-zones` 选项。在本示例中,有两个网卡,有线以太网卡 `wlp2s0` 和虚拟(libvirt)桥接网卡 `virbr0`: + +``` +$ sudo firewall-cmd --get-active-zones +FedoraWorkstation + interfaces: wlp2s0 +libvirt + interfaces: virbr0 +``` + +如果想看看默认域是什么,或是直接查询所有域: + +``` +$ sudo firewall-cmd --get-default-zone +FedoraWorkstation +$ sudo firewall-cmd --get-zones +FedoraServer FedoraWorkstation block dmz drop external home internal libvirt public trusted work +``` + +查询默认域中防火墙放行了哪些系统,使用 `-–list-services` 选项。下例给出了一个定制系统的查询结果,你可以看到与常见的结果有些不同。 + +``` +$ sudo firewall-cmd --list-services +dhcpv6-client mdns samba-client ssh +``` + +该系统对外开启了四个服务。每个服务都对应一个常见端口。例如 `ssh` 服务对应 22 端口。 + +如果要查看当前域中防火墙还开启了哪些端口,可以使用 `--list-ports` 选项。当然,你也可以随时对其他域进行查询: + +``` +$ sudo firewall-cmd --list-ports --zone=FedoraWorkstation +1025-65535/udp 1025-65535/tcp +``` + +结果表明,从 1025 到 65535 端口(包含 UDP 和 TCP)默认都是开启的。 + +### 修改域、端口及服务 + +以上的配置都是预先设计好的防火墙策略。是为了确保新手用户安装的应用都能够正常访问网络。如果你确定自己心里有数,想要一个保护性更强的策略,可以将接口放入 `FedoraServer` 域,明确禁止所有端口的访问。(**警告**:如果你的服务器之前是联网状态,这么做可能会导致连接中断,那你就得到机房里去修改更多的配置项!) + +``` +$ sudo firewall-cmd --change-interface= --zone=FedoraServer +success +``` + +**本文并不讨论如何制定防火墙策略,Fedora 社区里已经有很多讨论了。你大可以按照自身需要来修改配置。** + +如果你想要开放某个服务的常见端口,可以将该服务加入默认域(或使用 `--zone` 指定一个不同的域)。还可以一次性将其加入多个域。下例开放了 HTTP 和 HTTPS 的常见端口 80、443: + +``` +$ sudo firewall-cmd --add-service=http --add-service=https +success +``` + +并非所有的服务都有默认端口,不过大部分都是有的。使用 `-–get-services` 选项可以查看完整列表。 + +如果你想指定某个特定端口号,可以直接用数字和协议进行配置。(多数情况下,`-–add-service` 和 `-–add-port` 这两个选项是合在一起使用的)下例开启的是 UDP 协议的网络启动服务: + +``` +$ sudo firewall-cmd --add-port=67/udp +success +``` + +**重要**:如果想要在系统重启或是 firewalld 服务重启后,配置仍然生效,**必须**在命令中加上 `-–permanent` 选项。本文中的例子只是临时修改了配置,下次遇到系统重启或是 firewalld 服务重启,这些配置就失效了。 + +以上只是 `firewall-cmd` 和 firewalld 服务诸多功能中的一小部分。firewalld 项目的[主页][8]还有更多信息值得你去探索和尝试。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/control-the-firewall-at-the-command-line/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[tinyeyeser](https://github.com/tinyeyeser) +校对:[wxy](https://github.com/wxy) + +本文由 [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/2020/03/firewall-cmd-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Portal:Internet +[3]: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers +[4]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol +[5]: https://en.wikipedia.org/wiki/User_Datagram_Protocol +[6]: https://fedoramagazine.org/howto-use-sudo/ +[7]: https://en.wikipedia.org/wiki/Polkit +[8]: https://firewalld.org/ +[9]: https://unsplash.com/@jakobustrop?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[10]: https://unsplash.com/s/photos/brick-wall?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/translated/tech/20200320 How to Check Password Expiration Date for All Users on Linux.md b/published/202004/20200320 How to Check Password Expiration Date for All Users on Linux.md similarity index 69% rename from translated/tech/20200320 How to Check Password Expiration Date for All Users on Linux.md rename to published/202004/20200320 How to Check Password Expiration Date for All Users on Linux.md index 0991e386b8..1633f32694 100644 --- a/translated/tech/20200320 How to Check Password Expiration Date for All Users on Linux.md +++ b/published/202004/20200320 How to Check Password Expiration Date for All Users on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12062-1.html) [#]: subject: (How to Check Password Expiration Date for All Users on Linux) [#]: via: (https://www.2daygeek.com/linux-check-user-password-expiration-date/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) @@ -10,37 +10,33 @@ 如何在 Linux 上检查所有用户密码到期日期 ====== -如果你在 **[Linux 上启用了密码策略][1]**。 +![](https://img.linux.net.cn/data/attachment/album/202004/01/104918dn0n0anhxoia40rc.jpg) -密码必须在到期前进行更改,并且登录到系统时会收到通知。 +如果你在 [Linux 上启用了密码策略][1]。密码必须在到期前进行更改,并且登录到系统时会收到通知。 -如果你很少使用自己的帐户,那么可能由于密码过期而被锁定。 +如果你很少使用自己的帐户,那么可能由于密码过期而被锁定。在许多情况下,这可能会在[无需密码登录][2]的服务帐户中发生,因为没人会注意到它。 -在许多情况下,这可能会在[无需密码登录][2]的服务帐户中发生,因为没人会注意到它。 - -这将导致停止服务器上配置的 **[cronjob/crontab][3]**。 +这将导致停止服务器上配置的 [cronjob/crontab][3]。 如果如此,该如何缓解这种情况。 -你可以写一个 **[shell 脚本][4]**来获得有关它的通知,我们前一段时间为此写了一篇文章。 - - * **[发送 “X” 日内到期的用户帐户列表邮件的 Bash 脚本][5]** - +你可以写一个 shell 脚本来获得有关它的通知,我们前一段时间为此写了一篇文章。 + * [使用 Bash 脚本发送包含几天内到期的用户账号列表的电子邮件][5] 它将给出天数,但是本文旨在在终端中给你实际日期。 -这可以使用 chage 命令来实现。 +这可以使用 `chage` 命令来实现。 ### 什么是 chage 命令? -chage 代表更改时效 (change age)。它更改用户密码到期信息。 +`chage` 代表更改时效change age。它更改用户密码到期信息。 -chage 命令更改两次密码更改之间的天数,以及最后一次更改密码的日期。 +`chage` 命令可以修改两次密码更改之间的天数,以及最后一次更改密码的日期。 系统使用此信息来确定用户何时应更改密码。 -它允许用户执行其他功能,例如设置帐户到期日期、在到期后将密码设置为无效、显示帐户时效信息、设置密码更改之前的最小和最大天数以及设置到期警告天数。 +它还允许用户执行其他功能,例如设置帐户到期日期、在到期后将密码设置为无效、显示帐户时效信息、设置密码更改之前的最小和最大天数以及设置到期警告天数。 ### 1)如何在 Linux 上检查特定用户的密码到期日期 @@ -60,8 +56,7 @@ Number of days of warning before password expires : 7 ### 2)如何在 Linux 上检查所有用户的密码到期日期 -You can use the chage command directly for a single user, which may not work as expected for many users, but you can use it. -你可以直接对单个用户使用 chage 命令,这对你可以使用的多个用户可能无效。 +你可以直接对单个用户使用 chage 命令,不过可能你对多个用户使用时可能无效。 为此,你需要编写一个小的 shell 脚本。下面的 shell 脚本可以列出添加到系统中的所有用户,包括系统用户。 @@ -111,14 +106,14 @@ via: https://www.2daygeek.com/linux-check-user-password-expiration-date/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/ +[1]: https://linux.cn/article-10698-1.html [2]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ [3]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ [4]: https://www.2daygeek.com/category/shell-script/ -[5]: https://www.2daygeek.com/bash-script-to-check-user-account-password-expiry-linux/ +[5]: https://linux.cn/article-11781-1.html diff --git a/published/202004/20200323 Don-t love diff- Use Meld instead.md b/published/202004/20200323 Don-t love diff- Use Meld instead.md new file mode 100644 index 0000000000..9fd421118f --- /dev/null +++ b/published/202004/20200323 Don-t love diff- Use Meld instead.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12067-1.html) +[#]: subject: (Don't love diff? Use Meld instead) +[#]: via: (https://opensource.com/article/20/3/meld) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +不喜欢 diff 么?试试 Meld 吧 +====== + +> Meld 是一个可视化 diff 工具,它可让你轻松比较和合并文件、目录、Git 仓库等的更改。 + +![](https://img.linux.net.cn/data/attachment/album/202004/03/122428dkagz1qtgh9f2g10.jpg) + +Meld 是我处理代码和数据文件的基本工具之一。它是一个图形化的 diff 工具,因此,如果你曾经使用过 `diff` 命令并难以理解输出,那么 [Meld][2] 可以为你提供帮助。 + +这是该项目网站的精彩描述: + +>“Meld 是面向开发人员的可视化 diff 和合并工具。Meld 可以帮助你比较文件、目录和版本控制的项目。它提供文件和目录的双向和三向比较,并支持许多流行的版本控制系统。” +> +>“Meld 可以帮助你检查代码更改并了解补丁。它甚至可以帮助你弄清你一直在避免的合并中发生了什么。” + +你可以使用以下命令在 Debian/Ubuntu 系统(包括 Raspbian)上安装 Meld: + +``` +$ sudo apt install meld +``` + +在 Fedora 或类似产品上: + +``` +$ sudo dnf install meld +``` + +Meld 是跨平台的,它有一个使用 [Chocolately][4] 包管理器的 [Windows 安装包][3]。尽管它在 macOS 上不受官方支持,但有[可用于 Mac 的版本][5],你可以使用 Homebrew 安装: + +``` +$ brew cask install meld +``` + +有关[其他系统][2],请参见 Meld 的主页。 + +### Meld 对比 diff 命令 + +如果你有两个相似的文件(也许一个是另一个的修改版本),并想要查看它们之间的更改,那么可以在终端中运行 `diff` 命令查看它们的区别: + +![diff output][6] + +此例显示了 `conway1.py` 和 `conway2.py` 之间的区别。表明我: + +* 删除了[释伴][7]和第二行 +* 从类声明中删除了 `(object)` +* 为类添加了 docstring +* 在方法中交换了 `alive` 和 `neighbours == 2` 的顺序 + +这是使用 `meld` 命令的相同例子。你可以在命令行中运行以下命令进行相同的比较: + +``` +$ meld conway1.py conway2.py +``` + +![Meld output][8] + +Meld 更清晰! + +你可以轻松查看并单击箭头(左右都行)合并文件之间的更改。你甚至可以实时编辑文件(在输入时,Meld 可以用作具有实时比较功能的简单文本编辑器)—只是要记得在关闭窗口之前保存。 + +你甚至可以比较和编辑三个不同的文件: + +![Comparing three files in Meld][9] + +### Meld 的 Git 感知 + +希望你正在使用 [Git][10] 之类的版本控制系统。如果是这样,那么你的比较就不是在两个不同文件之间进行,而是要查找当前文件与 Git 历史文件之间的差异。Meld 理解这一点,因此,如果你运行 `meld conway.py`(`conway.py` 在 Git 中),它将显示自上次 Git 提交以来所做的更改: + +![Comparing Git files in Meld][11] + +你可以看到当前版本(右侧)和仓库版本(左侧)之间的更改。你可以看到,自上次提交以来,我删除了一个方法,并添加了一个参数和一个循环。 + +如果你运行 `meld .`,你将看到当前目录(如果位于仓库的根目录,就是整个仓库)中的所有更改: + +![Meld . output][12] + +你会看到一个文件被修改了,另一个文件未加入版本控制(这意味着它对 Git 是新的,因此在比较之前,我需要 `git add` 添加该文件),以及许多其他未修改的文件。顶部的图标提供了各种显示选项。 + +你还可以比较两个目录,这有时很方便: + +![Comparing directories in Meld][13] + +### 结论 + +即使是普通用户也会觉得 diff 的比较难以理解。我发现 Meld 提供的可视化在找出文件之间的更改方面有很大的不同。最重要的是,Meld 有一些有用的版本控制认知,可以帮助你在不考虑太多内容的情况下对 Git 提交进行比较。快来试试 Meld,并轻松解决问题。 + +* * * + +*本文最初发表在 Ben Nuttall 的 [Tooling blog][14] 上,并经允许重新使用。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/meld + +作者:[Ben Nuttall][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://meldmerge.org/ +[3]: https://chocolatey.org/packages/meld +[4]: https://opensource.com/article/20/3/chocolatey +[5]: https://yousseb.github.io/meld/ +[6]: https://opensource.com/sites/default/files/uploads/diff-output.png (diff output) +[7]: https://en.wikipedia.org/wiki/Shebang_(Unix) +[8]: https://opensource.com/sites/default/files/uploads/meld-output.png (Meld output) +[9]: https://opensource.com/sites/default/files/uploads/meld-3-files.png (Comparing three files in Meld) +[10]: https://opensource.com/resources/what-is-git +[11]: https://opensource.com/sites/default/files/uploads/meld-git.png (Comparing Git files in Meld) +[12]: https://opensource.com/sites/default/files/uploads/meld-directory-changes.png (Meld . output) +[13]: https://opensource.com/sites/default/files/uploads/meld-directory-compare.png (Comparing directories in Meld) +[14]: https://tooling.bennuttall.com/meld/ diff --git a/published/202004/20200325 Linux firewall basics with ufw.md b/published/202004/20200325 Linux firewall basics with ufw.md new file mode 100644 index 0000000000..538d1a928a --- /dev/null +++ b/published/202004/20200325 Linux firewall basics with ufw.md @@ -0,0 +1,213 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12079-1.html) +[#]: subject: (Linux firewall basics with ufw) +[#]: via: (https://www.networkworld.com/article/3533551/linux-firewall-basics-with-ufw.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux 防火墙 ufw 简介 +====== + +> 我们来研究下 Linux 上的 ufw(简单防火墙),为你更改防火墙提供一些见解和命令。 + +![][0] + +`ufw`(简单防火墙Uncomplicated FireWall)真正地简化了 [iptables][1],它从出现的这几年,已经成为 Ubuntu 和 Debian 等系统上的默认防火墙。而且 `ufw` 出乎意料的简单,这对新管理员来说是一个福音,否则他们可能需要投入大量时间来学习防火墙管理。 + +`ufw` 也有 GUI 客户端(例如 `gufw`),但是 `ufw` 命令通常在命令行上执行的。本文介绍了一些使用 `ufw` 的命令,并研究了它的工作方式。 + +首先,快速查看 `ufw` 配置的方法是查看其配置文件 —— `/etc/default/ufw`。使用下面的命令可以查看其配置,使用 `grep` 来抑制了空行和注释(以 # 开头的行)的显示。 + +``` +$ grep -v '^#\|^$' /etc/default/ufw +IPV6=yes +DEFAULT_INPUT_POLICY="DROP" +DEFAULT_OUTPUT_POLICY="ACCEPT" +DEFAULT_FORWARD_POLICY="DROP" +DEFAULT_APPLICATION_POLICY="SKIP" +MANAGE_BUILTINS=no +IPT_SYSCTL=/etc/ufw/sysctl.conf +IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_netbios_ns" +``` + +正如你所看到的,默认策略是丢弃输入但允许输出。允许你接受特定的连接的其它规则是需要单独配置的。 + +`ufw` 命令的基本语法如下所示,但是这个概要并不意味着你只需要输入 `ufw` 就行,而是一个告诉你需要哪些参数的快速提示。 + +``` +ufw [--dry-run] [options] [rule syntax] +``` + +`--dry-run` 选项意味着 `ufw` 不会运行你指定的命令,但会显示给你如果执行后的结果。但是它会显示假如更改后的整个规则集,因此你要做有好多行输出的准备。 + +要检查 `ufw` 的状态,请运行以下命令。注意,即使是这个命令也需要使用 `sudo` 或 root 账户。 + +``` +$ sudo ufw status +Status: active + +To Action From +-- ------ ---- +22 ALLOW 192.168.0.0/24 +9090 ALLOW Anywhere +9090 (v6) ALLOW Anywhere (v6) +``` + +否则,你会看到以下内容: + +``` +$ ufw status +ERROR: You need to be root to run this script +``` + +加上 `verbose` 选项会提供一些其它细节: + +``` +$ sudo ufw status verbose +Status: active +Logging: on (low) +Default: deny (incoming), allow (outgoing), disabled (routed) +New profiles: skip + +To Action From +-- ------ ---- +22 ALLOW IN 192.168.0.0/24 +9090 ALLOW IN Anywhere +9090 (v6) ALLOW IN Anywhere (v6) +``` + +你可以使用以下命令轻松地通过端口号允许和拒绝连接: + +``` +$ sudo ufw allow 80 <== 允许 http 访问 +$ sudo ufw deny 25 <== 拒绝 smtp 访问 +``` + +你可以查看 `/etc/services` 文件来找到端口号和服务名称之间的联系。 + +``` +$ grep 80/ /etc/services +http 80/tcp www # WorldWideWeb HTTP +socks 1080/tcp # socks proxy server +socks 1080/udp +http-alt 8080/tcp webcache # WWW caching service +http-alt 8080/udp +amanda 10080/tcp # amanda backup services +amanda 10080/udp +canna 5680/tcp # cannaserver +``` + +或者,你可以命令中直接使用服务的名称。 + +``` +$ sudo ufw allow http +Rule added +Rule added (v6) +$ sudo ufw allow https +Rule added +Rule added (v6) +``` + +进行更改后,你应该再次检查状态来查看是否生效: + +``` +$ sudo ufw status +Status: active + +To Action From +-- ------ ---- +22 ALLOW 192.168.0.0/24 +9090 ALLOW Anywhere +80/tcp ALLOW Anywhere <== +443/tcp ALLOW Anywhere <== +9090 (v6) ALLOW Anywhere (v6) +80/tcp (v6) ALLOW Anywhere (v6) <== +443/tcp (v6) ALLOW Anywhere (v6) <== +``` + +`ufw` 遵循的规则存储在 `/etc/ufw` 目录中。注意,你需要 root 用户访问权限才能查看这些文件,每个文件都包含大量规则。 + +``` +$ ls -ltr /etc/ufw +total 48 +-rw-r--r-- 1 root root 1391 Aug 15 2017 sysctl.conf +-rw-r----- 1 root root 1004 Aug 17 2017 after.rules +-rw-r----- 1 root root 915 Aug 17 2017 after6.rules +-rw-r----- 1 root root 1130 Jan 5 2018 before.init +-rw-r----- 1 root root 1126 Jan 5 2018 after.init +-rw-r----- 1 root root 2537 Mar 25 2019 before.rules +-rw-r----- 1 root root 6700 Mar 25 2019 before6.rules +drwxr-xr-x 3 root root 4096 Nov 12 08:21 applications.d +-rw-r--r-- 1 root root 313 Mar 18 17:30 ufw.conf +-rw-r----- 1 root root 1711 Mar 19 10:42 user.rules +-rw-r----- 1 root root 1530 Mar 19 10:42 user6.rules +``` + +本文前面所作的更改,为 `http` 访问添加了端口 `80` 和为 `https` 访问添加了端口 `443`,在 `user.rules` 和 `user6.rules` 文件中看起来像这样: + +``` +# grep " 80 " user*.rules +user6.rules:### tuple ### allow tcp 80 ::/0 any ::/0 in +user6.rules:-A ufw6-user-input -p tcp --dport 80 -j ACCEPT +user.rules:### tuple ### allow tcp 80 0.0.0.0/0 any 0.0.0.0/0 in +user.rules:-A ufw-user-input -p tcp --dport 80 -j ACCEPT +You have new mail in /var/mail/root +# grep 443 user*.rules +user6.rules:### tuple ### allow tcp 443 ::/0 any ::/0 in +user6.rules:-A ufw6-user-input -p tcp --dport 443 -j ACCEPT +user.rules:### tuple ### allow tcp 443 0.0.0.0/0 any 0.0.0.0/0 in +user.rules:-A ufw-user-input -p tcp --dport 443 -j ACCEPT +``` + +使用 `ufw`,你还可以使用以下命令轻松地阻止来自一个 IP 地址的连接: + +``` +$ sudo ufw deny from 208.176.0.50 +Rule added +``` + +`status` 命令将显示更改: + +``` +$ sudo ufw status verbose +Status: active +Logging: on (low) +Default: deny (incoming), allow (outgoing), disabled (routed) +New profiles: skip + +To Action From +-- ------ ---- +22 ALLOW IN 192.168.0.0/24 +9090 ALLOW IN Anywhere +80/tcp ALLOW IN Anywhere +443/tcp ALLOW IN Anywhere +Anywhere DENY IN 208.176.0.50 <== new +9090 (v6) ALLOW IN Anywhere (v6) +80/tcp (v6) ALLOW IN Anywhere (v6) +443/tcp (v6) ALLOW IN Anywhere (v6) +``` + +总而言之,`ufw` 不仅容易配置,而且且容易理解。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533551/linux-firewall-basics-with-ufw.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[0]: https://images.idgesg.net/images/article/2019/06/cso_network_security_encryption_automation_by_vertigo3d_gettyimages-597931354_2400x1600-100798880-large.jpg +[1]: https://www.networkworld.com/article/2716098/working-with-iptables.html +[2]: https://www.networkworld.com/article/3143050/linux/linux-hardening-a-15-step-checklist-for-a-secure-linux-server.html#tk.nww-fsb +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200326 3 open source tools for sticking to a budget.md b/published/202004/20200326 3 open source tools for sticking to a budget.md new file mode 100644 index 0000000000..8504fec779 --- /dev/null +++ b/published/202004/20200326 3 open source tools for sticking to a budget.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12072-1.html) +[#]: subject: (3 open source tools for sticking to a budget) +[#]: via: (https://opensource.com/article/20/3/open-source-budget) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +3 个控制预算的开源工具 +====== + +> 在这篇开源预算工具汇总中找到适合你的解决方案。另外学习有关开源的备税务软件。 + +![](https://img.linux.net.cn/data/attachment/album/202004/05/092735ni323vgji9sbigq9.jpg) + +鉴于目前世界上许多国家/地区的经济形势都在变化,你可能会想改造或改善财务状况和你对它的了解。或者,也许你的新年决心之一是开始预算?你并不孤单。 + +坚持该决心的最佳方法是定期跟踪你的支出和收入。问题是,许多流行的个人理财应用都是专有的。你是否正在寻找 Quicken、Mint 或 You Need a Budget 的开源替代方案?无论你是开源软件新手,还是预算新手,这些工具之一都将满足你的需求和舒适度。 + +### LibreOffice Calc + +我向希望做预算的任何开源新手推荐使用 LibreOffice Calc。如果你使用过 Google Sheets 或 Microsoft Excel 等专有电子表格,那么 LibreOffice Calc 模板将非常熟悉。在此[预算教程][2]中,作者 Jess Weichler 已经为你提供了方便、可下载的模板。该模板已经有费用类别,例如水电费、杂货、外出就餐等,但是你可以自由地根据自己的生活方式对其进行自定义。在第二篇文章中,她向你展示了如何[创建自己的模板][3]。 + +### HomeBank + +对于所有的开源用户来说,HomeBank 都是另一个不错的选择。HomeBank 是免费的,但它拥有许多它同类专有软件的分析和交易功能。实际上,你可以将 Quicken 文件导入到 HomeBank 中,这使得转换到它变得轻而易举。最后,你可以使用一种工具来帮助你明智地做出有关资金的决定,而无需花费更多的钱。在 Jessica Cherry 的[教程][4]中学习如何入门。 + +### GnuCash + +就像这里提到的其他预算工具一样,GnuCash 可以在 Windows、macOS 和 Linux 上使用。它提供了大量文档,但 Don Watkins 会在[此教程][5]中指导你在 Linux 上设置 GnuCash。GnuCash 不仅是控制个人财务的绝佳选择,而且还有开发票等功能来帮助你管理小型企业。 + +### 赠品:OpenTaxSolver + +对许多美国人来说,可怕的税收季可能是一个压力很大的时期。许多人购买 TurboTax 或请会计师或税务服务来缴税。与普遍的看法相反,开源的备税务软件是存在的!作者 Jessica Cherry 在[本文][6]中做了研究,并向读者介绍 OpenTaxSolver。要正确使用 OpenTaxSolver,你需要特别注意细节,但是你不必担心进行复杂的数学运算。 + +你会尝试使用哪个开源预算应用?你是否有我在此列表中未提及的最喜欢的工具?请在评论区分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-source-budget + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0 (A dollar sign in a network) +[2]: https://opensource.com/article/20/3/libreoffice-open-source-budget +[3]: https://opensource.com/article/20/3/libreoffice-templates +[4]: https://opensource.com/article/20/2/open-source-homebank +[5]: https://opensource.com/article/20/2/gnucash +[6]: https://opensource.com/article/20/2/open-source-taxes diff --git a/published/202004/20200327 Build a private chat server with a Raspberry Pi and Rocket.Chat.md b/published/202004/20200327 Build a private chat server with a Raspberry Pi and Rocket.Chat.md new file mode 100644 index 0000000000..25a4581dd7 --- /dev/null +++ b/published/202004/20200327 Build a private chat server with a Raspberry Pi and Rocket.Chat.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12116-1.html) +[#]: subject: (Build a private chat server with a Raspberry Pi and Rocket.Chat) +[#]: via: (https://opensource.com/article/20/3/raspberry-pi-rocketchat) +[#]: author: (Giuseppe Cassibba https://opensource.com/users/peppe8o) + +使用树莓派和 Rocket.Chat 构建一个私人聊天服务器 +====== + +> 使用这些简单、经济高效的开源工具构建自己真正的私人聊天和消息解决方案。 + +![](https://img.linux.net.cn/data/attachment/album/202004/16/203055g5r5w7ei8eenw1ex.jpg) + +互联网提供了大量免费的消息服务。像 WhatsApp 和 Viber 这样的应用已经是我们日常生活的一部分,也是我们与亲朋好友沟通的最常见方式。但是,安全意识的提高,让人们对真正的私密聊天解决方案的需求越来越大。此外,消息类应用在我们的设备中占用了大量空间,因此一个备用聊天渠道可能对于我们与朋友分享媒体、信息和联系人很有作用。 + +今天,我们将了解如何使用[树莓派][2]和 Rocket.Chat 安装一个私人聊天和消息服务器。 + +### 什么是 Rocket.Chat? + +[Rocket.Chat][3] 是一个开源解决方案,它提供了一个增强的聊天服务。它包括媒体共享、屏幕共享和视频/音频呼叫支持等协作工具。 + +它可以通过浏览器或从所有主要应用商店(Google Play、App Store 等)下载使用。 + +除了社区版本外,Rocket.Chat 还提供企业版和专业版,包括支持和其他附加功能。 + +### 我们需要什么 + +对于这个项目,我将使用更便宜的树莓派 3A+。树莓派 3B 和 3B+ 以及树莓派 4B 应该也可以用同样的方法。 + +我也建议使用一块高性能 SD 卡,因为 Rocket.Chat 会给树莓派带来很大的负载。如其他文章中所述,高性能 SD 卡可显著提高 Raspbian 操作系统的性能。 + +我们将使用 Raspbian 的精简版本,拥有预配置的 WiFi 访问和 SSH 服务,因此不需要键盘或 HDMI 线缆。 + +### 分步过程 + +从[安装最新版本的 Raspbian Buster Lite][5] 开始。 + +我们将使用 [Snap][6] 简化 Rocket.Chat 安装。通过 SSH 登录并从终端输入: + +``` +sudo apt-get update +sudo apt-get upgrade +``` + +安装 Snap: + +``` +sudo apt-get install snapd +``` + +安装 Snap 后,我们需要重启系统使其正常工作: + +``` +sudo reboot +``` + +再次通过 SSH 登录,并用以下简单的命令安装 Rocket.Chat: + +``` +sudo snap install rocketchat-server +``` + +从终端安装后,请等待一段时间,让 Rocket.Chat 初始化数据库和服务。休息一下,几分钟后,你应该能够在浏览器中访问 `http://<>:3000`,你应该看到以下内容: + +![Rocket Chat setup wizard][7] + +填写所需的表单就可以了。经过四个简单的设置窗口后,你应该会进入 Rocket.Chat 主页: + +![Rocket Chat home page][8] + +享受吧! + +本文最初发表在 [peppe8o.com][9],并获许重新发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/raspberry-pi-rocketchat + +作者:[Giuseppe Cassibba][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/peppe8o +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://opensource.com/resources/raspberry-pi +[3]: https://rocket.chat/ +[5]: https://peppe8o.com/2019/07/install-raspbian-buster-lite-in-your-raspberry-pi/ +[6]: https://snapcraft.io/ +[7]: https://opensource.com/sites/default/files/uploads/rocket-chat-setup-wizard.jpg (Rocket Chat setup wizard) +[8]: https://opensource.com/sites/default/files/uploads/rocket-chat-home.jpg (Rocket Chat home page) +[9]: https://peppe8o.com/private-chat-and-messaging-server-with-raspberry-pi-and-rocket-chat/ diff --git a/published/202004/20200329 How to install Microsoft TrueType Fonts on Ubuntu-based Distributions.md b/published/202004/20200329 How to install Microsoft TrueType Fonts on Ubuntu-based Distributions.md new file mode 100644 index 0000000000..2300ffee80 --- /dev/null +++ b/published/202004/20200329 How to install Microsoft TrueType Fonts on Ubuntu-based Distributions.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12074-1.html) +[#]: subject: (How to install Microsoft TrueType Fonts on Ubuntu-based Distributions) +[#]: via: (https://itsfoss.com/install-microsoft-fonts-ubuntu/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/itsfoss/) + +如何在基于 Ubuntu 的发行版上安装微软 TrueType 字体 +====== + +如果你在 Linux 上用 LibreOffice 打开一些微软文档,你会发现字体看起来有一点不同。你也将注意到有些常用字体找不到,如 [Times New Roman][1]、Arial 等等。 + +不用担心。我将向你展示如何在 Ubuntu 上和其它基于 Ubuntu 的 Linux 发行版上安装这些字体。但是在此之前,让我告诉你为什么这些字体没有被默认安装。 + +### 为什么微软字体不被默认安装在 Linux 中? + +![][2] + +Times New Roman、Arial 等字体都是微软的,并且这些字体不是开源的。很多 Linux 发行版默认不提供专有软件,以避免授权问题。 + +这就是为什么在默认情况下 Ubuntu 和其它 Linux 发行版使用开源字体 “Liberation” 字体来替代微软字体的原因。[Red Hat][4] 创建 [Liberation 字体][3] 来代替 Arial、Arial Narrow、 Times New Roman 和 Courier New,因为这些字体的宽度一样。当你打开一个使用 Times New Roman 字体书写的文档时,会使用对应的 Liberation 字体来保持文档不被破坏。 + +不过,Liberation 字体与微软的字体并不是完全相同的,在一些情况下,你可能需要使用 Arial 或 Times New Roman。一个非常常见的情况是,在学校、大学和其他公共或私人机构中,微软的字体是唯一的选择。他们要求你使用这些字体之一来提交文档。 + +好在,你可以在 Ubuntu 和其它发行版上很容易地安装微软字体。以这种方式,你将增强 LibreOffice 的兼容性,并可以自由选择开源办公软件。 + +### 在基于 Ubuntu 的 Linux 发行版上安装微软字体 + +你可以自行下载字体,并[在 Ubuntu 中安装新的字体][5]。但是由于微软字体非常受欢迎(并且是免费提供的),所以 Ubuntu 提供了一种简单的方法来安装它们。 + +要知道尽管微软已经免费发布了其核心字体,在其它操作系统中使用该字体依然是受到限制的。在 Ubuntu 中安装微软字体前,你必须阅读并接受 EULA (最终用户许可协议) 。 + +这些字体 [可在 multiverse 存储库中获得,首先要确保启用它][6]: + +``` +sudo add-apt-repository multiverse +``` + +在此之后,你可以更新你的 Ubuntu 存储库缓存,并像这样安装微软字体: + +``` +sudo apt update && sudo apt install ttf-mscorefonts-installer +``` + +当微软的最终用户协议出现时,按 `tab` 键来选择 “OK” ,并按回车键。 + +![按 tab 键来高亮选择][7] + +单击 “Yes” 来接受微软的协议: + +![使用 tab 键来作出选择,并按回车键][8] + +当安装完成后,你应该使用下面的命令来更新字体缓存: + +``` +sudo fc-cache -f -v +``` + +![][9] + +如果你现在打开 LibreOffice ,你将看到微软 [TrueType 字体][10] 。 + +![][11] + +如果意外地拒绝了许可协议,你可以使用这个命令来重新安装安装程序: + +``` +sudo apt install –reinstall ttf-mscorefonts-installer +``` + +微软的 TrueType 字体也可以通过 [Ubuntu Restricted Extras package][12] 获得,其包含用来播放 MP3 等文件的其它专有的多媒体编解码器。 + +> 不要轻视专有字体。 +> +> 你可能认为字体有什么大不了的呢?毕竟,它只是一款字体,而不是软件的一个关键部分,对吧?但是你知道,这些年来 [Netflix 为其使用的专有字体支付了数百万美元][13]吗?最后,他们创建了自己的自定义字体,这为他们节省了一大笔钱。 + +希望这个快速教程有用。更多的生产力教程即将上线,请在下面留下你的评论,了解更多信息请订阅我们的社交媒体! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-microsoft-fonts-ubuntu/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Times_New_Roman +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/microsoft-fonts-ubuntu.png?ssl=1 +[3]: https://en.wikipedia.org/wiki/Liberation_fonts +[4]: https://en.wikipedia.org/wiki/Red_Hat +[5]: https://itsfoss.com/install-fonts-ubuntu/ +[6]: https://itsfoss.com/ubuntu-repositories/ +[7]: https://i1.wp.com/i.imgur.com/JoEJp5w.png?ssl=1 +[8]: https://i0.wp.com/i.imgur.com/M8zTc7f.png?ssl=1 +[9]: https://i0.wp.com/i.imgur.com/Cshle6S.png?ssl=1 +[10]: https://en.wikipedia.org/wiki/TrueType +[11]: https://i1.wp.com/i.imgur.com/9oIu3oj.png?ssl=1 +[12]: https://itsfoss.com/install-media-codecs-ubuntu/ +[13]: https://thehustle.co/nextflix-sans-custom-font/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Dimitrios.jpg?ssl=1 diff --git a/published/202004/20200329 Oracle Announces Java 14- How to Install it on Ubuntu Linux.md b/published/202004/20200329 Oracle Announces Java 14- How to Install it on Ubuntu Linux.md new file mode 100644 index 0000000000..fc7af79bb5 --- /dev/null +++ b/published/202004/20200329 Oracle Announces Java 14- How to Install it on Ubuntu Linux.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12076-1.html) +[#]: subject: (Oracle Announces Java 14! How to Install it on Ubuntu Linux) +[#]: via: (https://itsfoss.com/java-14-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何在 Ubuntu Linux 上安装 Oracle Java 14 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/05/205313e188lsbrbgz9932d.jpg) + +最近,Oracle 宣布 Java 14(或 Oracle JDK 14)公开可用。如果你想进行最新的实验或者开发的话,那么你可以试试在 Linux 系统上安装 Java 14。 + +Oracle JDK 14(或简称 Java 14)[发布版][1]包含几个新功能,如果你想预览它们的话。我已添加了链接: + + * [instanceof 的模式匹配][2] + * [Records][3] + * [Text Blocks][4] + +除预览功能外,它还包含一些改进和补充。在新闻中,他们还提到了其他改进: + +> 此外,最新的 Java 版本增加了 Java 语言对 switch 表达式的支持,新增了用于持续监控 JDK Flight Recorder 数据的新 API,将低延迟 zgc 扩展到了 macOS 和 Windows,并添加在 incubator 模块中,独立的 Java 应用打包,以及为了安全、有效地访问 Java 堆外部内存的新的外部内存访问 API。 + +当然,如果你想深入了解细节,那么你应查看[官方公告][1]。 + +在本教程中,我将向你展示在 Ubuntu 系统上安装 Java 14 的简便方法。请继续阅读。 + +**注意:**如果你选择使用 Oracle Java 11 或更高版本,那么应该了解新的 [Oracle 技术网络许可协议][5],以了解它如何影响个人用户、开发人员和商业组织。通常,它们可以免费用于开发和测试,但不能用于生产环境。 + +### 如何在 Ubuntu Linux 上安装 Java 14? + +作为参考,我已成功在默认安装 **OpenJDK 11** 的 **Pop!_OS 19.10** 上成功安装了它。 + +这里,我们将使用 [Linux Uprising][7] 的 Java 14 安装程序(最初基于 WebUpd8 Java 软件包)。 + +只需在终端中输入以下命令即可进行安装: + +``` +sudo add-apt-repository ppa:linuxuprising/java +sudo apt update +sudo apt install oracle-java14-installer +``` + +这应该就完成了,如果你想将它设为默认,那么你可以输入以下命令: + +``` +sudo apt install oracle-java14-set-default +``` + +值得注意的是,这仅适用于基于 Ubuntu 的发行版。如果要在 Debian 和其他 Linux 发行版上安装它,那么也可以按照 [Linux Uprising 中的详细指南][7]安装 Java 14。 + +### 总结 + +当然,这些会带来最新的特性,如果你不想破环原有环境,你或许会希望继续使用 Java 11。如果你想在了解风险的情况下进行试验,请继续尝试! + +欢迎在下面的评论中让我知道你对 Java 14 的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/java-14-ubuntu/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.oracle.com/corporate/pressrelease/oracle-announces-java14-031720.html +[2]: https://openjdk.java.net/jeps/305 +[3]: https://openjdk.java.net/jeps/359 +[4]: https://openjdk.java.net/jeps/368 +[5]: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/install-java-14-ubuntu.png?ssl=1 +[7]: https://www.linuxuprising.com/2020/03/how-to-install-oracle-java-14-jdk14-on.html diff --git a/published/202004/20200329 The Keyring Concept in Ubuntu- What is It and How to Use it.md b/published/202004/20200329 The Keyring Concept in Ubuntu- What is It and How to Use it.md new file mode 100644 index 0000000000..3af840a02c --- /dev/null +++ b/published/202004/20200329 The Keyring Concept in Ubuntu- What is It and How to Use it.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12093-1.html) +[#]: subject: (The Keyring Concept in Ubuntu: What is It and How to Use it?) +[#]: via: (https://itsfoss.com/ubuntu-keyring/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +解读 Ubuntu 里的密钥环概念 +====== + +![][3] + +如果你用过 Ubuntu 或者其他的 Linux 发行版里的[自动登录功能][1], 你可能遇到过这种弹出消息: + +> 请输入密码以解锁你的登录密钥环 +> +> 登录密钥环在你登录系统时未解锁。 + +![Enter Password To Unlock Your Login Keyring Ubuntu][2] + +如果你一直点击取消,它会不断弹出几次才会消失。你可能想知道,为什么你会一直看到这个密钥环信息呢? + +让我来告诉你吧。它其实不是错误,而是一个安全特性。 + +奇怪吗?下面就让我来解释下 Linux 里的密钥环概念。 + +### Linux 里的密钥环是什么。为什么需要它? + +在现实生活中你为什么要用钥匙环(也叫[钥匙链][4])?你用它把一把或多把钥匙串到一起, 以便于携带和查找。 + +Linux 里也是类似的。密钥环特性使你的系统可以将各种密码放在一起,并将其保存在一个地方。 + +大多数 Linux 桌面环境,如 GNOME、KDE、Xfce 等采用 [GNOME 密钥环][5]来提供这个功能。 + +该密钥环保存了 ssh 密钥、GPG 密钥以及使用此功能的应用程序(例如 Chromium 浏览器)的密钥。默认情况下,**“密钥环”通过主密码来保护**,该密码通常是帐户的登录密码。 + +系统上的每个用户都有自己的密钥环,(通常)密码与用户帐户本身的密码相同。当你使用密码登录系统时,你的密匙环将使用你帐户的密码自动解锁。 + +当你[启用 Ubuntu 中的自动登录功能时][1]时,就有问题了。这意味着你无需输入密码即可登录系统。在这种情况下,你的密钥环不会自动解锁。 + +#### 密钥环是一个安全特性 + +记得我说过密钥环是一个安全特性吗?现在想象一下你在 Linux 电脑上开启了自动登录功能。有权访问你电脑的任何人无需密码就能进入你的系统。但是你可能不会在意,因为你只是用它来访问互联网。 + +但是,如果你在 Ubuntu 中使用 Chromium 或 [Google Chrome][6] 之类的浏览器,并使用它来保存各种网站的登录密码,那么你将遇到麻烦。任何人都可以使用浏览器并利用你在浏览器中保存的密码登录网站。这不很危险吗? + +这就是为什么当你使用 Chrome 时,它将反复地提示你先解锁密钥环。这确保了只有知道密钥环密码(即账户密码)的人才能使用在浏览器中保存的密码来登录它们相关的网站。 + +如果你反复取消解锁密钥环的提示,它最终将消失,并允许你使用浏览器。但是,保存的密码将不会被解锁,你在 Chromium/Chome 浏览器上将会看到“同步暂停”的提示。 + +![Sync paused in Google Chrome][7] + +#### 如果密钥环一直存在,为什么你从来没有见过它呢? + +如果你在你的 Linux 系统上从没见过它的话,这个问题就很有道理。 + +如果你从没有用过自动登录功能(或者修改你的账户密码),你可能都没有意识到这个特性的存在。 + +这是因为当你通过你的密码登录系统时,你的密钥环被你的账户密码自动解锁了。 + +Ubuntu(和其他发行版)在执行普通的管理任务如修改用户、安装新软件等需要输入密码,无论你是否是自动登录的。但是对于日常任务像使用浏览器,它不需要输入密码因为密钥环已经被解锁了。 + +当你切换到自动登录时,你不再需要输入登录密码。这意味着密钥环没有被自动解锁,因此当你使用利用了密钥环特性的浏览器时,它将提示你来解锁密钥环。 + +#### 你可以轻松地管理密钥环和密码 + +这个密钥环放在哪里?它的核心是一个守护任务(一个后台自动运行的程序)。 + +别担心。你不必通过终端来操作守护任务。大多数桌面环境都自带一个可以和这个守护进程进行交互的图形化应用程序。KDE 上有 KDE 钱包,GNOME 和其他桌面上叫做“密码和密钥”(之前叫 [Seahorse][8])。 + +![Password And Keys App in Ubuntu][9] + +你可以用这个 GUI 程序来查看哪些应用程序在用密钥环来管理/保护密码。 + +你可以看到,我的系统有自动创建的登录密钥环。也有一个存储 GPG 和 SSH 密钥的密钥环。那个[证书][10]用来保存证书机构颁发的证书(如 HTTPS 证书)。 + +![Password and Keys application in Ubuntu][11] + +你也可以使用这个应用程序来手动保存网站的密码。例如,我创建了一个新的叫做“Test”的被密码保护的密钥环,并手动存储了一个密码。 + +这比在一个文本文件中保存一批密码要好一些。至少在这种情况下,你的密码只有在你通过密码解锁了密钥环时才允许被看到。 + +![Saving New Password Seahorse][12] + +这里有一个潜在的问题,如果你格式化你的系统,手动保存的密码必然会丢失。通常,你会备份你的个人文件,但并不是所有的用户特定数据,如密钥环文件。 + +有一种办法能解决它。密钥环数据通常保存在 `~/.local/share/keyrings` 目录。在这里你可以看到所有的密钥环,但是你不能直接看到它们的内容。如果你移除密钥环的密码(我会在这篇文章的后面描述操作步骤),你可以像一个普通的文本文件一样读取密钥环的内容。你可以将这个解锁后的密钥环文件完整地复制下来,并在其他的 Linux 机器上运行“密码和密钥”应用程序导入到其中。 + +总结一下目前为止所学的内容: + + * 大多数 Linux 系统缺省已经安装并激活了密钥环特性 + * 系统上的每个用户都拥有他自己的密钥环 + * 密钥环通常是用账户密码锁定的(保护) + * 当你通过密码登录时密钥环会被自动解锁 + * 对于自动登录,密钥环不会自动解锁,因此当你试图使用依赖密钥环的应用程序时会被提示先解锁它 + * 并不是所有的浏览器或应用程序利用了密钥环特性 + * (Linux 上)安装一个 GUI 程序可以和密钥环交互 + * 你可以用密钥环来手动存储加密格式的密码 + * 你可以自己修改密钥环密码 + * 你可以通过导出(需要先解锁密钥环)并导入到其他计算机上的方式来获取手工保存的密码。 + +### 修改密钥环密码 + +假设你修改了你的账户密码。当你登录时,你的系统试图通过新的登录密码来自动解锁密钥环。但是密钥环还在使用老的登录密码。 + +这种情况下,你可以修改密钥环密码为新的登录密码,这样密码环才能在你登录系统时自动解锁。 + +从菜单中打开“密码和密钥”应用程序: + +![Look for Password and Keys app in the menu][9] + +在“Login”密钥环上右击并点击“修改密码”: + +![Change Keyring Password][13] + +#### 如果你不记得老的登录密码怎么办? + +你可能知道在 [Ubuntu 上重置忘记的密码很容易][14]。但是密钥环在这种场景下还是有问题。你修改了账户密码,但是你不记得仍然被密钥环使用的老的账户密码。 + +你不能修改它因为你不知道老的密码。怎么办? + +这种情况下,你将不得不移除整个密钥环。你可以通过“密码和密钥”应用程序来操作: + +![Delete Keyring Ubuntu][15] + +它会提示你进行确认: + +![Delete Keyring][16] + +另外,你也可以手动删除 `~/.local/share/keyrings` 目录下的密钥环文件。 + +老的密钥环文件被移除后,你再打开 Chrome/Chromium 时,它会提示你创建一个新的密钥环。 + +![New Keyring Password][17] + +你可以用新的登录密码,密钥环就会被自动解锁了。 + +### 禁用密钥环密码 + +在你想用自动登录但又不想手动解锁密钥环时,你可以把禁用密钥环密码作为一个规避方法。记住你正在禁用一个安全特性,因此请三思。 + +操作步骤和修改密钥环相似。打开“密码和密钥”应用程序,然后修改密钥环密码。 + +技巧在于当它提示修改密码时,不要输入新密码,而是点击“继续”按钮。这将移除密钥环的密码。 + +![Disable Keyring password by not setting any password at all][18] + +这种方法,密钥环没有密码保护,并将一直处于解锁状态。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-keyring/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-automatic-logon/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/enter-password-to-unlock-your-login-keyring-ubuntu.jpg?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/keyring-concept-ubuntu-1.png?ssl=1 +[4]: https://en.wikipedia.org/wiki/Keychain +[5]: https://wiki.archlinux.org/index.php/GNOME/Keyring +[6]: https://itsfoss.com/install-chrome-ubuntu/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/sync-paused-keyring-ubuntu.jpg?ssl=1 +[8]: https://wiki.debian.org/Seahorse +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/password-and-keys-app-ubuntu.jpg?ssl=1 +[10]: https://help.ubuntu.com/lts/serverguide/certificates-and-security.html +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/keyring-pasword-ubuntu.png?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/saving-new-password-seahorse.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/change-keyring-password.png?ssl=1 +[14]: https://itsfoss.com/how-to-hack-ubuntu-password/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/delete-keyring-ubuntu.jpg?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/delete-keyring.jpg?ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/new-keyring-password.jpg?ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/disable-keyring-password-ubuntu.png?ssl=1 diff --git a/published/202004/20200329 Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen.md b/published/202004/20200329 Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen.md new file mode 100644 index 0000000000..fd51a345f3 --- /dev/null +++ b/published/202004/20200329 Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12063-1.html) +[#]: subject: (Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen) +[#]: via: (https://itsfoss.com/kde-plasma-bigscreen/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +用 KDE “等离子大屏幕”把你的普通电视变成智能电视 +====== + +> KDE 即将推出的“等离子大屏幕”项目可让你使用开源技术将普通电视变成智能电视。 + +如今,智能电视已成为新的常态。这些智能电视主要基于 Android,可让你播放 YouTube、Netflix、Spotify 和其他流媒体服务。你甚至可以使用语音命令来控制你的智能电视。 + +这些所谓的“智能电视”的一个主要问题是它们可能正在[监视你][1]。你的数据在你或许知道或许不知道的情况下被收集。 + +这就是 KDE 的“[等离子大屏幕项目][2]”旨在解决的问题。(LCTT 译注: 等离子Plasma恰是 KDE 桌面环境的名称,和大屏幕Bigscreen很搭,因此这个惯常不翻译的名称这里翻译出来。) + +### “等离子大屏幕”:通过开源技术使电视更智能 + +![][3] + +你可能了解 [KDE][4] 项目。它开始是一个 Linux 桌面环境项目,而在发展了 20 多年后,KDE 项目变得越来越大,这就是为什么他们创建了 Plasma 桌面环境的原因,以明确表明 KDE 不再仅仅是“K 桌面环境K Desktop Environment(KDE)”了。 + +Plasma 项目本身具有多种用途,当然,你可以在台式机 Linux 计算机上使用它,而 [Plasma 也具有移动版本][5],你可以在基于 Linux 的智能手机上运行它,例如 [Librem5][6] 和 [PinePhone][7]。 + +“等离子大屏幕Plasma Bigscreen”是 KDE 的一个新项目,旨在提供类似于智能电视所提供的界面和功能。 + +你需要的是一台[树莓派之类的单板计算机][8]和一台带 HDMI 端口的电视,然后在你的树莓派设备上安装“等离子大屏幕”,将其连接到电视就行。 + +### “等离子大屏幕”的功能:不仅仅是媒体服务器 + +![YouTube In Plasma Bigscreen][9] + +乍一看,它看起来很像是一个媒体服务器,但“等离子大屏幕”却和 Kodi 及其它 [Linux 媒体服务器][10] 不同,它不止于此。 + +#### 使用常规遥控器进行控制 + +你不需要新的专用遥控器。多亏了 [CEC][11],你可以使用常规的电视遥控器。 + +#### 带有开源 Mycroft AI 的语音控制 + +“等离子大屏幕”利用了开源 Mycroft AI 项目。借助“等离子大屏幕”内置的 Mycroft AI,你可以使用语音命令播放内容、检查天气并控制智能电视的其他方面。你可以通过教它新技能来进一步训练它。 + +#### 传统的桌面应用程序 + +“等离子大屏幕”不仅提供丰富的媒体应用程序,还提供经过重新设计,适合它的体验的传统桌面应用程序。 + +#### 自由开源软件 + +最重要的是它是一个开源项目,它使用其他开源技术为你提供对数据和智能电视的完全控制。 + +由于它是开源的,我相信一旦发布,就会有一些供应商将其作为即插即用设备提供。 + +### 如何获取“等离子大屏幕”? + +“等离子大屏幕”仍处于测试阶段,没有确定稳定版发布的时间表。 + +但是,测试版已经可以在树莓派 4 等设备上正常运行。下面是一个从事此项目的开发人员的视频。 + +- [video](https://youtu.be/iOxMuexAPaQ) + +如果你有树莓派 4,则可以从其官方下载页面上下载“[等离子大屏幕][13]”的测试版,然后按照[此处][14]的步骤进行安装。 + +就个人而言,我对此感到非常兴奋。我要花一些时间在[树莓派 4][15]上尝试一下。你呢?你认为该项目具有潜力吗?你想试试看吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kde-plasma-bigscreen/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.zdnet.com/article/fbi-warns-about-snoopy-smart-tvs-spying-on-you/ +[2]: https://plasma-bigscreen.org/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/plasma-bigscreen-menu.jpg?ssl=1 +[4]: https://kde.org/ +[5]: https://itsfoss.com/kde-announces-plasma-mobile/ +[6]: https://itsfoss.com/librem-linux-phone/ +[7]: https://itsfoss.com/pinephone/ +[8]: https://itsfoss.com/raspberry-pi-alternatives/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/youtube-in-plasma-bigscreen.jpg?ssl=1 +[10]: https://itsfoss.com/best-linux-media-server/ +[11]: http://libcec.pulse-eight.com/ +[12]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[13]: https://plasma-bigscreen.org/#download-jumpto +[14]: https://plasma-bigscreen.org/manual/ +[15]: https://itsfoss.com/raspberry-pi-4/ diff --git a/published/202004/20200330 Using data from spreadsheets in Fedora with Python.md b/published/202004/20200330 Using data from spreadsheets in Fedora with Python.md new file mode 100644 index 0000000000..9cff11bd8f --- /dev/null +++ b/published/202004/20200330 Using data from spreadsheets in Fedora with Python.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12099-1.html) +[#]: subject: (Using data from spreadsheets in Fedora with Python) +[#]: via: (https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +使用 Python 读取电子表格中的数据 +====== + +![][1] + +[Python][2] 是最流行、功能最强大的编程语言之一。由于它是自由开源的,因此每个人都可以使用。大多数 Fedora 系统都已安装了该语言。Python 可用于多种任务,其中包括处理逗号分隔值(CSV)数据。CSV文件一开始往往是以表格或电子表格的形式出现。本文介绍了如何在 Python 3 中处理 CSV 数据。 + +CSV 数据正如其名。CSV 文件按行放置数据,数值之间用逗号分隔。每行由相同的*字段*定义。简短的 CSV 文件通常易于阅读和理解。但是较长的数据文件或具有更多字段的数据文件可能很难用肉眼解析,因此在这种情况下计算机做得更好。 + +这是一个简单的示例,其中的字段是 `Name`、`Email` 和 `Country`。在此例中,CSV 数据将字段定义作为第一行,尽管并非总是如此。 + +``` +Name,Email,Country +John Q. Smith,jqsmith@example.com,USA +Petr Novak,pnovak@example.com,CZ +Bernard Jones,bjones@example.com,UK +``` + +### 从电子表格读取 CSV + +Python 包含了一个 `csv` 模块,它可读取和写入 CSV 数据。大多数电子表格应用,无论是原生(例如 Excel 或 Numbers)还是基于 Web 的(例如 Google Sheet),都可以导出 CSV 数据。实际上,许多其他可发布表格报告的服务也可以导出为 CSV(例如,PayPal)。 + +Python `csv` 模块有一个名为 `DictReader` 的内置读取器方法,它可以将每个数据行作为有序字典 (`OrderedDict`) 处理。它需要一个文件对象访问 CSV 数据。因此,如果上面的文件在当前目录中为 `example.csv`,那么以下代码段是获取此数据的一种方法: + +``` +f = open('example.csv', 'r') +from csv import DictReader +d = DictReader(f) +data = [] +for row in d: + data.append(row) +``` + +现在,内存中的 `data` 对象是 `OrderedDict` 对象的列表: + +``` +[OrderedDict([('Name', 'John Q. Smith'), + ('Email', 'jqsmith@example.com'), + ('Country', 'USA')]), + OrderedDict([('Name', 'Petr Novak'), + ('Email', 'pnovak@example.com'), + ('Country', 'CZ')]), + OrderedDict([('Name', 'Bernard Jones'), + ('Email', 'bjones@example.com'), + ('Country', 'UK')])] +``` + +引用这些对象很容易: + +``` +>>> print(data[0]['Country']) +USA +>>> print(data[2]['Email']) +bjones@example.com +``` + +顺便说一句,如果你需要处理没有字段名标题行的 CSV 文件,那么 `DictReader` 类可以让你定义它们。在上面的示例中,添加 `fieldnames` 参数并传递一系列名称: + +``` +d = DictReader(f, fieldnames=['Name', 'Email', 'Country']) +``` + +### 真实例子 + +我最近想从一长串人员名单中随机选择一个中奖者。我从电子表格中提取的 CSV 数据是一个简单的名字和邮件地址列表。 + +幸运的是,Python 有一个有用的 `random` 模块,可以很好地生成随机值。该模块 `Random` 类中的 `randrange` 函数正是我需要的。你可以给它一个常规的数字范围(例如整数),以及它们之间的步长值。然后,该函数会生成一个随机结果,这意味着我可以在数据的总行数范围内获得一个随机整数(或者说是行号)。 + +这个小程序运行良好: + +``` +from csv import DictReader +from random import Random + +d = DictReader(open('mydata.csv')) +data = [] +for row in d: + data.append(row) + +r = Random() +winner = data[r.randrange(0, len(data), 1)] +print('The winner is:', winner['Name']) +print('Email address:', winner['Email']) +``` + +显然,这个例子非常简单。电子表格本身包含了复杂的分析数据的方法。但是,如果你想在电子表格应用之外做某事,Python 或许是一种技巧! + +题图由 [Isaac Smith][3] 拍摄,发表于 [U​​nsplash][4]。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [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/2020/03/spreadsheets-python-816x345.jpg +[2]: https://python.org +[3]: https://unsplash.com/@isaacmsmith?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[4]: https://unsplash.com/s/photos/spreadsheets?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202004/20200331 5 ways to level up your Vim skills.md b/published/202004/20200331 5 ways to level up your Vim skills.md new file mode 100644 index 0000000000..487f0247ba --- /dev/null +++ b/published/202004/20200331 5 ways to level up your Vim skills.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12077-1.html) +[#]: subject: (5 ways to level up your Vim skills) +[#]: via: (https://opensource.com/article/20/3/vim-skills) +[#]: author: (Detlef Johnson https://opensource.com/users/deckart) + +提升你的 Vim 技能的 5 个方法 +====== + +> 通过一些有趣的小技巧使你的文本编辑器更上一层楼。 + +![](https://img.linux.net.cn/data/attachment/album/202004/05/232434x1hnzlnhcnm3nrc7.jpg) + +Vim 是最受欢迎的文本编辑器之一,因此绝对值得你花时间去学习如何使用它。就算你只是学习使用这个无处不在的 [Vi(m)][2] 命令行文本编辑器打开文件、输入和编辑一些文本、保存编辑的文件并退出程序,你都会受益匪浅。 + +你会发现,使用 Vim 非常方便的的场景几乎总是涉及到运行远程 Shell 操作的任务。如果你时不时地使用 ssh,比如 + +``` +$ ssh user@hostname.provider.com +``` + +并在虚拟专用服务器(VPS)或本地虚拟化容器中工作,那么就可以从这些强大的 Vim 技能中受益匪浅。 + +### 将 Vim 设置为默认的文本编辑器 + +几乎所有的现代 Linux(或 BSD)发行版中,都可以在终端仿真器的 shell 命令提示符下使用 Vim。一旦在你的用户 shell 程序中将 Vim 定义为默认编辑器后,那么就可以使用熟悉的 Vim 键绑定来在内置的实用程序(例如 `man`)中导航。我将说明如何使用 Bash 和 Z shell(zsh)来实现此目的,zsh 现在是 macOS 用户的默认 shell(自 Catalina 起)。 + +#### 在 Bash 中将 Vim 设置为默认 + +Bash 通过点文件的组合来管理设置。最常见的的做法将你的编辑器添加到主目录中的 `.bashrc` 文件中,但也可以将其添加到 `.bash_profile` 中。(请阅读 [GNU Bash 文档][3]了解两者的不同之处)。 + +通过在 `~/.bashrc` 中添加以下内容,将 Vim 设置为默认编辑器: + +``` +# set default editor to Vim +export EDITOR=vim +``` + +以 `#` 开头的行是可选的注释,这是一个好方法,可以提醒自己该命令的作用。 + +#### 在 zsh 中将 Vim 设置为默认 + +zsh 是一种越来越流行的终端仿真器,尤其是在苹果公司的基于 FreeBSD 的 Darwin 系统最近从 Bash 转向 zsh 以来。 + +zsh 点文件与 Bash 的文件相当,因此你可以在 `~/.zshrc` 或 `~/.zprofile` 之间进行选择。有关何时使用哪一个的详细信息,请参见 [zsh文档][4]。 + +将其设置为默认: + +``` +# set default editor to Vim +export EDITOR=vim +``` + +### 优化 Vim 配置 + +Vim 像是终端仿真器 shell 一样,也使用点文件来设置个人偏好。如果你发现了这种模式,则可能已经猜到它是 `~/.vimrc`。 + +你可能要更改的第一个设置是将对传统的 Vi 兼容模式切换为“关闭”。由于 Vim 是 Vi 的超集,因此 Vi 中的所有功能在 Vim 中都是可用的,并且在 Vim 中得到了很大的改进,你可以获得许多高级功能。最新版本(8.2)允许你在分割的窗口中以子进程 shell 的方式打开一个终端。 + +顺便说一句,明确关闭对传统的 Vi 的兼容性看起来没有什么作用([事实上,可能并没有什么作用][5])。当 Vim 遇到 `.vimrc` 文件时,它会暗暗地自动将兼容模式切换到关闭。但有时将其明确关闭仍然很重要。缩写 `nocp` 是 `nocompatible` 的同义词,作用是一样的。[条条大道通罗马][6],切换首选项有很多方式。 + +在 `.vimrc` 语法中, 以 `"` 开头的行是注释(就像 `.bashrc` 文件中的 `#` 一样),这些注释可以帮助你记住诸如为何选择了一个隐晦的设置名称之类的内容。 + +要关闭 Vi 兼容性,请将以下内容添加到 `~/.vimrc` 文件中: + +``` +" ensure that legacy compatibility mode is off +" documentation: ' +set nocp +``` + +### 理解模式 + +Vim 的 “模式”概念是非常重要的,尤其是“普通模式”和“插入模式”之间的区别。对模式的混淆是大多数新用户的困扰。模式并不是 Vim 所独有的,甚至也不是 Vi 所引入的。命令模式是如此的古老,以至于它比 70 年代发明的[复制和粘贴][7]功能还要早。 + +#### 重要的模式 + +Vim 依赖于不同的模式来定义键盘的敲击行为。需要了解的重要模式有: + +* 普通模式:默认模式,主要用于导航和打开文件。 +* 插入模式(包括替换):这种模式下 Vim 允许将文本输入到打开的文件中。 +* 可视模式:Vim 的行为类似于基于鼠标的输入方式,如复制、编辑、替换等。 +* 命令模式(包括行模式、Ex 命令模式和末行模式):是在 Vim 中做更多事情的强大方法。 + +每种模式都有很多值得探索的地方。使用 [Vimtutor][8](`vimtutor`)可以交互式地学习移动光标、模式和在末行模式下运行 Ex 命令。一些不可缺少的生产力操作符包括: + +操作符 | 说明 +--- | --- +`:E` | 打开资源管理器,用于定位文件和目录。 +`.` | 重复上次的编辑操作。 +`;` | 向前重复上一次的动作或移动 +`,` | 向后重复上一次的动作或移动。 +`/` | 向前搜索文档。 +`?` | 向后搜索文档。 +`*` | 查找光标所在处的单词的下一个出现的地方。 +`#` | 查找光标所在处的单词的上一次出现的地方。 +`~` | 切换大小写。 +`%` | 在 `()`、`[]` 和 `{}` 的开闭符号之间切换;对编码非常有用。 +`z=` | 提出拼写建议。 + +### 像钢琴一样弹奏 Vim + +尽管把 Vim 的操作符“语言”记在记忆中是很重要的,但要想掌握它,难点在于学会像音乐家一样思考,把操作符和动作组合成“和弦”,这样你就可以像弹钢琴一样弹奏 Vim。这就是 Vim 的文本操作能力可以与另一个著名的命令行编辑器 Emacs 相媲美的地方。(虽然其中一个编辑器会让磨损掉你的 `Esc` 键,而另一个编辑器会让你的 `Ctrl` 键磨损掉。) + +在描述键“和弦”时,Vim 中的传统做法是用大写字母 C 后面加上一个连字符(`C-`)来指代 `Ctrl` 键。这并不是通用的,但我将从这里开始遵循这一惯例,并在有可能引起混淆的时候加以说明。 + +如果你在 Vim 中键入长行,你会想把它设置成可以换行。想要根据你的工作方式对 Vim 进行个性化设置,请考虑一下这个设置:默认情况下,你希望 Vim 启动时如何处理文本换行?开还是关?我喜欢将其关闭,并将其留在运行命令文件之外。当我想让文本自动换行时,我只需在命令行模式下用 `:set wrap` 设置即可。 + +让 Vim 设置为默认情况下自动换行并没有错,这只是一个偏好问题 —— 它可能随着时间的推移而改变。同样你也可以控制粘贴、代码语言缩进语法和 `Tab` 键的设置(制表符还是空格?多少个空格?可也在[这里][9]深入研究这些选项)。所有这些默认行为的选项都是完全可配置和可更改的,并且在你使用命令行模式操作时可以实时更改。 + +你会在社区论坛、Vim 维基和文章(比如这篇文章)中找到很多关于设置 Vim 默认设置的建议。你应该很熟悉为你的个人计算环境设置首选项,Vim 也不例外。我强烈建议你从对设置进行很小的更改开始,慢慢地进行其它更改,以便你可以轻松地恢复设置。这样一来,你就可以好多年避免使用插件或完全不用插件。 + +### Vim 8.2 中的分割、标签和终端 + +有两种方法可以将你正在处理的文件分割成不同的视图:它们可以并排显示,也可以使用应用程序标签页在全屏(窗口)中切换。这些对应用程序窗口的更改是从命令模式启动的,这需要使用冒号(`:`)来调起提示符。 + +每个分割的窗口可以容纳一个文件进行编辑,你可以通过标签页在更多的文件之间随意切换。分割的屏幕空间有限,所以当你想分割更多的屏幕时,标签页是很方便的。想要如何设置,纯属个人喜好的问题。要水平分割一个窗口,使用 `:sp`,垂直分割时使用 `:vs`。 + +从 [Vim 8.2][10] 开始,你可以用 `:vert term` 打开一个垂直分割的终端 shell 子进程,以在你的代码旁边的命令行上进行操作。你需要键入 `exit` 来关闭你的终端进程,就像你结束一个 shell 会话一样,但你关闭这个分割的窗口和标签页的方式和关闭任何普通的 Vim 窗口一样,要用 `:q` 来关闭。 + +要初始化一个标签页,请使用一个特殊的编辑命令:`:tabedit`,它会自动切换到新打开的标签页。如果你给该命令一个文件名作为参数,会打开该文件并进行编辑。如果你忽略了给它一个文件名作为参数,可以在命令行模式下的使用编辑命令 `:e filename.txt`,就像在任何一个普通的 Vim 窗口中一样。可以使用下一个(`:tabn`)和上一个(`:tabp`)命令在标签页间导航。 + +要使用分割,你需要知道如何使用组合键 `C-w` 和你想要移动的方向的移动键,例如左(`h`)、下(`j`)、左(`k`)、右(`l`)。如果你想学习更多的组合键,请阅读 Vim 手册中的 `:help split` 和 `:help tabpage`。 + +### 获取帮助 + +虽然可以在 Vimtutor 中打开参考 Vim 手册,但用 `:help` 打开 Vim 帮助,可以让你自己把时间花在编辑器上,不用完全依赖像这样的文章,就能获得更多的成果。经验是掌握 Vim 的关键。经验有助于提高你的整体计算直觉,因为 Vim 中的很多东西都是从 Unix 宇宙中汲取的。 + +祝你在探索 Vim 之美的过程中玩得开心,有什么问题可以在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/vim-skills + +作者:[Detlef Johnson][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/deckart +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/keyboaord_enter_writing_documentation.jpg?itok=kKrnXc5h (Computer keyboard typing) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html +[4]: http://zsh.sourceforge.net/Intro/intro_3.html +[5]: http://vimdoc.sourceforge.net/htmldoc/starting.html#compatible-default +[6]: https://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it +[7]: https://www.npr.org/2020/02/22/808404858/remembering-the-pioneer-behind-your-computers-cut-copy-and-paste-functions +[8]: http://www2.geog.ucl.ac.uk/~plewis/teaching/unix/vimtutor +[9]: https://opensource.com/article/18/9/vi-editor-productivity-powerhouse +[10]: https://www.vim.org/vim-8.2-released.php diff --git a/published/202004/20200401 How to Find Which Graphics Card do You Have in Linux.md b/published/202004/20200401 How to Find Which Graphics Card do You Have in Linux.md new file mode 100644 index 0000000000..6ad35a9367 --- /dev/null +++ b/published/202004/20200401 How to Find Which Graphics Card do You Have in Linux.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12086-1.html) +[#]: subject: (How to Find Which Graphics Card do You Have in Linux?) +[#]: via: (https://itsfoss.com/check-graphics-card-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何知道你的 Linux 用的哪种显卡? +====== + +无论是 [Nvidia][1] 还是 [Radeon][2] 或者 Intel,它们的显卡都可能在 Linux 中有问题。当你要对图形问题进行故障排除时,首先要了解系统中装有哪种显卡。 + +Linux 有几个命令可以检查硬件信息。你可以使用它们来检查你有哪些显卡(也称为视频卡)。让我向你展示一些命令来获取 Linux 中的 GPU 信息。 + +### 在 Linux 命令行中检查显卡详细信息 + +![][3] + +#### 使用 lspci 命令查找显卡 + +`lspci` 命令显示通过 [PCI][4](外设组件互连Peripheral Component Interconnect)总线连接的设备的信息。基本上,此命令提供有关系统从键盘和鼠标到声卡、网卡和显卡的所有外设的详细信息。 + +默认情况下,你会有大量的此类外设列表。这就是为什么你需要用 `grep` 命令过滤出显卡的原因: + +``` +lspci | grep VGA +``` + +这应该会显示一行有关你显卡的信息: + +``` +abhishek@itsfoss:~$ lspci | grep VGA +00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02) +``` + +如你所见,我的系统中有 Intel HD 620 显卡。 + +#### 在 Linux 中使用 lshw 命令获取显卡详细信息 + +`lspci` 命令足以查看你的显卡,但是并不能告诉你很多信息。你可以使用 `lshw` 命令获取有关它的更多信息。 + +此命令要求你有 root 用户权限。你需要以这种方式查找视频卡(显卡)信息: + +``` +sudo lshw -C video +``` + +正如你在下面的输出中看到的那样,此命令提供了有关显卡的更多信息,例如时钟频率、位宽、驱动等。 + +``` +abhishek@itsfoss:~$ sudo lshw -C video +[sudo] password for abhishek: + *-display + description: VGA compatible controller + product: HD Graphics 620 + vendor: Intel Corporation + physical id: 2 + bus info: [email protected]:00:02.0 + version: 02 + width: 64 bits + clock: 33MHz + capabilities: pciexpress msi pm vga_controller bus_master cap_list rom + configuration: driver=i915 latency=0 + resources: irq:139 memory:db000000-dbffffff memory:90000000-9fffffff ioport:f000(size=64) memory:c0000-dffff +``` + +#### 附赠技巧:以图形方式检查显卡详细信息 + +并非必须使用命令行在 Linux 中查找显卡详细信息。大多数 Linux 发行版(或者应该说是桌面环境)在设置中提供了必要的详细信息。 + +例如,如果你使用的是 [GNOME 桌面环境][5],那么可以进入“设置”的“关于”部分来检查详细信息。[Ubuntu 20.04][6] 中看上去像这样: + +![Graphics card information check graphically][7] + +我希望这个快速技巧对你有所帮助。你也可以使用相同的命令来[查找网卡][8]和 [Linux 中的 CPU 信息][9]。 + +如果你有任何疑问或建议,请随时发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-graphics-card-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.nvidia.com/en-us/ +[2]: https://www.amd.com/en/graphics/radeon-rx-graphics +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/check-gpu-info-linux.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/Conventional_PCI +[5]: https://www.gnome.org/ +[6]: https://itsfoss.com/ubuntu-20-04-release-features/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubuntu-gpu-check.jpg?ssl=1 +[8]: https://itsfoss.com/find-network-adapter-ubuntu-linux/ +[9]: https://linuxhandbook.com/check-cpu-info-linux/ diff --git a/published/202004/20200401 IEEE Standards Association Launches an Open Source Collaboration Platform.md b/published/202004/20200401 IEEE Standards Association Launches an Open Source Collaboration Platform.md new file mode 100644 index 0000000000..891edf7bdb --- /dev/null +++ b/published/202004/20200401 IEEE Standards Association Launches an Open Source Collaboration Platform.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12096-1.html) +[#]: subject: (IEEE Standards Association Launches an Open Source Collaboration Platform) +[#]: via: (https://itsfoss.com/ieee-open-source-collaboration-platform/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +IEEE 标准协会推出开源协作平台 +====== + +> IEEE 标准协会宣布了一个基于 GitLab 的开源协作平台。 + +![](https://img.linux.net.cn/data/attachment/album/202004/10/222910vjpiqd6lqqm6riqp.jpg) + +[IEEE][1] 是世界上最大的技术专业组织,致力于推动技术的发展。IEEE 标准协会the IEEE Standards Association(IEEE SA)是 IEEE 内部的一个组织,负责制定全球各行业的标准。 + +IEEE 标准协会(SA)提出了一个开源协作平台,即 [IEEE SA Open][2]。 + +技术上来说,它是一个自托管的 GitLab 实例,结合了 [Mattermost][3](一个 [Slack 的替代品][4])和 [GitLab Pages][5]。[其官方博文][6]对此进一步解释道: + +> 该平台使独立软件开发者、初创企业、业界、学术机构等能够在一个协作、安全、负责任的环境中创建、测试、管理和部署创新项目。 + +### 它有什么不同或有用的地方? + +这个平台最主要的吸引力应该是 IEEE 的会员网络、技术专长和资源。 + +IEEE 主席 [Robert Fish][7],也曾(在接受 Radio Kan 的采访时)简单地提到它有什么不同之处,以及为什么 IEEE 想要使用它。 + +> 如今,世界上大部分的基础设施都是由软件运行的,而这些软件需要符合通信网络、电网、农业等方面的标准。 + +这是有道理的 —— 如果我们想提高标准化技术,这在很大程度上取决于软件。所以,这听起来肯定是要对创新的开源项目进行标准化,让它们也能为潜在的资本机会做好准备。 + +IEEE 还澄清说: + +> 随着软件在当今世界越来越普遍,道德规范、可靠性、透明度和民主治理成为必须具备的条件。IEEE 在赋予开源项目这些属性方面有着得天独厚的优势。 + +虽然听起来很好,但 IEEE 的开源平台究竟能提供什么?让我们一起来看看这个问题。 + +### IEEE SA Open 概览 + +![][8] + +首先,它对所有人开放并且完全免费使用。你只需要创建一个 [IEEE 帐户][9],然后[登录到这个开源平台][10]就可以开始。 + +除了与 IEEE 广泛的会员网络相关的好处之外,你还可以期望其开源社区经理或社区成员提供指导性支持。 + +![Ieee Gitlab][11] + +该平台提供了标准和非标准项目的用例,你可以尝试一下。 + +因为选择将 GitLab 与 Mattermost 和 Pages 结合起来,你可以获得一些有用的功能,它们是: + + * 项目规划和管理功能 + * 源代码管理 + * 测试、代码质量和持续集成功能 + * Docker 容器注册库和 Kubernetes 集成 + * 应用程序的发布和交付功能 + * 集成了 Mattermost 聊天论坛的斜线命令(完全支持 Android 和 iPhone 应用程序) + * 能够弥合标准制定和开源社区之间的差距,以便以更快的速度推进灵活和创造性的技术解决方案 + * 安全的开放空间,并有严格的行为准则。 + +### 小结 + +显然,有更多的平台来潜在地放大开源项目的曝光率是一件好事 —— 因此,IEEE 的举措听起来很有希望。 + +你对此有何看法?让我知道你的想法吧! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ieee-open-source-collaboration-platform/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.ieee.org/about/index.html +[2]: https://standards.ieee.org/content/ieee-standards/en/initiatives/opensource/ +[3]: https://mattermost.com/ +[4]: https://itsfoss.com/open-source-slack-alternative/ +[5]: https://docs.gitlab.com/ee/user/project/pages/ +[6]: https://spectrum.ieee.org/the-institute/ieee-products-services/ieee-standards-association-launches-a-platform-for-open-source-collaboration +[7]: https://www.linkedin.com/in/robertsfish/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/ieee-opensource.jpg?ssl=1 +[9]: https://www.ieee.org/profile/public/createwebaccount/showRegister.html +[10]: https://opensource.ieee.org/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/ieee-gitlab.jpg?ssl=1 diff --git a/published/202004/20200402 How to Upgrade to Ubuntu 20.04 Beta from 18.04 - 19.10.md b/published/202004/20200402 How to Upgrade to Ubuntu 20.04 Beta from 18.04 - 19.10.md new file mode 100644 index 0000000000..10db11050c --- /dev/null +++ b/published/202004/20200402 How to Upgrade to Ubuntu 20.04 Beta from 18.04 - 19.10.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12085-1.html) +[#]: subject: (How to Upgrade to Ubuntu 20.04 Beta from 18.04 & 19.10) +[#]: via: (https://itsfoss.com/upgrade-ubuntu-beta/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何将 Ubuntu 18.04 LTS/19.10 升级到 Ubuntu 20.04 beta +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/08/125043m1qyy7gzvkjazx41.jpg) + +[Ubuntu 20.04 LTS 版本][1]还有不到一个月就发布了,Ubuntu 在这一个版本中对视觉效果作出了大变动,同时在性能方面也有所提高。 + +如果你还在使用 Ubuntu 18.04 LTS 版本,你会发现 Ubuntu 20.04 配合深色 Yaru 主题非常惊艳,看过 [Ubuntu 20.04 的展示视频][2]你就知道了。 + +- [video](https://img.linux.net.cn/static/video/Ubuntu%2020.04%20Desktop%20Tour%20-%20Check%20Out%20New%20Features-9u5B0njRgOw.mp4) + +感觉确实不错。如果你想在 4 月 23 日最终稳定版正式发布前率先使用 Ubuntu 20.04,也可以在官方网站上下载 beta 版本。尽管是测试版本,但它的稳定性并不差,同时你也可以在使用这个版本的过程中帮助 Ubuntu 团队进行测试。 + +你可以下载每日构建daily build版并进行重新安装,如果你正在使用的是 Ubuntu 18.04 或 Ubuntu 19.10,也可以在现有系统的基础上直接升级到 Ubuntu 20.04 beta 版本。 + +从现有系统中升级是很方便的,因为你不会丢失系统设置和其他文件。与重新安装不同的是,你不需要从头开始重新安装所有的软件。当你切换到新版本时,你的主目录、应用程序(大部分)、文件都会保持原样。 + +> 如果你需要确认正在使用的 Ubuntu 版本,可以参考[这篇文章][4]。 + +在本文中,我将会介绍如何升级到 Ubuntu 20.04 beta 版本。 + +### 如何将 Ubuntu 18.04/19.10 升级到 Ubuntu 20.04 beta + +![Upgrade Ubuntu 20 04 Beta][5] + +在你阅读后面的内容之前,我首先说明一些关于升级到 Ubuntu beta 版本的常见问题。 + + * 版本升级的过程并不复杂,但在整个过程中需要有良好的网络连接,以便下载高达好几 GB 的数据。 + * 版本升级的过程中,第三方存储库(比如你自行添加的 [PPA][6])会被禁用,有些 PPA 可能也和新版本不兼容,在版本升级完毕后,你可以手动启用这些 PPA。 + * 强烈建议将重要数据备份到外部的 USB 硬盘上。你只需要将各个目录下的重要文件直接复制到外部 USB 硬盘上保存即可。 + * 升级到新版本之后,就无法再回滚到之前的旧版本了,如果需要旧版本的系统,只能重新安装。 + * 如果你选择升级到 Ubuntu 20.04 beta 版本,那么在 Ubuntu 20.04 最终稳定版发布之后,你也不需要重新安装。只需要保持定期更新 Ubuntu 系统,届时你就可以直接用上最终稳定版了。 + * Ubuntu 16.04/17/18/19.04 都无法直接升级到 Ubuntu 20.04。 + +了解完上面的内容之后,下面开始从 Ubuntu 18.04/19.10 升级到 Ubuntu 20.04。 + +#### 步骤 1:检查设置是否正确 + +进入“软件和升级Software & Updates”应用: + +![Software & Updates application in Ubuntu][7] + +在“升级Updates”选项卡中,设置“有任何新版本 Ubuntu 都提醒我”或“有 LTS 版本 Ubuntu 就提醒我”: + +![Ubuntu Upgrade Version Settings][8] + +设置完成后,系统会刷新软件库缓存。 + +#### 步骤 2:安装系统更新 + +在上面的步骤完成之后,打开终端(在 Ubuntu 中可以使用 `Ctrl+Alt+T` [快捷键][9]),然后使用以下命令[更新 Ubuntu 系统][10]: + +``` +sudo apt update && sudo apt full-upgrade +``` + +`apt full-upgrade` 或 `apt dist-upgrade` 的功能和 `apt upgrade` 大致相同,但对于系统版本的升级,`apt full-upgrade` 会在需要的情况下将当前已安装的软件移除掉。 + +更新安装完成后,系统可能会需要重新启动。在重新启动之后,就可以进入步骤 3 了。 + +#### 步骤 3:使用更新管理器查找开发版本 + +在步骤 2 中已经安装了所有必要的更新,现在通过下面的命令打开更新管理器,其中 `-d` 参数表示需要查找开发版本: + +``` +update-manager -d +``` + +整个过程可能需要好几分钟,随后会提示有新版本的 Ubuntu 可用: + +![Availability of Ubuntu 20.04 in Ubuntu 19.10][11] + +在 Ubuntu 18.04 上的提示是这样的: + +![Availability of Ubuntu 20.04 in Ubuntu 18.04][12] + +然后点击对话框中的“升级upgrade”按钮。 + +#### 步骤 4:开始升级到 Ubuntu 20.04 beta + +接下来只要等待下载更新就可以了,遇到对话框直接点击 “OK” 即可。 + +![][13] + +点击“升级upgrade”按钮,然后按照提示进行操作。 + +![][14] + +在升级过程中,可能会有提示信息告知所有第三方源都已经禁用。有时候还会提示有哪些软件包需要升级或删除,以及是否需要保留一些已经过时了的软件包。一般情况下,我会选择直接删除。 + +整个升级过程通常会需要几个小时,但主要还是取决于实际的网速。升级完成后,系统会提示需要重新启动。 + +![][15] + +下面的视频展示了所有相关步骤。 + +- [video](https://img.linux.net.cn/static/video/How%20to%20Upgrade%20to%20Ubuntu%2020.04%20Beta%20from%2018.04%20&%2019.10%20Right%20Now-RkxxEtaTVkA.mp4) + +由此可见,这个升级流程并不复杂。欢迎体验 Ubuntu 20.04 带来的新特性。 + +如果你有疑问或建议,欢迎在评论区留言。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/upgrade-ubuntu-beta/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://www.youtube.com/watch?v=9u5B0njRgOw +[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[4]: https://linux.cn/article-9872-1.html +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-beta.jpg?ssl=1 +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/software-updates-app-ubuntu.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubuntu-upgrade-version-settings.jpg?ssl=1 +[9]: https://itsfoss.com/ubuntu-shortcuts/ +[10]: https://itsfoss.com/update-ubuntu/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04.jpg?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-from-18-04.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-steps-1.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-steps-2.jpg?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/restart-to-finish-beta-upgarde-ubuntu-20-04.jpg?ssl=1 diff --git a/published/202004/20200403 Scheduling tasks on Linux using the at command.md b/published/202004/20200403 Scheduling tasks on Linux using the at command.md new file mode 100644 index 0000000000..5c692a68ef --- /dev/null +++ b/published/202004/20200403 Scheduling tasks on Linux using the at command.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12092-1.html) +[#]: subject: (Scheduling tasks on Linux using the at command) +[#]: via: (https://www.networkworld.com/article/3535808/scheduling-tasks-on-linux-using-the-at-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 at 命令在 Linux 上安排任务 +====== + +> at 命令可以很容易地安排 Linux 任务在你选择的任何时间或日期运行,让我们来看看它能为你做什么。 + +![][0] + +当你希望命令或脚本在某个特定时间运行时,你不需要将手指放在键盘上盘旋等待按下回车键,或者是在特定时间坐在办公桌前。相反,你可以通过 `at` 命令来设置任务。在本文中,我们将研究如何使用 `at` 来安排任务,如何精确地选择任务希望运行的时间,以及如何使用 `at` 来查看安排运行的任务。 + +### at vs cron + +对于那些使用 cron 在 Linux 系统上安排任务的人来说,`at` 命令类似于 cron,因为你可以在选定的时间调度任务,但是 cron 用于定期运行的作业 —— 甚至是每年仅一次。大多数 cron 作业的频率都设置为每天、每周或每月运行一次,不过你可以控制运行的频率和时间。 + +另一方面,`at` 命令用于仅运行一次的任务。想在午夜重启系统?没问题,只要你有适当的权限,`at` 可以为你完成此操作。如果你希望系统在每个星期六凌晨 2 点重启,那么改用 cron。 + +### 使用 at + +`at` 命令很容易使用,只需记住几件事。一个简单使用 `at` 的例子类似于这样: + +``` +$ at 5:00PM +at> date >> thisfile +at> +``` + +在输入 `at` 和应该运行命令的时间,`at` 会提示你在设定时间会运行该命令(此例中是 `date` 命令)。输入 `^D`(`Ctrl + d`)来完成请求。 + +假设我们在下午 5 点之前设置这个 `at` 命令,那么这个日期和时间将在当天下午 5 点添加到名为 `thisfile` 文件的末尾。否则,该命令将在第二天下午 5 点运行。 + +与 `at` 命令进行交互时,可以输入多个命令。如果你要同时运行多个命令,只需输入多个命令行即可: + +``` +$ at 6:22 +warning: commands will be executed using /bin/sh +at> echo first >> thisfile +at> echo second >> thisfile +at> +``` + +在上面的命令中,我们使用了一个普通的用户账户,将一些简单的文本添加到该用户主目录的文件中。如果在上午 6:22 之后运行这些命令,那么命令会在第二天运行,因为 6:22 表示上午 6:22。如果你想在下午 6:22 运行,使用 `6:22 PM` 或者 `18:22`。`6:22 PM` 这样也是可以工作的。 + +你也可以通过使用 `at` 来安排命令在指定的日期或时间运行,例如 `10:00AM April 15 2021` 或 `noon + 5 days`(从今天起 5 天内的中午运行),以下是一些例子: + +``` +at 6PM tomorrow +at noon April 15 2021 +at noon + 5 days +at 9:15 + 1000 days +``` + +在指定要运行的命令并按下 `^D` 后,你会注意到 `at` 命令为每个请求分配了一个作业编号,这个数字将显示在 `at` 命令的作业队列中。 + +``` +$ at noon + 1000 days +warning: commands will be executed using /bin/sh +at> date >> thisfile +at> +job 36 at Tue Dec 27 12:00:00 2022 <== job # is 36 +``` + +### 检查队列 + +你可以使用 `atq`(at queue)命令来查看 `at` 作业队列: + +``` +$ atq +32 Thu Apr 2 03:06:00 2020 a shs +35 Mon Apr 6 12:00:00 2020 a shs +36 Tue Dec 27 12:00:00 2022 a shs +34 Thu Apr 2 18:00:00 2020 a shs +``` + +如果你需要取消队列中的一个作业,使用 `atrm`(at remove)命令和作业编号: + +``` +$ atrm 32 +$ atq +35 Mon Apr 6 12:00:00 2020 a shs +36 Tue Dec 27 12:00:00 2022 a shs +34 Thu Apr 2 18:00:00 2020 a shs +``` + +你可以使用 `at -c` 命令来查看安排任务的详细信息,其它详细信息(活动的搜索路径等)也可以看到,但是输出的最后一行将显示计划运行的命令。 + +``` +$ at -c 36 | tail -6 +cd /home/shs || { + echo 'Execution directory inaccessible' >&2 + exit 1 +} +date >> thisfile +``` + +注意,该命令显示首先会测试是否可以通过 `cd` 命令进入用户目录。如果不可以,作业将退出并显示错误。如果可以,则运行在 `at` 中指定的命令。它将命令视为 “进入 `/home/shs` 或退出并显示错误”。 + +### 以 root 身份运行作业 + +要以 root 身份运行 `at` 作业,只需将 `sudo` 与你的 `at` 命令一起使用,如下所示: + +``` +$ sudo at 8PM +[sudo] password for shs: +warning: commands will be executed using /bin/sh +at> reboot now +at> +job 37 at Wed Apr 1 16:00:00 2020 +``` + +注意,root 的任务以 `root` 作为执行者显示在队列中。 + +``` +35 Mon Apr 6 12:00:00 2020 a shs +36 Tue Dec 27 12:00:00 2022 a shs +37 Wed Apr 1 20:00:00 2020 a root <== +``` + +### 运行脚本 + +你还可以使用 `at` 命令来运行脚本,这里有一个例子: + +``` +$ at 4:30PM +warning: commands will be executed using /bin/sh +at> bin/tryme +at> +``` + +### 禁止使用 at 命令 + +`/etc/at.deny` 文件提供了一种禁止用户使用 `at` 命令的方法。默认情况下,它可能会包含一个不允许的账户列表,例如 `ftp` 和 `nobody`。可以使用 `/etc/at.allow` 文件执行相反的操作,但是通常只配置 `at.deny` 文件。 + +### 总结 + +当你要安排一项一次性任务时,无论你是希望在今天下午或几年后运行,`at` 命令都是通用且易于使用的。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3535808/scheduling-tasks-on-linux-using-the-at-command.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[0]: https://images.idgesg.net/images/article/2019/08/gettyimages-140389307-100808283-large.jpg +[1]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200403 Take back your dotfiles with Chezmoi.md b/published/202004/20200403 Take back your dotfiles with Chezmoi.md new file mode 100644 index 0000000000..caded6c08c --- /dev/null +++ b/published/202004/20200403 Take back your dotfiles with Chezmoi.md @@ -0,0 +1,308 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12109-1.html) +[#]: subject: (Take back your dotfiles with Chezmoi) +[#]: via: (https://fedoramagazine.org/take-back-your-dotfiles-with-chezmoi/) +[#]: author: (Ryan Walter https://fedoramagazine.org/author/rwaltr/) + +用 Chezmoi 取回你的点文件 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/14/183618dwkhe4ehx1kthxvw.jpg) + +在 Linux 中,点文件是隐藏的文本文件,从 Bash、Git 到 i3 或 VSCode 等更复杂的许多应用程序,都用它存储配置设置。 + +这些文件大多数都放在 `~/.config` 目录中或用户主目录中。编辑这些文件使你可以自定义也许没有提供设置菜单的应用程序,并且它们可以跨设备甚至是跨其它 Linux 发行版移植。但是,整个 Linux 发烧友社区的讨论焦点是如何管理这些点文件以及如何共享它们。 + +我们将展示一个名为 [Chezmoi][2] 的工具,该工具与其它工具略有不同。 + +### 点文件管理的历史 + +如果你在 [GitHub 上搜索“dotfiles”][3],那么你将看到有超过 10 万个存储库在解决一个目标:将人们的点文件存储在可共享且可重复的领地中。但是,除了都在使用 Git 之外,它们存储文件的方式各有不同。 + +虽然 Git 解决了代码管理问题,也将其转换为配置文件管理,但它并没有解决如何区分发行版、角色(例如家用计算机与工作计算机)、机密信息管理以及按设备配置的问题。 + +因此,许多用户决定制定自己的解决方案,多年来,社区已经做出了许多成果。本文将简要介绍已有的一些解决方案。 + +#### 在孤立的环境中进行实验 + +你想在封闭的环境中快速尝试以下解决方案吗?运行: + +``` +$ podman run --rm -it fedora +``` + +来创建一个 Fedora 容器尝试应用程序。退出容器时,该容器将自动删除自身。 + +#### 安装问题 + +如果将点文件存储在 Git 存储库中,你肯定希望可以让更改轻松地自动应用到主目录之中,乍一看,最简单的方法是使用符号链接,例如 `ln -s ~/.dotfies/bashrc ~/.bashrc`。这可以使你的更改在更新存储库时立即就绪。 + +符号链接的问题在于管理符号链接可能很麻烦。Stow 和 [RCM][4](在 Fedora 杂志上介绍过)可以帮助你管理这些,但是这些并不是非常舒服的解决方案。下载后,需要对私有文件进行适当的修改和设置访问模式。如果你在一个系统上修改了点文件,然后将存储库下载到另一个系统,则可能会发生冲突并需要进行故障排除。 + +解决此问题的另一种方法是编写自己的安装脚本。这是最灵活的选项,但要权衡花费更多时间来构建自定义解决方案是否值得。 + +#### 机密信息问题 + +Git 旨在跟踪更改。如果你在 Git 存储库中存储密码或 API 密钥之类的机密信息,则会比较麻烦,并且需要重写 Git 历史记录以删除该机密信息。如果你的存储库是公开的,那么如果其他人下载了你的存储库,你的机密信息将不再保密。仅这个问题就会阻止许多人与公共世界共享其点文件。 + +#### 多设备配置问题 + +问题不在于如何将配置拉到多个设备,而是当你有多个需要不同配置的设备的问题。大多数人通过使用不同的文件夹或使用不同的复刻fork来处理此问题。这使得难以在不同设备和角色集之间共享配置。 + +### Chezmoi 是如何干的 + +Chezmoi 是一种考虑了以上问题的用于管理点文件的工具,它不会盲目地从存储库复制或符号链接文件。 Chezmoi 更像是模板引擎,可以根据系统变量、模板、机密信息管理器和 Chezmoi 自己的配置文件来生成你的点文件。 + +#### Chezmoi 入门 + +目前,Chezmoi 并不在 Fedora 的默认软件库中。你可以使用以下命令下载 Chezmoi 的当前版本。 + +``` +$ sudo dnf install https://github.com/twpayne/chezmoi/releases/download/v1.7.17/chezmoi-1.7.17-x86_64.rpm +``` + +这会将预打包的 RPM 安装到你的系统中。 + +让我们继续使用以下方法创建你的存储库: + +``` +$ chezmoi init +``` + +它将在 `~/.local/share/chezmoi/` 中创建你的新存储库。你可以使用以下命令轻松地切换到该目录: + +``` +$ chezmoi cd +``` + +让我们添加第一个文件: + +``` +chezmoi add ~/.bashrc +``` + +这将你的 `.bashrc` 文件添加到 chezmoi 存储库。 + +注意:如果你的 `.bashrc` 文件实际上是一个符号链接,则需要添加 `-f` 标志以跟随它来读取实际文件的内容。 + +现在,你可以使用以下命令编辑该文件: + +``` +$ chezmoi edit ~/.bashrc +``` + +现在让我们添加一个私有文件,这是一个具有 600 或类似权限的文件。我在 `.ssh/config` 中有一个文件,我想通过使用如下命令添加它: + +``` +$ chezmoi add ~/.ssh/config +``` + +Chezmoi 使用特殊的前缀来跟踪隐藏文件和私有文件,以解决 Git 的限制。运行以下命令以查看它: + +``` +$ chezmoi cd +``` + +**请注意,标记为私有的文件实际上并不是私有的,它们仍会以纯文本格式保存在你的 Git 存储库中。稍后会进一步解释。** + +你可以使用以下方法应用任何更改: + +``` +$ chezmoi apply +``` + +并使用如下命令检查有什么不同: + +``` +$ chezmoi diff +``` + +#### 使用变量和模板 + +要导出 Chezmoi 可以收集的所有数据,请运行: + +``` +$ chezmoi data +``` + +其中大多数是有关用户名、架构、主机名、操作系统类型和操作系统名称的信息。但是你也可以添加我们自己的变量。 + +继续,运行: + +``` +$ chezmoi edit-config +``` + +然后输入以下内容: + +``` +[data] + email = "fedorauser@example.com" + name = "Fedora Mcdora" +``` + +保存文件,然后再次运行 `chezmoi data`。你将在底部看到你的电子邮件和姓名已经添加成功。现在,你可以将这些与 Chezmoi 的模板一起使用。运行: + +``` +$ chezmoi add -T --autotemplate ~/.gitconfig +``` + +来将你的 `.gitconfig` 作为模板添加到 Chezmoi 中。如果 Chezmoi 成功地正确推断了模板,你将获得以下信息: + +``` +[user] + email = "{{ .email }}" + name = "{{ .name }}" +``` + +如果没有,则可以将文件更改为这样。 + +使用以下方法检查文件: + +``` +$ chezmoi edit ~/.gitconfig +``` + +然后使用: + +``` +$ chezmoi cat ~/.gitconfig +``` + +来查看 Chezmoi 为此文件生成什么。我生成的示例如下: + +``` +[root@a6e273a8d010 ~]# chezmoi cat ~/.gitconfig +[user] + email = "fedorauser@example.com" + name = "Fedora Mcdora" +[root@a6e273a8d010 ~]# +``` + +它将在我们的 Chezmoi 配置中生成一个充满变量的文件。你也可以使用变量执行简单的逻辑语句。一个例子是: + +``` +{{- if eq .chezmoi.hostname "fsteel" }} +# 如果主机名为 "fsteel" 才包括此部分 +{{- end }} +``` + +请注意,要使其正常工作,该文件必须是模板。你可以通过查看文件是否在 `chezmoi cd` 中的文件名后附加 `.tmpl` 或使用 `-T` 选项读取文件来进行检查。 + +#### 让机密信息保持机密 + +要对设置进行故障排除,请使用以下命令。 + +``` +$ chezmoi doctor +``` + +这里重要的是它还向你显示了[所支持的密码管理器][5]。 + +``` +[root@a6e273a8d010 ~]# chezmoi doctor + warning: version dev + ok: runtime.GOOS linux, runtime.GOARCH amd64 + ok: /root/.local/share/chezmoi (source directory, perm 700) + ok: /root (destination directory, perm 550) + ok: /root/.config/chezmoi/chezmoi.toml (configuration file) + ok: /bin/bash (shell) + ok: /usr/bin/vi (editor) + warning: vimdiff (merge command, not found) + ok: /usr/bin/git (source VCS command, version 2.25.1) + ok: /usr/bin/gpg (GnuPG, version 2.2.18) + warning: op (1Password CLI, not found) + warning: bw (Bitwarden CLI, not found) + warning: gopass (gopass CLI, not found) + warning: keepassxc-cli (KeePassXC CLI, not found) + warning: lpass (LastPass CLI, not found) + warning: pass (pass CLI, not found) + warning: vault (Vault CLI, not found) + [root@a6e273a8d010 ~]# +``` + +你可以使用这些客户端,也可以使用[通用客户端][6],也可以使用系统的[密钥环][7]。 + +对于 GPG,你需要使用以下命令将以下内容添加到配置中: + +``` +$ chezmoi edit-config +``` + +``` +[gpg] + recipient = "开悟 enlightenment
”。 + +然而,当 Enlightenment 18 版本发布以后,这一切都改变了。该版本是如此的糟糕,以至于它并没有集成到 Bodhi 中。Enlightenment 19 发布后修复了一些问题,但仍然存在一些不足。 + +在尝试与 Enlightenment 开发团队合作却毫无进展之后,Bodhi 开发者在 2015 年[复刻][8]了 Enlightenment 17。新的桌面环境被命名为 [Moksha][9],它是基于梵文单词“解脱、解放或释放”。你可以在 [GitHub][10] 上找到它的代码。 + +### 5.1.0 有什么新特性? + +- [Bodhi Linux 5.1 Trailer](https://youtu.be/e8wcRL9F3p8) + +[Bodhi 5.1.0][12] 是这两年内发布的第一个版本,也是基于 Ubuntu 18.04 的第二个版本。除了更新包,它还有新的默认图标和主题。该版本对默认应用程序做了几处更改。预装版 Leafpad 取代了 epad 并且 [GNOME Web][13](也被称为 Epiphany)代替了 [Midori][14]。删除了 eepDater 系统更新器。 + +目前有[四个不同的版本][15]的 Bodhi5.1.0 可以[下载][16]: 标准版Standard硬件支持版Hwe兼容版Legacy软件包版AppPack。 + +* 标准适用于过去十年内电脑配置。它不推送内核更新。 +* 硬件支持版是 Bodhi 家族的新成员,其设计用来包括对更新的硬件的支持,并会接收到内核更新。5.1 版本的使用的是 5.3.0-42 内核。 +* 兼容版是仅有的 32 位版本。它使用“较旧的 4.9.0-6-686 Linux 内核,该内核针对旧的(15 年以上)硬件进行了优化。这个内核也不包括许多老系统不支持的 PAE 扩展。” +* 软件包版是为那些想要一个开箱即用的全载系统的人准备的,并预装了许多应用程序。 + +### Bodhi Linux 的系统要求 + +最低系统要求: + + * 500 MHz 处理器 + * 256 MB 内存 + * 5 GB 的硬盘存储空间 + +推荐系统要求: + + * 1.0 GHz 处理器 + * 512 MB 内存 + * 10 GB 的硬盘存储空间 + +### 体验 Bodhi Linux + +![Old Bodhi Linux][17] + +由于它是基于 Ubuntu 的,所以安装 Bodhi 非常简单。当我登录到 Bodhi 后,新的主题和图标集让我大吃一惊。上次我安装 Bodhi(包括几个月前的 5.0)时,我认为它需要换一个新的外观。之前的主题并没有什么问题,但看起来像是二十一世纪初的东西。新的主题使它看起来更具现代感。 + +![Bodhi Linux 5.1][18] + +我也很高兴看到 Midori 浏览器被 GNOME Web 所取代。我不是 [Midori 浏览器][19]的粉丝。对我来说,它总是显得功能太少了。(不过,随着 [Midori Next][20] 的推出,这种情况可能会改变。)GNOME Web 更像是我需要的网页浏览器。最重要的是它带有 Firefox Sync,这样我就可以同步我所有的书签和密码了。 + +与许多 Linux 发行版不同,Bodhi 并没有一个独立的软件中心。相反,如果你点击 AppCenter 图标,它会打开浏览器,并导航到 Bodhi 网站的软件中心页面 [AppCenter 页面][21]。这里的应用程序是按类别排序的,它们中的大多数是[轻量级应用程序][22]。 + +![Bodhi Linux Appcenter][23] + +如果你点击其中一个页面并点击“安装”,(在你输入密码之后)Bodhi 就会安装它。这是通过一个名为 [apturl][24] 的小程序实现的,它是“是一个非常简单的从网页浏览器安装软件包的方法”。它非常灵巧,我希望更多基于 Ubuntu 的发行版使用它。 + +总的来说,我喜欢 Moksha 桌面。它坚持我们几十年来看到的桌面风格(这是我最喜欢的)。它不会影响你,却很容易改变和定制。我唯一怀念的是,当我按下超级键时,应用程序菜单不打开。但我猜你不可能拥有生活中的一切。 + +### 结语 + +我对最近发布的 Bodhi Linux 感到十分惊喜。过去,我经常折腾它。并且我一直很喜欢它,但最近的这个版本是迄今为止最好的。在某种程度上,他们打破了 Bodhi 只适合老系统的想法,加入了对较新内核的支持。 + +如果你想换换个环境,同时又想在 Ubuntu 的世界里寻找新的风景,那就试试[Bodhi Linux][3]吧。 + +你用过 Bodhi Linux 吗?你最喜欢的基于 Ubuntu 的发行版是什么?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bodhi-linux-review/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/lightweight-linux-beginners/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/bodhi-start-page.png?resize=800%2C500&ssl=1 +[3]: https://www.bodhilinux.com/ +[4]: https://www.bodhilinux.com/w/wiki/ +[5]: https://www.bodhilinux.com/w/what-is-bodhi-linux/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/bodhi-desktop.jpg?resize=800%2C500&ssl=1 +[7]: https://www.enlightenment.org/start +[8]: https://www.bodhilinux.com/2015/04/28/introducing-the-moksha-desktop/ +[9]: https://www.bodhilinux.com/moksha-desktop/ +[10]: https://github.com/JeffHoogland/moksha +[11]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[12]: https://www.bodhilinux.com/2020/03/25/bodhi-linux-5-1-0-released/ +[13]: https://wiki.gnome.org/Apps/Web/ +[14]: https://en.wikipedia.org/wiki/Midori_(web_browser +[15]: https://www.bodhilinux.com/w/selecting-the-correct-iso-image/ +[16]: https://www.bodhilinux.com/download/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/bodhi.png?resize=800%2C400&ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/bodhi-Linux-5-1-screenshot.jpg?ssl=1 +[19]: https://itsfoss.com/midori-browser/ +[20]: https://www.midori-browser.org/2020/01/15/midori-next-come-on-yarovi-we-can/ +[21]: https://www.bodhilinux.com/a/ +[22]: https://itsfoss.com/lightweight-alternative-applications-ubuntu/ +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Bodhi-Linux-AppCenter.png?resize=800%2C500&ssl=1 +[24]: https://wiki.ubuntu.com/AptUrl +[25]: https://reddit.com/r/linuxusersgroup diff --git a/published/202004/20200404 What is Arch User Repository (AUR)- How to Use AUR on Arch and Manjaro Linux.md b/published/202004/20200404 What is Arch User Repository (AUR)- How to Use AUR on Arch and Manjaro Linux.md new file mode 100644 index 0000000000..df0074259a --- /dev/null +++ b/published/202004/20200404 What is Arch User Repository (AUR)- How to Use AUR on Arch and Manjaro Linux.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12107-1.html) +[#]: subject: (What is Arch User Repository (AUR)? How to Use AUR on Arch and Manjaro Linux?) +[#]: via: (https://itsfoss.com/aur-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +什么是 Arch 用户仓库(AUR)以及如何使用? +====== + +如果你一直在使用 [Arch Linux][1] 或其他基于 Arch 的发行版,如 Manjaro,那么可能会遇到 AUR。你尝试安装新软件,有人建议从 AUR 中安装它。这让你感到困惑。 + +什么是 AUR?为什么使用它?如何使用 AUR?我将在本文中回答这些问题。 + +### 什么是 AUR? + +![][2] + +AUR 表示Arch 用户仓库Arch User Repository。它是针对基于 Arch 的 Linux 发行版用户的社区驱动的仓库。它包含名为 [PKGBUILD][3] 的包描述,它可让你使用 [makepkg][4] 从源代码编译软件包,然后通过 [pacman][5](Arch Linux 中的软件包管理器)安装。 + +创建 AUR 的目的是组织和共享社区中的新软件包,并帮助加速将流行的软件包纳入[社区仓库][6]。 + +进入官方仓库的大量新软件包都从 AUR 开始。在 AUR 中,用户可以贡献自己的软件包构建(PKGBUILD 和相关文件)。 + +AUR 社区可以对 AUR 中的软件包进行投票。如果一个软件包变得足够流行(假设它具有兼容的许可证和良好的打包技术),那么可以将其加入 `pacman` 直接访问的社区仓库中。 + +> 简而言之,AUR 是开发人员在 Arch 仓库中正式包含新软件之前向 Arch Linux 用户提供新软件的一种方式。 + +### 你应该使用 AUR 吗?有什么风险? + +使用 AUR 就像过马路一样。如果你谨慎操作,应该就没问题。 + +如果你刚接触 Linux,建议你在建立有关 Arch/Manjaro 和 Linux 的基础知识之前不要使用 AUR。 + +的确,任何人都可以将软件包上传到 AUR,但[受信任用户][7](TU)负责监视上传的内容。尽管 TU 对上传的软件包执行质量控制,但不能保证 AUR 中的软件包格式正确或没有恶意。 + +在实践中,AUR 似乎很安全,但理论上讲它可以造成一定程度的损害,但前提是你不小心。从 AUR 构建软件包时,聪明的 Arch 用户**总是**检查 `PKGBUILD` 和 `*.install` 文件。 + +此外,TU(受信任用户)还会删除 AUR 中包含在 core/extra/community 中的软件包,因此它们之间不应存在命名冲突。AUR 通常会包含软件包的开发版本(cvs/svn/git 等),但它们的名称会被修改,例如 foo-git。 + +对于 AUR 软件包,`pacman` 会处理依赖关系并检测文件冲突,因此,除非你默认使用 `–force` 选项,否则你不必担心用另一个包中的文件会覆盖另一个包的文件。如果这么做了,你可能会遇到比文件冲突更严重的问题。 + +### 如何使用 AUR? + +使用 AUR 的最简单方法是通过 AUR 助手。 [AUR 助手][8] 是一个命令行工具(有些还有 GUI),可让你搜索在 AUR 上发布的软件包并安装。 + +#### 在 Arch Linux 上安装 AUR 助手 + +假设你要使用 [Yay AUR 助手][9]。确保在 Linux 上安装了 git。然后克隆仓库,进入目录并构建软件包。 + +依次使用以下命令: + +``` +sudo pacman -S git +sudo git clone https://aur.archlinux.org/yay-git.git +cd yay +makepkg -si +``` + +安装后,你可以使用 `yay` 命令来安装软件包: + +``` +yay -S package_name +``` + +并非必须使用 AUR 助手来从 AUR 安装软件包。从以下文章解如何在没有 AUR 助手的情况下使用 AUR。 + +#### 不使用 AUR 助手安装 AUR 软件包 + +如果你不想使用 AUR 助手,那么也可以自行从 AUR 安装软件包。 + +在 [AUR 页面][10]上找到要安装的软件包后,建议确认“许可证”、“流行程度”、“最新更新”、“依赖项”等,作为额外的质量控制步骤。 + +``` +git clone [package URL] +cd [package name] +makepkg -si +``` + +例如。假设你要安装 [telegram 桌面包][11]: + +``` +git clone https://aur.archlinux.org/telegram-desktop-git.git +cd telegram-desktop-git +makepkg -si +``` + +#### 在 Manjaro Linux 中启用 AUR 支持 + +它默认情况下未启用 AUR,你必须通过 `pamac` 启用它。我的笔记本电脑运行 [Manjaro][12] Cinnamon,但是所有 Manjaro 变种的步骤都相同。 + +打开 Pamac(显示为 “Add/Remove Software”): + +![][13] + +进入 Pamac 后,请进入如下所示的首选项preferences。 + +![][14] + +在首选项对话框中,进入 “AUR” 选项卡,启用 AUR 支持,启用检查更新,并关闭对话框。 + +![][15] + +现在,你可以搜索软件包,并且可以通过软件包描述下的标签来识别属于 AUR 的软件包。 + +![][16] + +希望本文对你有用,并关注社交媒体上即将出现的与 Arch 相关的主题。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/aur-arch-linux/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.archlinux.org/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/what-is-aur.png?ssl=1 +[3]: https://wiki.archlinux.org/index.php/PKGBUILD +[4]: https://wiki.archlinux.org/index.php/Makepkg +[5]: https://wiki.archlinux.org/index.php/Pacman#Additional_commands +[6]: https://wiki.archlinux.org/index.php/Community_repository +[7]: https://wiki.archlinux.org/index.php/Trusted_Users +[8]: https://itsfoss.com/best-aur-helpers/ +[9]: https://github.com/Jguer/yay +[10]: https://aur.archlinux.org/ +[11]: https://aur.archlinux.org/packages/telegram-desktop-git +[12]: https://manjaro.org/ +[13]: https://i1.wp.com/i.imgur.com/kFF6HtW.png?ssl=1 +[14]: https://i0.wp.com/i.imgur.com/47r963A.png?ssl=1 +[15]: https://i1.wp.com/i.imgur.com/UThiDHO.png?ssl=1 +[16]: https://i2.wp.com/i.imgur.com/RM5BKi2.png?ssl=1 diff --git a/published/202004/20200407 15 years of Git- How to get started or learn something new.md b/published/202004/20200407 15 years of Git- How to get started or learn something new.md new file mode 100644 index 0000000000..d08342b3e7 --- /dev/null +++ b/published/202004/20200407 15 years of Git- How to get started or learn something new.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12104-1.html) +[#]: subject: (15 years of Git: How to get started or learn something new) +[#]: via: (https://opensource.com/article/20/4/get-started-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Git 都 15 岁了,如何入门或学习点新东西 +====== + +> 在 Git 15 周年之际,了解为什么 Git 是保持软件行业运行的重要组成部分。 + +![](https://img.linux.net.cn/data/attachment/album/202004/13/091410k80er3mttrznc22e.jpg) + +如果说过去二十年来有什么东西改变了软件,那么 [Git][2] 肯定位列榜首。 + +如果你没有亲自使用过 Git,你可能会认为它只是一种技术时尚,只是因为它是由 [Linux][3] 项目的创始人创建的,所以在开发者中只是一个偶然的宠儿。这或许有一定的道理,但 Git 确实取得了一些其他行业所没有的成就。有了 Git,分布在世界各地的开发者们可以在同一时间对同一段代码进行工作,并记录下每一次修改的历史,然后将所有的工作合并到一起,形成一个成品。由于这件事情非常复杂,所以这个工具本身也会变得很复杂,但归根结底,它是维持软件行业运行的重要组成部分。 + +无论你是否了解 Git,如果你足够深入的研究开源软件,或者进入计算机科学领域,都有可能遇到它。无论你使用 Git 只是为了下载一个安装包,还是每天与它交互来管理代码,了解更多关于它的知识,都会对你有很大的启发和帮助。 + +### Git 术语 + +与任何专业工具一样,Git 中也有很多行话。像“克隆clone”、“合并merge”和“变基rebase”这样的术语,最起码也是神秘的,而更糟的情况下会令人感到排斥。试图理解这些术语的含义可能会让人不知所措,但如果你从 Matthew Broberg 的优秀文章《[Git 术语基础][4]》中得到一点指导,就不会这样了。只需快速阅读一下,你就能真正理解地听懂关于 Git 的对话。 + +### Git 入门 + +如果你需要知道如何使用 Git,那么我自己的[关于使用 Git 的入门文章系列][5]是一个很好的开始。这些文章已经有几年的历史了,但就像许多 Linux 和 UNIX 技术一样,它的界面并没有发生很大的变化,所以这些文章和我写这些文章那时一样,在今天还是很有意义的。这一系列文章向你介绍了 Git 最基本的概念,并带领你完成创建仓库、提交文件、恢复文件、合并分支等过程。 + +### 常见的 Git 服务 + +Git 最常见的用途之一是公共的 Git 托管服务,比如 GitLab 和 GitHub。Kedar Vijay Kulkarni 在他的《[如何在 Git 中克隆、修改、添加和删除文件][6]》一文中,演示了大多数开发者使用 Git 执行的日常任务。这不是非开发者的必读书目,但对于任何想在公共 Git 托管服务上为项目做贡献的人来说,这篇文章是必读的。这篇文章专门针对的是 Github,因为它是当今最常见的平台之一,但其原理也适用于任何 Git 服务的 Web 前端,包括 [GitLab][7]、[Gogs][8] 和 [Gitea][9] 等流行的开源框架。 + +### 试试这个 Git 演练 + +与其漫无目的的探索,你是不是更喜欢在导游的带领下学习?有时候,学习一件事最简单的方法就是模仿别人的准确步骤。你知道最终的结果是肯定成功的,所以你在进行练习的时候会有信心,而你的大脑和手指也会得到重复的好处,从而建立起记忆。如果这是你的学习风格,那就跟着 Alan Formy-Duvall 的《[Git 的实用学习练习][10]》,找出成功的 Git 课程的感觉。 + +### Git 应用程序 + +信不信由你,Git 的界面比你在终端输入的文字更多。显然,在线托管的 Git 有 Web 界面,但是你也可以在计算机上使用 Git 客户端。如果想获得更多的帮助,请阅读 Jesse Duffield 关于 [Lazygit][11] 的文章或 Olaf Anders 关于 [Tig][12] 的文章。要获得完整的图形应用程序体验,请阅读我有关 [Git-cola][13]、[Sparkleshare][14] 以及[其它应用][15]的文章。是的,甚至还有[用于你的移动设备的界面][16]! + +### 了解更多关于 Git 的信息 + +知识就是力量,所以不要让 Git 对你来说像个谜。无论你是直接使用它,还是只知道它的名字,或者你以前从未听说过它,现在都是了解 Git 的好时机。这里有很多资源可以帮助你了解它的工作原理、工作原理以及人们为什么这么喜欢它。潜入其中,按照自己的节奏来学习,并学会爱上 Git 吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/get-started-git + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2 (Scissors cutting open access to files) +[2]: https://en.wikipedia.org/wiki/Git +[3]: https://opensource.com/resources/linux +[4]: https://opensource.com/article/19/2/git-terminology +[5]: https://opensource.com/life/16/7/stumbling-git +[6]: https://opensource.com/article/18/2/how-clone-modify-add-delete-git-files +[7]: https://about.gitlab.com/install/ +[8]: https://gogs.io/ +[9]: https://gitea.io/en-us/ +[10]: https://opensource.com/article/19/5/practical-learning-exercise-git +[11]: https://opensource.com/article/20/3/lazygit +[12]: https://opensource.com/article/19/6/what-tig +[13]: https://opensource.com/article/20/3/git-cola +[14]: https://opensource.com/article/19/4/file-sharing-git +[15]: https://opensource.com/life/16/8/graphical-tools-git +[16]: https://opensource.com/article/19/4/calendar-git#mobile diff --git a/published/202004/20200407 Bitwarden- A Free - Open Source Password Manager.md b/published/202004/20200407 Bitwarden- A Free - Open Source Password Manager.md new file mode 100644 index 0000000000..5341efed3d --- /dev/null +++ b/published/202004/20200407 Bitwarden- A Free - Open Source Password Manager.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12111-1.html) +[#]: subject: (Bitwarden: A Free & Open Source Password Manager) +[#]: via: (https://itsfoss.com/bitwarden/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Bitwarden:一个自由开源的密码管理器 +====== + +> Bitwarden 是流行的开源密码管理器。在这里,我们来看看它提供了什么。 + +![][1] + +[Bitwarden][2] 是一个自由开源的密码管理器。你可能还记得,我们之前将它列为 [Linux 中的最佳密码管理器][3]之一。 + +就个人而言,几个月来我一直在多个设备上使用 Bitwarden 作为我的密码管理器。因此,在本文中,我将说明它提供的功能以及我的使用经验。 + +**注意:** 如果你对服务的安全性有疑问,请查看其官方安全性[常见问题页面][4]。 + +### Bitwarden 密码管理器的特性 + +![][5] + +[Bitwarden][2] 是许多其他方便的密码管理器的不错替代品。 + +以下是它的特性: + + * 提供免费和付费选择 + * 适用于团队(企业)和个人 + * 开源 + * 支持自托管 + * 能够作为身份验证器应用(如 Google 身份验证器) + * 跨平台支持(安卓、iOS、Linux、Windows 和 macOS) + * 提供浏览器扩展(Firefox,、Chrome、Opera、Edge、Safari) + * 提供命令行工具 + * 提供网页保管库 + * 能够导入/导出密码 + * [密码生成器][6] + * 自动填充密码 + * 两步身份验证 + +从技术上讲,Bitwarden 使用完全免费。然而,它也提供了一些付费计划(个人付费和商务付费计划)。 + +通过付费计划,你可以与更多用户共享密码、获取 API 访问权限(业务使用)以及更多此类高级功能。 + +以下是定价(在编写本文时): + +![][7] + +对于大多数个人来说,考虑到支持开源项目,10 美元/年的高级个人计划不应成为问题。当然,你也可以选择没有限制地免费使用。 + +### 在 Linux 上安装 Bitwarden + +![][8] + +很容易将 Bitwarden 安装到你的 Linux 系统上,因为它提供了一个 .AppImage 文件。如果你还不知道[如何使用 AppImage][9] 文件,你可以参考我们的指南。 + +如果你不喜欢使用 AppImage,你可以选择 [snap 包][10]或在其[官方下载页面][11]上下载 .deb 或者 .rpm 文件。你还可以查看其 [GitHub 页面][12]了解更多信息。 + +- [下载 Bitwarden][2] + +如果你对使用桌面应用不感兴趣,也可以使用浏览器扩展。 + +### 我使用 Bitwarden 的体验 + +在 Bitwarden 之前,我使用 [LastPass][13] 作为密码管理器。尽管这不是一个糟糕的选择,但它不是开源软件。 + +所以,在我发现 Bitwarden 后就决定使用它。 + +首先,我从 LastPass 导出我的数据,并导入到 Bitwarden 没有遇到困难。在此过程中我没有丢失任何数据。 + +除了桌面应用,我一直在使用 Bitwarden 的火狐插件和 Android 应用。使用六个多月后,我没有遇到任何问题。所以,如果你愿意试试看,我一定会给它好评! + +### 总结 + +我想说,对于那些想要一个可以到处工作,并且跨设备轻松同步的密码管理器的用户而言,Bitwarden 是一个完整的解决方案。 + +你可以免费入门,但如果可以,请购买 **10 美元/年**的高级计划来支持这个开源项目。 + +如果你正在寻找更多选择,你也可以查看我们的 [Linux 中 5 个最佳密码管理器][3]。 + +你试过 Bitwarden 了吗?如果没有,请试试看!此外,你最喜欢的密码管理器是什么?让我在下面的评论中知道! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bitwarden/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-screenshot.jpg?ssl=1 +[2]: https://bitwarden.com/ +[3]: https://linux.cn/article-11531-1.html +[4]: https://help.bitwarden.com/security/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-dark-mode.jpg?ssl=1 +[6]: https://itsfoss.com/password-generators-linux/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-pricing.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-settings.png?ssl=1 +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://snapcraft.io/bitwarden +[11]: https://bitwarden.com/#download +[12]: https://github.com/bitwarden +[13]: https://www.lastpass.com/ diff --git a/published/202004/20200407 New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu.md b/published/202004/20200407 New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu.md new file mode 100644 index 0000000000..87410d1362 --- /dev/null +++ b/published/202004/20200407 New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12114-1.html) +[#]: subject: (New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu) +[#]: via: (https://itsfoss.com/ubuntudde/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +新的 Linux 发行版 UbuntuDDE 将漂亮的深度桌面带到 Ubuntu +====== + +深度是一个漂亮桌面环境,拥有直观的 UI。UbuntuDDE 项目结合了 Ubuntu 的强大和深度之美。 + +[深度桌面环境][1](DDE)是由[深度 Linux][2] 的开发人员创建的漂亮桌面环境。最初,深度 Linux 基于 [Ubuntu][3],但后来他们切换到了 [Debian][4]。 + +![Deepin Desktop Environment in Ubuntu][5] + +深度 Linux 的一个主要问题是它的下载服务器速度较慢。常规系统需要花几个小时才能下载,因为他们的所有服务器都在中国,而这些服务器很不幸的是速度极慢。 + +如果你想使用深度桌面,那没有什么可以阻止你将其安装在常规 Ubuntu 系统上。[UbuntuDDE][6] 试图通过在 Ubuntu 之上为你提供开箱即用的深度桌面体验来使其更简单。这样可以节省你在 Ubuntu 上安装和配置深度桌面的时间和精力。 + +![Screenshot of UbuntuDDE][7] + +### Ubuntu DDE:Ubuntu 的强大和深度桌面的漂亮 + +请注意,UbuntuDDE 不是 Ubuntu 的官方变种。UbuntuDDE 的开发人员与 Ubuntu 团队无关。UbuntuDDE 目前一个混合发行版,其目标是在未来的发行版中被接纳为 Ubuntu 的官方变种。 + +UbuntuDDE 开发人员得到了 Ubuntu Snapcraft 团队的 Alan Pope、Ubuntu Budgie 团队和 [Ubuntu Cinnamon][8] 团队,以及其他开发者,如 Hualet Wang 和 Felix Yan 的帮助。 + +在与 FOSS 的对话中,其主要开发人员 Arun 强调说,该项目的重点是定期维护 Ubuntu 的 DDE 软件包,并帮助用户享受 DDE(深度桌面环境)的全部乐趣。 + +![Ubuntu Deepin Edition login screen][9] + +Arun 还提到,这个 Ubuntu 和深度的混合项目首先是维护和打包来自上游(即深度仓库)的最新版本。然后,它最终与 Ubuntu 20.04 focal 结合,生成了一个镜像文件,每个人都可以安装,而不必麻烦地先安装常规的 Ubuntu,然后再安装深度桌面。UbuntuDDE 不仅是 DDE 和 Ubuntu 的组合,而且还是 UbuntuDDE 团队的软件包选择和设计变更的融合。 + +![UbuntuDDE screenshot][10] + +与 Deepin Linux 不同,UbuntuDDE 不使用深度应用商店。它改用 Ubuntu 软件中心。如果你被[这个来自武汉的深度 Linux 的间谍软件谣言][11]吓到了,这应该是一个好消息。 + +### 下载 UbuntuDDE 20.04 Beta + +UbuntuDDE 的目标是与 Ubuntu 20.04 一起发布第一个正式的稳定版本。像[其他 Ubuntu 变种][12]一样,UbuntuDDE 20.04 beta 也可供你下载并尝试。 + +> 警告! +> +> 一句话警告。 UbuntuDDE 是正在开发的新手项目。请不要在你的主用系统上使用它。如果要尝试,请在虚拟机或备用系统中使用它。 + +- [下载 Ubuntu 20.04 DDE Beta][13] + +![Installing UbuntuDDE][14] + +由于本质上是 Ubuntu,因此安装 UbuntuDDE 与安装 Ubuntu 相同。你可以参考这篇教程,其中展示了[如何在 VirtualBox 内安装 Ubuntu][15]。 + +我知道你可能会认为这“不过是另一个 Ubuntu” 或者“只是 Ubuntu 上的深度,任何人都可以做到的”。但是我也知道有一小部分用户喜欢像 UbuntuDDE 这样的项目,这对他们来说使事情变得容易。我的意思是有许多 Ubuntu 变种就是这样出现的。你怎么看? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntudde/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.deepin.org/en/dde/ +[2]: https://www.deepin.org/en/ +[3]: https://ubuntu.com/ +[4]: https://www.debian.org/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot.jpg?ssl=1 +[6]: https://ubuntudde.com/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-1.jpg?ssl=1 +[8]: https://itsfoss.com/ubuntu-cinnamon/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-5.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-2.jpg?ssl=1 +[11]: https://www.deepin.org/en/2018/04/14/linux-deepin-is-not-spyware/ +[12]: https://itsfoss.com/which-ubuntu-install/ +[13]: https://ubuntudde.com/download/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-4.jpg?ssl=1 +[15]: https://itsfoss.com/install-linux-in-virtualbox/ diff --git a/published/202004/20200408 Create web tutorials with Reveal.js and Git.md b/published/202004/20200408 Create web tutorials with Reveal.js and Git.md new file mode 100644 index 0000000000..8d549aceaf --- /dev/null +++ b/published/202004/20200408 Create web tutorials with Reveal.js and Git.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12139-1.html) +[#]: subject: (Create web tutorials with Reveal.js and Git) +[#]: via: (https://opensource.com/article/20/4/create-web-tutorial-git) +[#]: author: (Eric D. Schabell https://opensource.com/users/eschabell) + +使用 Reveal.js 和 Git 创建网页教程 +====== + +> 通过这个简单的工作流程创建的研讨会幻灯片,可以在任何浏览器、设备和平台上获得一致的查看效果。 + +![](https://img.linux.net.cn/data/attachment/album/202004/23/094800ohkpbjd3zbj0dj0d.jpg) + +无论你是学习者还是教师,你可能都会认识到采用幻灯片放映来传播知识的在线研讨会workshop的价值。如果你曾经偶然看到过这样一个逐页、逐章设置的井井有条的教程,你可能会想知道创建这样的一个网站有多难。 + +好吧,让我在这里向你展示,使用全自动化的流程来生成这样的教程是多么容易。 + +### 介绍 + +当我开始将学习内容放到网上置时,体验并不是很好。我想要的是一种可重复的、一致的、易于维护的东西,因为我的内容会随着我教学的技术发展而变化。 + +我尝试了许多交付模型,从 [Asciidoctor][2] 这样的低级代码生成器到在单个 PDF 文件中放置教程。全都不能让我满意。当我举办现场的在座研讨会时,我喜欢使用幻灯片放映,因此我想知道我是否可以为我自己的在线的,自定进度的研讨会体验做同样的事情。 + +经过一番挖掘,我为创建无痛的研讨会网站打下了基础。当时我已经在使用一个演示文稿生成框架,这对我来说是很有帮助的,因为这个框架可以产生对网站友好的格式(HTML)。 + +### 设置 + +这里是这个项目所需要的基本组件。 + + * 研讨会的想法(这是你的问题,我帮不了你) + * 用于研讨会幻灯片的 Reveal.js + * GitLab 项目仓库 + * 你常用的 HTML 代码编辑器 + * Web 浏览器 + * 在你的机器上安装好 Git + +如果这个列表看起来令人望而生畏,那么有一个快速入门的方法,不需要把所有的东西一个个都拉到一起。你可以用我的模板项目来给你提供幻灯片和项目设置的入门教程。 + +本文假设你熟悉 Git 和在 Git 平台(如 GitLab)上托管项目。如果你需要指导或教程,请查看我们的[Git 入门系列][3]。 + +首先,将模板项目克隆到本地机器上。 + +``` +$ git clone https://gitlab.com/eschabell/beginners-guide-automated-workshops.git +``` + +为此设置一个新的 GitLab 项目,导入模板项目作为初始导入。 + +研讨会网站有一些重要的文件。在**根目录**下,你会发现一个名为 `.gitlab-ci.yml` 的文件,当你向主分支提交修改时(即将拉取请求合并到 `master` 分支),这个文件会作为触发器。它可以触发将 `slides` 目录的全部内容复制到 GitLab 项目的 `website` 文件夹中。 + +我把它托管在我的 GitLab 账户中,名为 `beginners-guide-automated-workshops`。当它部署完毕后,你可以在浏览器中通过导航到下列地址查看 `slides` 目录的内容: + +``` +https://eschabell.gitlab.io/beginners-guide-automated-workshops +``` + +对于你的用户帐户和项目,URL 如下所示: + +``` +https://[YOUR_USERNAME].gitlab.io/[YOUR_PROJECT_NAME] +``` + +这些是你开始创建网站内容所需要的基本素材。当你推送修改后,它们会自动生成更新过的研讨会网站。请注意,默认模板包含了几个示例幻灯片,这将是你完成对存储库的完整签入后的第一个研讨会网站。 + +研讨会模板生成的结果是一个 [receive.js][4] 幻灯片,可以在任何浏览器中运行,并可以自动调整大小,几乎可以让任何人在任何地方、任何设备上观看。 + +这样创建一个方便、易访问的研讨会怎么样? + +### 它是如何工作的 + +有了这些背景信息,你就可以开始探索研讨会的这些素材,并开始把你的内容放在一起了。你需要的一切都可以在项目的 `slides` 目录中找到;这里是使用 reveal.js 在浏览器中创建研讨会幻灯片的地方。 + +你将用来制作研讨会的文件和目录是: + + * `default.css`文件 + * `images` 目录 + * `index.html`文件 + +在你常用的 HTML/CSS 编辑器中打开每一个文件,然后进行下面描述的修改。你用哪个编辑器并不重要,我更喜欢 [RubyMine IDE][5],因为它能在本地浏览器中提供页面预览。这对我在将内容推送到研讨会网站之前测试内容时很有帮助。 + +#### default.css 文件 + +文件 `css/theme/default.css` 是一个基础文件,你将在这里为你的研讨会幻灯片设置重要的全局设置。其中值得注意的两个主要的项目是所有幻灯片的默认字体和背景图片。 + +在 `default.css` 中,看一下标有 `GLOBAL STYLES` 的部分。当前的默认字体在这一行中列出了。 + +``` +font-family: "Red Hat Display", "Overpass", san-serif; +``` + +如果你使用的是非标准字体类型,则必须在以下行中将其导入(Overpass 字体类型就是这样做的): + +``` +@import url('SOME_URL'); +``` + +`background` 是你创建的每张幻灯片的默认图像。它存储在 `images` 目录下(见下面),并在下面这一行中设置(重点是图像路径)。 + +``` +background: url("…/…/images/backgrounds/basic.png") +``` + +要设置一个默认背景,只需将这一行指向你要使用的图片。 + +#### images 目录 + +顾名思义,`images` 目录是用来存储你想在研讨会幻灯片上使用的图片。例如,我通常会把展示研讨会主题进展的截图放在我的个人幻灯片上。 + +现在,你只需要知道你需要将背景图片存储在一个子目录(`backgrounds`)中,并将你计划在幻灯片中使用的图片存储在 `images` 目录中。 + +#### index.html 文件 + +现在你已经把这两个文件整理好了,剩下的时间你就可以在 HTML 文件中创建幻灯片了,从 `index.html` 开始。为了让你的研讨会网站开始成形,请注意这个文件中的以下三个部分。 + + * `head `部分,在这里你可以设置标题、作者和描述。 + * `body` 部分,你可以在这里找到要设计的单个幻灯片。 + * 你可以在每个 `section` 中定义各个幻灯片的内容。 + +从 `head` 部分开始,因为它在顶部。模板项目有三个占位符行供你更新。 + +``` +INSERT-YOUR-TITLE-HERE + + +``` + +`title` 标签包含文件打开时显示在浏览器选项卡中的文字。请将其改为与你的研讨会的标题相关的内容(或研讨会的某个部分),但记得要简短,因为标签页的标题空间有限。`description` 元标签包含了对你的工作坊的简短描述,而 `author` 元标签是你应该把你的名字(如果你是为别人写的,则是工作坊创建者的名字)。 + +现在继续到 `body` 部分。你会注意到它被分成了许多 `section` 标签。`body` 的开头包含了一个注释,说明你正在为每个标有 `section` 的打开和关闭的标签创建幻灯片。 + +``` + +
+ + +
+``` + +接下来,创建你的各个幻灯片,每张幻灯片都用 `section` 标签封装起来。这个模板包括了一些幻灯片来帮助你开始制作。例如,这里是第一张幻灯片。 + +``` +
+
+

Beginners guide

+

to automated workshops

+
+
+ Brought to you by,
+ YOUR-NAME
+
+ +
+``` + +这张幻灯片有两个区域,用 `div` 标签分隔。用空格隔开了标题和作者。 + +如果你有一定的 HTML 使用知识,可以尝试各种东西来开发你的研讨会。使用浏览器预览结果的时候真的很方便。有些 IDE 提供了本地查看修改,但你也可以打开 `index.html` 文件查看你的修改,然后再推送到资源库中。 + +一旦你对你的研讨会感到满意,推送你的修改,然后等待它们通过持续集成管道。它们将像模板项目一样被托管在 。 + +### 了解更多 + +要了解更多关于这个工作流程可以做什么,请查看下面的示例研讨会和托管了研讨会集合的网站。所有这些都是基于本文中描述的工作流程。 + +研讨会例子: + + * [Red Hat Process Automation Manage workshop][6] + * [JBoss Travel Agency BPM Suite online workshop][7] + +研讨会集合: + + * [Rule the world: Practical decisions & process automation development workshops][8] + * [Application development in the cloud workshop][9] + * [Portfolio architecture: Workshops for creating impactful architectural diagrams][10] + +我希望这本新手指南和模板研讨会项目能让你看到,在开发和维护研讨会网站的过程中,可以轻松、无痛地完成。我也希望这个工作流程能让你的研讨会受众几乎在任何设备上都能完全访问你的内容,这样他们就能从你分享的知识中学习到你的知识。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/create-web-tutorial-git + +作者:[Eric D. Schabell][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/eschabell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://asciidoctor.org/ +[3]: https://opensource.com/resources/what-is-git +[4]: https://revealjs.com/#/ +[5]: https://www.jetbrains.com/ruby/ +[6]: https://gitlab.com/bpmworkshop/rhpam-devops-workshop +[7]: https://gitlab.com/bpmworkshop/presentation-bpmworkshop-travel-agency +[8]: https://bpmworkshop.gitlab.io/ +[9]: https://appdevcloudworkshop.gitlab.io/ +[10]: https://redhatdemocentral.gitlab.io/portfolio-architecture-workshops diff --git a/published/202004/20200408 How to Create Templates in LibreOffice to Save Time and Increase Productivity.md b/published/202004/20200408 How to Create Templates in LibreOffice to Save Time and Increase Productivity.md new file mode 100644 index 0000000000..1377f03523 --- /dev/null +++ b/published/202004/20200408 How to Create Templates in LibreOffice to Save Time and Increase Productivity.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12118-1.html) +[#]: subject: (How to Create Templates in LibreOffice to Save Time and Increase Productivity) +[#]: via: (https://itsfoss.com/create-templates-libreoffice/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 LibreOffice 中创建模板以实现省时高效 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/16/214314y17oww0ymfylyn1m.jpg) + +在 [LibreOffice][1] 中为你经常使用的文档创建模板可以为你节省一些时间。它可以是信件、财务表格抑或是简报。 + +模板不仅可以为你节省时间,另一方面它可以保证在同一机构内参与统一项目的小组成员文档的一致性。 + +举例而言,如果你是一家需要经常开具工作经验证明的企业,你可以创建一个模板,而不再需要从某个地方复制粘贴已保存的文档。当你需要开具一个新的经验证明时,你可以从模板中创建,稍微编辑一下就可以了。 + +LibreOffice 默认情况下提供了一些模板,但并不仅仅局限于使用这些,你可以根据自己的需求自由定制。 + +我认为模板是每个用户都应该了解的 [LibreOffice 基础技巧之一][2]。下面我将为你演示如何使用。 + +### 如何在 LibreOffice 中创建一个模板 + +首先,创建你希望通过最少的编辑就可以重复使用的文档。它可以是文档、电子表格或演示文稿。我在示例中使用的是 word 文档,但是所有步骤都是相同的。 + +然后转到“文件”选项卡并选择“存储为模板”。你将被提示输入“名称”及选择“类别”,再单击“保存”。 + +![Creating a new template in LibreOffice][3] + +此文件将以 .ots 格式保存在 LibreOffice 的模板文件夹中。你可以在其他安装了 LibreOffice 的系统上使用这些 .ots 文件,并在这些系统上使用相同的模板。 + +### 如何在 LibreOffice 中使用模板 + +要使用模板,请选择 “文件选项卡”,然后选择 “模板”。 + +不要担心! LibreOffice 在打开一个模板时会在不影响原始模板的情况下创建一个副本。你可以随意编辑文档而不必担心模板发生改动。 + +![Using templates][4] + +选择模板后,单击打开。你就可以随意编辑了。 + +### 如何在 LibreOffice 中更改模板 + +我们需求可能会不时变化,所以需要对模板进行相应。 + +编辑一个现有的模板,单击“文件” -> “模板”,然后右键单击所需的模板,然后单击“编辑”。 + +![edit Template][5] + +当你完成对模板的编辑时,单击“保存”以使更改生效。 + +总之,模板不仅可以减少重复任务的工作量,还可以防止用户出错。你可以利用电脑优势来灵活的处理重复性的任务,并以此提高你的效率。 + +> 福利小贴士 + +你可以在 [LibreOffice 网站][7]上找到大量的附加模板。你可以搜索你需要的,下载并使用它们。请注意,这些模板来自第三方和未经验证的用户。所以使用它们的风险需要自己承担。 + +之后我会继续分享更多这样的技巧。同时,你还可以学习一下如何创建模板[在 GNOME 的右键菜单上下文中添加“创建新文档”选项][8]。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/create-templates-libreoffice/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.libreoffice.org/ +[2]: https://itsfoss.com/libreoffice-tips/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/1.Template-save-as.png?resize=800%2C567&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/2.Use-a-template.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/3.edit-template.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/LibreOffice-logo.jpeg?fit=800%2C450&ssl=1 +[7]: https://extensions.libreoffice.org/templates +[8]: https://itsfoss.com/add-new-document-option/ diff --git a/published/202004/20200409 Here-s How to Find Out Which Desktop Environment You are Using.md b/published/202004/20200409 Here-s How to Find Out Which Desktop Environment You are Using.md new file mode 100644 index 0000000000..963a64f356 --- /dev/null +++ b/published/202004/20200409 Here-s How to Find Out Which Desktop Environment You are Using.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12124-1.html) +[#]: subject: (Here’s How to Find Out Which Desktop Environment You are Using) +[#]: via: (https://itsfoss.com/find-desktop-environment/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何找出你所使用的桌面环境 +====== + +如果你是 Linux 新用户,并在一个 Linux 论坛中寻求帮助,那么你可能会被问以下问题: + +> “你使用的是哪个桌面环境?” + +你知道什么是桌面环境desktop environment(DE),但你如何知道你使用的是哪一个?我会告诉你如何找到它。我将首先展示命令行方法,因为这适用于[各种 Linux 发行版][1]。我还将展示如何通过图形方式获得。 + +### 检查你使用的是哪个桌面环境 + +![][2] + +你可以[在 Linux 中使用 echo 命令][3]在终端中显示 `XDG_CURRENT_DESKTOP` 变量的值。 + +打开终端并复制粘贴此命令: + +``` +echo $XDG_CURRENT_DESKTOP +``` + +例如,这表明我在 [Ubuntu 20.04][5] 中使用了 [GNOME 桌面][4]: + +``` +[email protected]:~$ echo $XDG_CURRENT_DESKTOP +ubuntu:GNOME +``` + +尽管此命令可以快速告诉你正在使用哪个桌面环境,但它不会提供任何其他信息。 + +在某些情况下,了解桌面环境版本可能很重要。软件的每个新版本都会带来新功能或删除某些功能。[GNOME 3.36][6] 引入了“请勿打扰”选项,以关闭所有桌面通知。 + +假设你了解了这个新的“请勿打扰”功能。你确认自己正在使用 GNOME,但是在 GNOME 桌面上看不到此选项。如果你可以检查系统上已安装的 GNOME 桌面版本,那么这会很清楚。 + +我将先向你展示命令检查桌面环境版本,因为你可以在任何运行桌面环境的 Linux 中使用它。 + +### 如何获取桌面环境版本 + +与获取桌面环境的名称不同。获取其版本号的方法并不直接,因为它没有标准的命令或环境变量可以提供此信息。 + +在 Linux 中获取桌面环境信息的一种方法是使用 [Screenfetch][7] 之类的工具。此[命令行工具以 ascii 格式显示 Linux 发行版的 logo][8] 以及一些基本的系统信息。桌面环境版本就是其中之一。 + +在基于 Ubuntu 的发行版中,你可以通过[启用 Universe 仓库][9]安装 Screenfetch,然后使用以下命令: + +``` +sudo apt install screenfetch +``` + +对于其他 Linux 发行版,请使用系统的软件包管理器来安装此程序。 + +安装后,只需在终端中输入 `screenfetch` 即可,它应该显示桌面环境版本以及其他系统信息。 + +![Check Desktop Environment Version][10] + +如上图所示,我的系统使用 GNOME 3.36.1(基本版本是 GNOME 3.36)。你也可以这样[检查 Linux 内核版本][11]和其他详细信息。 + +请记住,Screenfetch 不一定显示桌面环境版本。我查看了它的源码,它有许多 if-else 代码,可以从各种桌面环境中的许多源和参数获取版本信息。如果找不到任何版本,那么仅显示桌面环境名称。 + +### 使用 GUI 检查桌面环境版本 + +几乎所有桌面环境在其 “Settings”->“About” 部分中都提供了基本的系统详细信息。 + +一个主要问题是,大多数桌面环境看起来都不同,因此我无法展示每个桌面环境的确切步骤。我将展示 GNOME 的,让你在桌面上发现它。 + +在菜单中搜索 “Settings”(按 Windows 键并搜索): + +![Search for Settings application][12] + +在这里,找到底部的 “About” 部分。单击它,你应该就能看到桌面环境及其版本。 + +![Check Desktop Environment in Ubuntu][13] + +如你所见,这表明我的系统正在使用 GNOME 3.36。 + +我希望这个快速入门技巧对你有所帮助。如果你有任何疑问或建议,请在下面发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/find-desktop-environment/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/check-desktop-environment.jpg?ssl=1 +[3]: https://linuxhandbook.com/echo-command/ +[4]: https://www.gnome.org/ +[5]: https://itsfoss.com/ubuntu-20-04-release-features/ +[6]: https://itsfoss.com/gnome-3-36-release/ +[7]: https://github.com/KittyKatt/screenFetch +[8]: https://itsfoss.com/display-linux-logo-in-ascii/ +[9]: https://itsfoss.com/ubuntu-repositories/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/check-desktop-environment-version.jpg?ssl=1 +[11]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/check-desktop-environment-ubuntu.jpg?ssl=1 diff --git a/published/202004/20200410 How I-m using AI to translate -wash your hands- in 500 languages.md b/published/202004/20200410 How I-m using AI to translate -wash your hands- in 500 languages.md new file mode 100644 index 0000000000..4117cefacf --- /dev/null +++ b/published/202004/20200410 How I-m using AI to translate -wash your hands- in 500 languages.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12131-1.html) +[#]: subject: (How I'm using AI to translate 'wash your hands' in 500 languages) +[#]: via: (https://opensource.com/article/20/4/ai-translation) +[#]: author: (Daniel Whitenack https://opensource.com/users/datadan) + +我是如何用 AI 把“请洗手”翻译成 500 种语言的? +====== + +> 通过使用人类和机器生成的翻译,可以将关键的健康短语翻译成世界各地的当地语言。 + +![](https://img.linux.net.cn/data/attachment/album/202004/20/184427f1a2t5z61m5xxo1t.jpg) + +你可能不知道,目前世界上有 [7117 种语言][2]在使用,不是方言,而是在用的语言! 然而,世界上许多数字媒体只能使用几十种语言,而像谷歌翻译这样的翻译平台只支持 100 种左右的语言。这样的现实意味着,由于缺乏及时获取信息的机会,全世界有数十亿人被边缘化。当前的冠状病毒(COVID-19)大流行已经让人痛苦地意识到了这一点,凸显了将健康相关的短语(如“请洗手wash your hands”或“保持距离”等)即时、快速翻译成小众语言的必要性。 + +为此,我应用了最先进的 AI 技术,用 544 种语言构建出了与“请洗手”相近的短语并进行了统计(我的 GPU 还在运行)。多语言无监督和受监督嵌入Multilingual Unsupervised and Supervised Embeddings(MUSE)方法被用来训练这 544 种语言和英语之间的跨语言单词嵌入。然后,这些嵌入方法可以从现有文档中提取出与目标短语相似的短语。 + +我与 SIL 国际公司的同事们合作完成了这项工作,他们收集了该短语的更多的人工翻译结果。这些人工翻译结果和我的一些机器翻译结果的组合可以在[这个民族语指南页面][3]上搜索到(机器生成的短语用一个小的机器人图标表示),更多的翻译将在生成/收集到的时候加入。 + +### 利用现有的语料库 + +SIL 国际公司已经完成了 2000 多种语言的语言工作,目前管理着 1600 多个语言项目。因此,当我解决这个特殊的问题时,我知道我们很可能已经多次将“请洗手”和/或类似的短语翻译成了数百种语言,而这一猜测得到了回报。我很快就从我们的档案库中收集到了超过 900 种语言的文档(主要是完成的贝壳书模板、教材和圣经)。这些文档中的每一份都有一个英文的对应版本,其中必然包括“请洗手”和/或类似“请洗脸”这样的短语。此外,这些文档的质量都很高,并与当地语言社区合作进行了翻译和检查。 + +这是相当多语言的数据集。然而,有两个问题需要克服。首先,这个数据包含了大多数语言的数千种样本,这与训练机器翻译模型所使用的数百万个样本形成了鲜明对比。其次,即使文档中包含目标语言中的“请洗手”这个短语,我们也不知道这个短语在周围文本中的确切位置。 + +我们当然可以利用[低资源语言的机器翻译][4]中的一些最新技巧,但是需要花费一些时间来调整自动化方法,以快速适应每种语言对中的翻译模型。此外,我们所针对的许多语言都没有现成的的基线,可以用来比较评估指标(例如 [BLEU 评分][5])。考虑到对冠状病毒大流行的迫切担忧,我们希望比这更快一点(尽管我们计划在将来再来解决这个问题)。 + +我选择通过在现有的文档中寻找短语本身或短语的组件(如“请洗”或“你的手”)来尝试构建“请洗手”这个短语。为了找到这些成分,我使用 Facebook Research 的[多语言无监督和受监督嵌入(MUSE)][6]对每个 {英语、目标语言} 对进行了跨语言cross-lingual嵌入训练。MUSE 以单语言monolingual的单词嵌入作为输入(我使用 [fasttext][7] 来生成这些词),并使用对抗性方法学习了从英语到目标嵌入空间的映射。这个过程的输出是跨语言cross-lingual的单词嵌入。 + +![Using fasttext along with MUSE to perform cross-language embedding][8] + +一旦产生了跨语言嵌入,我们就可以开始在目标语言文档中寻找短语组件。结果发现,整个文档中清楚地使用了“请洗脸”这个短语以及单独的“手”、“请洗”等词。对于每一种语言,我都通过 n-gram 搜索我预期该短语会出现的地方(根据其在英语的对应版本中的用法)。使用跨语言嵌入法对 n-gram 进行了矢量化处理,并使用各种距离指标与英语短语的矢量化版本进行了比较。在嵌入空间中,与英文短语“最接近”的 n-gram 被确定为与目标语言匹配。 + +最后,将与英语对应的成分短语进行组合,生成目标语言中的“请洗手”短语。这种组合方式再次利用了跨语言嵌入,以确保以合适方式组合组件。例如,如果我们在目标语言中匹配“请洗脚”这个短语,就必须将“脚”对应的 n-gram 替换成“手”对应的 n-gram。下面是伯利兹·克里奥尔Belize Kriol英语的一个例子: + +![][9] + +当然,在这个匹配过程中,会做一些假设,这个过程完全有可能不能产生语法上正确的预测。例如,我假设在大多数语言中,“手”的单词和“脚”的单词都是一个字元token长的(字元由空格和标点符号隔开)。当然并非总是如此。这可能会造成类似于“和洗和手你”或类似的瑕疵词条。希望我们可以克服其中的一些局限性,并在未来扩展这个系统,但是,现在,我们选择用图形来强化这个想法。 + +我们将世界卫生组织的洗手说明改编成了一个 PNG 图片模板。然后,我们把我们翻译和生成的短语,用 Bash 和 Go 脚本的组合将其渲染到洗手图像中。这样,在文字和图像中都强调了正确洗手的理念(以防万一我们生成的翻译很尴尬)。 + +![][10] + +### 结果 + +到目前为止,我已经能够训练出 544 种语言的跨语言嵌入。我使用上述讨论过的方法尝试为所有这些语言构建“请洗手”这个短语。因为我没有许多语言对的对齐数据,所以我使用了同样包含“请洗手”成分的单独的保留文档来帮助验证构造短语中的字元。这让我们对公开发布的翻译版本有了一些信心(至少它们包含了表示“洗”和/或“手”的信息)。此外,我还将该方法与谷歌翻译支持的和/或有可用的人工翻译的语言对进行了比较。以下是来自 [Ethnologue][11] 带有语言统计的翻译样本。 + +**语言:意大利语 [Ita]** + +- 地点:意大利 +- 人口: 68,000,000 +- 我们的系统: làvati la mani +- 谷歌翻译: Lavati le mani + +**语言:保加利亚语 [bul]** + +- 地点:保加利亚 +- 人口:8,000,000 +- 我们的系统:умий ръцете +- 谷歌翻译:Измий си ръцете + +**语言: 荷兰语 [nld]** + +- 地点:荷兰 +- 人口:24,000,000,000 +- 我们的系统:wast uw handen +- 谷歌翻译:Was je handen + +**语言: Pijin [pis]** + +- 地点:所罗门群岛 +- 人口: 550,000 +- 我们的系统:wasim han +- 谷歌翻译:不支持 + +**语言:Tikar [tik]** + +- 地点:喀麦隆 +- 人口:110,000 +- 我们的系统:ɓɔsi fyàʼ +- 谷歌翻译:不支持 + +**语言:Waffa [waj]** + +- 地点:巴布亚新几内亚 +- 人口:1,300 +- 我们的系统:yaakuuvaitana nnikiiyauvaa fini +- 谷歌翻译:不支持 + +构造的短语类似于参考翻译,或者似乎是“请洗手”的另一种说法。例如,在保加利亚语中,我预测为“умий ръцете”,而谷歌翻译预测为“Измий си ръцете”。 然而,如果我用谷歌翻译回译我的预测,我还是会得到“请洗手”。有一些不确定的地方,我无法与参考译文(例如,所罗门群岛的 Pijin [pis])或人类注释的跨度进行比较,但我仍然可以验证“洗”(wasim)和“手”(han)分别用在其他必定是谈论洗或手的参考文件中。 大约有 15% 的译文可以用这个方法验证,我希望在收集参考文献字典的过程中能进行更多的验证。 + +请注意,我最多使用了每种语言中大约 7000 个句子来得到上述译文,即使是意大利语这样的高资源语言也是如此。我也不依赖语言对之间的对齐句子。尽管存在这种数据非常稀缺、无监督的情况,但对于两个系统都支持的语言,我仍然能够获得类似于谷歌翻译的短语。这证明了这种“混合”方法(无监督的单词嵌入+基于规则的匹配)在将短语翻译成数据非常少的语言中的潜在用途。 + +注意:我绝对不是说这是解决冠状病毒和其他健康相关的信息传播问题的解决方案。这里仍有很多东西需要探索和正式评估,我们正在为此努力。在很多情况下,这种方法无法帮助构建数百种语言的重要信息资料。但是,我认为,我们所有人都应该尝试着为当前危机的相关问题制定创造性的解决方案。也许这只是一个非常大的拼图中的一块。 + +你可以在[这个民族语言指南][3]上查看经过验证的译文加上人工翻译的完整列表。此外,我们即将以论文的形式对这一系统进行更深入的描述和分析。我们欢迎公众对翻译进行反馈,以帮助系统进行微调,最重要的是,确保将健康信息传递给世界各地的边缘化语言社区。 + +### 制作自己的洗手海报 + +我们已经开源了[用于渲染复合的脚本和生成洗手海报的代码][12]。这种方法应该能够处理几乎所有的语言和脚本。你可以在海报中添加你自己的“请洗手”的翻译,以帮助传播,或者根据自己的本地语境进行翻译。请务必在社交媒体上以 #WashYourHands 为标签分享你生成的海报。 + +### 培养你的 AI 技能 + +有很多令人兴奋的 AI 问题,可以给世界带来巨大的影响。如果你想用人工智能解决像上面提到的问题,或者你认为你的企业可能需要开始利用人工智能来做其他事情(供应链优化、推荐、客户服务自动化等),那么不要错过今年 5 月的[AI 课堂培训活动][13]。*AI 课堂*是一个沉浸式的、为期三天的虚拟培训活动,适合至少有一定编程经验和数学基础知识的人参加。该培训提供了使用 Python 和开源框架(如 TensorFlow 和 PyTorch)进行现实的 AI 开发的实用基础知识。完成课程后,学员将有信心开始开发和部署自己的 AI 解决方案。 + +本文经许可转载自 https://datadan.io/blog/wash-your-hands + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/ai-translation + +作者:[Daniel Whitenack][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/datadan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) +[2]: https://www.ethnologue.com/guides/how-many-languages +[3]: https://www.ethnologue.com/guides/health +[4]: https://datadan.io/blog/resources-for-low-resource-machine-translation +[5]: https://en.wikipedia.org/wiki/BLEU +[6]: https://github.com/facebookresearch/MUSE +[7]: https://fasttext.cc/ +[8]: https://opensource.com/sites/default/files/uploads/ai-language-translation-wash-your-hands-opensourcedotcom.gif (Using fasttext along with MUSE to perform cross-language embedding) +[9]: https://opensource.com/sites/default/files/uploads/ai-language-translation-wash-your-hands-opensourcedotcom2.gif +[10]: https://opensource.com/sites/default/files/uploads/ai-language-translation-wash-your-hands-opensourcedotcom3.gif +[11]: https://www.ethnologue.com/ +[12]: https://github.com/sil-ai/wash-your-hands +[13]: https://datadan.io/ diff --git a/published/202004/20200410 How to Go Full Dark Mode in Ubuntu 20.04.md b/published/202004/20200410 How to Go Full Dark Mode in Ubuntu 20.04.md new file mode 100644 index 0000000000..5ff72f17b5 --- /dev/null +++ b/published/202004/20200410 How to Go Full Dark Mode in Ubuntu 20.04.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12098-1.html) +[#]: subject: (How to Go Full Dark Mode in Ubuntu 20.04) +[#]: via: (https://itsfoss.com/dark-mode-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 20.04 中完全进入深色模式 +====== + +> 深色模式是 Ubuntu 20.04 最受瞩目的[新功能][1]之一了。任何版本的 Ubuntu 都可以通过[安装深色主题][2]让用户界面拥有一个深色的外观,但在 Ubuntu 20.04 中,这个过程变得更简单。 + +![](https://img.linux.net.cn/data/attachment/album/202004/11/200841gvvaja25jaz5z7hv.jpg) + +在 Ubuntu 20.04 中,无需额外安装主题,默认主题(称为 Yaru)本身就带有三种模式,其中就包括深色模式。 + +下面我会展示如何将 Ubuntu 系统完全设置为深色模式。 + +### 在 Ubuntu 20.04 打开深色模式 + +- [video](https://player.vimeo.com/video/405726943) + +这个步骤是在 GNOME 桌面上进行的,如果你[使用的是其它桌面][4],你看到的可能会和下面的截图不一样。 + +按下 super 键(或 Windows 键),然后输入 “settings”,就可以找到系统设置。 + +![Search for Settings][5] + +在系统设置中,进入“外观Appearance”部分,就可以看到浅色light标准standard深色dark三个选项。既然要使用深色模式,那自然而然要选择“深色”这个选项了。 + +![Enable Dark Theme in Ubuntu][6] + +完成设置以后,使用了 GTK3 的应用程序都可以跟随深色模式。因此你会看到系统中包括文本编辑器、终端、LibreOffice 等在内的大多数应用程序都已经切换成深色了。但未使用 GTK3 的应用程序可能并没有跟随进入深色模式,下面我会展示如何更完整地进入深色模式。 + +### 继续调整,进入完整深色模式 + +这个时候你会发现,shell 主题、屏幕顶部面板中的消息托盘和系统托盘还仍然保持在原有的模式当中。 + +![No Dark Shell by default in Ubuntu][7] + +现在就需要使用 [GNOME 扩展][8]安装 Yaru 深色 shell 主题了。[在 Ubuntu 中通过 Ctrl+Alt+T 打开终端][9],然后执行以下这个命令安装浏览器扩展: + +``` +sudo apt install chrome-gnome-shell +``` + +进入[扩展页面][10]启用这个扩展: + +![Enable User Themes GNOME Extension][11] + +执行以下命令安装 [GNOME 调整工具][12]: + +``` +sudo apt install gnome-tweaks +``` + +打开 GNOME 调整工具,进入“外观Appearance”部分,就可以看到 shell 主题的选项,现在只需要把它启用就可以了。 + +![Enable Yaru Dark Shell Theme in Ubuntu][13] + +设置完之后再观察一下,桌面通知、消息托盘、系统托盘等等都已经进入深色模式了。 + +![Yaru Dark Shell Theme in Ubuntu][14] + +现在感觉好多了。但你可能还会注意到,在使用浏览器访问网站的时候,很多网站都使用了白色的背景色。如果期望网站方提供深色模式,那是很不现实的,但我们可以自己实现这一件事。 + +你需要用到的东西就是诸如 [Dark Reader][15] 这样的浏览器扩展。《[在 Firefox 中启用深色模式][16]》这篇文章中也有讨论过这个浏览器扩展,它的使用过程并不复杂,如果你使用的浏览器是 Firefox、Chrome 或 [Ubuntu 下的 Chromium][17],就可以直接安装[其官方网站][15]上列出的扩展。 + +Dark Reader 安装完成后,就会以深色模式打开网站了。 + +![It’s FOSS Homepage in Dark Mode with Dark Reader][18] + +当然,有些外部的第三方应用程序可能仍然是浅色状态。如果它们自己附带了深色模式的选项,就需要手动启用它们的深色模式。 + +如今,深色模式在非开发者人群中也越来越流行了。按照以上的步骤,你就可以轻松进入深色模式。 + +请享受深色模式。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/dark-mode-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://itsfoss.com/install-themes-ubuntu/ +[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[4]: https://itsfoss.com/find-desktop-environment/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/settings-search-ubuntu-20-04.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-dark-theme-ubuntu.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/no-dark-shell-ubuntu.jpg?ssl=1 +[8]: https://itsfoss.com/gnome-shell-extensions/ +[9]: https://itsfoss.com/ubuntu-shortcuts/ +[10]: https://extensions.gnome.org/extension/19/user-themes/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-user-themes-gnome.jpg?ssl=1 +[12]: https://itsfoss.com/gnome-tweak-tool/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-yaru-dark-shell-theme.jpeg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/yaru-dark-shell-theme-ubuntu.jpg?ssl=1 +[15]: https://darkreader.org/ +[16]: https://itsfoss.com/firefox-dark-mode/ +[17]: https://itsfoss.com/install-chromium-ubuntu/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/itsfoss_dark_mode.jpg?ssl=1 diff --git a/published/202004/20200413 A handy utility for creating Raspberry Pi SD card images.md b/published/202004/20200413 A handy utility for creating Raspberry Pi SD card images.md new file mode 100644 index 0000000000..9fd472c01d --- /dev/null +++ b/published/202004/20200413 A handy utility for creating Raspberry Pi SD card images.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12136-1.html) +[#]: subject: (A handy utility for creating Raspberry Pi SD card images) +[#]: via: (https://opensource.com/article/20/4/raspberry-pi-imager-mac) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +一个方便的用于创建树莓派 SD 卡镜像的程序 +====== + +> 开始在 Mac 上使用 Raspberry Pi Imager。 + +![Raspberries with pi symbol overlay][1] + +有多种购买树莓派的方法,根据你的购买渠道的不同,可能附带或不附带操作系统。要在树莓派上安装操作系统,只需将操作系统镜像 “闪存” 到 SD 卡即可。为了使之尽可能简单,[树莓派基金会][2]推出一个 Raspberry Pi Imager 实用程序,你可以在所有主流平台上下载它。下面就来简单介绍一下这个有用的新工具。 + +### 安装 Imager + +你通常可以在[树莓派下载][3]页面上找到 Raspberry Pi Imager。它有 Mac、Ubuntu 和 Windows 版本。我将下载并演示 Mac 版本。 + +Mac 的安装包是常规的 DMG 镜像,它会挂载到你的桌面,然后经典的安装界面就会出现: + +![Raspberry Pi Imager installer][4] + +只需将可爱的树莓图标拖到“应用”文件夹,就可以完成。从启动台中调用它,你会看到一系列简单的按钮和菜单供你选择。真的不能比这更简单了: + +![Raspberry Pi Imager home screen][5] + +### 可用的镜像和选项 + +默认选项包含各种树莓派型号的镜像。Raspbian 是首选,它有两个可用的选项,较小的 “Lite” 版本和较大的 “Full” 版本。LibreELEC Kodi 娱乐系统有各种特定于型号的版本。Ubuntu 18 和 19 有适用于不同树莓派型号的 32 位和 64 位版本。有一个 RPi 4 EEPROM 恢复程序,以及使用 FAT32 格式化卡的功能。最后,有一个通用的镜像安装程序选项,稍后我将进行尝试。这个简单而紧凑的程序非常方便。 + +### 安装一些镜像 + +我决定使用 16g 的 micro SD 卡。我选择了默认的 Raspbian 镜像,选择已连接的 USB/SD 设备,然后按下 “WRITE” 按钮。这是一个简短的演示: + +![Raspberry Pi Imager demo][6] + +我没有在此处发布整个操作过程。我认为它是在写入的时候下载了镜像,对于我的无线连接这花费了几分钟。该过程在完成之前要先经过写入,然后经过验证环节。完成后,我弹出设备,并将卡插入到我的树莓派 3 中,然后按照通常的图形 Raspbian 安装向导和桌面环境进行设置。 + +这对我来说还不够。我每天都会下载许多 Linux,今天我还在寻找更多。我回到了[树莓派下载][3]页面,并下载了 RISC OS 镜像。这个过程几乎一样容易。下载 RISCOSPi.5.24.zip 文件,将其解压缩,然后找到 ro524-1875M.img 文件。在 “Operating System” 按钮中,我选择了 “Use Custom” 并选择了所需的镜像文件。这个过程几乎是相同的。唯一真正的不同是我必须在下载目录中搜寻并选择一个镜像。文件写完后,回到树莓派 3,RISC OS 可以使用了。 + +### 对 USB C 的抱怨 + +顺便说一句,如今有多少人对 USB C 带来的不便感到沮丧?我使用的是只有 USB C 口的 MacBook Pro,我需要不断更换适配器才能完成工作。看看这个: + +![USB C adapter][7] + +是的,那是一个 USB C 到 USB A 适配器,然后是一个 USB 到 SD 卡读卡器,以及一个 SD 到 micro SD 适配器。我可能可以在网上找到一些东西来简化此过程,但这些都是我手头有的部件,以支持我家五花八门的 Mac、Windows 和 Linux 主机。说到这里就不多说了,但我希望你能从这些疯狂的东西中得到一个笑点。 + +### 总结 + +新的 Raspberry Pi Imager 是一种简单有效的工具,可以快速烧录树莓派镜像。[BalenaEtcher][8] 是用于对可移动设备进行烧录的类似工具,但是新的 Raspberry Pi Imager 通过省去了获取那些常见镜像的步骤,使普通树莓派系统安装(如 Raspbian)更加容易。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/raspberry-pi-imager-mac + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://www.raspberrypi.org/ +[3]: https://www.raspberrypi.org/downloads/ +[4]: https://opensource.com/sites/default/files/uploads/install_1.png (Raspberry Pi Imager installer) +[5]: https://opensource.com/sites/default/files/uploads/screen_2_0.png (Raspberry Pi Imager home screen) +[6]: https://opensource.com/sites/default/files/uploads/demo_3.gif (Raspberry Pi Imager demo) +[7]: https://opensource.com/sites/default/files/uploads/adapter_4.png (USB C adapter) +[8]: https://www.balena.io/etcher/ diff --git a/published/202004/20200413 How to Add Multiple Time Zones in Ubuntu.md b/published/202004/20200413 How to Add Multiple Time Zones in Ubuntu.md new file mode 100644 index 0000000000..8cd0619343 --- /dev/null +++ b/published/202004/20200413 How to Add Multiple Time Zones in Ubuntu.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12121-1.html) +[#]: subject: (How to Add Multiple Time Zones in Ubuntu) +[#]: via: (https://itsfoss.com/add-multiple-time-zones-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 中添加多个时区 +====== + +> 本快速教程介绍了在 Ubuntu 和其他发行版中使用 GNOME 桌面环境添加多时区时钟的步骤。 + +![](https://img.linux.net.cn/data/attachment/album/202004/18/142021jborblzkglbebrkk.jpg) + +如果你的家人或同事在另一个国家,或者你居住在一个有多个时区的国家,那么了解时差就变得很重要。毕竟,你不想在凌晨 4 点打电话打扰别人。 + +一些 Linux 用户还会记下 [UTC 时间][1],因为大多数服务器都使用 UTC。 + +如果你有多个时钟,那么可以更好地管理此类情况。你可以将一个时钟设置为本地时间,并将其他时钟同步到其他时区。这使得了解不同时间变得更加容易。 + +在本教程中,我将向你展示如何在 Ubuntu 和其他使用 GNOME 桌面环境的 Linux 发行版中添加其他时钟。 + +### 在 Ubuntu(以及其他使用 GNOME 的 Linux)中添加多个时区时钟 + +请[检查你正在使用的桌面环境][2]。本教程仅适用于 GNOME 桌面。 + +要添加其他时钟,可以使用一个叫 [GNOME Clocks][3] 的小程序。 + +GNOME Clocks 是一个简单的应用,它可以显示多个位置的时间和日期。你也可以使用它来设置闹钟或计时器,它还包括秒表功能。 + +GNOME Clocks 存在于 Ubuntu 的 Universe 仓库中。因此,请确保首先[启用 Universe 仓库][4]。 + +你可以在软件中心中搜索 “GNOME Clocks” 并从那里安装它。 + +![Gnome Clocks Ubuntu Software Center][5] + +或者,你可以打开终端并使用以下命令来安装 GNOME Clocks: + +``` +sudo apt install gnome-clocks +``` + +如果你使用的是其他 Linux 发行版,那么请使用发行版的软件中心或软件包管理器来安装此程序。 + +安装后,请按 `Super` 键( `Windows` 键)并搜索 clocks: + +![Gnome Clocks App Search Ubuntu][6] + +启动程序,你应该会看到一个界面,提供一些选项,例如添加世界时钟、设置闹钟、使用秒表和计时器。 + +单击左上角的 “+” 号,它将为你提供搜索地理位置的选项。搜索、选择并添加。 + +![Adding additional clocks][7] + +通过地理位置添加所需的时区后,你可以看到现在在消息托盘中添加了这个新时钟。它还显示了你当地时间与其他时区之间的时差。 + +![Multiple clocks for multiple time zones][8] + +你可以使用 `Super + M` 键快速打开消息托盘。你可以掌握这些[有用的 Ubuntu 快捷方式][9]来节省时间。 + +如果要删除其他时钟,你可以从 GNOME Clocks 应用界面执行以下操作: + +![Remove Additional Clocks][10] + +你无法(在这里)删除当前时区并设置为其他时区。有其他方法[更改 Linux 中的当前时区][11]。 + +我希望你喜欢这个快速技巧。欢迎提出问题和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-multiple-time-zones-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Coordinated_Universal_Time +[2]: https://itsfoss.com/find-desktop-environment/ +[3]: https://wiki.gnome.org/Apps/Clocks +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-clocks-ubuntu-software-center.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-clocks-app-search-ubuntu.jpg?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/add-multiple-time-zones-gnome.jpg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/multiple-clocks-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/ubuntu-shortcuts/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/remove-additional-clocks-ubuntu.jpg?ssl=1 +[11]: https://itsfoss.com/change-timezone-ubuntu/ diff --git a/published/202004/20200413 How to install Python on Linux.md b/published/202004/20200413 How to install Python on Linux.md new file mode 100644 index 0000000000..7a152a5489 --- /dev/null +++ b/published/202004/20200413 How to install Python on Linux.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12132-1.html) +[#]: subject: (How to install Python on Linux) +[#]: via: (https://opensource.com/article/20/4/install-python-linux) +[#]: author: (Vijay Singh Khatri https://opensource.com/users/vijaytechnicalauthor) + +如何在 Linux 上安装 Python +====== + +> 在 Linux 上安装最新 Python,替代或与老版本并存的分步说明。 + +![](https://img.linux.net.cn/data/attachment/album/202004/21/094500u63lnlgukgnjb0t0.jpg) + +[Python][2] 现在是[最流行][3]、最常用的编程语言。Python 的简单语法和较低的学习曲线使其成为初学者和专业开发人员的终极选择。Python 还是一种非常通用的编程语言。从 Web 开发到人工智能,它几乎在除了移动开发的所有地方都有使用。 + +如果你使用的是 Python,那么你很有可能是一名开发人员(或想成为一名开发人员),而 Linux 是创建软件的绝佳平台。但是,当你每天使用 Python 时,有时你希望使用最新版本。你可能不想仅仅为了测试最新版本的系统而替换了默认的 Python 安装,因此本文说明了如何在 Linux 上安装最新版本的 Python 3,而不替换发行版提供的版本。 + +使用 `python --version` 终端命令检查是否已安装 Python,如果已安装,那么检查是哪个版本。如果你的 Linux 系统上未安装 Python,或者你想安装更新的版本,请按照以下步骤操作。 + +### 分步安装说明 + +#### 步骤 1:首先,安装构建 Python 所需的开发包 + +在 Debian 上 + +``` +$ sudo apt update +$ sudo apt install build-essential zlib1g-dev \ +libncurses5-dev libgdbm-dev libnss3-dev \ +libssl-dev libreadline-dev libffi-dev curl +``` + +在 Fedora 上: + +``` +$ sudo dnf groupinstall development +``` + +#### 步骤 2:下载最新的稳定版本的 Python 3 + +访问[官方 Python 网站][4]并下载最新版本的 Python 3。下载完成后,你会有一个 `.tar.xz` 归档文件(“tarball”),其中包含 Python 的源代码。 + +#### 步骤 3:解压 tarball + +下载完成后,使用解压程序或 [Linux 的 tar 命令][5]解压压缩包,例如: + +``` +$ tar -xf Python-3.?.?.tar.xz +``` + +#### 步骤 4:配置脚本 + +解压 Python 压缩包后,进入 `configure` 脚本所在目录并在 Linux 终端中使用以下命令执行该脚本: + +``` +$ cd Python-3.* +./configure +``` + +配置可能需要一些时间。等待直到成功完成,然后再继续。 + +#### 步骤 5:开始构建过程 + +如果你的系统上已经安装了某个版本的 Python,并且希望同时安装新版本的 Python,请使用以下命令: + +``` +$ sudo make altinstall +``` + +构建过程可能需要一些时间。 + +如果要使用此版本替换当前版本的 Python,那么应使用包管理器(例如 `apt` 或 `dnf`)卸载当前的 Python 包,然后安装: + +``` +$ sudo make install +``` + +但是,通常最好以软件包的形式(例如 `.deb` 或 `.rpm` 文件)来安装软件,以便系统可以为你跟踪和更新它。因为本文假设尚未打包最新的 Python,所以你可能没有这个选择。在这种情况下,你可以按照建议使用 `altinstall` 来安装 Python,或者使用最新的源代码重构现有的 Python 包。这是一个高级主题,并且特定于你的发行版,因此不在本文讨论范围之内。 + +#### 步骤 6:验证安装 + +如果你没有遇到任何错误,那么现在你的 Linux 系统上已安装了最新的 Python。要进行验证,请在终端中输入以下命令之一: + +``` +python3 --version +``` + +或者 + +``` +python --version +``` + +如果输出显示 `Python 3.x`,那么说明 Python 3 已成功安装。 + +### 创建虚拟环境(可选) + +Python 提供了名为 `venv`(虚拟环境)的软件包,可帮助你将程序目录或软件包与其他目录或软件包隔离。 + +要创建虚拟环境,请在 Python 终端中输入以下内容(在此示例中,假定你安装的 Python 版本为 `3.8` 系列): + +``` +python3.8 -m venv example +``` + +该命令创建一个带有一些子目录的新目录(我将其命名为 `example`)。 + +要激活虚拟环境,请输入: + +``` +$ source example/bin/activate +(example) $ +``` + +请注意,你的终端提示符(`$`)现在以环境名称开头。 + +要停用虚拟环境,请使用 `deactivate` 命令: + +``` +(example) $ deactivate +``` + +### 总结 + +Python 是一种有趣的语言,它的开发和改进非常频繁。一旦了解了如何安装最新版本而又不干扰发行版提供的稳定版本,熟悉新功能将很容易。 + +如果你有任何反馈或问题,请在评论中提出。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/install-python-linux + +作者:[Vijay Singh Khatri][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/vijaytechnicalauthor +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM) +[2]: https://www.python.org/ +[3]: http://pypl.github.io/PYPL.html +[4]: http://python.org +[5]: https://opensource.com/article/17/7/how-unzip-targz-file diff --git a/published/202004/20200415 How to Open Files and Folders as Administrator in Nautilus File Manager in Linux.md b/published/202004/20200415 How to Open Files and Folders as Administrator in Nautilus File Manager in Linux.md new file mode 100644 index 0000000000..4b46fad9b3 --- /dev/null +++ b/published/202004/20200415 How to Open Files and Folders as Administrator in Nautilus File Manager in Linux.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12128-1.html) +[#]: subject: (How to Open Files and Folders as Administrator in Nautilus File Manager in Linux) +[#]: via: (https://itsfoss.com/open-nautilus-as-administrator/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Linux 的 Nautilus 文件管理器中以管理员身份打开文件和文件夹 +====== + +> 了解如何在 Ubuntu 和其他 Linux 发行版的 Nautilus 文件管理器的右键菜单中添加“以管理员身份打开”选项。 + +![](https://img.linux.net.cn/data/attachment/album/202004/19/211224hurk01u0kuvqnpvn.jpg) + +如果要以根用户身份打开或编辑文件,你总是可以在终端中执行此操作。但我知道有些人对命令行不适应。 + +桌面 Linux 通常为那些害怕终端的人提供方法避免命令行。 + +如果你必须以 root 用户身份访问文件夹或以 root 用户权限编辑文件,那你可以在 [Nautilus 文件管理器][1]中以图形方式进行操作。 + +一个小巧优雅的 Nautilus 技巧能让你以管理员(也就是 root)打开文件和文件夹。让我向你展示如何做。 + +### 在 Nautilus 文件管理器的右键菜单中添加“以管理员身份打开”选项 + +> 警告!请不要以 root 用户身份打开和编辑随机文件,因为这样可能会弄乱文件并导致系统损坏。仅在需要时使用它。 + +我展示的是 Ubuntu 的步骤。你可以根据你的发行版的软件包管理器进行更改。 + +你必须使用终端(即使你不喜欢它)来安装 Nautilus 插件。请[确保已启用 Universe 仓库][4]: + +``` +sudo apt install nautilus-admin +``` + +关闭并再次打开 Nautilus 文件管理器以查看更改生效。 + +![Right clock to see the “Open as Administrator” option][5] + +你也可以用 root 用户身份编辑文件。只需选择文件,右键单击它,然后选择“以管理员身份编辑”选项。 + +![Edit Files As Root Ubuntu][6] + +这两种情况下,系统都会提示你输入帐户密码: + +![You need to enter your password, of course][7] + +差不多了。你可以享受 GUI 的舒适了。 + +如果你不想再以 root 用户身份运行 Nautilus,那么可以删除此插件。删除已安装但不再使用的其他东西总是没错的。 + +在终端中(没错,再一次在终端),使用以下命令删除 Nautilus 插件。 + +``` +sudo apt remove nautilus-admin +``` + +顺便说一句,如果你在使用 [Ubuntu MATE][8],你可以使用 caja-admin 代替 nautilus-admin。其他文件管理器可能会或可能不会提供此类功能。 + +我希望这个快速技巧对你有所帮助。随时欢迎提出问题和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-nautilus-as-administrator/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.gnome.org/Apps/Files +[3]: https://itsfoss.com/root-user-ubuntu/ +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/open-folder-as-administrator-ubuntu.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/edit-files-as-root-ubuntu.jpg?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/authentication-pop-up-ubuntu.png?ssl=1 +[8]: https://ubuntu-mate.org/ diff --git a/published/202004/20200416 How to package Python applications for Linux.md b/published/202004/20200416 How to package Python applications for Linux.md new file mode 100644 index 0000000000..95b6bba528 --- /dev/null +++ b/published/202004/20200416 How to package Python applications for Linux.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12143-1.html) +[#]: subject: (How to package Python applications for Linux) +[#]: via: (https://opensource.com/article/20/4/package-python-applications-linux) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何为 Linux 打包 Python 应用 +====== + +> 了解如何使用 dh_virtualenv 来让你的 Python 应用可作为 .deb 包安装。 + +![](https://img.linux.net.cn/data/attachment/album/202004/23/235547iztz5d955t9s9b5t.jpg) + +在基于 Debian 的操作系统(例如 Debian 或 [Elementary OS][2])上安装 Python 应用的一种方法是使用 [dh_virtualenv][3] 工具。它可以构建一个 `.deb` 包,在应用之外封装了一个 Python 虚拟环境,并在安装时进行部署。 + +在本文中,我将以构建一个包含 [HTTPie][4] 工具的包为例来解释如何使用它,以便在无需激活虚拟环境的情况下从命令行测试 HTTP API。 + +### 使用 dh_virtualenv 打包 + +首先,你需要安装 `dh_virtualenv` 所需的工具。`dh_virtualenv` 的[文档][5]提供了所有安装选项。在基于 Debian 的系统上,我输入: + +``` +apt-get install dh-virtualenv devscripts +``` + +尽管不需要 [devscripts][6] 包,但它可以简化后续操作。 + +现在,创建一个目录来保存源码。由于这是一个本地的、非官方的 HTTPie 打包,因此我将其称为 `myhttp`。接下来,让我们在 `myhttp` 内创建一些文件,向 Debian 构建系统提供元数据。 + +首先,创建 `debian/control` 文件: + +``` +Source: myhttp +Section: python +Priority: extra +Maintainer: Jan Doe +Build-Depends: debhelper (>= 9), python3.7, dh-virtualenv (>= 0.8) +Standards-Version: 3.9.5 + +Package: myhttp +Architecture: any +Pre-Depends: dpkg (>= 1.16.1), python3.7, ${misc:Pre-Depends} +Depends: ${misc:Depends} +Description: http client + Useful for doing stuff +``` + +那么这些是什么信息呢?正如 [Debian 文档][8]指出的: + +>“第 1–7 行是源码包的控制信息。第 9–13 行是二进制包的控制信息。” + +以下是我使用的: + +* `Section` 的值对于我们来说大多没有意义,但需要存在。它对给引导式 UI 安装程序提供信息是有意义的,但对于这个包来说,没有意义。 +* `Priority` 对像这样的第三方包的正确值是 `extra`。 +* 强烈建议在 `Maintainer` 字段中填写正确的联系人信息。但不一定非得是你的个人电子邮件,如果包由团队维护,并且你希望将问题发送到团队的邮件别名,例如 `Infrastructure Team `。 +* `Build-Depends` 字段标识你需要 `debhelper`、`python` 和 `dh-virtualenv` 来构建包:包构建过程中将确保这些依赖项在包构建时已安装。 +* `Standards-Version` 字段主要给人看。它表明你遵循的指南。本指南基于 `dh-virtualenv` 的官方文档,它是基于 Debian 的 3.9.5 指南。最好一直将源码包和二进制包命名相同。 +* `Architecture` 字段应为 `Any`,因为除非虚拟环境可能包含一些特定于体系结构的文件。否则,最好选择该字段为 `any`。 +* 保持 `Pre-Depends` 列表不变:它是一种非常严格的依赖关系形式,你很少会需要比这里建议的最小依赖更多的依赖项。依赖项通常由构建系统准确计算,因此没有理由手动指定它们。 +* 如果你的包主要用于内部,那么 `Description` 字段可能只需要最少的信息或者指向公司 wiki 的链接,不然更多的信息会更有用。 + +然后创建 `debian/compat` 文件,它[主要出于历史目的而存在][10]: + +``` +$ echo "9" > debian/compat +``` + +接下来,创建更新日志以告知包用户自上次发布以来发生了什么变化。最简单的方法是使用 `dch --create` 创建模板,然后填写值。 + +填写后,它看起来像: + +``` +myhttp (2.0.0-1) stable; urgency=medium + + * Initial release. + + -- Jan Doe Fri, 27 Mar 2020 01:09:22 +0000 +``` + +现在你需要告诉工具安装 HTTPie,但是哪个版本? + +创建一个宽松版本的 `requirements.in` 文件: + +``` +httpie +``` + +通常,宽松的需求文件将仅包含项目的直接依赖项,并在需要时指定最低版本。不一定总是需要指定最低版本:这些工具通常偏向于将依赖关系转化为“可能的最新版本”。如果你的 Debian 包与一个内部 Python 包相对应,这是内部应用中的一种常见情况,那么宽松的需求文件看起来将很相似:仅包含包名的一行。 + +然后使用 `pip-compile`(可通过安装 PyPI 包 `pip-tools` 获得): + +``` +$ pip-compile requirements.in > requirements.txt +``` + +这会生成一个严格的依赖文件,名为 `requirements.txt`: + +``` +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile requirements.in +# +certifi==2019.11.28 # via requests +chardet==3.0.4 # via requests +httpie==2.0.0 # via -r requirements.in +idna==2.9 # via requests +pygments==2.6.1 # via httpie +requests==2.23.0 # via httpie +urllib3==1.25.8 # via requests +``` + +最后,写一个 `debian/rules` 文件来创建包。因为 `dh_virtualenv` 会处理所有困难的事,因此规则文件很简单: + +``` +#!/usr/bin/make -f + +%: + dh $@ --with python-virtualenv --python /usr/bin/python3.7 +``` + +确保指定 Python 解释器。默认它会使用 `/usr/bin/python`,这是 Python2,但是你应该使用一个[受支持的 Python 版本][11]。 + +完成了,接下来就是构建包: + +``` +$ debuild -b -us -uc +``` + +这会在父目录生成一个类似 `myhttp_2.0.0-1_amd64.deb` 的文件。该文件可在任何兼容的系统上安装。 + +通常,最好在同一平台上构建用于特定平台(例如 Debian 10.0)的 Debian 包。 + +你可以将此 Debian 包保存在软件仓库中,并使用例如 [Ansible][12] 的工具将其安装在所有相关系统上。 + +### 总结 + +给基于 Debian 的系统的打包应用是一个有着多个步骤的过程。使用 `dh_virtualenv` 将使过程变得简单明了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/package-python-applications-linux + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-python.jpg?itok=F2PYP2wT (Python in a tree) +[2]: https://opensource.com/article/19/12/pantheon-linux-desktop +[3]: https://dh-virtualenv.readthedocs.io/en/latest/ +[4]: https://opensource.com/article/19/8/getting-started-httpie +[5]: https://dh-virtualenv.readthedocs.io/en/1.1/tutorial.html +[6]: http://man.he.net/man1/devscripts +[7]: mailto:jandoe@example.org +[8]: https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control +[9]: mailto:infra-team-list@company.example.com +[10]: https://www.debian.org/doc/manuals/maint-guide/dother.en.html#compat +[11]: https://opensource.com/article/19/11/end-of-life-python-2 +[12]: https://opensource.com/resources/what-ansible diff --git a/published/202004/20200417 12 Linux Commands to Have Some Fun in the Terminal.md b/published/202004/20200417 12 Linux Commands to Have Some Fun in the Terminal.md new file mode 100644 index 0000000000..d13219c30a --- /dev/null +++ b/published/202004/20200417 12 Linux Commands to Have Some Fun in the Terminal.md @@ -0,0 +1,329 @@ +[#]: collector: (lujun9972) +[#]: translator: (Zioyi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12149-1.html) +[#]: subject: (12 Linux Commands to Have Some Fun in the Terminal) +[#]: via: (https://itsfoss.com/funny-linux-commands/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +12 个有趣的 Linux 终端命令 +====== + +> 你觉得 Linux 终端里只有无趣的工作吗?那你一定不知道下面这些有趣的 Linux 命令吧。 + +Linux 终端是用来完成复杂的工作的,我们有很多有用的 [linux 命令奇技淫巧][1]来帮助你。 + +但是,你知道你还可以用终端来做很多有趣的事吗?如果你不知道,没关系,大多数 Linux 用户也都只把终端视为一个用来管理系统和开发工作的交互界面。 + +然而,如果你知道这里有些你可以在终端玩的[基于终端的游戏][2]和 [ASCII 码游戏][3],你一定会大吃一惊。 + +在这篇文章中,我将会探索一些有趣的、可笑的、荒谬的命令来让你可以在终端中找点乐子! + +### 用这些命令在 Linux 终端中找点乐子 + +![][4] + +你可能会觉得这些命令荒谬或没用,但是有一些还是可以被好好利用的。 + +我已经放上了 Ubuntu/Debian 的安装指令,如果你使用基于 Ubuntu 的发行版,请确保[启用 universe 仓库][5],因为大多数命令不在主仓库中。 + +如果你使用 Arch、Fedora、SUSE、Solus 或者其他非 Ubuntu 的发行版,请使用你的发行版包管理工具去安装这些有趣的 Linux 命令。 + +#### 1、在终端开一辆火车 + +让我们坐上火车,来一场说走就走的旅行的,没错,就是字面意思! + +`sl` 命令可以让你在终端运行一辆火车。 + +![][6] + +安装方法: + +``` +sudo apt install sl +``` + +完成后,你只要在终端输入下面的命令就可以开始: + +``` +sl +``` + +很精彩,对吧?但等等,我们还没结束!你还可以让你的火车飞起来,只要加上参数 `-F`,波特先生,请飞吧: + +``` +sl -F +``` + +这样会让火车长出翅膀飞出终端窗口! + +#### 2、给你的 Linux 终端加上黑客帝国效果 + +还记得科幻电影[黑客帝国][7]吗?终端里掉落的绿色字符成为了黑客帝国的标志形象。 + +你也可以在你的 Linux 电脑里有这样的黑客帝国数字雨!你只需要安装 `cmatric` 然后在终端输入它就行。 + +![][8] + +在 Debian/Ubuntu Linux 上安装 cmatrix: + +``` +sudo apt install cmatrix +``` + +现在,你要做的就是输入下面的命令,在终端就会有黑客帝国屏幕了: + +``` +cmatrix +``` + +按下 `Ctrl+C` 来停止它,黑客先生。 + +#### 3、燃起来 + +拿好灭火器,因为接下来你要在你的终端里点火了! + +![][11] + +想安装它,你要输入: + +``` +sudo apt install libaa-bin +``` + +完成后,你输入下面的命令,你的终端就会燃起一团火焰: + +``` +aafire +``` + +按下 `Ctrl+C` 来停止它。 + +#### 4、幸运饼干命令 + +想知道你的运气怎样但身边没有幸运饼干? + +别担心,你只需在终端打出 `fortune` 然后按下回车。终端将会随机显示出一个幸运语,就像你从幸运饼干里得到的一样。 + +![][12] + +安装它: + +``` +sudo apt install fortune +``` + +完成后,只要在命令行打出下面的内容,你就会知道你的运气怎样: + +``` +fortune +``` + +这是一个你可以实际使用的命令。你可以用它作为每日消息,这样在多用户环境下,每个用户登录后都会得到一个“幸运饼干”。 + +你也可以把它添加到 `bashrc` 文件,这样当你登进终端你就会看到了。 + +#### 5、宠物爱好者?这是给你准备的 + +`oneko` 是一个有趣的命令,可以把你的光标变成一只老鼠,然后创造一只好奇的猫,一旦你移动光标,就会来追你。这不仅局限于终端。当猫追逐光标时,你可以继续工作。 + +如果你家里有孩子这一定很有趣。 + +![][13] + +用下面的命令安装 `oneko`: + +``` +sudo apt install oneko +``` + +用下面的命令运行它: + +``` +oneko +``` + +如果你不喜欢猫,喜欢狗,输入: + +``` +oneko -dog +``` + +它有很多种小宠物,你可以用 `oneko -help` 获取信息。按下 `Ctrl+C` 终止它。 + +#### 6、有个小兄弟在看着你 + +`xeyes` 是一个很小的 GUI 程序,它可以绘制出一双眼睛一直盯着你!它会不断跟随你的鼠标光标,运行命令自己看看! + +![][14] + +你可以用下面命令安装: + +``` +sudo apt install xeyes +``` + +然后这样用它: + +``` +xeyes +``` + +按下 `Ctrl+C` 终止它。 + +#### 7、让终端帮你讲话 + +打开你的扬声器,你来试试这个命令,[eSpeak][15] 是一个有趣的命令,它可以让你的终端说话。是的,你没听错。 + +先安装这个包: + +``` +sudo apt install espeak +``` + +接下来,你只需要输入在命令行中输入你想听到的话: + +``` +espeak "Type what your computer says" +``` + +无论你在双引号里面填什么,你的电脑都会复述出来!它就像[在 Linux 中的 echo 命令][16],但不是打印出来,而是说出来。 + +#### 8、Toilet(但与洗手间无关) + +这听起来有点奇怪,是的。但是,这只是一个命令,用来将文本转换成大的 ASCII 字符。 + +![][17] + +用这个命令安装 `toilet`: + +``` +sudo apt install toilet +``` + +完成后,你只需输入: + +``` +toilet sample text you want +``` + +我也不知道为啥这个小程序叫 Toilet。 + +#### 9、那个牛说什么? + +`cowsay` 是一个在终端中用 ASCII 字符展示出一头牛的命令。通过这个命令,你可以控制牛说出你想说的话。 + +别纠结声音,它只展示文本(就是你看漫画书一样)。 + +![Cowsay Cowthink][18] + +安装 `cowsay`: + +``` +sudo apt install cowsay +``` + +安装完成后,你只要输入: + +``` +cowsay "your text" +``` + +无论你在双引号里填什么,你的牛都会说!我看到一些系统管理员用它来展示每天的消息。你也可以这样,你甚至可以把它和 `fortune` 命令结合。 + +#### 10、旗帜 + +`banner` 命令与 `toilet` 命令相似,但它限制最多只能打印 10 个字符。 + +![][19] + +你可以这样安装 `banner` 命令: + +``` +sudo apt install sysvbanner +``` + +然后这样运行: + +``` +banner "Welcome" +``` + +替换双引号里的内容,你将会得到你想要的展示内容。 + +#### 11、Yes + +![][20] + +`yes` 命令帮助你在循环中自动响应直到终止命令。这个命令将会一直打印相同的内容。如果你想快速生成大量垃圾文本,那么此命令将像超级按钮一样工作。 + +你也可以使用它为命令提供 `yes` 应答(如果提示应答时)。例如,`apt upgrade` 命令会要求你确认,你可以像这样使用它: + +``` +yes | sudo apt upgrade +``` + +你不需要安装任何包,`yes` 命令已经存在了。 + +想要终止 `yes` 命令循环,只需按下 `CTRL+C`。 + +#### 12、得到一个新的身份 + +要生成一个随机的假身份吗?我推荐你用 `rig` 命令。你在终端运行它,就会生成一个假的身份。 + +![][21] + +用这个命令安装 `rig`: + +``` +sudo apt install rig +``` + +只需像这样输入: + +``` +rig +``` + +它可能被用在脚本或者 web 应用中展示随机信息,但我自己还没做过什么。 + +### 结尾 + +我希望你会喜欢这个有趣的 Linux 命令列表。你最喜欢哪个命令呢?你还知道其他有趣的命令吗?请在评论部分与我们分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/funny-linux-commands/ + +作者:[Srimanta Koley][a] +选题:[lujun9972][b] +译者:[Zioyi](https://github.com/Zioyi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-command-tricks/ +[2]: https://itsfoss.com/best-command-line-games-linux/ +[3]: https://itsfoss.com/best-ascii-games/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fun-linux-commands.png?ssl=1 +[5]: https://itsfoss.com/ubuntu-repositories/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/sl-command.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/The_Matrix +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/matrix-screen-command.png?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png?fit=732%2C462&ssl=1 +[10]: https://itsfoss.com/star-wars-linux/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fire-command.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fortune-command.jpg?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/oneko-command.jpg?ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/xeyes-command.jpg?ssl=1 +[15]: https://itsfoss.com/espeak-text-speech-linux/ +[16]: https://linuxhandbook.com/echo-command/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/toilet-command.jpg?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cowsay-cowthink.jpg?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/banner-command.jpg?ssl=1 +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/yes-yourtext.jpg?ssl=1 +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/rig-command.jpg?ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/srimanta.jpg?ssl=1 diff --git a/published/202004/20200418 Ethernet consortium announces completion of 800GbE spec.md b/published/202004/20200418 Ethernet consortium announces completion of 800GbE spec.md new file mode 100644 index 0000000000..c909b1fb0e --- /dev/null +++ b/published/202004/20200418 Ethernet consortium announces completion of 800GbE spec.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12138-1.html) +[#]: subject: (Ethernet consortium announces completion of 800GbE spec) +[#]: via: (https://www.networkworld.com/article/3538529/ethernet-consortium-announces-completion-of-800gbe-spec.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +以太网技术联盟宣布完成 800Gb 以太网规范 +====== + +> 800Gb 以太网规范使当前以太网标准的最高速度提高了一倍,但同时也对包括延迟在内的其他方面进行了调整。 + +![](https://images.techhive.com/images/article/2017/05/170522-networking-2-100723415-large.jpg) + +由业界支持的以太网技术联盟Ethernet Technology Consortium(ETC)已宣布完成 800Gb 以太网技术规范。 + +新规范基于当前高端 400Gb 以太网协议中使用的许多技术,新规范正式称为 800GBASE-R。设计它的联盟(当时称为 25Gb 以太网联盟)在开发 25、50 和 100Gb 以太网协议方面也发挥了重要作用,其成员包括 博通、思科、谷歌和微软。 + +800Gb 以太网规范增加了新的介质访问控制media access control(MAC)和物理编码子层physical coding sublayer(PCS)方法,新规范对这些功能进行了调整,来使用 8 条 106.25Gbps 的物理通道分发数据。(通道可以是铜双绞线,也可以是光缆,一束光纤或光波。)800GBASE-R 规范建立在两个 400 GbE 2xClause PCS 之上,以创建一个以 800Gbps 的总速率运行的单个 MAC。 + +尽管主要是使用八条 106.25Gb 通道,但这并不是固定的。它可以以一半的速度 (53.125Gbps) 使用 16 条通道。 + +新标准提供了 400G 以太网规范的一半延迟,但是新规范也将运行在 50 Gbps、100 Gbps 和 200 Gbps 的网络上的前向纠错forward error correction(FEC)开销减少了一半,从而减少了网卡上的数据包处理负担。 + +通过降低延迟,这将满足对延迟敏感的应用(例如[高性能计算][2]和人工智能)中对速度的需求,在这些应用中,需要尽可能快地移动大量数据。 + +从 400G 增加到 800G 并不是太大的技术飞跃。它意味着在相同的传输速率下增加更多的通道,再做一些调整。但是,要想突破 Tb 级,Cisco 和其他网络公司已经讨论了十年了,这将需要对技术进行重大修改,而且并非易事。 + +新技术可能也不便宜。800G 可与现有硬件一起使用,而 400Gb 以太网交换机价格不菲,高达六位数。对技术进行重大修改,越过 Tb 障碍,可能会变得更加昂贵。但是对于大客户和高性能计算客户而言,这也是情理之中的事。 + +ETC 并未透露何时会支持 800G 的新硬件,但考虑到它对现有规格的变化不大,它可能会在今年出现,前提是疫情引起的停滞不会影响它。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538529/ethernet-consortium-announces-completion-of-800gbe-spec.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[2]: https://www.networkworld.com/article/3444399/high-performance-computing-do-you-need-it.html +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200421 MystiQ- A Free and Open Source Audio-Video Converter.md b/published/202004/20200421 MystiQ- A Free and Open Source Audio-Video Converter.md new file mode 100644 index 0000000000..c4c99dac95 --- /dev/null +++ b/published/202004/20200421 MystiQ- A Free and Open Source Audio-Video Converter.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12160-1.html) +[#]: subject: (MystiQ: A Free and Open Source Audio/Video Converter) +[#]: via: (https://itsfoss.com/mystiq/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +MystiQ:一个自由开源的音视频转换器 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/28/223258cr9rxzyrj344kh68.jpg) + +> MystiQ 是一款全新的开源视频转换工具,适用于 Linux 和 Windows。它的底层使用 FFMPEG,并为你提供了一个基于 Qt 的整洁干净的图形界面。 + +### MystiQ,一个基于 QT 的 FFmpeg GUI 前端 + +![][1] + +音频/视频转换工具可为每位跨多个平台的计算机用户提供方便。 + +出于同样的原因,我想着重介绍 [MystiQ][2] 是个好主意,这是一个相对较新的视频/音频转换器工具,适用于 Linux 和 Windows。截至目前,它还不支持 macOS,但可能会在不久的将来支持。 + +MystiQ 是基于 [Qt 5 界面][4]的 [FFmpeg][3] 图形前端。现在,你可以随时[在 Linux 命令行中安装并使用 ffmpeg][5],但这不是很舒服,是吗?这就是为什么 [Handbrake][6] 和 MystiQ 之类的工具可以使我们的生活更方便的原因。 + +由于 MystiQ 基于 FFmpeg,因此你可以将其用于一些基本的视频编辑,例如修剪、旋转等。 + +让我们来看看它的功能。 + +### MystiQ 视频转换器的功能 + +![][7] + +即使 MystiQ 目前还算是一个新事物,但它也包含了一组很好的基本功能。以下它提供的: + + * 视频转换 + * 音频转换(也可从视频中提取音频) + * 支持的格式:MP4、WEBM、MKV、MP3、MOV、OGG、WAV、ASF、FLV、3GP、M4A 等。 + * 跨平台(Windows 和 Linux) + * 适用于 32 位和 64 位系统的安装包 + * 能够调整音频质量(采样率、比特率等)进行转换 + * 基本的视频编辑功能(剪辑视频、插入字幕、旋转视频、缩放视频等) + * 将彩色视频转换为黑白 + * 有几个预设方案,可轻松转换视频以获得最佳质量或获得最佳压缩效果。 + +### 安装 MystiQ + +你可能没有在软件中心中找到它,但将它安装在 Linux 发行版上非常容易。 + +它提供了 .AppImage 文件和 .deb / .rpm 文件(32 位和 64 位软件包)。如果你不清楚如何使用的话,可以阅读[如何使用 AppImage 文件][10]。 + +如果你想帮助他们测试软件进行改进,你还可以找到他们的 [GitHub 页面][11],并查看源码或任何近期的预发布软件包。 + +你可以在其官方网站下载适用于 Linux 和 Windows 的安装程序文件。 + +- [下载 MystiQ][2] + +### 总结 + +在本文中,我使用 [Pop!_OS][12] 20.04 测试了 MytiQ 转换器,并且在转换视频和音频时没遇到任何问题。而且,对于像我这样的普通用户来说,它的转换速度足够快。 + +欢迎尝试一下,让我知道你对它的想法!另外,如果你在 Linux 上一直使用其他工具转换视频和音频,那它是什么? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mystiq/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/mystiq-converter-ft.jpg?ssl=1 +[2]: https://mystiqapp.com/ +[3]: https://www.ffmpeg.org/ +[4]: https://www.qt.io/ +[5]: https://itsfoss.com/ffmpeg/ +[6]: https://itsfoss.com/handbrake/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mystiq-options.jpg?ssl=1 +[9]: https://itsfoss.com/sound-converter-linux/ +[10]: https://itsfoss.com/use-appimage-linux/ +[11]: https://github.com/swl-x/MystiQ/ +[12]: https://system76.com/pop diff --git a/published/202004/20200422 How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux.md b/published/202004/20200422 How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux.md new file mode 100644 index 0000000000..8464da643e --- /dev/null +++ b/published/202004/20200422 How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux.md @@ -0,0 +1,198 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12165-1.html) +[#]: subject: (How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux) +[#]: via: (https://www.2daygeek.com/linux-unix-check-network-interfaces-names-nic-speed-ip-mac-address/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 上检查网卡信息 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/29/214835m1ms3n00s6qbcycz.jpg) + +默认情况下,在设置服务器时你会配置主网络接口。这是每个人所做的构建工作的一部分。有时出于各种原因,你可能需要配置额外的网络接口。 + +这可以是通过网络绑定bonding/协作teaming来提供高可用性,也可以是用于应用需求或备份的单独接口。 + +为此,你需要知道计算机有多少接口以及它们的速度来配置它们。 + +有许多命令可检查可用的网络接口,但是我们仅使用 `ip` 命令。以后,我们会另外写一篇文章来全部介绍这些工具。 + +在本教程中,我们将向你显示可用网络网卡(NIC)信息,例如接口名称、关联的 IP 地址、MAC 地址和接口速度。 + +### 什么是 ip 命令 + +[ip 命令][1] 类似于 `ifconfig`, 用于分配静态 IP 地址、路由和默认网关等。 + +``` +# ip a + +1: lo: mtu 65536 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever +2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether fa:16:3e:a0:7d:5a brd ff:ff:ff:ff:ff:ff + inet 192.168.1.101/24 brd 192.168.1.101 scope global eth0 + inet6 fe80::f816:3eff:fea0:7d5a/64 scope link + valid_lft forever preferred_lft forever +``` + +### 什么是 ethtool 命令 + +`ethtool` 用于查询或控制网络驱动或硬件设置。 + +``` +# ethtool eth0 +``` + +### 1)如何在 Linux 上使用 ip 命令检查可用的网络接口 + +在不带任何参数的情况下运行 `ip` 命令时,它会提供大量信息,但是,如果仅需要可用的网络接口,请使用以下定制的 `ip` 命令。 + +``` +# ip a |awk '/state UP/{print $2}' + +eth0: +eth1: +``` + +### 2)如何在 Linux 上使用 ip 命令检查网络接口的 IP 地址 + +如果只想查看 IP 地址分配给了哪个接口,请使用以下定制的 `ip` 命令。 + +``` +# ip -o a show | cut -d ' ' -f 2,7 +或 +ip a |grep -i inet | awk '{print $7, $2}' + +lo 127.0.0.1/8 +192.168.1.101/24 +192.168.1.102/24 +``` + +### 3)如何在 Linux 上使用 ip 命令检查网卡的 MAC 地址 + +如果只想查看网络接口名称和相应的 MAC 地址,请使用以下格式。 + +检查特定的网络接口的 MAC 地址: + +``` +# ip link show dev eth0 |awk '/link/{print $2}' +00:00:00:55:43:5c +``` + +检查所有网络接口的 MAC 地址,创建该脚本: + +``` +# vi /opt/scripts/mac-addresses.sh + +#!/bin/sh +ip a |awk '/state UP/{print $2}' | sed 's/://' | while read output; +do + echo $output: + ethtool -P $output +done +``` + +运行该脚本获取多个网络接口的 MAC 地址: + +``` +# sh /opt/scripts/mac-addresses.sh + +eth0: +Permanent address: 00:00:00:55:43:5c +eth1: +Permanent address: 00:00:00:55:43:5d +``` + +### 4)如何在 Linux 上使用 ethtool 命令检查网络接口速度 + +如果要在 Linux 上检查网络接口速度,请使用 `ethtool` 命令。 + +检查特定网络接口的速度: + +``` +# ethtool eth0 |grep "Speed:" + +Speed: 10000Mb/s +``` + +检查所有网络接口速度,创建该脚本: + +``` +# vi /opt/scripts/port-speed.sh + +#!/bin/sh +ip a |awk '/state UP/{print $2}' | sed 's/://' | while read output; +do + echo $output: + ethtool $output |grep "Speed:" +done +``` + +运行该脚本获取多个网络接口速度: + +``` +# sh /opt/scripts/port-speed.sh + +eth0: +Speed: 10000Mb/s +eth1: +Speed: 10000Mb/s +``` + +### 5)验证网卡信息的 Shell 脚本 + +通过此 shell 脚本你可以收集上述所有信息,例如网络接口名称、网络接口的 IP 地址,网络接口的 MAC 地址以及网络接口的速度。创建该脚本: + +``` +# vi /opt/scripts/nic-info.sh + +#!/bin/sh +hostname +echo "-------------" +for iname in $(ip a |awk '/state UP/{print $2}') +do + echo "$iname" + ip a | grep -A2 $iname | awk '/inet/{print $2}' + ip a | grep -A2 $iname | awk '/link/{print $2}' + ethtool $iname |grep "Speed:" +done +``` + +运行该脚本检查网卡信息: + +``` +# sh /opt/scripts/nic-info.sh + +vps.2daygeek.com +---------------- +eth0: +192.168.1.101/24 +00:00:00:55:43:5c +Speed: 10000Mb/s +eth1: +192.168.1.102/24 +00:00:00:55:43:5d +Speed: 10000Mb/s +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-unix-check-network-interfaces-names-nic-speed-ip-mac-address/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/ip-command-configure-network-interface-usage-linux/ +[2]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/202004/20200422 Things You Should Know About Ubuntu 20.04.md b/published/202004/20200422 Things You Should Know About Ubuntu 20.04.md new file mode 100644 index 0000000000..a6a56b25f2 --- /dev/null +++ b/published/202004/20200422 Things You Should Know About Ubuntu 20.04.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12158-1.html) +[#]: subject: (Things You Should Know About Ubuntu 20.04) +[#]: via: (https://itsfoss.com/ubuntu-20-04-faq/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +关于 Ubuntu 20.04 你应该了解的事情 +====== + +[Ubuntu 20.04][1] 已经发布,你可能对升级、安装等有一些问题和疑问。 + +我在各种社交媒体渠道上主持了一些问答环节,回答像你这样的读者的疑虑。我将列出这些关于 Ubuntu 20.04 的常见问题,并给出答案。我希望它能帮助你消除你的疑虑。如果你仍有问题,请随时在下面的评论栏提问。 + +### Ubuntu 20.04:已回复的问题 + +![][2] + +为了澄清一下,这里的一些答案也许受我个人意见的影响。如果你是一个有经验的 Ubuntu 用户,有些问题听起来可能有点愚蠢,但它对 Ubuntu 新用户不是这样。 + +#### Ubuntu 20.04 何时发布? + +Ubuntu 20.04 LTS 于 2020 年 4 月 23 日发布。所有变种,如 Kubuntu、Lubuntu,、Xubuntu、Budgie、MATE 都将和 20.04 同一天发布。 + +#### Ubuntu 20.04 的系统要求是什么? + +对于默认的 GNOME 版本,应至少具有 4GB 的内存、2GHz 双核处理器和至少 25GB 的磁盘空间。 + +其他 [Ubuntu 变种][3]可能有不同的系统要求。 + +#### 我可以在 32 位系统上使用 Ubuntu 20.04 吗? + +完全不行。你不能在 32 位系统上使用 Ubuntu 20.04。即使你使用的是 32 位 Ubuntu 18.04,也不能升级到 Ubuntu 20.04。32 位的系统 ISO 是以前用的。 + +![Error while upgrading 32-bit Ubuntu 18.04 to Ubuntu 20.04][4] + +#### 我可以在 Ubuntu 20.04 上使用 Wine 吗? + +是的,你仍然可以在 Ubuntu 20.04 上使用 Wine,因为仍然用于 Wine 和 [Steam Play][5] 软件包所需的 32 位库。 + +#### 我需要购买 Ubuntu 20.04 或许可证? + +不,Ubuntu 完全可以免费使用。你不必像在 Windows 中那样购买许可证密钥或激活 Ubuntu。 + +Ubuntu 的下载页会请求你捐赠一些资金,如果你想为开发这个强大的操作系统捐钱,由你自己决定。 + +#### GNOME 版本是什么? + +Ubuntu 20.04 有 GNOME 3.36。 + +#### Ubuntu 20.04 的性能是否优于 Ubuntu 18.04? + +是的,在几个方面。Ubuntu 20.04 系统速度更快,甚至超快。我在下面这个视频的 4:40 处展示了性能对比。 + +- [video](https://img.linux.net.cn/static/video/Top%207%20Best%20Features%20You%27ll%20Love%20in%20Ubuntu%2020.04-lpq8pm_xkSE.mp4) + +在 GNOME 3.36 中,滚动、窗口动画和其他 UI 元素更加流畅,提供了更流畅的体验。 + +#### Ubuntu 20.04 将支持多长时间? + +它是一个长期支持(LTS)版本,与任何 LTS 版本一样,它将在五年内得到支持。这意味着 Ubuntu 20.04 将在 2025 年 4 月之前获得安全和维护更新。 + +#### 升级到 Ubuntu 20.04 时,是否会丢失数据? + +你可以从 Ubuntu 19.10 或 Ubuntu 18.04 升级到 Ubuntu 20.04。你无需创建 live USB 并从中安装。你所需要的是一个良好的互联网连接,来下载约 1.5GB 的数据。 + +从现有系统升级不会破坏你的文件。你应该会留有所有文件,并且大多数现有软件应具有相同的版本或升级后的版本。 + +如果你使用了某些第三方工具或[其他 PPA][6],升级过程将禁用它们。如果 Ubuntu 20.04 可以使用这些其他存储库,那么可以再次启用它们。 + +升级大约需要一个小时,重启后,你将登录到新版本。 + +虽然你的数据不会被触碰,并且不会丢失系统文件和配置,但最好在外部设备备份重要数据。 + +#### 何时可以升级到 Ubuntu 20.04? + +![][7] + +如果你正在使用 Ubuntu 19.10 并有正确的更新设置(如前面部分所述),那么应在发布后的几天内通知你升级到 Ubuntu 20.04。 + +对于 Ubuntu 18.04 用户,可能需要几周时间才能正式通知他们 Ubuntu 20.04 可用。可能,你可能会在第一个点版本 Ubuntu 20.04.1 后获得提示。 + +#### 如果我升级到 Ubuntu 20.04,我可以降级到 19.10 或 18.04 吗? + +不行。虽然升级到新版本很容易,但无法选择降级。如果你想回到 Ubuntu 18.04,你需要重新[安装 Ubuntu 18.04][8]。 + +#### 我使用的是 Ubuntu 18.04 LTS。我应该升级到 Ubuntu 20.04 LTS 吗? + +这取决于你。如果你对 Ubuntu 20.04 中的新功能印象深刻,并希望上手尝试,那么你应该升级。 + +如果你想要一个更稳定的系统,我建议等待第一个点版本 Ubuntu 20.04.1,新版本会有 bug 修复。20.04.1 通常在 Ubuntu 20.04 发布后大约两个月到来。 + +无论是那种情况,我都建议你或早或晚升级到 Ubuntu 20.04。Ubuntu 20.04 具有更新的内核、性能改进,尤其是仓库中有更新版本的软件。 + +在外部磁盘上进行备份,并且有良好的互联网连接,升级不应成为问题。 + +#### 我应该重新安装 Ubuntu 20.04 还是从 18.04/19.10 升级到 Ubuntu? + +如果你可以选择,请备份数据,并重新安装 Ubuntu 20.04。 + +从现有版本升级到 20.04 是一个方便的选择。然而,在我看来,它仍然保留有一些旧版本的痕迹/包。全新安装更加干净。 + +#### 关于 Ubuntu 20.04 的任何其他问题? + +如果你对 Ubuntu 20.04 有任何疑问,请随时在下面发表评论。如果你认为应该将其他信息添加到列表中,请让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-20-04-faq/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12142-1.html +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu_20_04_faq.jpg?ssl=1 +[3]: https://itsfoss.com/which-ubuntu-install/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-32-bit.jpg?ssl=1 +[5]: https://itsfoss.com/steam-play/ +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04.jpg?ssl=1 +[8]: https://itsfoss.com/install-ubuntu/ diff --git a/published/202004/20200424 Ubuntu 20.04 LTS Released. Download Now.md b/published/202004/20200424 Ubuntu 20.04 LTS Released. Download Now.md new file mode 100644 index 0000000000..fcd11c0e8d --- /dev/null +++ b/published/202004/20200424 Ubuntu 20.04 LTS Released. Download Now.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12146-1.html) +[#]: subject: (Ubuntu 20.04 LTS Released. Download Now!) +[#]: via: (https://itsfoss.com/download-ubuntu-20-04/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu 20.04 LTS 下载及新特性 +====== + +> Ubuntu 20.04 LTS Focal Fossa 终于发布了。以下是 Ubuntu 20.04 的新功能和下载链接,以及Ubuntu 20.04的官方风味版。 + +等待终于结束了。Ubuntu 20.04 LTS 终于来了,可以下载了! + +![][1] + +如果你已经在使用 Ubuntu 19.10,你可能发现没有太多明显的差异 —— 但我所看到的改进清单确实令人印象深刻。 + +如果你想知道有什么新的东西,我将会提到这个版本的几个主要亮点。 + +### Ubuntu 20.04 有什么新特性? + +与之前的 18.04 LTS 版本相比,Ubuntu 20.04 LTS 有很多视觉上的改变,同时也包括了一些底层的改进。 + +当然,随着 [GNOME 3.36][2] 的加入,视觉上的重大升级和性能上的提升是相当明显的。以下是一段视频,重点介绍了 Ubuntu 20.04 中的新功能。 + +- [What's New in Ubuntu 20.04 Take a Look at the Top Features](https://youtu.be/9u5B0njRgOw) + +如果你有兴趣的话,你也可以深入到我们的文章中去看看,重点介绍 [Ubuntu 20.04 的新功能][3]。 + +不管是哪种情况,让我来给你介绍一些亮点。 + + * GNOME 3.36 是默认的桌面系统 + * 性能提高了很多 + * 新的 Yaru 主题很华丽,也有黑暗模式。 + * 你不会再看到亚马逊应用程序,它已经永远消失了! + * 改进的 [ZFS][4] 支持 + * 你可以获得最新的 [Linux 内核 5.4][5](LTS) + * 增加了对 exFAT 的支持 + * 改进硬件和图形支持 + * 更新软件 Python 3.8.2 + * Wireguard 已被移植到 Linux 内核5.4,可以在 Ubuntu 20.04 上使用。 + +如果你想看详细的功能介绍,请观看这段视频,重点介绍 20.04 LTS 的最佳功能。 + +- [Top 7 Best Features You'll Love in Ubuntu 20.04](https://youtu.be/lpq8pm_xkSE) + +如果你是 Ubuntu 的新手,对 Ubuntu 20.04 有疑问,我们也为你提供了一篇快速的 [Ubuntu 20.04 FAQ][7] 文章。 + +### 从 18.04 和 19.10 升级到 Ubuntu 20.04 + +如果你已经在使用 Ubuntu 18.04 或 19.10,你可以从系统中轻松升级到 Ubuntu 20.04。 + +这样一来,当你开始使用新版本的时候,你的文件和大部分的应用程序设置都会保持原样,而无需从 ISO 中重新安装。 + +你可以阅读此详细教程来学习[如何将 Ubuntu 升级到新版本][8]。 + +请注意,如果你使用的是 Lubuntu 18.04,请不要升级到 Lubuntu 20.04。Lubuntu 18.04 使用的是 Lxde 桌面,而后面的版本使用的是 LXQt 桌面。这样升级可能会导致冲突和系统崩溃。 + +### 下载 Ubuntu 20.04 LTS + +你可以抓取 ISO 或 torrent 文件,这取决于你喜欢什么。 + +- [Ubuntu 20.04 LTS (ISO)][9] +- [Ubuntu 20.04 LTS (Torrent)][10] + +请按照本教程学习[如何安装 Ubuntu][11]。 + +### 下载Ubuntu 20.04 LTS官方版下载 + +如果你想在不同的桌面环境下得到 Ubuntu 的官方版本,请按照下面的链接进行操作。 + +- [Ubuntu MATE 20.04 LTS][12] +- [Kubuntu 20.04 LTS][13] +- [Xubuntu 20.04 LTS][14] +- [Ubuntu Budgie 20.04 LTS][15] +- [Ubuntu Studio 20.04 LTS][16] +- [Lubuntu 20.04 LTS][17] + +如果你没有在各自的官方网站上找到最新的 ISO/torrent 文件,只需前往 [cdimages.ubuntu.com][18] 找到所有的版本。 + +接下来,导航到“发行版名称” -> “releases” -> “20.04” -> “release”,然后你应该可以找到列出的 ISO 和 torrent 文件的链接。 + +如果你有问题,请参考这篇文章,它回答了[关于 Ubuntu 20.04 的常见问题][7]。如果你要安装,请查看我们推荐的[安装 Ubuntu 20.04 之后要做的事情][19]。 + +享受 Ubuntu 20.04 LTS Focal Fossa! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/download-ubuntu-20-04/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Ubuntu-20.04-LTS-released.png?ssl=1 +[2]: https://itsfoss.com/gnome-3-36-release/ +[3]: https://itsfoss.com/ubuntu-20-04-release-features/ +[4]: https://itsfoss.com/what-is-zfs/ +[5]: https://itsfoss.com/linux-kernel-5-4/ +[6]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[7]: https://itsfoss.com/ubuntu-20-04-faq/ +[8]: https://itsfoss.com/upgrade-ubuntu-version/ +[9]: http://releases.ubuntu.com/focal/ubuntu-20.04-desktop-amd64.iso +[10]: http://releases.ubuntu.com/focal/ubuntu-20.04-desktop-amd64.iso.torrent +[11]: https://itsfoss.com/install-ubuntu/ +[12]: https://ubuntu-mate.org/download/amd64/focal/ +[13]: https://kubuntu.org/getkubuntu/ +[14]: https://xubuntu.org/download/ +[15]: https://ubuntubudgie.org/downloads/ +[16]: https://ubuntustudio.org/ +[17]: https://lubuntu.me/downloads/ +[18]: http://cdimages.ubuntu.com/ +[19]: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ diff --git a/published/202004/20200424 What you need to know about open source ad blockers.md b/published/202004/20200424 What you need to know about open source ad blockers.md new file mode 100644 index 0000000000..c28cbc6080 --- /dev/null +++ b/published/202004/20200424 What you need to know about open source ad blockers.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (CrazyShipOne) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12157-1.html) +[#]: subject: (What you need to know about open source ad blockers) +[#]: via: (https://opensource.com/article/20/4/ad-blockers) +[#]: author: (Joshua Pearce https://opensource.com/users/jmpearce) + +开源的广告拦截器不但节能,而且能拯救生命! +====== +> 三个开源广告拦截器与“无广告拦截器”对照组进行了测试。 + +![](https://img.linux.net.cn/data/attachment/album/202004/27/220109b86sidn56sn6inoh.jpg) + +一项旨在调查自由开源的广告拦截器节能的情况的[研究][2],意外地发现了互联网广告正在浪费你大量的时间。 + +更重要的是,研究结果表明了你可以挽救回这些失去的时间。这项研究评估发现,使用 [uBlock Origin][3](一个开源免费的广告拦截器)的情况下平均每个网民一年可以节约超过 100 个小时的时间。uBlock Origin 是测试中最有效的广告拦截器,不过其他的广告拦截器也为网民节省了时间、能源以及金钱。 + +![Ad blocker screen comparison][4] + +在研究结果中,[AdBlock+][5] 减少了 11% 的页面加载时间,[Privacy Badger][6] 减少了 22%,[uBlock Origin][3] 减少了 28%。对于单独一个页面来说这个时间並不算多,但是网民们一半以上的浏览时间都是在网站间快速跳转,通常在一个页面停留少于 15 秒。鉴于这种情况,加载广告的额外时间加起来就很多了。 + +发布于 Technologies 杂志上的《[用开源的广告拦截器节能][7]》一文最初旨在解决日益增长的能源消耗问题。随着全球网民每日上网时间超过 6.5 小时,与互联网相关的用电量正在快速地增加。以美国人为例,自 2000 年他们的上网时间已经增加了一倍,几乎达到每周 24 小时。开源广告拦截器通过消灭上网和观看视频时产生的广告,潜在地减少了时间,从而减少用电。 + +在研究过程中,对三个开源广告拦截器与“无广告拦截器”对照组进行了测试。研究人员记录了浏览全球访问量最大的网站的页面加载时间,其中包括网络搜索(谷歌、雅虎、必应)、信息(Weather.com、维基百科)和新闻网站(CNN、福克斯、纽约时报)。除此之外,研究还分析了观看流行与非流行视频内容时广告所花费的时间。这部分研究由于缺乏 Youtube 上流行和非流行内容观看比例的数据而非常具有挑战性。每个视频浪费在广告观看上的时间可以从 0.06% 到惊人的 21% 不等。而且,这还只是浏览器上记录的加载广告而失去的时间。 + +总的来说,研究结果表明加载广告所浪费的能源并不是是小事。由于运行电脑所使用的大量电力仍然来自于煤炭,而煤炭会造成空气污染和过早死亡,因此该研究分析了广告拦截器拯救美国人生命的潜力。(LCTT 译注:由于这项研究是美国人完成的,所以这里仅提及了美国人,但是同理可推至全球。)结果是令人震惊的:如果美国人都使用开源广告拦截器,每年节约的能源将会拯救超过 36 个美国人的生命。 + +电能即金钱,所以削减广告也可以为消费者节约钱财。在美国,如果所有的网民都在他们的电脑上开启 [Privacy Badger][8],美国人每年可以节约超过 9100 万美元。在全球范围内,调查研究的结果则更令人吃惊。uBlock Origin 每年可以为全球消费者节约 18 亿美元。 + +这项研究始于人们因为新冠肺炎大流行而被迫居家之前,因此所有的数据都可以被认为是保守的估算。整体来说,研究发现了开源广告拦截器是一项潜在的节能技术。 + +虽然自由开源的广告拦截器可以节约能源,对自然环境也有好处,但你可能主要是为了拦截恼人的广告和节省自己的时间而使用它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/ad-blockers + +作者:[Joshua Pearce][a] +选题:[lujun9972][b] +译者:[CrazyShipOne](https://github.com/CrazyShipOne) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jmpearce +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) +[2]: https://www.mdpi.com/2227-7080/8/2/18 +[3]: https://github.com/gorhill/uBlock +[4]: https://opensource.com/sites/default/files/uploads/os_ad_blocker_story_.png (Ad blocker screen comparison) +[5]: https://adblockplus.org/ +[6]: https://privacybadger.org/ +[7]: https://www.academia.edu/42434401/Energy_Conservation_with_Open_Source_Ad_Blockers +[8]: https://privacybadger.org/ diff --git a/published/202004/20200425 What Happened to IPv5- Why there is IPv4, IPv6 but no IPv5.md b/published/202004/20200425 What Happened to IPv5- Why there is IPv4, IPv6 but no IPv5.md new file mode 100644 index 0000000000..3a8ab6b8bd --- /dev/null +++ b/published/202004/20200425 What Happened to IPv5- Why there is IPv4, IPv6 but no IPv5.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12168-1.html) +[#]: subject: (What Happened to IPv5? Why there is IPv4, IPv6 but no IPv5?) +[#]: via: (https://itsfoss.com/what-happened-to-ipv5/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +IPv5 发生了什么?为什么有 IPv4、IPv6 但没有 IPv5? +====== + +如果你花过很多时间在互联网上,那么你应该已经听说过计算机每天使用的 IPv4 和 IPv6 协议。 + +你可能会问的一个问题是:为什么没有 IPv5?为什么 IPv6 在 IPv4 之后而不是 IPv5 之后出现?是否有 IPv5,如果是,那么 IPv5 发生了什么? + +答案是肯定的,曾经有一个 IPv5。让我解释一下这里发生的事。 + +### 互联网的早期历史 + +![ARPA Logical Map in 1977 | Image courtesy: Wikipedia][1] + +在 1960 年代后期,美国国防部的[高级研究计划局][2](DARPA)发起了一个[项目][3]来连接全国的计算机。最初的目标是创建一个由全国 ARPA 资助的所有计算机组成的网络系统。 + +由于这是第一次将如此规模的网络整合在一起,因此他们也在不断发展自己的技术和硬件。他们首先做的工作之一就是开发名为[传输控制协议][4]Transmission Control Protocol(TCP)的互联网协议Internet Protocol(IP)。该协议“可靠、有序,并会对运行于通过 IP 网络传输的主机上的应用的八进制(字节)流通讯进行错误检测”。简单来说,它可以确保数据安全到达。 + +最初,TCP 被设计为[“主机级别的端到端协议以及封装和路由协议”][5]。但是,他们意识到他们需要拆分协议以使其更易于管理。于是决定由 IP 协议处理封装和路由。 + +那时,TCP 已经经历了三个版本,因此新协议被称为 IPv4。 + +### IPv5 的诞生 + +IPv5 开始时有个不同的名字:互联网流协议Internet Stream Protocol(ST)。它是[由 Apple、NeXT 和 Sun Microsystems][6] 为试验流式语音和视频而创建的。 + +该新协议能够“在保持通信的同时,以特定频率传输数据包”。 + +### 那么 IPv5 发生了什么? + +![][7] + +IPv5 从未被接受为正式的互联网协议。这主要是由于 32 位限制。 + +IPV5 使用与 IPv4 相同的寻址系统。每个地址由 0 到 255 之间的四组数字组成。这将可能的地址数量限制为 [43 亿][6]个。 + +在 1970 年代初,这似乎比全世界所需要的还要多。但是,互联网的爆炸性增长证明了这一想法是错误的。2011 年,世界上的IPv4地址正式用完了。 + +在 1990 年代,一个新项目开始致力于研究下一代互联网协议(IPng)。这形成了 128 位的 IPv6。IPv6 地址包含 [“8 组 4 字符的十六进制数字”][6],它可以包含从 0 到 9 的数字和从 A 到 F 的字母。与 IPv4 不同,IPv6 拥有数万亿个可能的地址,因此我们应该能安全一阵子。 + +同时,IPv5 奠定了 VoIP 的基础,而该技术已被我们用于当今世界范围内的通信。**因此,我想在某种程度上,你可以说 IPv5 仍然可以保留到了今天**。 + +希望你喜欢有关互联网历史的轶事。你可以阅读其他[关于 Linux 和技术的琐事文章][8]。 + +如果你觉得这篇文章有趣,请花一点时间在社交媒体、Hacker News 或 [Reddit][9] 上分享它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-happened-to-ipv5/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Arpa_internet.png?fit=800%2C573&ssl=1 +[2]: https://en.wikipedia.org/wiki/DARPA +[3]: https://en.wikipedia.org/wiki/ARPANET +[4]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol +[5]: https://fcw.com/articles/2006/07/31/what-ever-happened-to-ipv5.aspx +[6]: https://www.lifewire.com/what-happened-to-ipv5-3971327 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/what-happened-to-ipv5.png?ssl=1 +[8]: https://itsfoss.com/category/story/ +[9]: https://reddit.com/r/linuxusersgroup diff --git a/published/202004/20200428 Fedora 32 is officially here.md b/published/202004/20200428 Fedora 32 is officially here.md new file mode 100644 index 0000000000..acad6862f5 --- /dev/null +++ b/published/202004/20200428 Fedora 32 is officially here.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12164-1.html) +[#]: subject: (Fedora 32 is officially here!) +[#]: via: (https://fedoramagazine.org/announcing-fedora-32/) +[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) + +Fedora 32 正式发布! +====== + +![][1] + +它来了! 我们很荣幸地宣布 Fedora 32 的发布。感谢成千上万的 Fedora 社区成员和贡献者的辛勤工作,我们又一次准时发布了。 + +如果你只想马上就能拿到它,请马上访问 。更多详情,请继续阅读本文。 + +### Fedora 的全部变种 + +Fedora Editions 是针对特定的“展示”用途输出的。 + +Fedora Workstation 专注于桌面系统。特别是,它面向的是那些希望获得“可以工作的” Linux 操作系统体验的软件开发者。这个版本采用了 [GNOME 3.36][2],一如既往地有很多很棒的改进。我最喜欢的是新的锁屏! + +Fedora Server 以一种易于部署的方式为系统管理员带来了新锐的开源服务器软件。对于边缘计算用例,[Fedora IoT][3] 为 IoT 生态系统提供了坚实的基础。 + +Fedora CoreOS 是一个新兴的 Fedora Edition。它是一个自动更新的、最小化的操作系统,用于安全地大规模运行容器化工作负载。它提供了几个[更新流][4],遵循大约每两周一次的自动更新。目前,next 流是基于 Fedora 32,后续还有 testing 流和 stable 流。你可以从[下载页面][5]中找到关于按 next 流发布的工件的信息,并在 [Fedora CoreOS 文档][6]中找到关于如何使用这些工件的信息。 + +当然,我们制作的不仅仅是 Editions。[Fedora Spins][7] 和[实验室][8]针对的是不同的受众和用例,包括[Fedora 天文学实验室][9],它为业余和专业的天文学家带来了完整的开源工具链,还有像 [KDE Plasma][10] 和 [Xfce][11] 这样的桌面环境。Fedora 32 中新增的 [计算神经科学实验室][12] 是由我们的神经科学特别兴趣小组开发的,它可以实现计算神经科学。 + +还有,别忘了我们的备用架构,[ARM AArch64、Power 和 S390x][13]。特别值得一提的是,我们改进了对 Rockchip 系统级芯片的支持,包括 Rock960、RockPro64 和 Rock64。 + +### 一般性的改进 + +无论你使用 Fedora 的哪个变体,你都能获得最新的开源世界。遵循我们的“[First][14]”理念,我们更新了关键的编程语言和系统库包,包括 GCC 10、Ruby 2.7 和 Python 3.8。当然,随着 Python 2 已经过了报废期,我们已经从 Fedora 中删除了大部分 Python 2 包,但我们为仍然需要它的开发者和用户提供了一个遗留的 python27 包。在 Fedora Workstation 中,我们默认启用了 EarlyOOM 服务,以改善低内存情况下的用户体验。 + +我们非常期待你能尝试一下新版本的使用体验! 现在就去 下载它。或者如果你已经在运行 Fedora 操作系统,请按照简单的[升级说明][15]进行升级。 + +### 万一出现问题…… + +如果你遇到问题,请查看[Fedora 32 常见错误][16]页面,如果有问题,请访问我们的 [Askedora][17] 用户支持平台。 + +### 谢谢大家 + +感谢在这个发布周期中为 Fedora 项目做出贡献的成千上万的人,特别是感谢那些在大流行期间为又一次准时发布而付出额外努力的人。Fedora 是一个社区,很高兴看到我们彼此之间的支持。我邀请大家参加 4 月28-29 日的[红帽峰会虚拟体验][18],了解更多关于 Fedora 和其他社区的信息。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/announcing-fedora-32/ + +作者:[Matthew Miller][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/mattdm/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/f32-final-816x345.png +[2]: https://www.gnome.org/news/2020/03/gnome-3-36-released/ +[3]: https://iot.fedoraproject.org/ +[4]: https://docs.fedoraproject.org/en-US/fedora-coreos/update-streams/ +[5]: https://getfedora.org/en/coreos/download?stream=next +[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[7]: https://spins.fedoraproject.org/ +[8]: https://labs.fedoraproject.org/ +[9]: https://labs.fedoraproject.org/en/astronomy/ +[10]: https://spins.fedoraproject.org/en/kde/ +[11]: https://spins.fedoraproject.org/en/xfce/ +[12]: https://labs.fedoraproject.org/en/comp-neuro +[13]: https://alt.fedoraproject.org/alt/ +[14]: https://docs.fedoraproject.org/en-US/project/#_first +[15]: https://docs.fedoraproject.org/en-US/quick-docs/upgrading/ +[16]: https://fedoraproject.org/wiki/Common_F32_bugs +[17]: http://ask.fedoraproject.org +[18]: https://www.redhat.com/en/summit diff --git a/published/202004/20200429 Manjaro 20 Lysia Arrives with ZFS and Snap Support.md b/published/202004/20200429 Manjaro 20 Lysia Arrives with ZFS and Snap Support.md new file mode 100644 index 0000000000..2ed94dd0a8 --- /dev/null +++ b/published/202004/20200429 Manjaro 20 Lysia Arrives with ZFS and Snap Support.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12166-1.html) +[#]: subject: (Manjaro 20 Lysia Arrives with ZFS and Snap Support) +[#]: via: (https://itsfoss.com/manjaro-20-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Manjaro 20 Lysia 到来,支持 ZFS 和 Snap +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/29/232925j8paomvp11pfu12v.jpg) + +> Manjaro Linux 刷新了其 Manjaro 20 “Lysia” 的 ISO。现在在 Pamac 中支持了 Snap 和 Flatpak 软件包。在 Manjaro Architect 安装程序中增加了 ZFS 选项,并使用最新的内核 5.6 作为基础。 + +最近新的发行版的发布像下雨一样。在上周发布了 [Ubuntu 20.04 LTS](https://linux.cn/article-12142-1.html) ,紧接着 [Fedora 32](https://linux.cn/article-12164-1.html) 也刚刚发布,而现在 [Manjaro 发布了版本 20][1],代号为 Lysia。 + +### Manjaro 20 Lysia 有什么新东西? + +其实有很多。让我给大家介绍一下 Manjaro 20 中的一些主要新功能。 + +#### 新的抹茶主题 + +Manjaro 20 有一个新的默认主题,名为 Matcha(抹茶)。它让桌面看起来更有质感。 + +![][2] + +#### 对 Snap 和 Flatpak 的支持 + +Snap 和 Flatpak 软件包的支持得到了改进。如果你愿意,你可以在命令行中使用它们。 + +你还可以在 Pamac 图形界面包管理器中启用 Snap 和 Flatpak 支持。 + +![Enable Snap support in Pamac Manjaro][3] + +启用后,你可以在 Pamac 软件管理器中找到并安装 Snap/Flatpak 应用程序。 + +![Snap applications in Pamac][4] + +#### Pamac 提供了基于搜索安装新软件的方式(在 GNOME 中) + +在 GNOME 变种中,如果你搜索某个东西,Pamac 软件管理器会提供安装符合查询的软件。在其他使用 GNOME 桌面的发行版中,GNOME 软件中心也会这样做。 + +#### ZFS 支持登陆了 Manjaro Architect + +现在,你可以在 Manjaro Linux 中轻松地使用 ZFS 作为根文件系统。在 [Manjaro Architect][6] 中提供了对 [ZFS 文件系统][5]的支持。 + +请注意,我说的是 Manjaro Architect,即基于终端的安装程序。它和普通的图形化的 [Calamares 安装程序][7]不一样。 + +![][8] + +#### Linux kernel 5.6 + +最新的稳定版 [Linux 内核 5.6][9] 带来了更多的硬件支持,如 thunderbolt、Nvidia 和 USB4。你也可以使用 [WireGuard VPN][10]。 + +![][11] + +#### 其他杂项变化 + + * 新的桌面环境版本:Xfce 4.14、GNOME 3.36 和 KDE Plasma 5.18。 + * 新的默认 shell 是 zsh。 + * Display-Profiles 允许你存储一个或多个配置文件,用于你的首选显示配置。 + * 改进后的 Gnome-Layout-Switcher。 + * 最新的驱动程序。 + * 改进和完善了 Manjaro 工具。 + +### 如何取得 Manjaro 20 Lysia? + +如果你已经在使用 Manjaro,只需更新你的 Manjaro Linux 系统,你就应该已经在使用 Lysia 了。 + +Manjaro 采用了滚动发布模式,这意味着你不必手动从一个版本升级到另一个版本。只要有新的版本发布,不需要重新安装就可以使用了。 + +既然 Manjaro 是滚动发布的,为什么每隔一段时间就会发布一个新版本呢?这是因为他们要刷新 ISO,这样下载 Manjaro 的新用户就不用再安装过去几年的更新了。这就是为什么 Arch Linux 也会每个月刷新一次 ISO 的原因。 + +Manjaro 的“ISO 刷新”是有代号和版本的,因为它可以帮助开发者清楚地标明每个开发阶段的发展方向。 + +所以,如果你已经在使用它,只需使用 Pamac 或命令行[更新你的 Manjaro Linux 系统][12]即可。 + +如果你想尝试 Manjaro 或者想使用 ZFS,那么你可以通过从它的网站上[下载 ISO][14] 来[安装 Manjaro][13]。 + +愿你喜欢新的 Manjaro Linux 发布。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/manjaro-20-release/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://forum.manjaro.org/t/manjaro-20-0-lysia-released/138633 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/manjaro-20-lysia.jpeg?resize=800%2C440&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-snap-in-pamac-manjaro.jpg?resize=800%2C490&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/snap-app-pacman.jpg?resize=800%2C489&ssl=1 +[5]: https://itsfoss.com/what-is-zfs/ +[6]: https://itsfoss.com/manjaro-architect-review/ +[7]: https://calamares.io/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pacman-prompts-install-apps.jpg?resize=800%2C331&ssl=1 +[9]: https://itsfoss.com/linux-kernel-5-6/ +[10]: https://itsfoss.com/wireguard/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/manjaro-20-neofetch-screen.jpg?resize=800%2C495&ssl=1 +[12]: https://itsfoss.com/update-arch-linux/ +[13]: https://itsfoss.com/install-manjaro-linux/ +[14]: https://manjaro.org/download/ diff --git a/published/202005/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/published/202005/20180425 An introduction to the GNU Core Utilities - Opensource.com.md new file mode 100644 index 0000000000..fe61c265f0 --- /dev/null +++ b/published/202005/20180425 An introduction to the GNU Core Utilities - Opensource.com.md @@ -0,0 +1,127 @@ +GNU 核心实用程序简介 +====== + +> 大多数 Linux 系统管理员需要做的事情都可以在 GNU coreutils 或 util-linux 中找到。 + +![](https://img.linux.net.cn/data/attachment/album/202005/10/172312hofgh88i3g6jajfj.jpg) + +许多 Linux 系统管理员最基本和常用的工具主要包括在两套实用程序中:[GNU 核心实用程序(coreutils)][3]和 util-linux。它们的基本功能允许系统管理员执行许多管理 Linux 系统的任务,包括管理和操作文本文件、目录、数据流、存储介质、进程控制、文件系统等等。 + +这些工具是不可缺少的,因为没有它们,就不可能在 Unix 或 Linux 计算机上完成任何有用的工作。鉴于它们的重要性,让我们来研究一下它们。 + +### GNU coreutils + +要了解 GNU 核心实用程序的起源,我们需要乘坐时光机进行一次短暂的旅行,回到贝尔实验室的 Unix 早期。[编写 Unix][8] 是为了让 Ken Thompson、Dennis Ritchie、Doug McIlroy 和 Joe Ossanna 可以继续他们在大型多任务和多用户计算机项目 [Multics][9] 上的工作:开发一个叫做《太空旅行》游戏的小东西。正如今天一样,推动计算技术发展的似乎总是游戏玩家。这个新的操作系统比 Multics(LCTT 译注:multi- 字头的意思是多数的)的局限性更大,因为一次只能有两个用户登录,所以被称为 Unics(LCTT 译注:uni- 字头的意思是单独的)。后来这个名字被改成了 Unix。 + +随着时间的推移,Unix 取得了如此巨大的成功,开始贝尔实验室基本上是将其赠送给大学,后来送给公司也只是收取介质和运输的费用。在那个年代,系统级的软件是在组织和程序员之间共享的,因为在系统管理这个层面,他们努力实现的是共同的目标。 + +最终,AT&T 公司的[老板们][10]决定,他们应该在 Unix 上赚钱,并开始使用限制更多的、昂贵的许可证。这发生在软件变得更加专有、受限和封闭的时期,从那时起,与其他用户和组织共享软件变得不可能。 + +有些人不喜欢这种情况,于是用自由软件来对抗。Richard M. Stallman(RMS),他带领着一群“反叛者”试图编写一个开放的、自由的可用操作系统,他们称之为 GNU 操作系统。这群人创建了 GNU 实用程序,但并没有产生一个可行的内核。 + +当 Linus Torvalds 开始编写和编译 Linux 内核时,他需要一套非常基本的系统实用程序来开始执行一些稍微有用的工作。内核并不提供命令或任何类型的命令 shell,比如 Bash,它本身是没有任何用处的,因此,Linus 使用了免费提供的 GNU 核心实用程序,并为 Linux 重新编译了它们。这让他拥有了一个完整的、即便是相当基本的操作系统。 + +你可以通过在终端命令行中输入命令 `info coreutils` 来了解 GNU 核心实用程序的全部内容。下面的核心实用程序列表就是这个信息页面的一部分。这些实用程序按功能进行了分组,以方便查找;在终端中,选择你想了解更多信息的组,然后按回车键。 + +``` +* Output of entire files::       cat tac nl od base32 base64 +* Formatting file contents::     fmt pr fold +* Output of parts of files::     head tail split csplit +* Summarizing files::            wc sum cksum b2sum md5sum sha1sum sha2 +* Operating on sorted files::    sort shuf uniq comm ptx tsort +* Operating on fields::          cut paste join +* Operating on characters::      tr expand unexpand +* Directory listing::            ls dir vdir dircolors +* Basic operations::             cp dd install mv rm shred +* Special file types::           mkdir rmdir unlink mkfifo mknod ln link readlink +* Changing file attributes::     chgrp chmod chown touch +* Disk usage::                   df du stat sync truncate +* Printing text::                echo printf yes +* Conditions::                   false true test expr +* Redirection::                  tee +* File name manipulation::       dirname basename pathchk mktemp realpath +* Working context::              pwd stty printenv tty +* User information::             id logname whoami groups users who +* System context::               date arch nproc uname hostname hostid uptime +* SELinux context::              chcon runcon +* Modified command invocation::  chroot env nice nohup stdbuf timeout +* Process control::              kill +* Delaying::                     sleep +* Numeric operations::           factor numfmt seq +``` + +这个列表里有 102 个实用程序。它涵盖了在 Unix 或 Linux 主机上执行基本任务所需的许多功能。但是,很多基本的实用程序都缺失了,例如,`mount` 和 `umount` 命令不在这个列表中。这些命令和其他许多不在 GNU 核心实用程序中的命令可以在 util-linux 中找到。 + +### util-linux + +util-linix 实用程序包中包含了许多系统管理员常用的其它命令。这些实用程序是由 Linux 内核组织发布的,这 107 条命令中几乎每一个都来自原本是三个单独的集合 —— fileutils、shellutils 和 textutils,2003 年它们被[合并成一个包][11]:util-linux。 + +``` +agetty          fsck.minix      mkfs.bfs        setpriv +blkdiscard      fsfreeze        mkfs.cramfs     setsid +blkid           fstab           mkfs.minix      setterm +blockdev        fstrim          mkswap          sfdisk +cal             getopt          more            su +cfdisk          hexdump         mount           sulogin +chcpu           hwclock         mountpoint      swaplabel +chfn            ionice          namei           swapoff +chrt            ipcmk           newgrp          swapon +chsh            ipcrm           nologin         switch_root +colcrt          ipcs            nsenter         tailf +col             isosize         partx           taskset +colrm           kill            pg              tunelp +column          last            pivot_root      ul +ctrlaltdel      ldattach        prlimit         umount +ddpart          line            raw             unshare +delpart         logger          readprofile     utmpdump +dmesg           login           rename          uuidd +eject           look            renice          uuidgen +fallocate       losetup         reset           vipw +fdformat        lsblk           resizepart      wall +fdisk           lscpu           rev             wdctl +findfs          lslocks         RTC Alarm       whereis +findmnt         lslogins        runuser         wipefs +flock           mcookie         script          write +fsck            mesg            scriptreplay    zramctl +fsck.cramfs     mkfs            setarch +``` + +这些实用程序中的一些已经被淘汰了,很可能在未来的某个时候会从集合中被踢出去。你应该看看[维基百科的 util-linux 页面][12]来了解其中许多实用程序的信息,而 man 页面也提供了关于这些命令的详细信息。 + +### 总结 + +这两个 Linux 实用程序的集合,GNU 核心实用程序和 util-linux,共同提供了管理 Linux 系统所需的基本实用程序。在研究这篇文章的过程中,我发现了几个有趣的实用程序,这些实用程序是我从不知道的。这些命令中的很多都是很少需要的,但当你需要的时候,它们是不可缺少的。 + +在这两个集合里,有 200 多个 Linux 实用工具。虽然 Linux 的命令还有很多,但这些都是管理一个典型的 Linux 主机的基本功能所需要的。 + +--- + +via: [https://opensource.com/article/18/4/gnu-core-utilities][17] + +作者: [David Both][18] 选题者: [lujun9972][19] 译者: [wxy][20] 校对: [wxy][21] + +本文由 [LCTT][22] 原创编译,[Linux中国][23] 荣誉推出 + +[1]: https://pixabay.com/en/tiny-people-core-apple-apple-half-700921/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.gnu.org/software/coreutils/coreutils.html +[4]: https://opensource.com/life/17/10/top-terminal-emulators?intcmp=7016000000127cYAAQ +[5]: https://opensource.com/article/17/2/command-line-tools-data-analysis-linux?intcmp=7016000000127cYAAQ +[6]: https://opensource.com/downloads/advanced-ssh-cheat-sheet?intcmp=7016000000127cYAAQ +[7]: https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=7016000000127cYAAQ +[8]: https://en.wikipedia.org/wiki/History_of_Unix +[9]: https://en.wikipedia.org/wiki/Multics +[10]: https://en.wikipedia.org/wiki/Pointy-haired_Boss +[11]: https://en.wikipedia.org/wiki/GNU_Core_Utilities +[12]: https://en.wikipedia.org/wiki/Util-linux +[13]: https://opensource.com/users/dboth +[14]: https://opensource.com/users/dboth +[15]: https://opensource.com/users/dboth +[16]: https://opensource.com/participate +[17]: https://opensource.com/article/18/4/gnu-core-utilities +[18]: https://opensource.com/users/dboth +[19]: https://github.com/lujun9972 +[20]: https://github.com/译者ID +[21]: https://github.com/校对者ID +[22]: https://github.com/LCTT/TranslateProject +[23]: https://linux.cn/ diff --git a/published/202005/20180612 Systemd Services- Reacting to Change.md b/published/202005/20180612 Systemd Services- Reacting to Change.md new file mode 100644 index 0000000000..8a7be7cde2 --- /dev/null +++ b/published/202005/20180612 Systemd Services- Reacting to Change.md @@ -0,0 +1,266 @@ +Systemd 服务:响应变化 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/12/001037iz91uu9b15dqb9w3.jpg) + +[我有一个这样的电脑棒][1](图1),我把它用作通用服务器。它很小且安静,由于它是基于 x86 架构的,因此我为我的打印机安装驱动没有任何问题,而且这就是它大多数时候干的事:与客厅的共享打印机和扫描仪通信。 + +![ComputeStick][3] + +*一个英特尔电脑棒。欧元硬币大小。* + +大多数时候它都是闲置的,尤其是当我们外出时,因此我认为用它作监视系统是个好主意。该设备没有自带的摄像头,也不需要一直监视。我也不想手动启动图像捕获,因为这样就意味着在出门前必须通过 SSH 登录,并在 shell 中编写命令来启动该进程。 + +因此,我以为应该这么做:拿一个 USB 摄像头,然后只需插入它即可自动启动监视系统。如果这个电脑棒重启后发现连接了摄像头也启动监视系统就更加分了。 + +在先前的文章中,我们看到 systemd 服务既可以[手动启动或停止][5],也可以[在满足某些条件时启动或停止][6]。这些条件不限于操作系统在启动或关机时序中达到某种状态,还可以在你插入新硬件或文件系统发生变化时进行。你可以通过将 Udev 规则与 systemd 服务结合起来实现。 + +### 有 Udev 支持的热插拔 + +Udev 规则位于 `/etc/udev/rules` 目录中,通常是由导致一个动作action条件conditions赋值assignments的单行语句来描述。 + +有点神秘。让我们再解释一次: + +通常,在 Udev 规则中,你会告诉 systemd 当设备连接时需要查看什么信息。例如,你可能想检查刚插入的设备的品牌和型号是否与你让 Udev 等待的设备的品牌和型号相对应。这些就是前面提到的“条件”。 + +然后,你可能想要更改一些内容,以便以后可以方便使用该设备。例如,更改设备的读写权限:如果插入 USB 打印机,你会希望用户能够从打印机读取信息(用户的打印应用程序需要知道其模型、制造商,以及是否准备好接受打印作业)并向其写入内容,即发送要打印的内容。更改设备的读写权限是通过你之前阅读的“赋值” 之一完成的。 + +最后,你可能希望系统在满足上述条件时执行某些动作,例如在插入某个外部硬盘时启动备份程序以复制重要文件。这就是上面提到的“动作”的例子。 + +了解这些之后, 来看看以下几点: + +``` +ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="e207", +SYMLINK+="mywebcam", TAG+="systemd", MODE="0666", ENV{SYSTEMD_WANTS}="webcam.service" +``` + +规则的第一部分, + +``` +ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", +ATTRS{idProduct}=="e207" [etc... ] +``` + +表明了执行你想让系统执行的其他动作之前设备必须满足的条件。设备必须被添加到(`ACTION=="add"`)机器上,并且必须添加到 `video4linux` 子系统中。为了确保仅在插入正确的设备时才应用该规则,你必须确保 Udev 正确识别设备的制造商(`ATTRS{idVendor}=="03f0"`)和型号(`ATTRS{idProduct}=="e207"`)。 + +在本例中,我们讨论的是这个设备(图2): + +![webcam][8] + +*这个试验使用的是 HP 的摄像头。* + +注意怎样用 `==` 来表示这是一个逻辑操作。你应该像这样阅读上面的简要规则: + +> 如果添加了一个设备并且该设备由 video4linux 子系统控制,而且该设备的制造商编码是 03f0,型号是 e207,那么... + +但是,你从哪里获取的这些信息?你在哪里找到触发事件的动作、制造商、型号等?你可要使用多个来源。你可以通过将摄像头插入机器并运行 `lsusb` 来获得 `IdVendor` 和 `idProduct` : + +``` +lsusb +Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub +Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub +Bus 003 Device 003: ID 03f0:e207 Hewlett-Packard +Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +Bus 001 Device 003: ID 04f2:b1bb Chicony Electronics Co., Ltd +Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub +Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +``` + +我用的摄像头是 HP 的,你在上面的列表中只能看到一个 HP 设备。`ID` 提供了制造商和型号,它们以冒号(`:`)分隔。如果你有同一制造商的多个设备,不确定哪个是哪个设备,请拔下摄像头,再次运行 `lsusb` , 看看少了什么。 + +或者... + +拔下摄像头,等待几秒钟,运行命令 `udevadmin monitor --environment` ,然后重新插入摄像头。当你使用的是HP摄像头时,你将看到: + +``` +udevadmin monitor --environment +UDEV [35776.495221] add /devices/pci0000:00/0000:00:1c.3/0000:04:00.0 + /usb3/3-1/3-1:1.0/input/input21/event11 (input) +.MM_USBIFNUM=00 +ACTION=add +BACKSPACE=guess +DEVLINKS=/dev/input/by-path/pci-0000:04:00.0-usb-0:1:1.0-event + /dev/input/by-id/usb-Hewlett_Packard_HP_Webcam_HD_2300-event-if00 +DEVNAME=/dev/input/event11 +DEVPATH=/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/ + usb3/3-1/3-1:1.0/input/input21/event11 +ID_BUS=usb +ID_INPUT=1 +ID_INPUT_KEY=1 +ID_MODEL=HP_Webcam_HD_2300 +ID_MODEL_ENC=HPx20Webcamx20HDx202300 +ID_MODEL_ID=e207 +ID_PATH=pci-0000:04:00.0-usb-0:1:1.0 +ID_PATH_TAG=pci-0000_04_00_0-usb-0_1_1_0 +ID_REVISION=1020 +ID_SERIAL=Hewlett_Packard_HP_Webcam_HD_2300 +ID_TYPE=video +ID_USB_DRIVER=uvcvideo +ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:030000: +ID_USB_INTERFACE_NUM=00 +ID_VENDOR=Hewlett_Packard +ID_VENDOR_ENC=Hewlettx20Packard +ID_VENDOR_ID=03f0 +LIBINPUT_DEVICE_GROUP=3/3f0/e207:usb-0000:04:00.0-1/button +MAJOR=13 +MINOR=75 +SEQNUM=3162 +SUBSYSTEM=input +USEC_INITIALIZED=35776495065 +XKBLAYOUT=es +XKBMODEL=pc105 +XKBOPTIONS= +XKBVARIANT= +``` + +可能看起来有很多信息要处理,但是,看一下这个:列表前面的 `ACTION` 字段, 它告诉你刚刚发生了什么事件,即一个设备被添加到系统中。你还可以在其中几行中看到设备名称的拼写,因此可以非常确定它就是你要找的设备。输出里还显示了制造商的ID(`ID_VENDOR_ID = 03f0`)和型号(`ID_VENDOR_ID = 03f0`)。 + +这为你提供了规则条件部分需要的四个值中的三个。你可能也会想到它还给了你第四个,因为还有一行这样写道: + +``` +SUBSYSTEM=input +``` + +小心!尽管 USB 摄像头确实是提供输入的设备(键盘和鼠标也是),但它也属于 usb 子系统和其他几个子系统。这意味着你的摄像头被添加到了多个子系统,并且看起来像多个设备。如果你选择了错误的子系统,那么你的规则可能无法按你期望的那样工作,或者根本无法工作。 + +因此,第三件事就是检查网络摄像头被添加到的所有子系统,并选择正确的那个。为此,请再次拔下摄像头,然后运行: + +``` +ls /dev/video* +``` + +这将向你显示连接到本机的所有视频设备。如果你使用的是笔记本,大多数笔记本都带有内置摄像头,它可能会显示为 `/dev/video0` 。重新插入摄像头,然后再次运行 `ls /dev/video*`。 + +现在,你应该看到多一个视频设备(可能是`/dev/video1`)。 + +现在,你可以通过运行 `udevadm info -a /dev/video1` 找出它所属的所有子系统: + +``` +udevadm info -a /dev/video1 + +Udevadm info starts with the device specified by the devpath and then +walks up the chain of parent devices. It prints for every device +found, all possible attributes in the udev rules key format. +A rule to match, can be composed by the attributes of the device +and the attributes from one single parent device. + + looking at device '/devices/pci0000:00/0000:00:1c.3/0000:04:00.0 +  /usb3/3-1/3-1:1.0/video4linux/video1': + KERNEL=="video1" + SUBSYSTEM=="video4linux" + DRIVER=="" + ATTR{dev_debug}=="0" + ATTR{index}=="0" + ATTR{name}=="HP Webcam HD 2300: HP Webcam HD" + +[etc...] +``` + +输出持续了相当长的时间,但是你感兴趣的只是开头的部分:`SUBSYSTEM =="video4linux"`。你可以将这行文本直接复制粘贴到你的规则中。输出的其余部分(为简洁未显示)为你提供了更多的信息,例如制造商和型号 ID,同样是以你可以复制粘贴到你的规则中的格式。 + +现在,你有了识别设备的方式吗,并明确了什么事件应该触发该动作,该对设备进行修改了。 + +规则的下一部分,`SYMLINK+="mywebcam", TAG+="systemd", MODE="0666"` 告诉 Udev 做三件事:首先,你要创建设备的符号链接(例如 `/dev/video1` 到 `/dev/mywebcam`。这是因为你无法预测系统默认情况下会把那个设备叫什么。当你拥有内置摄像头并热插拔一个新的时,内置摄像头通常为 `/dev/video0`,而外部摄像头通常为 `/dev/video1`。但是,如果你在插入外部 USB 摄像头的情况下重启计算机,则可能会相反,内部摄像头可能会变成 `/dev/video1` ,而外部摄像头会变成 `/dev/video0`。这想告诉你的是,尽管你的图像捕获脚本(稍后将看到)总是需要指向外部摄像头设备,但是你不能依赖它是 `/dev/video0` 或 `/dev/video1`。为了解决这个问题,你告诉 Udev 创建一个符号链接,该链接在设备被添加到 `video4linux` 子系统的那一刻起就不会再变,你将使你的脚本指向该链接。 + +第二件事就是将 `systemd` 添加到与此规则关联的 Udev 标记列表中。这告诉 Udev,该规则触发的动作将由 systemd 管理,即它将是某种 systemd 服务。 + +注意在这个两种情况下是如何使用 `+=` 运算符的。这会将值添加到列表中,这意味着你可以向 `SYMLINK` 和 `TAG` 添加多个值。 + +另一方面,`MODE` 值只能包含一个值(因此,你可以使用简单的 `=` 赋值运算符)。`MODE` 的作用是告诉 Udev 谁可以读或写该设备。如果你熟悉 `chmod`(你读到此文, 应该会熟悉),你就也会熟悉[如何用数字表示权限][9]。这就是它的含义:`0666` 的含义是 “向所有人授予对设备的读写权限”。 + +最后, `ENV{SYSTEMD_WANTS}="webcam.service"` 告诉 Udev 要运行什么 systemd 服务。 + +将此规则保存到 `/etc/udev/rules.d` 目录名为 `90-webcam.rules`(或类似的名称)的文件中,你可以通过重启机器或运行以下命令来加载它: + +``` +sudo udevadm control --reload-rules && udevadm trigger +``` + +### 最后是服务 + +Udev 规则触发的服务非常简单: + +``` +# webcam.service + +[Service] +Type=simple +ExecStart=/home/[user name]/bin/checkimage.sh +``` + +基本上,它只是运行存储在你个人 `bin/` 中的 `checkimage.sh` 脚本并将其放到后台。[这是你在先前的文章中看过的内容][5]。它看起来似乎很小,但那只是因为它是被 Udev 规则调用的,你刚刚创建了一种特殊的 systemd 单元,称为 `device` 单元。 恭喜。 + +至于 `webcam.service` 调用的 `checkimage.sh` 脚本,有几种方法从摄像头抓取图像并将其与前一个图像进行比较以检查变化(这是 `checkimage.sh` 所做的事),但这是我的方法: + +``` +#!/bin/bash +# This is the checkimage.sh script + +mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device= + /dev/mywebcam &>/dev/null +mv 00000001.png /home/[user name]/monitor/monitor.png + +while true +do + mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device=/dev/mywebcam &>/dev/null + mv 00000001.png /home/[user name]/monitor/temp.png + + imagediff=`compare -metric mae /home/[user name]/monitor/monitor.png /home/[user name] + /monitor/temp.png /home/[user name]/monitor/diff.png 2>&1 > /dev/null | cut -f 1 -d " "` + if [ `echo "$imagediff > 700.0" | bc` -eq 1 ] + then + mv /home/[user name]/monitor/temp.png /home/[user name]/monitor/monitor.png + fi + + sleep 0.5 +done +``` + +首先使用[MPlayer][10]从摄像头抓取一帧(`00000001.png`)。注意,我们怎样将 `mplayer` 指向 Udev 规则中创建的 `mywebcam` 符号链接,而不是指向 `video0` 或 `video1`。然后,将图像传输到主目录中的 `monitor/` 目录。然后执行一个无限循环,一次又一次地执行相同的操作,但还使用了[Image Magick 的 compare 工具][11]来查看最后捕获的图像与 `monitor/` 目录中已有的图像之间是否存在差异。 + +如果图像不同,则表示摄像头的镜框里某些东西动了。该脚本将新图像覆盖原始图像,并继续比较以等待更多变动。 + +### 插线 + +所有东西准备好后,当你插入摄像头后,你的 Udev 规则将被触发并启动 `webcam.service`。 `webcam.service` 将在后台执行 `checkimage.sh` ,而 `checkimage.sh` 将开始每半秒拍一次照。你会感觉到,因为摄像头的 LED 在每次拍照时将开始闪。 + +与往常一样,如果出现问题,请运行: + +``` +systemctl status webcam.service +``` + +检查你的服务和脚本正在做什么。 + +### 接下来 + +你可能想知道:为什么要覆盖原始图像?当然,系统检测到任何动静,你都想知道发生了什么,对吗?你是对的,但是如你在下一部分中将看到的那样,将它们保持原样,并使用另一种类型的 systemd 单元处理图像将更好,更清晰和更简单。 + +请期待下一篇。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting-change + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.intel.com/content/www/us/en/products/boards-kits/compute-stick/stk1a32sc.html +[2]: https://www.linux.com/files/images/fig01png +[3]: https://lcom.static.linuxfound.org/sites/lcom/files/fig01.png +[4]: https://www.linux.com/licenses/category/used-permission +[5]: https://linux.cn/article-9700-1.html +[6]: https://linux.cn/article-9703-1.html +[7]: https://www.linux.com/files/images/fig02png +[8]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig02.png?itok=esFv4BdM (webcam) +[9]: https://chmod-calculator.com/ +[10]: https://mplayerhq.hu/design7/news.html +[11]: https://www.imagemagick.org/script/compare.php +[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/published/202005/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/published/202005/20190915 How to Configure SFTP Server with Chroot in Debian 10.md new file mode 100644 index 0000000000..51a75f3521 --- /dev/null +++ b/published/202005/20190915 How to Configure SFTP Server with Chroot in Debian 10.md @@ -0,0 +1,199 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12186-1.html) +[#]: subject: (How to Configure SFTP Server with Chroot in Debian 10) +[#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 Debian 10 中配置 Chroot 环境的 SFTP 服务 +====== + +SFTP 意思是“安全文件传输协议Secure File Transfer Protocol” 或 “SSH 文件传输协议SSH File Transfer Protocol”,它是最常用的用于通过 `ssh` 将文件从本地系统安全地传输到远程服务器的方法,反之亦然。`sftp` 的主要优点是,除 `openssh-server` 之外,我们不需要安装任何额外的软件包,在大多数的 Linux 发行版中,`openssh-server` 软件包是默认安装的一部分。`sftp` 的另外一个好处是,我们可以允许用户使用 `sftp` ,而不允许使用 `ssh` 。 + +![](https://img.linux.net.cn/data/attachment/album/202005/05/223518ip4mbdi4nggbdtgu.jpg) + +当前发布的 Debian 10 代号为 ‘Buster’,在这篇文章中,我们将演示如何在 Debian 10 系统中在 “监狱式的” Chroot 环境中配置 `sftp`。在这里,Chroot 监狱式环境意味着,用户不能超出各自的家目录,或者用户不能从各自的家目录更改目录。下面实验的详细情况: + +* OS = Debian 10 +* IP 地址 = 192.168.56.151 + +让我们跳转到 SFTP 配置步骤, + +### 步骤 1、使用 groupadd 命令给 sftp 创建一个组 + +打开终端,使用下面的 `groupadd` 命令创建一个名为的 `sftp_users` 组: + +``` +root@linuxtechi:~# groupadd sftp_users +``` + +### 步骤 2、添加用户到组 sftp_users 并设置权限 + +假设你想创建新的用户,并且想添加该用户到 `sftp_users` 组中,那么运行下面的命令, + +**语法:** + +``` +# useradd -m -G sftp_users <用户名> +``` + +让我们假设用户名是 `jonathan`: + +``` +root@linuxtechi:~# useradd -m -G sftp_users jonathan +``` + +使用下面的 `chpasswd` 命令设置密码: + +``` +root@linuxtechi:~# echo "jonathan:<输入密码>" | chpasswd +``` + +假设你想添加现有的用户到 `sftp_users` 组中,那么运行下面的 `usermod` 命令,让我们假设已经存在的用户名称是 `chris`: + +``` +root@linuxtechi:~# usermod -G sftp_users chris +``` + +现在设置用户所需的权限: + +``` +root@linuxtechi:~# chown root /home/jonathan /home/chris/ +``` + +在各用户的家目录中都创建一个上传目录,并设置正确地所有权: + +``` +root@linuxtechi:~# mkdir /home/jonathan/upload +root@linuxtechi:~# mkdir /home/chris/upload +root@linuxtechi:~# chown jonathan /home/jonathan/upload +root@linuxtechi:~# chown chris /home/chris/upload +``` + +**注意:** 像 Jonathan 和 Chris 之类的用户可以从他们的本地系统上传文件和目录。 + +### 步骤 3、编辑 sftp 配置文件 /etc/ssh/sshd_config + +正如我们已经陈述的,`sftp` 操作是通过 `ssh` 完成的,所以它的配置文件是 `/etc/ssh/sshd_config`,在做任何更改前,我建议首先备份文件,然后再编辑该文件,接下来添加下面的内容: + +``` +root@linuxtechi:~# cp /etc/ssh/sshd_config /etc/ssh/sshd_config-org +root@linuxtechi:~# vim /etc/ssh/sshd_config +...... +#Subsystem sftp /usr/lib/openssh/sftp-server +Subsystem sftp internal-sftp + +Match Group sftp_users + X11Forwarding no + AllowTcpForwarding no + ChrootDirectory %h + ForceCommand internal-sftp +...... +``` + +保存并退出文件。 + +为使上述更改生效,使用下面的 `systemctl` 命令来重新启动 `ssh` 服务: + +``` +root@linuxtechi:~# systemctl restart sshd +``` + +在上面的 `sshd_config` 文件中,我们已经注释掉了以 `Subsystem` 开头的行,并添加了新的条目 `Subsystem sftp internal-sftp` 和新的行。而 + +`Match Group sftp_users` –> 它意味着如果用户是 `sftp_users` 组中的一员,那么将应用下面提到的规则到这个条目。 + +`ChrootDierctory %h` –> 它意味着用户只能在他们自己各自的家目录中更改目录,而不能超出他们各自的家目录。或者换句话说,我们可以说用户是不允许更改目录的。他们将在他们的目录中获得监狱一样的环境,并且不能访问其他用户的目录和系统的目录。 + +`ForceCommand internal-sftp` –> 它意味着用户仅被限制到只能使用 `sftp` 命令。 + +### 步骤 4、测试和验证 sftp + +登录到你的 `sftp` 服务器的同一个网络上的任何其它的 Linux 系统,然后通过我们放入 `sftp_users` 组中的用户来尝试 ssh 和 sftp 服务。 + +``` +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# +``` + +以上操作证实用户不允许 `ssh` ,现在使用下面的命令尝试 `sftp`: + +``` +[root@linuxtechi ~]# sftp root@linuxtechi +root@linuxtechi's password: +Connected to 192.168.56.151. +sftp> ls -l +drwxr-xr-x 2 root 1001 4096 Sep 14 07:52 debian10-pkgs +-rw-r--r-- 1 root 1001 155 Sep 14 07:52 devops-actions.txt +drwxr-xr-x 2 1001 1002 4096 Sep 14 08:29 upload +``` + +让我们使用 sftp 的 `get` 命令来尝试下载一个文件: + +``` +sftp> get devops-actions.txt +Fetching /devops-actions.txt to devops-actions.txt +/devops-actions.txt 100% 155 0.2KB/s 00:00 +sftp> +sftp> cd /etc +Couldn't stat remote file: No such file or directory +sftp> cd /root +Couldn't stat remote file: No such file or directory +sftp> +``` + +上面的输出证实我们能从我们的 sftp 服务器下载文件到本地机器,除此之外,我们也必须测试用户不能更改目录。 + +让我们在 `upload` 目录下尝试上传一个文件: + +``` +sftp> cd upload/ +sftp> put metricbeat-7.3.1-amd64.deb +Uploading metricbeat-7.3.1-amd64.deb to /upload/metricbeat-7.3.1-amd64.deb +metricbeat-7.3.1-amd64.deb 100% 38MB 38.4MB/s 00:01 +sftp> ls -l +-rw-r--r-- 1 1001 1002 40275654 Sep 14 09:18 metricbeat-7.3.1-amd64.deb +sftp> +``` + +这证实我们已经成功地从我们的本地系统上传一个文件到 sftp 服务中。 + +现在使用 winscp 工具来测试 sftp 服务,输入 sftp 服务器 IP 地址和用户的凭证: + +![][3] + +在 “Login” 上单击,然后尝试下载和上传文件: + +![][4] + +现在,在 `upload` 文件夹中尝试上传文件: + +![][5] + +上面的窗口证实上传是完好地工作的,这就是这篇文章的全部。如果这些步骤能帮助你在 Debian 10 中使用 chroot 环境配置 SFTP 服务器s,那么请分享你的反馈和评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-sftp-chroot-debian10/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-sftp-debian10.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Winscp-sftp-debian10.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Download-file-winscp-debian10-sftp.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Upload-File-using-winscp-Debian10-sftp.jpg diff --git a/published/202005/20200222 How to install TT-RSS on a Raspberry Pi.md b/published/202005/20200222 How to install TT-RSS on a Raspberry Pi.md new file mode 100644 index 0000000000..e3f83399d4 --- /dev/null +++ b/published/202005/20200222 How to install TT-RSS on a Raspberry Pi.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12264-1.html) +[#]: subject: (How to install TT-RSS on a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/2/ttrss-raspberry-pi) +[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) + +怎样在树莓派上安装 TT-RSS +====== + +> 使用 Tiny Tiny RSS 来保护你阅读新闻馈送时的隐私。 + +![](https://img.linux.net.cn/data/attachment/album/202005/29/230337vmazkl65hh61l0qq.png) + +[Tiny Tiny RSS][2](TT-RSS)是一个自由开源的基于 Web 的新闻馈送feed(RSS/Atom)阅读器和聚合工具。它非常适合那些注重隐私,并且仍然依赖 RSS 来获取日常新闻的人。TT-RSS 是自行托管的软件,因此你可以 100% 的掌控你的服务器、数据以及你的全部隐私。它还支持大量的插件、扩展和主题。你喜欢黑暗模式的界面?没问题。想基于关键词过滤发来的消息?TT-RSS 也能让你得偿所愿。 + +![Tiny Tiny RSS screenshot][3] + +现在你知道 TT-RSS 是什么了,那么为什么你可能会想用它。我会讲述要把它安装到树莓派或 Debian 10 服务器上你需要了解的所有的东西。 + +### 安装和配置 TT-RSS + +要把 TT-RSS 安装到树莓派上,你还需要安装和配置最新版本的 PHP(本文撰写时 PHP 最新版本是 7.3)、后端数据库 PostgreSQL、Nginx web 服务器、Git,最后才是 TT-RSS。 + +#### 1、安装 PHP 7 + +安装 PHP 7 是整个过程中最复杂的部分。幸运的是,它并不像看起来那样困难。从安装下面的支持包开始: + +``` +$ sudo apt install -y ca-certificates apt-transport-https +``` + +现在,添加存储库 PGP 密钥: + +``` +$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add - +``` + +下一步,把 PHP 库添加到你的 apt 源: + +``` +$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list +``` + +然后更新你的存储库索引: + +``` +$ sudo apt update +``` + +最后,安装 PHP 7.3(或最新版本)和一些通用组件: + +``` +$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl +``` + +上面的命令默认你使用的后端数据库是 PostgreSQL,会安装 `php7.3-pgsql`。如果你想用 MySQL 或 MariaDB,你可以把命令参数改为 `php7.3-mysql`。 + +下一步,确认 PHP 已安装并在你的树莓派上运行着: + +``` +$ php -v +``` + +现在是时候安装和配置 Web 服务器了。 + +#### 2、安装 Nginx + +可以用下面的命令安装 Nginx: + +``` +$ sudo apt install -y nginx +``` + +修改默认的 Nginx 虚拟主机配置,这样 Web 服务器才能识别 PHP 文件以及知道如何处理它们。 + +``` +$ sudo nano /etc/nginx/sites-available/default +``` + +你可以安全地删除原文件中的所有内容,用下面的内容替换: + +``` +server { + listen 80 default_server; + listen [::]:80 default_server; + + root /var/www/html; + index index.html index.htm index.php; + server_name _; + + location / { + try_files $uri $uri/ =404; + } + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php7.3-fpm.sock; + } + +} +``` + +按 `Ctrl+O` 保存修改后的配置文件,然后按 `Ctrl+X` 退出 Nano。你可以用下面的命令测试你的新配置文件: + + +``` +$ nginx -t +``` + +如果没有报错,重启 Nginx 服务: + +``` +$ systemctl restart nginx +``` + +#### 3、安装 PostgreSQL + +接下来是安装数据库服务器。在树莓派上安装 PostgreSQL 超级简单: + +``` +$ sudo apt install -y postgresql postgresql-client postgis +``` + +输入下面的命令看一下数据库服务器安装是否成功: + +``` +$ psql --version +``` + +#### 4、创建 Tiny Tiny RSS 数据库 + +在做其他事之前,你需要创建一个数数据库,用来给 TT-RSS 软件保存数据。首先,登录 PostgreSQL 服务器: + +``` +sudo -u postgres psql +``` + +下一步,新建一个用户,设置密码: + +``` +CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity'; +``` + +然后创建一个给 TT-RSS 用的数据库: + + +``` +CREATE DATABASE tinyrss; +``` + +最后,给新建的用户赋最高权限: + +``` +GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name; +``` + +这是安装数据库的步骤。你可以输入 `\q` 来退出 `psql` 程序。 + +#### 5、安装 Git + +安装 TT-RSS 需要用 Git,所以输入下面的命令安装 Git: + +``` +$ sudo apt install git -y +``` + +现在,进入到 Nginx 服务器的根目录: + +``` +$ cd /var/www/html +``` + +下载 TT-RSS 最新源码: + +``` +$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss +``` + +注意,这一步会创建一个 `tt-rss` 文件夹。 + +#### 6、安装和配置Tiny Tiny RSS + +现在是安装和配置你的新 TT-RSS 服务器的最后时刻了。首先,确认下你在浏览器中能打开 `http://your.site/tt-rss/install/index.php`。如果浏览器显示 `403 Forbidden`,那么就证明 `/var/www/html` 文件夹的权限没有设置正确。下面的命令通常能解决这个问题: + +``` +$ chmod 755 /var/www/html/ -v +``` + +如果一切正常,你会看到 TT-RSS 安装页面,它会让你输入一些数据的信息。你只需要输入前面你创建的数据库用户名和密码;数据库名;主机名填 `localhost`;端口填 `5432`。 + +点击“Test Configuration”。如果一切正常,你会看到一个标记着“Initialize Database”的红色按钮。点击它来开始安装。结束后,你会看到一个配置文件,你可以把它复制到 TT-RSS 的目录,另存为 `config.php`。 + +安装过程结束后,浏览器输入 `http://yoursite/tt-rss/` 打开 TT-RSS,使用默认的凭证登录(用户名:`admin`,密码:`password`)。登录后系统会提示你修改密码。我强烈建议你尽快修改密码。 + +### 配置 TT-RSS + +如果一切正常,你现在就可以开始使用 TT-RSS 了。建议你新建一个非管理员用户,使用新用户名登录,并开始导入你的馈送、订阅,按照你的意愿来配置它。 + +最后,并且是超级重要的事,不要忘了阅读 TT-RSS 维基上的 [Updating Feeds][4] 部分。它讲述了如何创建一个简单的 systemd 服务来更新馈送。如果你跳过了这一步,你的 RSS 馈送就不会自动更新。 + +### 总结 + +呵!工作量不小,但是你做完了!你现在有自己的 RSS 聚合服务器了。想了解 TT-RSS 更多的知识?我推荐你去看官方的 [FAQ][5]、[支持][6]论坛,和详细的[安装][7]笔记。如果你有任何问题,尽情地在下面评论吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ttrss-raspberry-pi + +作者:[Patrick H. Mullins][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pmullins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://tt-rss.org/ +[3]: https://opensource.com/sites/default/files/uploads/tt-rss.jpeg (Tiny Tiny RSS screenshot) +[4]: https://tt-rss.org/wiki/UpdatingFeeds +[5]: https://tt-rss.org/wiki/FAQ +[6]: https://community.tt-rss.org/c/tiny-tiny-rss/support +[7]: https://tt-rss.org/wiki/InstallationNotes diff --git a/published/202005/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md b/published/202005/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md new file mode 100644 index 0000000000..7a267a672e --- /dev/null +++ b/published/202005/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12173-1.html) +[#]: subject: (Create Stunning Pixel Art With Free and Open Source Editor Pixelorama) +[#]: via: (https://itsfoss.com/pixelorama/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +使用 Pixelorama 创建令人惊叹的像素艺术 +====== + +> Pixelorama 是一个跨平台、自由开源的 2D 精灵编辑器。它在一个整洁的用户界面中提供了创建像素艺术所有必要工具。 + +### Pixelorama:开源 Sprite 编辑器 + +[Pixelorama][1] 是 [Orama 互动][2]公司的年轻游戏开发人员创建的一个工具。他们已经开发了一些 2D 游戏,其中一些使用了像素艺术。 + +虽然 Orama 主要从事于游戏开发,但开发人员也创建实用工具,帮助他们(和其他人)创建这些游戏。 + +自由开源的精灵Sprite编辑器 Pixelorama 就是这样一个实用工具。它构建在 [Godot 引擎][3]之上,非常适合创作像素艺术。 + +![Pixelorama screenshot][4] + +你看到上面截图中的像素艺术了吗?它是使用 Pixelorama 创建的。这段视频展示了制作上述图片的时间推移视频。 + +### Pixelorama 的功能 + +以下是 Pixelorama 提供的主要功能: + + * 多种工具,如铅笔、橡皮擦、填充桶、取色器等 + * 多层系统,你可以根据需要添加、删除、上下移动、克隆和合并多个层 + * 支持 Spritesheets + * 导入图像并在 Pixelorama 中编辑它们 + * 带有 [Onion Skinning][5] 的动画时间线 + * 自定义画笔 + * 以 Pixelorama 的自定义文件格式 .pxo 保存并打开你的项目 + * 水平和垂直镜像绘图 + * 用于创建图样的磁贴模式 + * 拆分屏幕模式和迷你画布预览 + * 使用鼠标滚轮缩放 + * 无限次撤消和重做 + * 缩放、裁剪、翻转、旋转、颜色反转和去饱和图像 + * 键盘快捷键 + * 提供多种语言 + * 支持 Linux、Windows 和 macOS + +### 在 Linux 上安装 Pixelorama + +Pixelorama 提供 Snap 应用,如果你使用的是 Ubuntu,那么可以在软件中心找到它。 + +![Pixelorama is available in Ubuntu Software Center][6] + +或者,如果你在 [Linux 发行版上启用了 Snap 支持][7],那么可以使用此命令安装它: + +``` +sudo snap install pixelorama +``` + +如果你不想使用 Snap,不用担心。你可以从[他们的 GitHub 仓库][8]下载最新版本的 Pixelorama,[解压 zip 文件][9],你会看到一个可执行文件。授予此文件执行权限,并双击它运行应用。 + +- [下载 Pixelorama][10] + +### 总结 + +![Pixelorama Welcome Screen][11] + +在 Pixeloaram 的功能中,它说你可以导入图像并对其进行编辑。我想,这只是对某些类型的文件,因为当我尝试导入 PNG 或 JPEG 文件,程序崩溃了。 + +然而,我可以像一个 3 岁的孩子那样随意涂鸦并制作像素艺术。我对艺术不是很感兴趣,但我认为这[对 Linux 上的数字艺术家是个有用的工具][12]。 + +我喜欢这样的想法:尽管是游戏开发人员,但他们创建的工具,可以帮助其他游戏开发人员和艺术家。这就是开源的精神。 + +如果你喜欢这个项目,并且会使用它,请考虑通过捐赠来支持他们。[It’s FOSS 捐赠了][13] 25 美元,以感谢他们的努力。 + +- [向 Pixelorama 捐赠(主要开发者的个人 Paypal 账户)][14] + +你喜欢 Pixelorama 吗?你是否使用其他开源精灵编辑器?请随时在评论栏分享你的观点。 + +-------------------------------------------------------------------------------- +via: https://itsfoss.com/pixelorama/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.orama-interactive.com/pixelorama +[2]: https://www.orama-interactive.com/ +[3]: https://godotengine.org/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama-v6.jpg?ssl=1 +[5]: https://en.wikipedia.org/wiki/Onion_skinning +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama-ubuntu-software-center.jpg?ssl=1 +[7]: https://itsfoss.com/install-snap-linux/ +[8]: https://github.com/Orama-Interactive/Pixelorama +[9]: https://itsfoss.com/unzip-linux/ +[10]: https://github.com/Orama-Interactive/Pixelorama/releases +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama.jpg?ssl=1 +[12]: https://itsfoss.com/best-linux-graphic-design-software/ +[13]: https://itsfoss.com/donations-foss/ +[14]: https://www.paypal.me/erevos diff --git a/published/202005/20200323 How to create a personal file server with SSH on Linux.md b/published/202005/20200323 How to create a personal file server with SSH on Linux.md new file mode 100644 index 0000000000..14abf4cc64 --- /dev/null +++ b/published/202005/20200323 How to create a personal file server with SSH on Linux.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12255-1.html) +[#]: subject: (How to create a personal file server with SSH on Linux) +[#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +怎样在 Linux 下用 SSH 搭建个人文件服务器 +====== + +> 通过 SSH 连接远程 Linux 系统很简单。下面是教程。 + +![](https://img.linux.net.cn/data/attachment/album/202005/27/120338v62cakrqnccpjckk.jpg) + +树莓派是一个有用且价格低廉的家庭服务器,可用于很多事情。我的树莓派最常用来做[打印服务器][2],可以在我的家庭网络中共享激光打印机,或作为个人文件服务器保存项目副本和其他数据。 + +我的文件服务器有很多用途。假设说我现在有一个项目,比如一本新书,我想把我的工作和所有相关的文件都复制一份快照。这种场景下,我只需要把 `BookProject` 文件夹复制到文件服务器的 `BookBackup` 文件夹。 + +或者我现在正在清理我的本地文件时,发现一些我不需要的文件,但是我不确定是否要删除,我会把它们复制到文件服务器的 `KeepForLater` 文件夹。这是我日常 Linux 系统中清除杂乱的文件,并将不常用的文件卸载到个人文件服务器上的方便方法。 + +用树莓派或其他 Linux 系统搭建个人文件服务器不需要配置 NFS(网络文件系统Network File System>)或 CIFS(通用互联网文件系统Common Internet File System)或改造其他的文件共享系统如 WebDAV。你可以很轻松的使用 SSH 来搭建远程文件服务器。下面是教程。 + +### 在远程服务器上配置 SSHD + +你的 Linux 系统可能已经安装了 SSH 守护进程(`sshd`),甚至它已经默认运行了。如果没有,你可以使用你 Linux 发行版本上的任何控制面板来轻松配置 SSH。我在树莓派上运行了 [Fedora ARM][3],通过 Web 浏览器访问树莓派的 9090 端口,我可以远程访问控制面板。(在我的家庭网络中,树莓派的 IP 地址是 `10.0.0.11`,因此我连接的是 `10.0.0.11:9090`。)如果 SSH 守护进程没有默认运行,你可以在控制面板的“服务”里把它设置为开机启动。 + +![sshd in the list of system services][4] + +你可以在系统服务列表里找到 `sshd`。 + +![slider to activate sshd][5] + +如果 `sshd` 没有开启,点击切换按钮打开它。 + +### 你有账号吗? + +你需要有个远程系统的账号。它可以与你本地系统的账号相同,也可以不同。 + +在流行的 Raspbian 发行版本上,默认的账号名是 `pi`。但是其他的 Linux 发行版本可能需要你在安装系统时就设置一个唯一的新用户。如果你不知道你的用户名,你可以用系统的控制面板创建一个。在我的树莓派上,我创建了一个 `jhall` 账号,与我日常用的 Linux 桌面机器的用户名相同。 + +![Set up a new account on Fedora Server][6] + +如果你用的是 Fedora 服务器,你可以点击“创建新账号”按钮。 + +![Set password or SSH key][7] + +不要忘记设置密码或添加公钥。 + +### 可选:添加公钥 + +如果你把公钥添加到远程 Linux 系统上,你就可以不使用密码登录。这一步是可选的;如果你愿意,你仍可以用密码登录。 + +你可以在下面的文章中学到更多关于 SSH 密钥的信息: + +* [SSH 密钥管理工具][8] +* [用 Seahorse 对 SSH 密钥进行图形化管理][9] +* [如何管理多个 SSH 密钥][10] +* [使用 GPG 密钥作为鉴权依据开启 SSH 访问][11] + +### 创建文件管理器的快捷方式 + +现在你已经在远程系统上启动 SSH 守护进程了,也设置了用户名和密码,最后一步就是在你本地的文件管理器中创建一个快捷方式,地址映射到远程 Linux 系统。我的桌面是 GNOME,但是在其他的 Linux 桌面上的基本操作步骤都是一样的。 + +#### 建立初始连接 + +在 GNOME 的文件管理器中,在左边导航栏找到 “+其它位置” 按钮。点击它会出现一个 “连接到服务器” 提示框。在框中输入远程 Linux 服务器的地址,地址以 SSH 连接协议开头。 + +![Creating a shortcut in GNOME file manager][12] + +GNOME 文件管理器支持多种连接协议。要通过 SSH 进行连接,服务器地址请以 `sftp://` 或 `ssh://` 开头。 + +如果你远程 Linux 系统的用户名与本地的相同,那么你只需要输入服务器的地址和文件夹路径就可以了。比如要连接到我的树莓派的 `/home/jhall` 目录,我输入: + +``` +sftp://10.0.0.11/home/jhall +``` + +![GNOME file manager Connect to Server][13] + +如果你远程 Linux 系统的用户名与本地的不同,你可以在远程系统地址前加 `@` 符号来指定远程系统的用户名。要连接到远程的 Raspbian 系统,你可能要输入: + +``` +sftp://pi@10.0.0.11/home/pi +``` + +![GNOME file manager Connect to Server][14] + +如果你没有把公钥添加到远程服务器,那么你需要输入密码。如果你已经添加,GNOME 文件管理器应该会自动打开远程系统上的文件夹来让你跳转到不同的目录。 + +![GNOME file manager connection][15] + +#### 创建一个快捷方式,之后就可以轻松连接服务器 + +在 GNOME 文件管理器中,这很简单。右击导航栏中远程系统的名字,选择“添加书签”。这一步操作就创建了连接到远程路径的快捷方式。 + +![GNOME file manager - adding bookmark][16] + +如果你想把标签中的快捷方式改成一个更容易记的名字,你可以右击快捷方式选择“重命名”。 + +### 总结 + +通过 SSH 连接到远程 Linux 系统是很简单的事。你可以用相同的方式连接到家庭文件服务器以外的其他系统。我还创建了一个能让我立即访问我的提供商 Web 服务器上的文件的快捷方式,和另一个能迅速打开我的项目服务器的文件夹的快捷方式。SSH 使它成为一个安全的连接;所有的传输都是加密的。当我通过 SSH 打开远程的文件时,我可以像在本地操作一样使用 GNOME 文件管理器轻松打开远程文件。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/personal-file-server-ssh + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/18/3/print-server-raspberry-pi +[3]: https://arm.fedoraproject.org/ +[4]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd.png (sshd in the list of system services) +[5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd) +[6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server) +[7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key) +[8]: https://linux.cn/article-11947-1.html +[9]: https://linux.cn/article-9451-1.html +[10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage +[11]: https://opensource.com/article/19/4/gpg-subkeys-ssh +[12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager) +[13]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp.png (GNOME file manager Connect to Server) +[14]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp-username.png (GNOME file manager Connect to Server) +[15]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall.png (GNOME file manager connection) +[16]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall-add-bookmark.png (GNOME file manager - adding bookmark) diff --git a/published/202005/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/published/202005/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md new file mode 100644 index 0000000000..8b46842802 --- /dev/null +++ b/published/202005/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12250-1.html) +[#]: subject: (Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu) +[#]: via: (https://itsfoss.com/audacious-4-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何安装使用 Qt 5 的音频播放器 Audacious 4.0 +====== + +[Audacious][1] 是一个开源音频播放器,可用于包括 Linux 在内的多个平台。继上次发布主版本将近 2 年后,Audacious 4.0 带来了一些重大变化。 + +最新版本的 Audacious 4.0 默认带 [Qt 5][2] 用户界面。你仍然可以和以前一样使用旧的 GTK2 UI,但是,新功能仅会添加到 Qt UI 中。 + +让我们看下发生了什么变化,以及如何在 Linux 系统上安装最新的 Audacious。 + +### Audacious 4.0 关键变化和功能 + +![Audacious 4 Release][3] + +当然,主要的变化是默认使用 Qt 5 UI。除此之外,他们的[官方公告][4]中提到了许多改进和功能补充,它们是: + +* 单击播放列表列头可对播放列表进行排序 +* 拖动播放列表列头会更改列顺序 +* 应用中的音量和时间步长设置 +* 隐藏播放列表标签的新选项 +* 按路径对播放列表排序,现在将文件夹排序在文件后面 +* 实现了额外的 MPRIS 调用,以与 KDE 5.16+ 兼容 +* 新的基于 OpenMPT 的跟踪器模块插件 +* 新的 VU Meter 可视化插件 +* 添加了使用 SOCKS 网络代理的选项 +* 换歌插件现在可在 Windows 上使用 +* 新的“下一张专辑”和“上一张专辑”命令 +* Qt UI 中的标签编辑器现在可以一次编辑多个文件 +* 为 Qt UI 实现均衡器预设窗口 +* 歌词插件获得了在本地保存和加载歌词的能力 +* 模糊范围和频谱分析器可视化已移植到 Qt +* MIDI 插件 “SoundFont 选择”已移植到 Qt +* JACK 输出插件获得了一些新选项 +* 添加了无限循环 PSF 文件的选项 + +如果你以前不了解它,你可以轻松安装它,并使用均衡器和 [LADSP][5] 效果器来调整音乐体验。 + +![Audacious Winamp Classic Interface][6] + +### 如何在 Ubuntu 上安装 Audacious 4.0 + +值得注意的是,[非官方 PPA][7] 是由 [UbuntuHandbook][8] 提供的。你可以按照以下说明在 Ubuntu 16.04、18.04、19.10 和 20.04 上进行安装。 + +1、首先,你必须在终端中输入以下命令将 PPA 添加到系统中: + +``` +sudo add-apt-repository ppa:ubuntuhandbook1/apps +``` + +2、接下来,你需要从仓库中更新(刷新)软件包信息,然后继续安装该应用。方法如下: + +``` +sudo apt update +sudo apt install audacious audacious-plugins +``` + +就是这样。你无需执行其他任何操作。无论什么情况,如果你想[删除 PPA 和软件][9],只需按顺序输入以下命令: + +``` +sudo add-apt-repository --remove ppa:ubuntuhandbook1/apps +sudo apt remove --autoremove audacious audacious-plugins +``` + +你也可以在它的 GitHub 页面上查看有关源码的更多信息,并根据需要在其他 Linux 发行版上进行安装。 + +- [Audacious 源代码][10] + +### 总结 + +新功能和 Qt 5 UI 开关对于改善用户体验和音频播放器的功能应该是一件好事。如果你是经典 Winamp 界面的粉丝,它也可以正常工作。但缺少其公告中提到的一些功能。 + +你可以尝试一下,并在下面的评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/audacious-4-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://audacious-media-player.org +[2]: https://doc.qt.io/qt-5/qt5-intro.html +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-4-release.jpg?ssl=1 +[4]: https://audacious-media-player.org/news/45-audacious-4-0-released +[5]: https://www.ladspa.org/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-winamp.jpg?ssl=1 +[7]: https://itsfoss.com/ppa-guide/ +[8]: http://ubuntuhandbook.org/index.php/2020/03/audacious-4-0-released-qt5-ui/ +[9]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[10]: https://github.com/audacious-media-player/audacious diff --git a/published/202005/20200326 Tricks for getting around your Linux file system.md b/published/202005/20200326 Tricks for getting around your Linux file system.md new file mode 100644 index 0000000000..d9d6cf1006 --- /dev/null +++ b/published/202005/20200326 Tricks for getting around your Linux file system.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12239-1.html) +[#]: subject: (Tricks for getting around your Linux file system) +[#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 文件系统中导航的技巧 +====== + +> cd 命令可能是任何 Linux 用户学习的前 10 个命令之一,但这并不是在 Linux 文件系统中导航的唯一方法,这里还有其他一些方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/22/114058yrzlx94rz9lbx974.jpg) + +无论你是在文件系统中四处查看、寻找文件还是尝试进入重要目录,Linux 都可以提供很多帮助。在本文中,我们将介绍一些技巧,使你可以在文件系统中移动,查找和使用所需的命令也更加轻松。 + +### 添加到 \$PATH + +确保你不必花费大量时间在 Linux 系统上查找命令的最简单、最有用的方法之一就是在 `$PATH` 变量中添加适当的目录。但是,添加到 `$PATH` 变量中的目录顺序非常重要。它们确定系统在目录中查找要运行命令的目录顺序--在找到第一个匹配项时停止。 + +例如,你可能希望将家目录放在第一个,这样,如果你创建的脚本与其他可执行文件有相同的名称,那么只要输入该脚本的名称,它便会运行。 + +要将家目录添加到 `$PATH` 变量中,可以执行以下操作: + +``` +$ export PATH=~:$PATH +``` + +`~` 字符代表家目录。 + +如果将脚本保存在 `bin` 目录中,下面的会有效: + +``` +$ export PATH=~/bin:$PATH +``` + +然后,你可以运行位于家目录中的脚本,如下所示: + +``` +$ myscript +Good morning, you just ran /home/myacct/bin/myscript +``` + +**重要提示:**上面显示的命令会添加到你的搜索路径中,因为 `$PATH`(当前路径)被包含在内。它们不会覆盖它。你的搜索路径应该在你的 `.bashrc` 文件中配置,任何你打算永久化的更改也应该添加到那里。 + +### 使用符号链接 + +符号链接提供了一种简单而明显的方式来记录可能经常需要使用的目录的位置。例如,如果你管理网站的内容,那么可能需要通过创建如下链接来使你的帐户“记住”网页文件的位置: + +``` +ln -s /var/www/html www +``` + +参数的顺序很重要。第一个(`/var/www/html`)是目标,第二个是你创建的链接的名称。如果你当前不在家目录中,那么以下命令将执行相同的操作: + +``` +ln -s /var/www/html ~/www +``` + +设置好之后,你可以使用 `cd www` 进入 `/var/www/html`。 + +### 使用 shopt + +`shopt` 命令还提供了一种让移动到其他目录更加容易的方法。当你使用 `shopt` 的 `autocd` 选项时,只需输入名称即可转到目录。例如: + +``` +$ shopt -s autocd +$ www +cd -- www +/home/myacct/www +$ pwd -P +/var/www/html + +$ ~/bin +cd -- /home/myacct/bin +$ pwd +/home/myacct/bin +``` + +在上面的第一组命令中,启用了 `shopt` 命令的 `autocd` 选项。输入 `www`,就会调用 `cd www` 命令。由于此符号链接是在上面的 `ln` 命令示例之一中创建的,因此将我们移至 `/var/www/html`。 `pwd -P` 命令显示实际位置。 + +在第二组中,键入 `~/bin` 会调用 `cd` 进入在用户家目录的 `bin` 目录。 + +请注意,当你输入的是命令时,`autocd` 行为将*不会*生效,即使它也是目录的名称。 + +`shopt` 是 bash 内置命令,它有很多选项。这只是意味着你不必在要进入每个目录的名称之前输入 `cd`。 + +要查看 `shopt` 的其他选项,只需输入 `shopt`。 + +### 使用 \$CDPATH + +可能进入特定目录的最有用技巧之一,就是将你希望能够轻松进入的路径添加到 `$CDPATH` 中。这将创建一个目录列表,只需输入完整路径名的一部分即可进入。 + +一方面,这可能有点棘手。你的 `$CDPATH` 需要包含要移动到的目录的父目录,而不是目录本身。 + +例如,假设你希望仅通过输入 `cd html` 就可以移至 `/var/www/html` 目录,并仅使用 `cd` 和简单目录名即可移至 `/var/log` 中的子目录。在这种情况下,此 `$CDPATH` 就可以起作用: + +``` +$ CDPATH=.:/var/log:/var/www +``` + +你将看到: + +``` +$ cd journal +/var/log/journal +$ cd html +/var/www/html +``` + +当你输入的不是完整路径时,`$CDPATH` 就会生效。它向下查看其目录列表,以查看指定的目录是否存在于其中一个目录中。找到匹配项后,它将带你到那里。 + +在 `$CDPATH` 开头保持 `.` 意味着你可以进入本地目录,而不必在 `$CDPATH` 中定义它们。 + +``` +$ export CDPATH=".:$CDPATH" +$ Videos +cd -- Videos +/home/myacct/Videos +``` + +在 Linux 文件系统键切换并不难,但是如果你使用一些方便的技巧轻松地到达各个位置,那你可以节省一些大脑细胞。 + + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202005/20200331 Rambox is an All-in-one Messenger for Linux.md b/published/202005/20200331 Rambox is an All-in-one Messenger for Linux.md new file mode 100644 index 0000000000..93a73f4a54 --- /dev/null +++ b/published/202005/20200331 Rambox is an All-in-one Messenger for Linux.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12171-1.html) +[#]: subject: (Rambox is an All-in-one Messenger for Linux) +[#]: via: (https://itsfoss.com/rambox/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Rambox:Linux 中多合一的消息收发工具 +====== + +> Rambox 是一个多合一消息收发工具,允许你将多种服务(如 Discord、Slack、Facebook Messenger)和数百个此类服务结合在一起。 + +### Rambox:在单个应用中添加多个消息服务 + +![][1] + +Rambox 是通过安装单个应用管理多个通信服务的最佳方式之一。你可以在一个界面使用[多个消息服务][2],如 Facebook Messenger、Gmail chats、AOL、Discord、Google Duo、[Viber][3] 等。 + +这样,你就不需要安装单独的应用或者在浏览器中一直打开着。你可以使用主密码锁定 Rambox 应用。你还可以使用“请勿打扰”功能。 + +Rambox 提供可免费使用的[开源社区版][4]。付费专业版允许你访问 600 多个应用,而社区版则包含 99 多个应用。专业版本具有额外的功能,如主题、休眠、ad-block、拼写检查和高级支持。 + +不用担心。开源社区版本身非常有用,你甚至不需要这些专业功能。 + +### Rambox 的功能 + +![][5] + +虽然你应该在开源版中找到大多数基本功能,但你可能会注意到其中一些功能仅限于专业版。 + +此处,我说下所有的基本功能: + + * 在开源版本中,你有大约 100 个应用/服务可供选择 + * 能够使用单个主密码锁保护应用 + * 能够锁定加载的每个会话 + * 请勿打扰模式 + * 能够跨多个设备同步应用和配置 + * 你可以创建和添加自定义应用 + * 支持键盘快捷键 + * 启用/禁用应用而无需删除它们 + * JS 和 CSS 注入支持,以调整应用的样式 + * Ad-block (**专业版**) + * 休眠支持 (**专业版**) + * 主题支持(**专业版**) + * 移动设备视图 (**专业版**) + * 拼写检查 (**专业版**) + * 工作时间 - 计划传入通知的时间 (**专业版**) + * 支持代理 (**专业版**) + +除了我在这里列出的内容外,你还可以在 Rambox Pro 版本中找到更多功能。要了解有关它的更多信息,你可以参考[正式功能列表][6]。 + +还值得注意的是,你不能超过 3 个活跃并发设备的连接。 + +### 在 Linux 上安装 Rambox + +你可以在[官方下载页][4]获取 .AppImage 文件来运行 Rambox。如果你不清楚,你可以参考我们的指南,了解如何[在 Linux 上使用 AppImage 文件][7]。 + +另外,你也可以从 [Snap 商店][8]获取它。此外,请查看其 [GitHub release][9] 部分的 .deb / .rpm 或其他包。 + +- [下载 Rambox 社区版][4] + +### 总结 + +使用 Rambox 安装大量应用可能会有点让人不知所措。因此,我建议你在添加更多应用并将其用于工作时监视内存使用情况。 + +还有一个类似的应用称为 [Franz][10],它也像 Rambox 部分开源、部分高级版。 + +尽管像 Rambox 或 Franz 这样的解决方案非常有用,但它们并不总是节约资源,特别是如果你同时使用数十个服务。因此,请留意系统资源(如果你注意到对性能的影响)。 + +除此之外,这是一个令人印象深刻的应用。你有试过了么?欢迎随时让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rambox/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rambox-ce.jpg?ssl=1 +[2]: https://itsfoss.com/best-messaging-apps-linux/ +[3]: https://itsfoss.com/viber-linux-client-beta-install/ +[4]: https://rambox.pro/#ce +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rambox-preferences.png?ssl=1 +[6]: https://rambox.pro/#features +[7]: https://itsfoss.com/use-appimage-linux/ +[8]: https://snapcraft.io/rambox +[9]: https://github.com/ramboxapp/community-edition/releases +[10]: https://itsfoss.com/franz-messaging-app/ diff --git a/published/202005/20200401 3 Python templating languages you should (probably) never use.md b/published/202005/20200401 3 Python templating languages you should (probably) never use.md new file mode 100644 index 0000000000..a5a7502767 --- /dev/null +++ b/published/202005/20200401 3 Python templating languages you should (probably) never use.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12252-1.html) +[#]: subject: (3 Python templating languages you should (probably) never use) +[#]: via: (https://opensource.com/article/20/4/python-templating-languages) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +你应该(或许)没使用过的 3 种 Python 模板语言 +====== + +> 包括这 3 个模板语言在内,Python 积累了许多模板语言。 + +![](https://img.linux.net.cn/data/attachment/album/202005/26/110220lxie9osmd592m5ee.jpg) + +当需要使用模板语言来编写 [Python][2] Web 应用时,有很多健壮的解决方案。 + +有 [Jinja2][3]、[Genshi 和 Mako][4]。甚至还有 [Chameleon][5] 之类的解决方案,虽然有些陈旧,但仍被 [Pyramid][6] 框架推荐。 + +Python 已经存在了很长时间。此时,在系统的深处,它积累了一些几乎被遗忘的模板语言,它们都是值得一试的。 + +这些语言就像桉树上可爱的考拉一样,在自己的生态圈里快乐地生活着,有时也会有危险的工作,这些都是很少有人听说过的模板语言,使用过的应该更少。 + +### 3、string.Template + +你是否曾经想过:“如何获得一种没有任何特性的模板语言,而且同时也不需要 `pip install` 安装任何东西?” Python 标准库已经为你提供了答案。虽然没有循环和条件,但 `string.Template` 类是一种最小的模板语言。 + +使用它很简单。 + +``` +>>> import string +>>> greeting = string.Template("Hello, $name, good $time!") +>>> greeting.substitute(name="OpenSource.com", time="afternoon") +'Hello, OpenSource.com, good afternoon!' +``` + +### 2、twisted.web.template + +你会给一个包罗万象的库送什么礼物? + +当然,不是模板语言,因为它已经有了。twisted.web.template 中嵌套了两种模板语言。一种是基于 XML 的,并有一个[很棒的文档][7]。 + +但是它还有另一种,一种基于使用 Python 作为领域特定语言(DSL)来生成 HTML 文档。 + +它基于两个原语:包含标签对象的 `twisted.web.template.tags` 和渲染它们的 `twisted.web.template.flattenString`。由于它是 Twisted 的一部分,因此它内置支持高效异步渲染。 + +此例将渲染一个小页面: + +``` +async def render(reactor): + my_title = "A Fun page" + things = ["one", "two", "red", "blue"] + template = tags.html( + tags.head( + tags.title(my_title), + ), + tags.body( + tags.h1(my_title), + tags.ul( + [tags.li(thing) for thing in things], + ), + tags.p( + task.deferLater(reactor, 3, lambda: "Hello "), + task.deferLater(reactor, 3, lambda: "world!"), + ) + ) + ) + res = await flattenString(None, template) + res = res.decode('utf-8') + with open("hello.html", 'w') as fpout: + fpout.write(res) +``` + +该模板是使用 `tags.` 来指示层次结构的常规 Python 代码。原生支持渲染字符串,因此任何字符串都正常。 + +要渲染它,你需要做的是添加调用: + +``` +from twisted.internet import task, defer +from twisted.web.template import tags, flattenString + +def main(reactor): +    return defer.ensureDeferred(render(reactor)) +``` + +最后写上: + + +``` +task.react(main) +``` + +只需 3 秒(而不是 6 秒),它将渲染一个不错的 HTML 页面。在实际中,这些 `deferLater` 可以是对 HTTP API 的调用:它们将并行发送和处理,而无需付出任何努力。我建议你阅读关于[更好地使用 Twisted][8]。不过,这已经可以工作了。 + +### 1、Quixote + +你会说:“但是 Python 并不是针对 HTML 领域而优化的领域特定语言。” 如果有一种语言可以[转化][9]到 Python,但是更适合定义模板,而不是像 Python 那样按原样解决呢?如果可以的话,请使用“Python 模板语言”(PTL)。 + +编写自己的语言,有时被说成是一个攻击假想敌人的唐吉坷德项目。当 Quixote(可在 [PyPI][10] 中找到)的创造者决定这样做时,并没有受此影响。 + +以下将渲染与上面 Twisted 相同的模板。*警告:以下不是有效的 Python 代码*: + +``` +import time + +def render [html] (): + my_title = "A Fun page" + things = ["one", "two", "red", "blue"] + "" + my_title + "</head>

" + my_title + "

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

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

    " + "" + +def write(): + result = render() + with open("hello.html", 'w') as fpout: + fpout.write(str(result)) +``` + +但是,如果将它放到 `template.ptl` 文件中,那么可以将其导入到 Quixote 中,并写出可以渲染模板的版本: + + +``` +>>> from quixote import enable_ptl +>>> enable_ptl() +>>> import template +>>> template.write() +``` + +Quixote 安装了一个导入钩子,它会将 PTL 文件转换为 Python。请注意,此渲染需要 6 秒,而不是 3 秒。你不再获得自由的异步性。 + +### Python 中的模板太多 + +Python 库的历史悠久且曲折,其中一些库可以或多或少都能达到类似结果(例如,Python [包管理][11])。 + +我希望你喜欢探索这三种*可以*用 Python 创建模板的方式。另外,我建议从[这三个库之一][4]开始了解。 + +你是否有另一种深奥的模板方法?请在下面的评论中分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-templating-languages + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/20/2/jinja2-cheat-sheet +[4]: https://opensource.com/resources/python/template-libraries +[5]: https://chameleon.readthedocs.io/en/latest/ +[6]: https://opensource.com/article/18/5/pyramid-framework +[7]: https://twistedmatrix.com/documents/13.1.0/web/howto/twisted-templates.html +[8]: https://opensource.com/article/20/3/treq-python +[9]: https://en.wikipedia.org/wiki/Source-to-source_compiler +[10]: https://pypi.org/project/Quixote/ +[11]: https://opensource.com/article/19/4/managing-python-packages diff --git a/published/202005/20200401 The ins and outs of high-performance computing as a service.md b/published/202005/20200401 The ins and outs of high-performance computing as a service.md new file mode 100644 index 0000000000..ef96b09ffe --- /dev/null +++ b/published/202005/20200401 The ins and outs of high-performance computing as a service.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12202-1.html) +[#]: subject: (The ins and outs of high-performance computing as a service) +[#]: via: (https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-performance-computing-as-a-service.html) +[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) + +超算即服务:超级计算机如何上云 +====== + +> 高性能计算(HPC)服务可能是一种满足不断增长的超级计算需求的方式,但依赖于使用场景,它们不一定比使用本地超级计算机好。 + +![](https://img.linux.net.cn/data/attachment/album/202005/09/223805mrjfjzecr3hceais.jpg) + +导弹和军用直升机上的电子设备需要工作在极端条件下。美国国防承包商麦考密克·史蒂文森公司McCormick Stevenson Corp.在部署任何物理设备之前都会事先模拟它所能承受的真实条件。模拟依赖于像 Ansys 这样的有限元素分析软件,该软件需要强大的算力。 + +几年前的一天,它出乎意料地超出了计算极限。 + +麦考密克·史蒂文森公司的首席工程师 Mike Krawczyk 说:“我们的一些工作会使办公室的计算机不堪重负。购买机器并安装软件在经济上或计划上都不划算。”相反,他们与 Rescale 签约,该公司销售其超级计算机系统上的处理能力,而这只花费了他们购买新硬件上所需的一小部分。 + +麦考密克·史蒂文森公司已成为被称为超级计算即服务或高性能计算即服务(两个紧密相关的术语)市场的早期采用者之一。根据国家计算科学研究所的定义,HPC 是超级计算机在计算复杂问题上的应用,而超级计算机是处理能力最先进的那些计算机。 + +无论叫它什么,这些服务都在颠覆传统的超级计算市场,并将 HPC 能力带给以前负担不起的客户。但这不是万能的,而且绝对不是即插即用的,至少现在还不是。 + +### HPC 服务实践 + +从最终用户的角度来看,HPC 即服务类似于早期大型机时代的批处理模型。 “我们创建一个 Ansys 批处理文件并将其发送过去,运行它,然后将结果文件取下来,然后导入到本地,” Krawczyk 说。 + +在 HPC 服务背后,云提供商在其自己的数据中心中运行超级计算基础设施,尽管这不一定意味着当你听到“超级计算机”时你就会看到最先进的硬件。正如 IBM OpenPOWER 计算技术副总裁 Dave Turek 解释的那样,HPC 服务的核心是“相互互连的服务器集合。你可以调用该虚拟计算基础设施,它能够在你提出问题时,使得许多不同的服务器并行工作来解决问题。” + +理论听起来很简单。但都柏林城市大学数字商业教授 Theo Lynn 表示,要使其在实践中可行,需要解决一些技术问题。普通计算与 HPC 的区别在于那些互联互通 —— 高速的、低延时的而且昂贵的 —— 因此需要将这些互连引入云基础设施领域。在 HPC 服务可行之前,至少需要将存储性能和数据传输也提升到与本地 HPC 相同的水平。 + +但是 Lynn 说,一些制度创新相比技术更好的帮助了 HPC 服务的起飞。特别是,“我们现在看到越来越多的传统 HPC 应用采用云友好的许可模式 —— 这在过去是阻碍采用的障碍。” + +他说,经济也改变了潜在的客户群。“云服务提供商通过向那些负担不起传统 HPC 所需的投资成本的低端 HPC 买家开放,进一步开放了市场。随着市场的开放,超大规模经济模型变得越来越多,更可行,成本开始下降。” + +### 避免本地资本支出 + +HPC 服务对传统超级计算长期以来一直占据主导地位的私营部门客户具有吸引力。这些客户包括严重依赖复杂数学模型的行业,包括麦考密克·史蒂文森公司等国防承包商,以及石油和天然气公司、金融服务公司和生物技术公司。都柏林城市大学的 Lynn 补充说,松耦合的工作负载是一个特别好的用例,这意味着许多早期采用者将其用于 3D 图像渲染和相关应用。 + +但是,何时考虑 HPC 服务而不是本地 HPC 才有意义?对于德国的模拟烟雾在建筑物中的蔓延和火灾对建筑物结构部件的破坏的 hhpberlin 公司来说,答案是在它超出了其现有资源时。 + +Hpberlin 公司数值模拟的科学负责人 Susanne Kilian 说:“几年来,我们一直在运行自己的小型集群,该集群具有多达 80 个处理器核。……但是,随着应用复杂性的提高,这种架构已经越来越不足以支撑;可用容量并不总是够快速地处理项目。” + +她说:“但是,仅仅花钱买一个新的集群并不是一个理想的解决方案:鉴于我们公司的规模和管理环境,不断地维护这个集群(定期进行软件和硬件升级)是不现实的。另外,需要模拟的项目数量会出现很大的波动,因此集群的利用率并不是真正可预测的。通常,使用率很高的阶段与很少使用或不使用的阶段交替出现。”通过转换为 HPC 服务模式,hhpberlin 释放了过剩的产能,并无需支付升级费用。 + +IBM 的 Turek 解释了不同公司在评估其需求时所经历的计算过程。对于拥有 30 名员工的生物科学初创公司来说,“你需要计算,但你真的不可能让 15% 的员工专门负责计算。这就像你可能也会说你不希望有专职的法律代表,所以你也会把它作为一项服务来做。”不过,对于一家较大的公司而言,最终归结为权衡 HPC 服务的运营费用与购买内部超级计算机或 HPC 集群的费用。 + +到目前为止,这些都是你采用任何云服务时都会遇到的类似的争论。但是,可以 HPC 市场的某些特殊性将使得衡量运营支出(OPEX)与资本支出(CAPEX)时选择前者。超级计算机不是诸如存储或 x86 服务器之类的商用硬件;它们非常昂贵,技术进步很快会使其过时。正如麦考密克·史蒂文森公司的 Krawczyk 所说,“这就像买车:只要车一开走,它就会开始贬值。”对于许多公司,尤其是规模较大,灵活性较差的公司,购买超级计算机的过程可能会陷入无望的泥潭。IBM 的 Turek 说:“你会被规划问题、建筑问题、施工问题、培训问题所困扰,然后必须执行 RFP。你必须得到 CIO 的支持。你必须与内部客户合作以确保服务的连续性。这是一个非常、非常复杂的过程,并没有很多机构有非常出色的执行力。” + +一旦你选择走 HPC 服务的路线,你会发现你会得到你期望从云服务中得到的许多好处,特别是仅在业务需要时才需付费的能力,从而可以带来资源的高效利用。Gartner 高级总监兼分析师 Chirag Dekate 表示,当你对高性能计算有短期需求时,突发性负载是推动选择 HPC 服务的关键用例。 + +他说:“在制造业中,在产品设计阶段前后,HPC 活动往往会达到很高的峰值。但是,一旦产品设计完成,在其余产品开发周期中,HPC 资源的利用率就会降低。” 相比之下,他说:“当你拥有大型的、长期运行的工作时,云计算的经济性才会逐渐减弱。” + +通过巧妙的系统设计,你可以将这些 HPC 服务突发活动与你自己的内部常规计算集成在一起。埃森哲Accenture实验室常务董事 Teresa Tung 举了一个例子:“通过 API 访问 HPC 可以与传统计算无缝融合。在模型构建阶段,传统的 AI 流水线可能会在高端超级计算机上进行训练,但是最终经过反复按预期运行的训练好的模型将部署在云端的其他服务上,甚至部署在边缘设备上。” + +### 它并不适合所有的应用场景 + +HPC 服务适合批处理和松耦合的场景。这与一个常见的 HPC 缺点有关:数据传输问题。高性能计算本身通常涉及庞大的数据集,而将所有这些信息通过互联网发送到云服务提供商并不容易。IBM 的 Turek 说:“我们与生物技术行业的客户交流,他们每月仅在数据费用上就花费 1000 万美元。” + +而钱并不是唯一的潜在问题。构建一个利用数据的工作流程,可能会对你的工作流程提出挑战,让你绕过数据传输所需的漫长时间。hhpberlin 的 Kilian 说:“当我们拥有自己的 HPC 集群时,当然可以随时访问已经产生的仿真结果,从而进行交互式的临时评估。我们目前正努力达到在仿真的任意时刻都可以更高效地、交互地访问和评估云端生成的数据,而无需下载大量的模拟数据。” + +Mike Krawczyk 提到了另一个绊脚石:合规性问题。国防承包商使用的任何服务都需要遵从《国际武器交易条例》(ITAR),麦考密克·史蒂文森公司之所以选择 Rescale,部分原因是因为这是他们发现的唯一符合的供应商。如今,尽管有更多的公司使用云服务,但任何希望使用云服务的公司都应该意识到使用其他人的基础设施时所涉及的法律和数据保护问题,而且许多 HPC 场景的敏感性使得 HPC 即服务的这个问题更加突出。 + +此外,HPC 服务所需的 IT 治理超出了目前的监管范围。例如,你需要跟踪你的软件许可证是否允许云使用­ —— 尤其是专门为本地 HPC 群集上运行而编写的软件包。通常,你需要跟踪 HPC 服务的使用方式,它可能是一个诱人的资源,尤其是当你从员工习惯的内部系统过渡到有可用的空闲的 HPC 能力时。例如,Avanade 全球平台高级主管兼 Azure 平台服务全球负责人 Ron Gilpin 建议,将你使用的处理核心的数量回拨给那些对时间不敏感的任务。他说:“如果一项工作只需要用一小时来完成而不需要在十分钟内就完成,那么它可以使用 165 个处理器而不是 1,000 个,从而节省了数千美元。” + +### 对 HPC 技能的要求很高 + +一直以来,采用 HPC 的最大障碍之一就是其所需的独特的内部技能,而 HPC 服务并不能神奇使这种障碍消失。Gartner 的 Dekate 表示:“许多 CIO 将许多工作负载迁移到了云上,他们看到了成本的节约、敏捷性和效率的提升,因此相信在 HPC 生态中也可以达成类似的效果。一个普遍的误解是,他们可以通过彻底地免去系统管理员,并聘用能解决其 HPC 工作负载的新的云专家,从而以某种方式优化人力成本。”对于 HPC 即服务来说更是如此。 + +“但是 HPC 并不是一个主流的企业环境。” 他说。“你正在处理通过高带宽、低延迟的网络互联的高端计算节点,以及相当复杂的应用和中间件技术栈。许多情况下,甚至连文件系统层也是 HPC 环境所独有的。没有对应的技能可能会破坏稳定性。” + +但是超级计算技能的供给却在减少,Dekate 将其称为劳动力“老龄化”,这是因为这一代开发人员将目光投向了新兴的初创公司,而不是学术界或使用 HPC 的更老套的公司。因此,HPC 服务供应商正在尽其所能地弥补差距。IBM 的 Turek 表示,许多 HPC 老手将总是想运行他们自己精心调整过的代码,并需要专门的调试器和其他工具来帮助他们在云端实现这一目标。但是,即使是 HPC 新手也可以调用供应商构建的代码库,以利用超级计算的并行处理能力。第三方软件提供商出售的交钥匙软件包可以减少 HPC 的许多复杂性。 + +埃森哲的 Tung 表示,该行业需要进一步加大投入才能真正繁荣。她说:“HPCaaS 已经创建了具有重大影响力的新功能,但还需要做的是使它易于被数据科学家、企业架构师或软件开发人员使用。这包括易用的 API、文档和示例代码。它包括解答问题的用户支持。仅仅提供 API 是不够的,API 需要适合特定的用途。对于数据科学家而言,这可能是以 Python 形式提供,并容易更换她已经在使用的框架。价值来自于使这些用户能够通过新的效率和性能最终使他们的工作得到改善,只要他们能够访问新的功能就可以了。” 如果供应商能够做到这一点,那么 HPC 服务才能真正将超级计算带给大众。 + + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-performance-computing-as-a-service.html + +作者:[Josh Fruhlinger][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202005/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md b/published/202005/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md new file mode 100644 index 0000000000..25ebd65fcd --- /dev/null +++ b/published/202005/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md @@ -0,0 +1,353 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12219-1.html) +[#]: subject: (Best Raspberry Pi Operating Systems for Various Purposes) +[#]: via: (https://itsfoss.com/raspberry-pi-os/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +用于各种用途的最佳树莓派操作系统 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/15/105040b17d6v7gdmj63k3k.jpg) + +[树莓派][1] 是一款不可缺少的单板电脑,在很多工作中都能派上用场。不相信?只要[看看这个树莓派项目列表][2],就能了解这个小小的设备能做什么。 + +考虑到树莓派用途这么多,为它选择一个合适的操作系统就极其重要。当然,你可以用 Linux 做很多事,但专门为特定目的配置的操作系统可以为你节省大量的时间和精力。 + +因此,本文中我要介绍一些专门为树莓派量身定制的流行且实用的操作系统。 + +### 由于有树莓派镜像工具,安装任何操作系统到树莓派上都很容易 + +[在 SD 卡上安装树莓派操作系统][3]比以前容易得多。你只需下载[树莓派镜像][4]就可以快速地安装任何树莓派操作系统。请看下面的官方视频,你就知道有多简单。 + +- [HOW TO INSTALL RASPBIAN OS to your Raspberry Pi with ease - Raspberry Pi Imager](https://youtu.be/J024soVgEeM) + +你也可以使用 [NOOBS][5](新开箱即用软件New Out Of the Box Software)在树莓派上轻松安装各种的操作系统。你还可以从他们的 [NOOBS 官方下载页面][5]提到的支持的零售商列表中获得预装 SD 卡。 + +欢迎在他们的[官方文档][6]中了解更多关于安装操作系统的信息。 + +- [下载树莓派操作系统][4] + +现在你知道了怎么安装它(以及从哪儿获取),让我来重点介绍几个有用的树莓派操作系统,希望对你有所帮助。 + +### 适用于树莓派的各种操作系统 + +请注意,我花了一些精力筛选出了那些被积极维护的树莓派操作系统项目。如果某个项目在不久的将来会停止维护,请在评论区告诉我,我会更新本文。 + +另一件事是,我关注到现在最新的版本是树莓派 4,但是下面的列表不应被认为是树莓派 4 的操作系统列表,这些系统应该也能用于树莓派 3、3B+ 和其他变种,但是请参照项目的官方网站了解详细信息。 + +**注意:** 排名不分先后。 + +#### 1、Raspbian OS:官方的树莓派操作系统 + +![][7] + +Raspbian OS 是官方支持的树莓派板卡操作系统。它集成了很多工具,用于教育、编程以及其他广泛的用途。具体来说,它包含了 Python、Scratch、Sonic Pi、Java 和其他一些重要的包。 + +最初,Raspbian OS 是基于 Debian 的,并预装了大量有用的包。因此,当你安装 Raspbian OS 后,你可能就不需要特意安装基本工具了 — 你会发现大部分工具已经提前安装好了。 + +Raspbian OS 是被积极地维护着的,它也是最流行的树莓派操作系统之一。你可以使用 [NOOBS][5] 或参照[官方文档][6]来安装它。 + +- [Raspbian OS][8] + +#### 2、Ubuntu MATE:适合通用计算需求 + +![][9] + +尽管 Raspbian 是官方支持的操作系统,但它的特点不是最新、最大的软件包。因此,如果你想更快的更新,想用最新的包,你可以试试 Ubuntu MATE 的树莓派版本。 + +Ubuntu MATE 的树莓派定制版是值得安装的非常不错的轻量级发行版。它还被广泛用于 [NVIDIA 的 Jetson Nano][10]。换言之,你可以在树莓派的很多场景下使用它。 + +为了更好地帮助你,我们还有一份详细的教程:[怎样在树莓派上安装 Ubuntu MATE][11]。 + +- [Ubuntu MATE for Raspberry Pi][12] + +#### 3、Ubuntu Server:把树莓派作为一台 Linux 服务器来使用 + +![][13] + +如果你计划把你的树莓派当作项目的某个服务器来使用,那么安装 Ubuntu Server 会是一个不错的选择。 + +Ubuntu Server 有 32 位和 64 位的镜像。你可以根据你的板卡类型(是否支持 64 位)来选择对应的操作系统。 + +然而,值得注意的一点是 Ubuntu Server 不是为桌面用户定制的。因此,你需要留意 Ubuntu Server 默认不会安装图形用户界面。 + +- [Ubuntu Server][14] + +#### 4、LibreELEC:适合做媒体服务器 + +![][15] + +我们已经有一个 [Linux 下可用的媒体服务器软件][16],LibreELEC 在列表中。 + +它是一个很棒的轻量级操作系统,让你可以在树莓派上安装 [KODI][17]。你可以尝试使用树莓派镜像工具来安装它。 + +你可以很容易地找到他们的[官方下载页面][18],并找到适合你板卡的安装镜像。 + +- [LibreELEC][19] + +#### 5、OSMC:适合做媒体服务器 + +![][20] + +OSMC 是另一个 Linux 下[流行的媒体服务器软件][16]。如果要把树莓派板作为媒体中心设备,那么 OSMC 是你可以向他人推荐的操作系统之一。 + +类似 LibreELEC,OSMC 也运行 KODI,可以帮助你管理你的媒体文件和欣赏你已有的素材。 + +OSMC 没有正式提及对树莓派 4 的支持。因此,如果你的树莓派是树莓派 3 或更早的版本,那么应该没有问题。 + +- [OSMC][21] + +#### 6、RISC OS:最初的 ARM 操作系统 + +![][22] + +RISC OS 最初是为 ARM 设备打造的,至今已有近 30 年左右的历史。 + +如果你想了解,我们也有篇详细介绍 [RISC OS][23] 的文章。简而言之,RISC OS 也是为诸如树莓派的现代基于 ARM 的单板计算机定制的。它的用户界面很简单,更专注于性能。 + +同样的,这并不是为树莓派 4 量身定做的。因此,如果你的树莓派是 3 或更早的版本,你可以试一下。 + +- [RISC OS][24] + +#### 7、Mozilla WebThings Gateway:适合 IoT 项目 + +![][25] + +作为 Mozilla 的 [IoT 设备的开源实现][26]的一部分,WebThings Gateway 让你可以监控和控制所有连接的 IoT 设备。 + +你可以参考[官方文档][27]来检查所需的环境,遵照指导把安装到树莓派上。它确实是适合 IoT 应用的最有用的树莓派操作系统之一。 + +- [WebThings Gateway][28] + +#### 8、Ubuntu Core:适合 IoT 项目 + +Ubuntu Core 是又一个树莓派操作系统,适用于潜在的 [IoT][29] 应用,或者只是测试一下 Snap。 + +Ubuntu Core 是专门为 IoT 设备或者具体来说是树莓派定制的。我不会刻意宣传它 —— 但是 Ubuntu Core 是一款适合树莓派板卡的安全操作系统。你可以自己尝试一下! + +- [Ubuntu Core][30] + +#### 9、DietPi:轻量级树莓派操作系统 + +![][31] + +DietPi 是一款轻量级的 [Debian][32] 操作系统,它还宣称比 “Raspbian Lite” 操作系统更轻量。 + +虽然它被视作一款轻量级的树莓派操作系统,但它提供了很多功能,可以在多个使用场景中派上用场。从简单的软件安装包到备份解决方案,还有很多功能值得探索。 + +如果你想安装一个低内存占用而性能相对更好的操作系统,你可以尝试一下 DietPi。 + +- [DietPi][33] + +#### 10、Lakka Linux:打造复古的游戏主机 + +![][34] + +想让你的树莓派变成一个复古的游戏主机? + +Lakka Linux 发行版本最初是建立在 RetroArch 模拟器上的。因此,你可以立刻在树莓派上获得所有的复古游戏。 + +如果你想了解,我们也有一篇介绍 [Lakka Linux][35] 的文章。或者直接上手吧! + +- [Lakka][36] + +#### 11、RetroPie:适合复古游戏 + +![][37] + +RetroPie 是另一款可以让树莓派变成复古游戏主机的树莓派操作系统。它提供了几个配置工具,让你可以自定义主题,或者调整模拟器即可拥有最好的复古游戏。 + +值得注意的是它不包含任何有版权的游戏。你可以试一下,看看它是怎么工作的! + +- [RetroPie][38] + +#### 12、Kali Linux:适合低成本渗透 + +![][39] + +想要在你的树莓派上尝试和学习一些道德黑客技巧吗?[Kali Linux][64] 会是最佳选择。是的,Kali Linux 通常在最新的树莓派一发布就会支持它。 + +Kali Linux 不仅适合树莓派,它也支持很多其他设备。尝试一下,玩得愉快! + +- [Kali Linux][40] + +#### 13、OpenMediaVault:适合网络附加存储(NAS) + +![][41] + +如果你想在极简的硬件上搭建 [NAS][42] 解决方案,树莓派可以帮助你。 + +OpenMediaVault 最初是基于 Debian Linux 的,提供了大量功能,如基于 Web 的管理能力、插件支持,等等。它支持大多数树莓派型号,因此你可以尝试下载并安装它! + +- [OpenMediaVault][43] + +#### 14、ROKOS:适合加密挖矿 + +![][44] + +如果你对加密货币和比特币很感兴趣,那么 ROKOS 会吸引你。 + +ROKOS 是基于 Debian 的操作系统,基本上可以让你把你的树莓派变成一个节点,同时预装了相应的驱动程序和软件包。当然,在安装之前你需要了解它是怎么工作的。因此,如果你对此不太了解,我建议你先调研下。 + +- [ROKOS][45] + +#### 15、Alpine Linux:专注于安全的轻量级 Linux + +当今年代,很多用户都在寻找专注于安全和[隐私的发行版本][46]。如果你也是其中一员,你可以试试在树莓派上安装 Alpine Linux。 + +如果你是个树莓派新手,它可能不像你想象的那样对用户友好(或者说对初学者来说容易上手)。但是,如果你想尝试一些不一样的东西,那么你可以试试 Alpine Linux 这个专注于安全的 Linux 发行版本。 + +- [Alpine Linux][47] + +#### 16、Kano OS:适合儿童教育的操作系统 + +![][48] + +如果你在寻找一款能让学习变得有趣还能教育儿童的树莓派操作系统,那么 Kano OS 是个不错的选择。 + +它正在积极维护中,而且 Kano OS 上的桌面集成的用户体验相当简单,玩起来也很有趣,可以让孩子们从中学习。 + +- [Kano OS][49] + +#### 17、KDE Plasma Bigscreen:把普通电视转换为智能电视 + +![][50] + +这是 KDE 一个正在开发中的项目。在树莓派上安装 [KDE “等离子大屏”][51] 后,你可以把普通电视变成智能电视。 + +你不需要特殊的遥控器来控制电视,你可以使用普通的遥控器。 + +“等离子大屏”也集成了 [MyCroft 开源 AI][52] 作为声控。 + +这个项目还在测试阶段,所以如果你想尝试,可能会有一些错误和问题。 + +- [Plasma Bigscreen][53] + +#### 18、Manjaro Linux:为你提供多功能的桌面体验 + +![][54] + +如果你想在树莓派上寻找一个基于 Arch 的 Linux 发行版,那么 Manjaro Linux 应该是一个很好的补充,它可以做很多事情,适合一般的计算任务。 + +Manjaro Linux ARM 版也支持最新的树莓派 4。它为你的树莓派或任何[树莓派替代品][55]提供了 XFCE 和 KDE Plasma 变体。 + +此外,它似乎还提供了树莓派设备上最快/最好的体验之一。如果你还没试过,那就试试吧! + +- [Manjaro ARM][56] + +#### 19、Volumio:作为一个开源音乐播放器使用 + +![][57] + +想做一个廉价的音乐发烧友系统?Volumio 应该可以帮到你。 + +它是一个自由而开源的操作系统([GitHub][58]),还支持集成多个设备的能力。你可以通过一个简单的 Web 控制界面,对所有连接的设备进行管理。除了免费版之外,它还提供了一个高级版,可以让你获得独家功能。 + +它也确实支持最新的树莓派 4。所以,如果你对调整已有的家庭立体声系统有一定的兴趣,想要获得最佳的音质,不妨试试这个。 + +- [Volumio][59] + +#### 20、FreeBSD + +不想使用 Linux 发行版?不用担心,你也可以用 FreeBSD 在树莓派上安装一个类 UNIX 操作系统。 + +如果你不知道的话,我们有一篇关于 [FreeBSD 项目][60]的详细文章。 + +一旦你按照他们的[官方说明][61]安装好之后,你可以利用它来进行任何 DIY 实验,或者只是把它作为一个轻量级的桌面系统来完成特定的任务。 + +- [FreeBSD][62] + +#### 21、NetBSD + +NetBSD 是另一个令人印象深刻的类 UNIX 操作系统,你可以在树莓派上安装。它的目标是成为一个跨多个系统的便携式操作系统。 + +如果你在其他系统中使用过它,你可能已经知道它的好处了。然而,它不仅仅是一个轻量级的便携式操作系统,它的特点是拥有一套有用的功能,可以完成各种任务。 + +- [NetBSD][63] + +### 结语 + +我相信还有很多为树莓派定制的操作系统 — 但是我尽力列出了被积极维护的最流行的或最有用的操作系统。 + +如果你觉得我遗漏了最合适树莓派的操作系统,尽情在下面的评论去告诉我吧! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-os/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://itsfoss.com/raspberry-pi-projects/ +[3]: https://linux.cn/article-12136-1.html +[4]: https://www.raspberrypi.org/downloads/ +[5]: https://www.raspberrypi.org/downloads/noobs/ +[6]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/raspbian_home_screen.jpg?resize=800%2C492&ssl=1 +[8]: https://www.raspbian.org/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/04/Desktop-ubuntu.jpg?resize=800%2C600&ssl=1 +[10]: https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/ +[11]: https://linux.cn/article-10817-1.html +[12]: https://ubuntu-mate.org/raspberry-pi/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubunt-server.png?ssl=1 +[14]: https://ubuntu.com/download/raspberry-pi +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/libreelec.jpg?resize=800%2C600&ssl=1 +[16]: https://itsfoss.com/best-linux-media-server/ +[17]: https://kodi.tv/ +[18]: https://libreelec.tv/downloads_new/ +[19]: https://libreelec.tv/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/osmc-server.jpg?resize=800%2C450&ssl=1 +[21]: https://osmc.tv/ +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/10/riscos5.1.jpg?resize=800%2C600&ssl=1 +[23]: https://itsfoss.com/risc-os-is-now-open-source/ +[24]: https://www.riscosopen.org/content/ +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/web-things-gateway.png?ssl=1 +[26]: https://iot.mozilla.org/about/ +[27]: https://iot.mozilla.org/docs/gateway-getting-started-guide.html +[28]: https://iot.mozilla.org/gateway/ +[29]: https://en.wikipedia.org/wiki/Internet_of_things +[30]: https://ubuntu.com/download/raspberry-pi-core +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/diet-pi.jpg?ssl=1 +[32]: https://www.debian.org/ +[33]: https://dietpi.com/ +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/08/lakkaos.jpg?resize=1024%2C640&ssl=1 +[35]: https://linux.cn/article-10158-1.html +[36]: http://www.lakka.tv/ +[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/retro-pie.png?ssl=1 +[38]: https://retropie.org.uk/ +[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kali-linux-pi.png?ssl=1 +[40]: https://www.offensive-security.com/kali-linux-arm-images/ +[41]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/openmediavault.jpg?ssl=1 +[42]: https://en.wikipedia.org/wiki/Network-attached_storage +[43]: https://www.openmediavault.org/ +[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rocos-bitcoin-pi.jpg?ssl=1 +[45]: https://rokos.space/ +[46]: https://itsfoss.com/privacy-focused-linux-distributions/ +[47]: https://alpinelinux.org/ +[48]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kano-os-pi.jpeg?ssl=1 +[49]: https://kano.me/row/downloadable +[50]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/plasma-bigscreen-menu.jpg?ssl=1 +[51]: https://itsfoss.com/kde-plasma-bigscreen/ +[52]: https://itsfoss.com/mycroft-mark-2/ +[53]: https://plasma-bigscreen.org/#download-jumpto +[54]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/manjaro-arm.jpg?w=800&ssl=1 +[55]: https://linux.cn/article-10823-1.html +[56]: https://manjaro.org/download/#raspberry-pi-4 +[57]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/volumio.jpg?w=800&ssl=1 +[58]: https://github.com/volumio +[59]: https://volumio.org/ +[60]: https://itsfoss.com/freebsd-interview-deb-goodkin/ +[61]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-freebsd-for-raspberry-pi/ +[62]: https://www.freebsd.org/ +[63]: https://www.netbsd.org/ +[64]: https://linux.cn/article-10690-1.html diff --git a/published/202005/20200407 How to avoid man-in-the-middle cyber attacks.md b/published/202005/20200407 How to avoid man-in-the-middle cyber attacks.md new file mode 100644 index 0000000000..8ae4bb8a6d --- /dev/null +++ b/published/202005/20200407 How to avoid man-in-the-middle cyber attacks.md @@ -0,0 +1,80 @@ +[#]: collector: "lujun9972" +[#]: translator: "tinyeyeser" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12191-1.html" +[#]: subject: "How to avoid man-in-the-middle cyber attacks" +[#]: via: "https://opensource.com/article/20/4/mitm-attacks" +[#]: author: "Jackie Lam https://opensource.com/users/beenverified" + +如何避免中间人攻击(MITM) +====== + +> 首先搞明白到底什么是中间人攻击(MITM),才能避免成为此类高科技窃听的受害者。 + +![](https://img.linux.net.cn/data/attachment/album/202005/07/100655i7og1eqsw6o3ww81.jpg) + +当你使用电脑发送数据或与某人在线通话的时候,你一定采取了某种程度的安全隐私手段。 + +但如果有第三方在你不知情的情况下窃听,甚至冒充某个你信任的商业伙伴窃取破坏性的信息呢?你的私人数据就这样被放在了危险分子的手中。 + +这就是臭名昭著的中间人攻击man-in-the-middle(MITM)。 + +### 到底什么是中间人攻击? + +黑客潜入到你与受害者或是某个设备间的通信过程中,窃取敏感信息(多数是身份信息)进而从事各种违法行为的过程,就是一次中间人攻击。Scamicide 公司创始人 Steve J. J. Weisman 介绍说: + +> “中间人攻击也可以发生在受害者与某个合法 app 或网页中间。当受害者以为自己面对的是正常 app 或网页时,其实 Ta 正在与一个仿冒的 app 或网页互动,将自己的敏感信息透露给了不法分子。” + +中间人攻击诞生于 1980 年代,是最古老的网络攻击形式之一。但它却更为常见。Weisman 解释道,发生中间人攻击的场景有很多种: + + * **攻陷一个未有效加密的 WiFi 路由器**:该场景多见于人们使用公共 WiFi 的时候。“虽然家用路由器也很脆弱,但黑客攻击公共 WiFi 网络的情况更为常见。”Weisman 说,“黑客的目标就是从毫无戒心的人们那里窃取在线银行账户这样的敏感信息。” + * **攻陷银行、金融顾问等机构的电子邮件账户**:“一旦黑客攻陷了这些电子邮件系统,他们就会冒充银行或此类公司给受害者发邮件”,Weisman 说,”他们以紧急情况的名义索要个人信息,诸如用户名和密码。受害者很容易被诱骗交出这些信息。” + * **发送钓鱼邮件**:窃贼们还可能冒充成与受害者有合作关系的公司,向其索要个人信息。“在多个案例中,钓鱼邮件会引导受害者访问一个伪造的网页,这个伪造的网页看起来就和受害者常常访问的合法公司网页一模一样。”Weisman 说道。 + * **在合法网页中嵌入恶意代码**:攻击者还会把恶意代码(通常是 JavaScript)嵌入到一个合法的网页中。“当受害者加载这个合法网页时,恶意代码首先按兵不动,直到用户输入账户登录或是信用卡信息时,恶意代码就会复制这些信息并将其发送至攻击者的服务器。”网络安全专家 Nicholas McBride 介绍说。 + +### 有哪些中间人攻击的著名案例? + +联想作为主流的计算机制造厂商,在 2014 到 2015 年售卖的消费级笔记本电脑中预装了一款叫做 VisualDiscovery 的软件,拦截用户的网页浏览行为。当用户的鼠标在某个产品页面经过时,这款软件就会弹出一个来自合作伙伴的类似产品的广告。 + +这起中间人攻击事件的关键在于:VisualDiscovery 拥有访问用户所有私人数据的权限,包括身份证号、金融交易信息、医疗信息、登录名和密码等等。所有这些访问行为都是在用户不知情和未获得授权的情况下进行的。联邦交易委员会(FTC)认定此次事件为欺诈与不公平竞争。2019 年,联想同意为此支付 8300 万美元的集体诉讼罚款。 + +### 我如何才能避免遭受中间人攻击? + + * **避免使用公共 WiFi**:Weisman 建议,从来都不要使用公开的 WiFi 进行金融交易,除非你安装了可靠的 VPN 客户端并连接至可信任的 VPN 服务器。通过 VPN 连接,你的通信是加密的,信息也就不会失窃。 + * **时刻注意:**对要求你更新密码或是提供用户名等私人信息的邮件或文本消息要时刻保持警惕。这些手段很可能被用来窃取你的身份信息。 + + 如果不确定收到的邮件来自于确切哪一方,你可以使用诸如电话反查或是邮件反查等工具。通过电话反查,你可以找出未知发件人的更多身份信息。通过邮件反查,你可以尝试确定谁给你发来了这条消息。 + + 通常来讲,如果发现某些方面确实有问题,你可以听从公司中某个你认识或是信任的人的意见。或者,你也可以去你的银行、学校或其他某个组织,当面寻求他们的帮助。总之,重要的账户信息绝对不要透露给不认识的“技术人员”。 + + * **不要点击邮件中的链接**:如果有人给你发了一封邮件,说你需要登录某个账户,不要点击邮件中的链接。相反,要通过平常习惯的方式自行去访问,并留意是否有告警信息。如果在账户设置中没有看到告警信息,给客服打电话的时候也*不要*联系邮件中留的电话,而是联系站点页面中的联系人信息。 + * **安装可靠的安全软件**:如果你使用的是 Windows 操作系统,安装开源的杀毒软件,如 [ClamAV][2]。如果使用的是其他平台,要保持你的软件安装有最新的安全补丁。 + * **认真对待告警信息**:如果你正在访问的页面以 HTTPS 开头,浏览器可能会出现一则告警信息。例如,站点证书的域名与你尝试访问的站点域名不相匹配。千万不要忽视此类告警信息。听从告警建议,迅速关掉页面。确认域名没有输入错误的情况下,如果情况依旧,要立刻联系站点所有者。 + * **使用广告屏蔽软件**:弹窗广告(也叫广告软件攻击)可被用于窃取个人信息,因此你还可以使用广告屏蔽类软件。对个人用户来说,中间人攻击其实是很难防范的,因为它被设计出来的时候,就是为了让受害者始终蒙在鼓里,意识不到任何异常。有一款不错的开源广告屏蔽软件叫 [uBlock origin][4]。可以同时支持 Firefox 和 Chromium(以及所有基于 Chromium 的浏览器,例如 Chrome、Brave、Vivaldi、Edge 等),甚至还支持 Safari。 + +### 保持警惕 + +要时刻记住,你并不需要立刻就点击某些链接,你也并不需要听从某个陌生人的建议,无论这些信息看起来有多么紧急。互联网始终都在。你大可以先离开电脑,去证实一下这些人的真实身份,看看这些“无比紧急”的页面到底是真是假。 + +尽管任何人都可能遭遇中间人攻击,只要弄明白何为中间人攻击,理解中间人攻击如何发生,并采取有效的防范措施,就可以保护自己避免成为其受害者。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/mitm-attacks + +作者:[Jackie Lam][a] +选题:[lujun9972][b] +译者:[tinyeyeser](https://github.com/tinyeyeser) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/beenverified +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_chaos_engineer_monster.png?itok=J31aRccu "Security monster" +[2]: https://www.clamav.net +[3]: https://opensource.com/article/20/1/stop-typosquatting-attacks +[4]: https://github.com/gorhill/uBlock +[5]: https://www.beenverified.com/crime/what-is-a-man-in-the-middle-attack/ +[6]: https://creativecommons.org/licenses/by-sa/2.0/ diff --git a/published/202005/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/published/202005/20200407 How to use pyenv to run multiple versions of Python on a Mac.md new file mode 100644 index 0000000000..3bcf991e02 --- /dev/null +++ b/published/202005/20200407 How to use pyenv to run multiple versions of Python on a Mac.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12241-1.html) +[#]: subject: (How to use pyenv to run multiple versions of Python on a Mac) +[#]: via: (https://opensource.com/article/20/4/pyenv) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +如何在 Mac 上使用 pyenv 运行多个版本的 Python +====== + +> 如果你在 macOS 上运行的项目需要没有安装的 Python 版本,请试试 pyenv。 + +![](https://img.linux.net.cn/data/attachment/album/202005/23/112041pawp65alw6tmea6l.jpg) + +即使对于有经验的开发人员,管理本地 Python 开发环境仍然是一个挑战。尽管有详细的[软件包管理策略][2],但仍需要采取另外的步骤来确保你在需要时运行所需的 Python 版本。 + +### 为什么 Python 版本重要? + +起初这是一个奇怪的概念,但是编程语言会像其他任何软件一样发生变化。它们有错误、修复和更新,就像你喜欢的 [API][3] 和任何其他软件一样。同样,不同的发行版由称为[语义化版本][4]的三位数标识。 + +> 😭😭😭 [pic.twitter.com/yt1Z2439W8][5] +> +> — Denny Perez (@dennyperez18) [May 28, 2019][6] + +多年来,Python 2 是该语言的常用主要版本。在 2020 年 1 月,Python 2 [到达最后寿命][7],此后,Python 的核心维护者将仅支持 Python 3。Python 3 稳步发展,并定期发布新更新。对我来说定期获取这些更新很重要。 + +最近,我试图在 macOS 上运行一个依赖于 Python 3.5.9 的项目,而我的系统上并没有安装这个版本。我认为 Python 包管理器 `pip` 可以安装它,但事实并非如此: + +``` +$ pip install python3.5.9 +Collecting python3.5.9 +  ERROR: Could not find a version that satisfies the requirement python3.5.9 (from versions: none) +ERROR: No matching distribution found for python3.5.9 +``` + +或者,我也可以从官方 Python 网站下载该版本,但我如何在我的 Mac 上与现有的 Python 版本一起运行?每次运行时指定 Python 解释器版本(例如 python3.7 或 python3.5)似乎很容易出错。一定会有更好的方法。 + +(说明:我知道这对经验丰富的 Python 开发人员没有意义,但对当时的我来说是有意义的。我很乐意谈一谈为什么我仍然认为它应该这样做。) + +### 安装和设置 pyenv + +值得庆幸的是,`pyenv` 可以绕开这一系列复杂的问题。首先,我需要安装 `pyenv`。我可以[从源码][8]克隆并编译它,但是我更喜欢通过 Homebrew 包管理器来管理软件包: + +``` +$ brew install pyenv +``` + +为了通过 `pyenv` 使用 Python 版本,必须了解 shell 的 `PATH` 变量。`PATH` 决定了 shell 通过命令的名称来搜索文件的位置。你必须确保 shell 程序能够找到通过 `pyenv` 运行的 Python 版本,而不是默认安装的版本(通常称为*系统版本*)。如果不更改路径,那么结果如下: + +``` +$ which python +/usr/bin/python +``` + +这是 Python 的系统版本。 + +要正确设置 `pyenv`,可以在 Bash 或 zsh 中运行以下命令: + +``` +$ PATH=$(pyenv root)/shims:$PATH +``` + +现在,如果你检查 Python 的版本,你会看到它是 `pyenv` 管理的版本: + +``` +$ which python +/Users/my_username/.pyenv/shims/python +``` + +该导出语句(`PATH=`)仅会对该 shell 实例进行更改,为了使更改永久生效,你需要将它添加到点文件当中。由于 zsh 是 macOS 的默认 shell,因此我将重点介绍它。将相同的语法添加到 `~/.zshrc` 文件中: + +``` +$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc +``` + +现在,每次我们在 zsh 中运行命令时,它将使用 `pyenv` 版本的 Python。请注意,我在 `echo` 中使用了单引号,因此它不会评估和扩展命令。 + +`.zshrc` 文件仅管理 zsh 实例,因此请确保检查你的 shell 程序并编辑关联的点文件。如果需要再次检查默认 shell 程序,可以运行 `echo $SHELL`。如果是 zsh,请使用上面的命令。如果你使用 Bash,请将 `~/.zshrc` 更改为 `~/.bashrc`。如果你想了解更多信息,可以在 `pyenv` 的 `README` 中深入研究[路径设置][9]。 + +### 使用 pyenv 管理 Python 版本 + +现在 `pyenv` 已经可用,我们可以看到它只有系统 Python 可用: + +``` +$ pyenv versions +system +``` + +如上所述,你绝对不想使用此版本([阅读更多有关信息][10])。现在 `pyenv` 已正确设置,我希望它能有我经常使用的几个不同版本的 Python。 + +有一种方法可以通过运行 `pyenv install --list` 来查看 pyenv 可以访问的所有仓库中的所有 Python 版本。这是一个很长的列表,将来回顾的时候可能会有所帮助。目前,我决定在 [Python 下载页面][11]找到的每个最新的“点版本”(3.5.x 或 3.6.x,其中 x 是最新的)。因此,我将安装 3.5.9 和 3.8.0: + +``` +$ pyenv install 3.5.9 +$ pyenv install 3.8.0 +``` + +这将需要一段时间,因此休息一会(或阅读上面的链接之一)。有趣的是,输出中显示了该版本的 Python 的下载和构建。例如,输出显示文件直接来自 [Python.org][12]。 + +安装完成后,你可以设置默认值。我喜欢最新的,因此将全局默认 Python 版本设置为最新版本: + +``` +$ pyenv global 3.8.0 +``` + +该版本立即在我的 shell 中设置完成。确认一下: + +``` +$ python -V +Python 3.8.0 +``` + +我要运行的项目仅适于 Python 3.5,因此我将在本地设置该版本并确认: + +``` +$ pyenv local 3.5.9 +$ python -V +Python 3.5.9 +``` + +因为我在 `pyenv` 中使用了 `local` 选项,所以它向当前目录添加了一个文件来跟踪该信息。 + +``` +$ cat .python-version +3.5.9 +``` + +现在,我终于可以为想要的项目设置虚拟环境,并确保运行正确版本的 Python。 + +``` +$ python -m venv venv +$ source ./venv/bin/activate +(venv) $ which python +/Users/mbbroberg/Develop/my_project/venv/bin/python +``` + +要了解更多信息,请查看有关[在 Mac 上管理虚拟环境][13]的教程。 + +### 总结 + +默认情况下,运行多个 Python 版本可能是一个挑战。我发现 `pyenv` 可以确保在我需要时可以有我需要的 Python 版本。 + +你还有其他初学者或中级 Python 问题吗? 请发表评论,我们将在以后的文章中考虑介绍它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/pyenv + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://opensource.com/article/19/4/managing-python-packages +[3]: https://opensource.com/article/19/5/api-evolution-right-way +[4]: https://semver.org/ +[5]: https://t.co/yt1Z2439W8 +[6]: https://twitter.com/dennyperez18/status/1133505310516232203?ref_src=twsrc%5Etfw +[7]: https://opensource.com/article/19/11/end-of-life-python-2 +[8]: https://github.com/pyenv/pyenv +[9]: https://github.com/pyenv/pyenv#understanding-path +[10]: https://opensource.com/article/19/5/python-3-default-mac +[11]: https://www.python.org/downloads/ +[12]: http://python.org +[13]: https://linux.cn/article-11086-1.html diff --git a/published/202005/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/published/202005/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md new file mode 100644 index 0000000000..60ab428ad3 --- /dev/null +++ b/published/202005/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (Acceleratorrrr) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12228-1.html) +[#]: subject: (My Linux Story: From 8-bit enthusiast to Unix sysadmin) +[#]: via: (https://opensource.com/article/20/4/linux-story) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +我的 Linux 故事:从 8 位发烧友到 Unix 系统管理员 +====== + +> 我是如何从一个电脑爱好者成为职业系统管理员和 Linux 粉丝的。 + +![](https://img.linux.net.cn/data/attachment/album/202005/18/132731pnnzy7t5tz7hvc6z.jpg) + +故事得从 1980 年中期我父母给家里购买[苹果 \]\[c][2] 开始。尽管很喜欢打游戏,但我还是很快被实用又好玩的 BASIC 编程迷住了。那个年代的人们还是把电脑当作小一点的打字机对待,所以拥有“高级电脑技能”的人可以轻松使用他们的魔法。 + +以用 BASIC 和点阵打印机自动生成惩罚作业来举个例子。被罚写两百遍道歉时,我问老师我可不可以用打字代替手写。经过同意后,我写了 5 行 BASIC 语句来自动生成作业。另外一个小技巧是用非可视化文本编辑器,比如用 AppleWorks 微调字体、行距和边距,把学期论文“拉长”到要求的篇幅。 + +对电脑的痴迷很快让我得到了带有内存驱动卡和 x86 协处理器的苹果 ][gs。那时候,调制解调器和 BBS 刚开始火起来,有了这样的双处理器系统后,我就可以安装各种琳琅满目的软件。但是由于调制解调器 2400bps 的速度限制,对我每天都要下载几 KB 的有趣东西形成了阻碍。我对苹果痴迷一段时间,不久之后就换了。 + +### 探索 Unix + +我的本科专业是计算机信息系统,研究生专业是计算机科学。本科教育主要使用个人电脑,很少涉及大型分时系统。研究生的时候才开始真正有意思起来,拨号进入带有互联网连接的 Unix 简直打开了新世界的大门。尽管我依然用着我的双处理器 ][gs 来使用调制解调器还有写写论文,不过 Unix 系统真正吸引了我的注意力,因为它可以访问通用的 Telnet 游戏、文件传输协议(FTP)、在线邮箱和进行 C 语言编程。当时 Gopher 非常受欢迎,特别是在我们这群终端用户当中。 + +被分到学院计算机部门是我研究生命运的转折点,这个部门主管学校的计算机服务。学生们可以使用 X Window 终端来登录基于 [Ultrix][3] 的系统。大部分都是灰度的黑白界面,彩色处理在当时非常占用 CPU,也很影响系统性能。也有一些彩色系统还不错,但是这些机器都很慢。 + +我很喜欢那个时候,我有系统管理员权限而且工作是维护系统和网络。我有一些很好的导师,他们对我选择从事系统管理员而不是程序员起了关键作用(尽管我至今仍然热爱编程)。 + +### 从 Unix 到 Linux + +稀缺是创造之母,当需要分享匮乏的学校电脑系统资源的时候,我们学生们变得富有创造力。需要用电脑的学生是 Ultrix 工作站承受量的三到五倍,所以寻找资源往往是个难题(特别是要交付项目的时候)。在不需要图形化显示的时候,我们有一个 56k 的点对点协议的调制解调器池可供远程系统访问接入。但是找到一个有空余资源的机器并共享系统进行源码编译通常会导致进度缓慢。和大部分人一样,我发现晚上工作通常会有所帮助,但我还需要其它一些东西让我的项目迭代快一点。 + +后来学校的一个系统管理员建议我去看一个免费提供的 Unix 系统。那就是 Linux,它被装在 3.5 英寸的软盘里。多亏我们学校超快的 T1 线路,我很容易就搜索到新闻组和其他资源来学习如何下载它。它全是基于 32 位的英特尔 PC 机的,而我并没有这一类的设备。 + +幸运的是,我在学校的工作让我有机会接触到堆积如山的废旧电脑,所以命运的齿轮又开始旋转起来。 + +我找到了足够多的废旧 PC 组装了一个可靠的 80386 PC,带有足够内存(我确定不到 1GB),它有一个能用的显卡、一个细缆(同轴)以太网卡和一个硬盘。我所用的镜像是 Linux 内核 0.98,我不记得它是不是正式发行版的一部分了(可能是 SLS)。我所记得的是,它有一系列的软盘镜像,第一张软盘启动内核和一个最小安装程序,然后格式化硬盘,接着要求插入每个后续的软盘来安装 GNU 核心实用程序。在核心实用程序装好并引导系统之后,你可以下载和安装其他的软件包镜像,比如编译器之类的。 + +这是我学术道路上巨大的福音。在没有运行 X Window 显示服务器的情况下,这台电脑性能比学校的 Ultrix 工作站强很多。学校允许我把这台机器连到校园网络,挂载学校的学生网络文件系统(NFS)共享,并且能直接访问互联网。因为我的研究生课程用 [GCC][5](还有 Perl 4)来完成大部分学生作业,所以我可以在本地进行开发工作。这使得我可以独享关键资源,从而使我能够更快速地迭代我的项目。 + +但是,这个方案不是完美的。硬件有时会有点不稳定(这可能就是它们被丢弃的原因),但我都能搞定。真正让我感受到的是 Linux 和 Ultrix 在操作系统和系统库层面的差异。我开始理解移植软件到其他操作系统的意义,我可以自由地在任何地方开发,但是我必须以 Ultrix 编译的二进制文件交付项目。在一个平台上完美运行的 C 语言代码可能在另一个平台出错。这非常令人沮丧,但是我可能本能的察觉到了早期 Linux 解引用空指针的方法。Linux 倾向于把它作为空操作处理,但是 Ultrix 会立即触发核心转储和段错误 [SIGSEGV][6]。这是我第一次程序移植时的重大发现,正好在要交作业的几天之前。这同时对我研究 C++ 造成了一些麻烦,因为我粗心地同时使用了 `malloc()`/`free()` 和自动[构造函数和析构函数][7]处理,让我的项目到处都是空指针炸弹。 + +研究生课程快结束的时候,我升级到了一台性能野兽工作站:一颗英特尔 486DX2 66MHz 芯片、一块 SCSI 硬盘、一块光驱和一个 1024x768 RGB 显示器,并且还用一个 16550 UART 串口卡完美地匹配了我的新 US Robotics V.Everything 牌调制解调器。它可以双启动 Windows 和 Linux 系统,但更重要的是显卡和 CPU 的速度让我的开发环境幸福感倍增。那台旧的 386 依然在学校服役,不过我我现在大部分繁重的功课和钻研都转移到了家里。 + +和 [Mike Harris][8] 关于 90 年代的 Linux 故事类似,我真的对当时流行的 CD 集合很着迷。我住的附近有家新开的 Micro Center 计算机商店,这个宝库充满了电脑配件、高级专业书籍和你能想到的各种 Linux(以及免费的 Unix)CD。我还记得 [Yggdrasil][9] 和 [Slackware][10] 是我最喜欢的发行版。真正让人难以置信的是 CD 存储空间的巨大容量 —— 650MB!使它成为获得软件的必不可少的载体。是的,你可以用 56k 的速度下载,但是真的很慢。更别提大部分人负担不起存档这么多供以后使用的闲置数据。 + +### 而到了今天 + +就是这些开启了我长达 25 年的系统管理员的职业生涯和开源软件的乐趣。Linux 一直是我事业和个人开发中的重要组成部分。最近我依旧醉心于 Linux(主要是 CentOS、RedHat 和 Ubuntu),但也经常从 [FreeBSD][11] 和其他炫酷开源软件中得到乐趣。 + +Linux 让我来到了 Opensource.com,我希望在这里能回馈社区,为新一代电脑爱好者出一份力。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/linux-story + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[Accelerator](https://github.com/Acceleratorrrr) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://en.wikipedia.org/wiki/Apple_IIc +[3]: https://en.wikipedia.org/wiki/Ultrix +[4]: https://en.wikipedia.org/wiki/Point-to-Point_Protocol +[5]: https://en.wikipedia.org/wiki/GNU_Compiler_Collection +[6]: https://en.wikipedia.org/wiki/Segmentation_fault +[7]: https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm +[8]: https://linux.cn/article-11831-1.html +[9]: https://en.wikipedia.org/wiki/Yggdrasil_Linux/GNU/X +[10]: http://slackware.com +[11]: https://www.freebsd.org/ diff --git a/published/202005/20200413 9 open source CSS frameworks for frontend web development.md b/published/202005/20200413 9 open source CSS frameworks for frontend web development.md new file mode 100644 index 0000000000..00ab65d520 --- /dev/null +++ b/published/202005/20200413 9 open source CSS frameworks for frontend web development.md @@ -0,0 +1,249 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12227-1.html) +[#]: subject: (9 open source CSS frameworks for frontend web development) +[#]: via: (https://opensource.com/article/20/4/open-source-css-frameworks) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +9 个用于前端 Web 开发的开源 CSS 框架 +====== + +> 探索开源 CSS 框架,找到适合你的项目的框架。 + +![](https://img.linux.net.cn/data/attachment/album/202005/18/094922of81rqfiei8x78xi.jpg) + +当大多数人想到 Web 开发时,通常会想到 HTML 或 JavaScript。他们通常会忘记对网站的欣赏能力有更大影响的技术:[级联样式表][2]cascading style sheets(简称 CSS)。据维基百科的说法,CSS 既是网页中最重要的部分,也是最常被遗忘的部分,尽管它是万维网的三大基石技术之一。 + +本文将探讨九种流行的、强大的、开源的框架,是这些框架让构建漂亮的网站前端的 CSS 开发变得简单明了。 + +名称 | 介绍| 许可证 +---|---|--- +[Bootstrap][3] | 最流行的 CSS 框架,来自 Twitter | MIT +[PatternFly][4] | 开源框架,来自 Red Hat | MIT +[MDC Web][5] | Material Design 组件开源框架,来自 Google | MIT +[Pure][6] | 开源框架,来自 Yahoo | BSD +[Foundation][7] | 前端框架,来自 Zurb 基金会 | MIT +[Bulma][8] | 现代 CSS 框架,基于 Flexbox | MIT +[Skeleton][9] | 轻量级 CSS 框架 | MIT +[Materialize][10] | 基于 Material Design 的 CSS 框架 | MIT +[Bootflat][11] | 开源 Flat UI 工具,基于 Bootstrap 3.3.0 | MIT + +### Bootstrap + +[Bootstrap][2] 无疑是最流行的 CSS 框架,它是所有前端 Web 设计的开端。Bootstrap 由 Twitter 开发,提供了可用性、功能性和可扩展性。 + +![Bootstrap homepage][13] + +Bootstrap 还提供了大量的[例子][14]来帮助你入门。 + +![Bootstrap examples][15] + +使用 Bootstrap,你可以将不同的组件和布局拼接在一起,创造出有趣的页面设计。它还提供了大量详细的文档。 + +![Bootstrap documentation][16] + +Bootstrap 的 [GitHub][3] 仓库有超过 19000 个提交和 1100 个贡献者。它基于 MIT 许可证,所以(和这个列表中的所有框架一样)你也可以加入并贡献。 + +![Bootstrap GitHub][17] + +### PatternFly + +[PatternFly][18] 是由 Red Hat 开发的一个开源的(MIT 许可证)CSS 框架。PatternFly 采取了与 Bootstrap 不同的方法:Bootstrap 是为任何对创建一个漂亮网站感兴趣的人而设计的,而 PatternFly 主要针对企业级应用开发者,它提供的组件,如条形图、图表和导航,对于创建强大的、指标驱动的仪表盘非常有吸引力。事实上,Red Hat 在其产品(如 OpenShift)的设计中也使用了这个 CSS 框架。 + +![PatternFly homepage][19] + +除了静态 HTML 之外,PatternFly 还支持 ReactJS 框架,ReactJS 是 Facebook 开发的一个流行的 JavaScript 框架。 + +![PatternFly ReactJS support][20] + +PatternFly 有许多高级组件,如条形图、图表、[模态窗口][21]和布局等,适用于企业级应用。 + +![PatternFly chart component][22] + +PatternFly 的 [GitHub][4] 页面列出了超过 1050 个提交和 44 个贡献者。PatternFly 得到了很多人的关注,欢迎大家踊跃贡献。 + +![PatternFly GitHub][23] + +### MDC Web + +凭借其大获成功的安卓平台,谷歌以一个名为 [Material Design][24] 的概念制定了自己的标准设计准则。Material Design 标准旨在体现在所有谷歌的产品中,这些标准也可以面向大众,并且在 MIT 许可证下开源。 + +![Material Design homepage][25] + +Material Design 有许多“用于创建用户界面的交互式构建块”的[组件][26]。这些按钮、卡片、背景等可用于创建网站或移动应用程序的任何类型的用户界面。 + +![Material Components webpage][27] + +维护人员为不同的平台提供了详尽的文档。 + +![Material Design documentation][28] + +还有分步教程,其中包含用于实现不同目标的练习。 + +![Material Design tutorial][29] + +Material 组件的 GitHub 页面承载了面向不同平台的存储库,包括用于网站开发的 [Material Web 组件(MDC Web)][5]。MDC Web 有超过 5700 个提交和 349 个贡献者。 + +![MDC Web GitHub][30] + +### Pure + +Bootstrap、Patternfly 和 MDC Web 都是非常强大的 CSS 框架,但是它们可能相当的笨重和复杂。如果你想要一个轻量级的 CSS 框架,它更接近于自己编写 CSS,但又能帮助你建立一个漂亮的网页,可以试试 [Pure.css][31]。Pure 是一个轻量级的 CSS 框架,它的体积很小。它是由 Yahoo 开发的,在 BSD 许可证下开源。 + +![Pure.css homepage][32] + +尽管体积小,但 Pure 提供了建立一个漂亮网页的很多必要的组件。 + +![Pure.css components][33] + +Pure 的 [GitHub][6] 页面显示它有超过 565 个提交和 59 个贡献者。 + +![Pure.css GitHub][34] + +### Foundation + +[Foundation][35] 号称是世界上最先进的响应式前端框架。它提供了先进的功能和教程,用于构建专业网站。 + +![Foundation homepage][36] + +该框架被许多公司、组织甚至政客[使用][37],并且有大量的文档可用。 + +![Foundation documentation][38] + +Foundation 的 [GitHub][7] 页面显示有近 17000 个提交和 1000 个贡献者。和这个列表中的大多数其他框架一样,它也是在 MIT 许可证下提供的。 + +![Foundation GitHub][39] + +### Bulma + +[Bulma][40] 是一个基于 Flexbox 的开源框架,在 MIT 许可证下提供。Bulma 是一个相当轻量级的框架,因为它只需要一个 CSS 文件。 + +![Bulma homepage][41] + +Bulma 有简洁明快的文档,让你可以很容易地选择你想要探索的主题。它也有很多网页组件,你可以直接拿起来在设计中使用。 + +![Bulma documentation][42] + +Bulma 的 [GitHub][8] 页面列出了 1400 多个提交和 300 多个贡献者。 + +![Bulma GitHub][43] + +### Skeleton + +如果连 Pure 都觉得太重了,那么还有一个叫 [Skeleton][44] 的更轻量级框架。Skeleton 库只有 400 行左右的长度,而且这个框架只提供了开始你的 CSS 框架之旅的基本组件。 + +![Skeleton homepage][45] + +尽管它很简单,但 Skeleton 提供了详细的文档,可以帮助你马上上手。 + +![Skeleton documentation][46] + +Skeleton 的 [GitHub][9] 列出了 167 个提交和 22 个贡献者。然而,它不是很活跃,它的最后一次更新是在 2014 年,所以在使用之前可能需要一些维护。由于它是在 MIT 许可证下发布的,你可以自行维护。 + +![Skeleton GitHub][47] + +### Materialize + +[Materialize][48] 是一个基于 Google 的 Material Design 的响应式前端框架,带有由 Materialize 的贡献者开发的附加主题和组件。 + +![Materialize homepage][49] + +Materialize 的文档页面非常全面,而且相当容易理解。它的组件页面包括按钮、卡片、导航等等。 + +![Materialize documentation][50] + +Materialize 是 MIT 许可证下的开源项目,它的 [GitHub][10] 列出了超过 3800 个提交和 250 个贡献者。 + +![Materialize GitHub][51] + +### Bootflat + +[Bootflat][52] 是由 Twitter 的 Bootstrap 衍生出来的一个开源 CSS 框架。与 Bootstrap 相比, Bootflat 更简单,框架组件更轻量级。 + +![Bootflat homepage][53] + +Bootflat 的[文档][54]几乎像是受到了宜家的启发 —— 它显示的是每个组件的图片,没有太多的文字。 + +![Bootflat docs][55] + +Bootflat 是在 MIT 许可证下提供的,其 [GitHub][11] 页面包括 159 个提交和 8 个贡献者。 + +![Bootflat GitHub][56] + +### 你应该选择哪个 CSS 框架? + +对于开源的 CSS 框架,你有很多选择,这取决于你想要的工具功能有多丰富或简单。就像所有的技术决定一样,没有一个正确的答案,只有在给定的时间和项目中才有正确的选择。 + +尝试一下其中的一些,看看要在下一个项目中使用哪个。另外,我有没有错过任何有趣的开源 CSS 框架?请在下面的评论中分享你的反馈和想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-css-frameworks + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://en.wikipedia.org/wiki/Cascading_Style_Sheets +[3]: https://github.com/twbs/bootstrap +[4]: https://github.com/patternfly/patternfly +[5]: https://github.com/material-components/material-components-web +[6]: https://github.com/pure-css/pure +[7]: https://github.com/foundation/foundation-sites +[8]: https://github.com/jgthms/bulma +[9]: https://github.com/dhg/Skeleton +[10]: https://github.com/Dogfalo/materialize +[11]: https://github.com/bootflat/bootflat.github.io +[12]: https://getbootstrap.com +[13]: https://opensource.com/sites/default/files/uploads/2_bootstrapscreenshot.jpg (Bootstrap homepage) +[14]: https://getbootstrap.com/docs/4.4/examples/ +[15]: https://opensource.com/sites/default/files/uploads/3_bootstrapsamples.jpg (Bootstrap examples) +[16]: https://opensource.com/sites/default/files/uploads/4_bootstrapdocs.jpg (Bootstrap documentation) +[17]: https://opensource.com/sites/default/files/uploads/5_bootstrapgithub.jpg (Bootstrap GitHub) +[18]: https://www.patternfly.org +[19]: https://opensource.com/sites/default/files/uploads/6_patternflyhomepage.jpg (PatternFly homepage) +[20]: https://opensource.com/sites/default/files/uploads/7_patternflyreactjs.jpg (PatternFly ReactJS support) +[21]: https://en.wikipedia.org/wiki/Modal_window +[22]: https://opensource.com/sites/default/files/uploads/8_patternflycomponents.jpg (PatternFly chart component) +[23]: https://opensource.com/sites/default/files/uploads/9_patternflygithub.jpg (PatternFly GitHub) +[24]: https://material.io +[25]: https://opensource.com/sites/default/files/uploads/10_materialhome.jpg (Material Design homepage) +[26]: https://material.io/components/ +[27]: https://opensource.com/sites/default/files/uploads/11_materialcomponents.jpg (Material Components webpage) +[28]: https://opensource.com/sites/default/files/uploads/12_materialdocs.jpg (Material Design documentation) +[29]: https://opensource.com/sites/default/files/uploads/13_materialtutorial.jpg (Material Design tutorial) +[30]: https://opensource.com/sites/default/files/uploads/15_materialgithub.jpg (MDC Web GitHub) +[31]: https://purecss.io +[32]: https://opensource.com/sites/default/files/uploads/16_purehome.jpg (Pure.css homepage) +[33]: https://opensource.com/sites/default/files/uploads/17_purecomponents.jpg (Pure.css components) +[34]: https://opensource.com/sites/default/files/uploads/18_puregithub.jpg (Pure.css GitHub) +[35]: https://get.foundation +[36]: https://opensource.com/sites/default/files/uploads/19_foundationhome.jpg (Foundation homepage) +[37]: https://zurb.com/responsive +[38]: https://opensource.com/sites/default/files/uploads/21_foundationdocs.jpg (Foundation documentation) +[39]: https://opensource.com/sites/default/files/uploads/22_foundationgithub.jpg (Foundation GitHub) +[40]: https://bulma.io +[41]: https://opensource.com/sites/default/files/uploads/23_bulmahome.jpg (Bulma homepage) +[42]: https://opensource.com/sites/default/files/uploads/24_bulmadoc.jpg (Bulma documentation) +[43]: https://opensource.com/sites/default/files/uploads/25_bulmagithub.jpg (Bulma GitHub) +[44]: http://getskeleton.com +[45]: https://opensource.com/sites/default/files/uploads/26_skeletonhome.jpg (Skeleton homepage) +[46]: https://opensource.com/sites/default/files/uploads/27_skeletondocs.jpg (Skeleton documentation) +[47]: https://opensource.com/sites/default/files/uploads/28_skeletongithub.jpg (Skeleton GitHub) +[48]: https://materializecss.com +[49]: https://opensource.com/sites/default/files/uploads/29_materializehome.jpg (Materialize homepage) +[50]: https://opensource.com/sites/default/files/uploads/30_materializedocs.jpg (Materialize documentation) +[51]: https://opensource.com/sites/default/files/uploads/31_materializegithub.jpg (Materialize GitHub) +[52]: http://bootflat.github.io +[53]: https://opensource.com/sites/default/files/uploads/32_bootflathome.jpg (Bootflat homepage) +[54]: http://bootflat.github.io/documentation.html +[55]: https://opensource.com/sites/default/files/uploads/33_bootflatdocs.jpg (Bootflat docs) +[56]: https://opensource.com/sites/default/files/uploads/34_bootflatgithub.jpg (Bootflat GitHub) diff --git a/published/202005/20200414 How I containerize a build system.md b/published/202005/20200414 How I containerize a build system.md new file mode 100644 index 0000000000..e268f779ff --- /dev/null +++ b/published/202005/20200414 How I containerize a build system.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12232-1.html) +[#]: subject: (How I containerize a build system) +[#]: via: (https://opensource.com/article/20/4/how-containerize-build-system) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + +对构建系统进行容器化的指南 +====== + +> 搭建一个通过容器分发应用的可复用系统可能很复杂,但这儿有个好方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/19/085248ausakkjfu05akqr2.jpg) + +一个用于将源代码转换成可运行的应用的构建系统是由工具和流程共同组成。在转换过程中还涉及到代码的受众从软件开发者转变为最终用户,无论最终用户是运维的同事还是部署的同事。 + +在使用容器搭建了一些构建系统后,我觉得有一个不错的可复用的方法值得分享。虽然这些构建系统被用于编译机器学习算法和为嵌入式硬件生成可加载的软件镜像,但这个方法足够抽象,可用于任何基于容器的构建系统。 + +这个方法是以一种易于使用和维护的方式搭建或组织构建系统,但并不涉及处理特定编译器或工具容器化的技巧。它适用于软件开发人员构建软件,并将可维护镜像交给其他技术人员(无论是系统管理员、运维工程师或者其他一些头衔)的常见情况。该构建系统被从终端用户中抽象出来,这样他们就可以专注于软件。 + +### 为什么要容器化构建系统? + +搭建基于容器的可复用构建系统可以为软件团队带来诸多好处: + + * **专注**:我希望专注于应用的开发。当我调用一个工具进行“构建”时,我希望这个工具集能生成一个随时可用的二进制文件。我不想浪费时间在构建系统的查错上。实际上,我宁愿不了解,或者说不关心构建系统。 + * **一致的构建行为**:无论在哪种使用情况下,我都想确保整个团队使用相同版本的工具集并在构建时得到相同的结果。否则,我就得不断地处理“我这咋就是好的”的麻烦。在团队项目中,使用相同版本的工具集并对给定的输入源文件集产生一致的输出是非常重要。 + * **易于部署和升级**:即使向每个人都提供一套详细说明来安装一个项目的工具集,也可能会有人翻车。问题也可能是由于每个人对自己的 Linux 环境的个性化修改导致的。在团队中使用不同的 Linux 发行版(或者其他操作系统),情况可能还会变得更复杂。当需要将工具集升级到下一版本时,问题很快就会变得更糟糕。使用容器和本指南将使得新版本升级非常简单。 + +对我在项目中使用的构建系统进行容器化的这些经验显然很有价值,因为它可以缓解上述问题。我倾向于使用 Docker 作为容器工具,虽然在相对特殊的环境中安装和网络配置仍可能出现问题,尤其是当你在一个使用复杂代理的企业环境中工作时。但至少现在我需要解决的构建系统问题已经很少了。 + +### 漫步容器化的构建系统 + +我创建了一个[教程存储库][2],随后你可以克隆并检查它,或者按照本文内容进行操作。我将逐个介绍存储库中的文件。这个构建系统非常简单(它运行 `gcc`),从而可以让你专注于这个构建系统结构上。 + +### 构建系统需求 + +我认为构建系统中有两个关键点: + + * **标准化构建调用**:我希望能够指定一些形如 `/path/to/workdir` 的工作目录来构建代码。我希望以如下形式调用构建: + + ./build.sh /path/to/workdir + + 为了使得示例的结构足够简单(以便说明),我将假定输出也在 `/path/to/workdir` 路径下的某处生成。(否则,将增加容器中显示的卷的数量,虽然这并不困难,但解释起来比较麻烦。) + * **通过 shell 自定义构建调用**:有时,工具集会以出乎意料的方式被调用。除了标准的工具集调用 `build.sh` 之外,如果需要还可以为 `build.sh` 添加一些选项。但我一直希望能够有一个可以直接调用工具集命令的 shell。在这个简单的示例中,有时我想尝试不同的 `gcc` 优化选项并查看效果。为此,我希望调用: + + ./shell.sh /path/to/workdir + + 这将让我得到一个容器内部的 Bash shell,并且可以调用工具集和访问我的工作目录(`workdir`),从而我可以根据需要尝试使用这个工具集。 + +### 构建系统的架构 + +为了满足上述基本需求,这是我的构架系统架构: + +![Container build system architecture][3] + +在底部的 `workdir` 代表软件开发者用于构建的任意软件源码。通常,这个 `workdir` 是一个源代码的存储库。在构建之前,最终用户可以通过任何方式来操纵这个存储库。例如,如果他们使用 `git` 作为版本控制工具的话,可以使用 `git checkout` 切换到他们正在工作的功能分支上并添加或修改文件。这样可以使得构建系统独立于 `workdir` 之外。 + +顶部的三个模块共同代表了容器化的构建系统。最左边的黄色模块代表最终用户与构建系统交互的脚本(`build.sh` 和 `shell.sh`)。 + +在中间的红色模块是 Dockerfile 和相关的脚本 `build_docker_image.sh`。开发运营者(在这个例子中指我)通常将执行这个脚本并生成容器镜像(事实上我多次执行它直到一切正常为止,但这是另一回事)。然后我将镜像分发给最终用户,例如通过容器信任注册库container trusted registry进行分发。最终用户将需要这个镜像。另外,他们将克隆构建系统的存储库(即一个与[教程存储库][2]等效的存储库)。 + +当最终用户调用 `build.sh` 或者 `shell.sh` 时,容器内将执行右边的 `run_build.sh` 脚本。接下来我将详细解释这些脚本。这里的关键是最终用户不需要为了使用而去了解任何关于红色或者蓝色模块或者容器工作原理的知识。 + +### 构建系统细节 + +把教程存储库的文件结构映射到这个系统结构上。我曾将这个原型结构用于相对复杂构建系统,因此它的简单并不会造成任何限制。下面我列出存储库中相关文件的树结构。文件夹 `dockerize-tutorial` 能用构建系统的其他任何名称代替。在这个文件夹下,我用 `workdir` 的路径作参数调用 `build.sh` 或 `shell.sh`。 + +``` +dockerize-tutorial/ +├── build.sh +├── shell.sh +└── swbuilder +    ├── build_docker_image.sh +    ├── install_swbuilder.dockerfile +    └── scripts +        └── run_build.sh +``` + +请注意,我上面特意没列出 `example_workdir`,但你能在教程存储库中找到它。实际的源码通常存放在单独的存储库中,而不是构建工具库中的一部分;本教程为了不必处理两个存储库,所以我将它包含在这个存储库中。 + +如果你只对概念感兴趣,本教程并非必须的,因为我将解释所有文件。但是如果你继续本教程(并且已经安装 Docker),首先使用以下命令来构建容器镜像 `swbuilder:v1`: + +``` +cd dockerize-tutorial/swbuilder/ +./build_docker_image.sh +docker image ls  # resulting image will be swbuilder:v1 +``` + +然后调用 `build.sh`: + +``` +cd dockerize-tutorial +./build.sh ~/repos/dockerize-tutorial/example_workdir +``` + +下面是 [build.sh][4] 的代码。这个脚本从容器镜像 `swbuilder:v1` 实例化一个容器。而这个容器实例映射了两个卷:一个将文件夹 `example_workdir` 挂载到容器内部路径 `/workdir` 上,第二个则将容器外的文件夹 `dockerize-tutorial/swbuilder/scripts` 挂载到容器内部路径 `/scripts` 上。 + +``` +docker container run                              \ +    --volume $(pwd)/swbuilder/scripts:/scripts    \ +    --volume $1:/workdir                          \ +    --user $(id -u ${USER}):$(id -g ${USER})      \ +    --rm -it --name build_swbuilder swbuilder:v1  \ +    build +``` + +另外,`build.sh` 还会用你的用户名(以及组,本教程假设两者一致)去运行容器,以便在访问构建输出时不出现文件权限问题。 + +请注意,[shell.sh][5] 和 `build.sh` 大体上是一致的,除了两点不同:`build.sh` 会创建一个名为 `build_swbuilder` 的容器,而 `shell.sh` 则会创建一个名为 `shell_swbuilder` 的容器。这样一来,当其中一个脚本运行时另一个脚本被调用也不会产生冲突。 + +两个脚本之间的另一处关键不同则在于最后一个参数:`build.sh` 传入参数 `build` 而 `shell.sh` 则传入 `shell`。如果你看了用于构建容器镜像的 [Dockerfile][6],就会发现最后一行包含了下面的 `ENTRYPOINT` 语句。这意味着上面的 `docker container run` 调用将使用 `build` 或 `shell` 作为唯一的输入参数来执行 `run_build.sh` 脚本。 + +``` +# run bash script and process the input command +ENTRYPOINT [ "/bin/bash", "/scripts/run_build.sh"] +``` + +[run_build.sh][7] 使用这个输入参数来选择启动 Bash shell 还是调用 `gcc` 来构建 `helloworld.c` 项目。一个真正的构建系统通常会使用 Makefile 而非直接运行 `gcc`。 + +``` +cd /workdir + +if [ $1 = "shell" ]; then     +    echo "Starting Bash Shell" +    /bin/bash +elif [ $1 = "build" ]; then +    echo "Performing SW Build" +    gcc helloworld.c -o helloworld -Wall +fi +``` + +在使用时,如果你需要传入多个参数,当然也是可以的。我处理过的构建系统,构建通常是对给定的项目调用 `make`。如果一个构建系统有非常复杂的构建调用,则你可以让 `run_build.sh` 调用 `workdir` 下最终用户编写的特定脚本。 + +### 关于 scripts 文件夹的说明 + +你可能想知道为什么 `scripts` 文件夹位于目录树深处而不是位于存储库的顶层。两种方法都是可行的,但我不想鼓励最终用户到处乱翻并修改里面的脚本。将它放到更深的地方是一个让他们更难乱翻的方法。另外,我也可以添加一个 `.dockerignore` 文件去忽略 `scripts` 文件夹,因为它不是容器必需的部分。但因为它很小,所以我没有这样做。 + +### 简单而灵活 + +尽管这一方法很简单,但我在几个相当不同的构建系统中使用过,发现它相当灵活。相对稳定的部分(例如,一年仅修改数次的给定工具集)被固定在容器镜像内。较为灵活的部分则以脚本的形式放在镜像外。这使我能够通过修改脚本并将更改推送到构建系统存储库中,轻松修改调用工具集的方式。用户所需要做的是将更改拉到本地的构建系统存储库中,这通常是非常快的(与更新 Docker 镜像不同)。这种结构使其能够拥有尽可能多的卷和脚本,同时使最终用户摆脱复杂性。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/how-containerize-build-system + +作者:[Ravi Chandran][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_2015-3-osdc-lead.png?itok=O6aivM_W (Containers on a ship on the ocean) +[2]: https://github.com/ravi-chandran/dockerize-tutorial +[3]: https://opensource.com/sites/default/files/uploads/build_sys_arch.jpg (Container build system architecture) +[4]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/build.sh +[5]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/shell.sh +[6]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/install_swbuilder.dockerfile +[7]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/scripts/run_build.sh diff --git a/published/202005/20200416 Learning to love systemd.md b/published/202005/20200416 Learning to love systemd.md new file mode 100644 index 0000000000..5cacf21a0c --- /dev/null +++ b/published/202005/20200416 Learning to love systemd.md @@ -0,0 +1,318 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12214-1.html) +[#]: subject: (Learning to love systemd) +[#]: via: (https://opensource.com/article/20/4/systemd) +[#]: author: (David Both https://opensource.com/users/dboth) + +学会爱上 systemd +====== + +> systemd 是所有进程之母,负责将 Linux 主机启动到可以做生产性任务的状态。 + +![](https://img.linux.net.cn/data/attachment/album/202005/13/085016gy86wj713zh7xq71.jpg) + +systemd(是的,全小写,即使在句子开头也是小写),是初始化程序(`init`)和 SystemV 初始化脚本的现代替代者。此外,它还有更多功能。 + +当我想到 `init` 和 SystemV 初始化时,像大多数系统管理员一样,我想到的是 Linux 的启动和关闭,而不是真正意义上的管理服务,例如在服务启动和运行后对其进行管理。像 `init` 一样,systemd 是所有进程之母,它负责使 Linux 主机启动到可以做生产性任务的状态。systemd 设定的一些功能比老的初始化程序要广泛得多,它要管理正在运行的 Linux 主机的许多方面,包括挂载文件系统、管理硬件、处理定时器以及启动和管理生产性主机所需的系统服务。 + +本系列文章是基于我的三期 Linux 培训课程《[使用和管理 Linux:从零开始进行学习系统管理][2]》部分内容的摘录,探讨了 systemd 在启动和启动完成后的功能。 + +### Linux 引导 + +Linux 主机从关机状态到运行状态的完整启动过程很复杂,但它是开放的并且是可知的。在详细介绍之前,我将简要介绍一下从主机硬件被上电到系统准备好用户登录的过程。大多数时候,“引导过程”被作为一个整体来讨论,但这是不准确的。实际上,完整的引导和启动过程包含三个主要部分: + +* 硬件引导:初始化系统硬件 +* Linux 引导boot:加载 Linux 内核和 systemd +* Linux 启动startup:systemd 为主机的生产性工作做准备 + +Linux 启动阶段始于内核加载了 `init` 或 systemd(取决于具体发行版使用的是旧的方式还是还是新的方式)之后。`init` 和 systemd 程序启动并管理所有其它进程,它们在各自的系统上都被称为“所有进程之母”。 + +将硬件引导与 Linux 引导及 Linux 启动区分开,并明确定义它们之间的分界点是很重要的。理解它们的差异以及它们每一个在使 Linux 系统进入生产状态所起的作用,才能够管理这些进程,并更好地确定大部分人所谓的“启动”问题出在哪里。 + +启动过程按照三步引导流程,使 Linux 计算机进入可进行生产工作的状态。当内核将主机的控制权转移到 systemd 时,启动环节开始。 + +### systemd 之争 + +systemd 引起了系统管理员和其它负责维护 Linux 系统正常运行人员的广泛争议。在许多 Linux 系统中,systemd 接管了大量任务,这在某些开发者和sysadmins群体中引起了反对和不和谐。 + +SystemV 和 systemd 是执行 Linux 启动环节的两种不同的方法。SystemV 启动脚本和 `init` 程序是老的方法,而使用目标target的 systemd 是新方法。尽管大多数现代 Linux 发行版都使用较新的 systemd 进行启动、关机和进程管理,但仍有一些发行版未采用。原因之一是某些发行版维护者和系统管理员喜欢老的 SystemV 方法,而不是新的 systemd。 + +我认为两者都有其优势。 + +#### 为何我更喜欢 SystemV + +我更喜欢 SystemV,因为它更开放。使用 Bash 脚本来完成启动。内核启动 `init` 程序(这是一个编译后的二进制)后,`init` 启动 `rc.sysinit` 脚本,该脚本执行许多系统初始化任务。`rc.sysinit` 执行完后,`init` 启动 `/etc/rc.d/rc` 脚本,该脚本依次启动 `/etc/rc.d/rcX.d` 中由 SystemV 启动脚本定义的各种服务。其中 `X` 是待启动的运行级别号。 + +除了 `init` 程序本身之外,所有这些程序都是开放且易于理解的脚本。可以通读这些脚本并确切了解整个启动过程中发生的事情,但是我不认为有太多系统管理员真正做到这一点。每个启动脚本都被编了号,以便按特定顺序启动预期的服务。服务是串行启动的,一次只能启动一个服务。 + +systemd 是由 Red Hat 的 Lennart Poettering 和 Kay Sievers 开发的,它是一个由大型的、编译的二进制可执行文件构成的复杂系统,不访问其源码就无法理解。它是开源的,因此“访问其源代码”并不难,只是不太方便。systemd 似乎表现出对 Linux 哲学多个原则的重大驳斥。作为二进制文件,systemd 无法被直接打开供系统管理员查看或进行简单更改。systemd 试图做所有事情,例如管理正在运行的服务,同时提供明显比 SystemV 更多的状态信息。它还管理硬件、进程、进程组、文件系统挂载等。systemd 几乎涉足于现代 Linux 主机的每个方面,使它成为系统管理的一站式工具。所有这些都明显违反了“程序应该小,且每个程序都应该只做一件事并做好”的原则。 + +#### 为何我更喜欢 systemd + +我更喜欢用 systemd 作为启动机制,因为它会根据启动阶段并行地启动尽可能多的服务。这样可以加快整个的启动速度,使得主机系统比 SystemV 更快地到达登录屏幕。 + +systemd 几乎可以管理正在运行的 Linux 系统的各个方面。它可以管理正在运行的服务,同时提供比SystemV 多得多的状态信息。它还管理硬件、进程和进程组、文件系统挂载等。systemd 几乎涉足于现代 Linux 操作系统的每方面,使其成为系统管理的一站式工具。(听起来熟悉吧?) + +systemd 工具是编译后的二进制文件,但该工具包是开放的,因为所有配置文件都是 ASCII 文本文件。可以通过各种 GUI 和命令行工具来修改启动配置,也可以添加或修改各种配置文件来满足特定的本地计算环境的需求。 + +#### 真正的问题 + +你认为我不能喜欢两种启动系统吗?我能,我会用它们中的任何一个。 + +我认为,SystemV 和 systemd 之间大多数争议的真正问题和根本原因在于,在系统管理层面[没有选择权][3]。使用 SystemV 还是 systemd 已经由各种发行版的开发人员、维护人员和打包人员选择了(但有充分的理由)。由于 `init` 极端的侵入性,挖出并替换 `init` 系统会带来很多影响,会带来很多在发行版设计过程之外难以解决的后果。 + +尽管该选择实际上是为我而选的,但我的Linux主机能不能开机、能不能工作,这是我平时最关心的。作为最终用户,甚至是系统管理员,我主要关心的是我是否可以完成我的工作,例如写我的书和这篇文章,安装更新以及编写脚本来自动化所有事情。只要我能做我的工作,我就不会真正在意发行版中使用的启动系统。 + +在启动或服务管理出现问题时,我会在意。无论主机上使用哪种启动系统,我都足够了解如何沿着事件顺序来查找故障并进行修复。 + +#### 替换SystemV + +以前曾有过用更现代的东西替代 SystemV 的尝试。大约在两个版本中,Fedora 使用了一个叫作 Upstart 的东西来替换老化的 SystemV,但是它没有取代 `init`,也没有提供我所注意到的任何变化。由于 Upstart 并未对 SystemV 的问题进行任何显著的改变,所以在这个方向上的努力很快就被放弃了,转而使用 systemd。 + +尽管大部分 Linux 开发人员都认可替换旧的 SystemV 启动系统是个好主意,但许多开发人员和系统管理员并不喜欢 systemd。与其重新讨论人们在 systemd 中遇到的或曾经遇到过的所有所谓的问题,不如带你去看两篇好文章,尽管有些陈旧,但它们涵盖了大多数内容。Linux 内核的创建者 Linus Torvalds 对 systemd 似乎不感兴趣。在 2014 年 ZDNet 的一篇文章《[Linus Torvalds 和其他人对 Linux 上的 systemd 的看法][4]》中,Linus 清楚地表达了他的感受。 + +> “实际上我对 systemd 本身没有任何特别强烈的意见。我对一些核心开发人员有一些问题,我认为他们在对待错误和兼容性方面过于轻率,而且我认为某些设计细节是疯狂的(例如,我不喜欢二进制日志),但这只是细节,不是大问题。” + +如果你对 Linus 不太了解的话,我可以告诉你,如果他不喜欢某事,他是非常直言不讳的,很明确,而且相当明确的表示不喜欢。他解决自己对事物不满的方式已经被社会更好地接受了。 + +2013 年,Poettering 写了一篇很长的博客,他在文章驳斥了[关于 systemd 的迷思][5],同时对创建 systemd 的一些原因进行了深入的剖析。这是一分很好的读物,我强烈建议你阅读。 + +### systemd 任务 + +根据编译过程中使用的选项(不在本系列中介绍),systemd 可以有多达 69 个二进制可执行文件执行以下任务,其中包括: + +* `systemd` 程序以 1 号进程(PID 1)运行,并提供使尽可能多服务并行启动的系统启动能力,它额外加快了总体启动时间。它还管理关机顺序。 +* `systemctl` 程序提供了服务管理的用户接口。 +* 支持 SystemV 和 LSB 启动脚本,以便向后兼容。 +* 服务管理和报告提供了比 SystemV 更多的服务状态数据。 +* 提供基本的系统配置工具,例如主机名、日期、语言环境、已登录用户的列表,正在运行的容器和虚拟机、系统帐户、运行时目录及设置,用于简易网络配置、网络时间同步、日志转发和名称解析的守护进程。 +* 提供套接字管理。 +* systemd 定时器提供类似 cron 的高级功能,包括在相对于系统启动、systemd 启动时间、定时器上次启动时间的某个时间点运行脚本。 +* 它提供了一个工具来分析定时器规范中使用的日期和时间。 +* 能感知分层的文件系统挂载和卸载功能可以更安全地级联挂载的文件系统。 +* 允许主动的创建和管理临时文件,包括删除。 +* D-Bus 的接口提供了在插入或移除设备时运行脚本的能力。这允许将所有设备(无论是否可插拔)都被视为即插即用,从而大大简化了设备的处理。 +* 分析启动环节的工具可用于查找耗时最多的服务。 +* 它包括用于存储系统消息的日志以及管理日志的工具。 + +### 架构 + +这些以及更多的任务通过许多守护程序、控制程序和配置文件来支持。图 1 显示了许多属于 systemd 的组件。这是一个简化的图,旨在提供概要描述,因此它并不包括所有独立的程序或文件。它也不提供数据流的视角,数据流是如此复杂,因此在本系列文章的背景下没用。 + +![系统架构][6] + +*图 1:systemd 的架构,作者 Shmuel Csaba Otto Traian (CC BY-SA 3.0)* + +如果要完整地讲解 systemd 就需要一本书。你不需要了解图 1 中的 systemd 组件是如何组合在一起的细节。只需了解支持各种 Linux 服务管理以及日志文件和日志处理的程序和组件就够了。但是很明显, systemd 并不是某些批评者所宣称的那样,它是一个单一的怪物。 + +### 作为 1 号进程的 systemd + +systemd 是 1 号进程(PID 1)。它的一些功能,比老的 SystemV3 `init` 要广泛得多,用于管理正在运行的 Linux 主机的许多方面,包括挂载文件系统以及启动和管理 Linux 生产主机所需的系统服务。与启动环节无关的任何 systemd 任务都不在本文讨论范围之内(但本系列后面的一些文章将探讨其中的一些任务)。 + +首先,systemd 挂载 `/etc/fstab` 所定义的文件系统,包括所有交换文件或分区。此时,它可以访问位于 `/etc` 中的配置文件,包括它自己的配置文件。它使用其配置链接 `/etc/systemd/system/default.target` 来确定将主机引导至哪个状态或目标。`default.target` 文件是指向真实目标文件的符号链接。对于桌面工作站,通常是 `graphical.target`,它相当于 SystemV 中的运行级别 5。对于服务器,默认值更可能是 `multi-user.target`,相当于 SystemV 中的运行级别 3。`emergency.target` 类似于单用户模式。目标target服务service是 systemd 的单元unit。 + +下表(图 2)将 systemd 目标与老的 SystemV 启动运行级别进行了比较。systemd 提供 systemd 目标别名以便向后兼容。目标别名允许脚本(以及许多系统管理员)使用 SystemV 命令(如 `init 3`)更改运行级别。当然,SystemV 命令被转发给 systemd 进行解释和执行。 + +systemd 目标 | SystemV 运行级别 | 目标别名 | 描述 +--- | --- | --- | --- +`default.target` | | | 此目标总是通过符号连接的方式成为 `multi-user.target` 或 `graphical.target` 的别名。systemd 始终使用 `default.target` 来启动系统。`default.target` 绝不应该设为 `halt.target`,`poweroff.target` 或 `reboot.target` 的别名。 +`graphic.target` | 5 | `runlevel5.target` |带有 GUI 的 `multi-user.target`。 + | 4 | `runlevel4.target` |未用。在 SystemV 中运行级别 4 与运行级别 3 相同。可以创建并自定义此目标以启动本地服务,而无需更改默认的 `multi-user.target`。 +`multi-user.target` | 3 | `runlevel3.target` |所有服务在运行,但仅有命令行界面(CLI)。 + | 2 | `runlevel2.target` | 多用户,没有 NFS,其它所有非 GUI 服务在运行。 +`rescue.target` | 1 | `runlevel1.target` | 基本系统,包括挂载文件系统,运行最基本的服务和主控制台的恢复 shell。 +`emergency.target` | S | |单用户模式:没有服务运行;不挂载文件系统。这是最基本的工作级别,只有主控制台上运行的一个紧急 Shell 供用户与系统交互。 +`halt.target` | | | 停止系统而不关闭电源。 +`reboot.target` | 6 | `runlevel6.target` | 重启。 +`poweroff.target` | 0 | `runlevel0.target` | 停止系统并关闭电源。 + +*图 2:SystemV 运行级别与 systemd 目标和一些目标别名的比较* + +每个目标在其配置文件中都描述了一个依赖集。systemd 启动必须的依赖项,这些依赖项是运行 Linux 主机到特定功能级别所需的服务。当目标配置文件中列出的所有依赖项被加载并运行后,系统就在该目标级别运行了。在图 2 中,功能最多的目标位于表的顶部,从顶向下,功能逐步递减。 + +systemd 还会检查老的 SystemV `init` 目录,以确认是否存在任何启动文件。如果有,systemd 会将它们作为配置文件以启动它们描述的服务。网络服务是一个很好的例子,在 Fedora 中它仍然使用 SystemV 启动文件。 + +图 3(如下)是直接从启动手册页复制来的。它显示了 systemd 启动期间一般的事件环节以及确保成功启动的基本顺序要求。 + +``` + cryptsetup-pre.target + | + (various low-level v + API VFS mounts: (various cryptsetup devices...) + mqueue, configfs, | | + debugfs, ...) v | + | cryptsetup.target | + | (various swap | | remote-fs-pre.target + | devices...) | | | | + | | | | | v + | v local-fs-pre.target | | | (network file systems) + | swap.target | | v v | + | | v | remote-cryptsetup.target | + | | (various low-level (various mounts and | | | + | | services: udevd, fsck services...) | | remote-fs.target + | | tmpfiles, random | | | / + | | seed, sysctl, ...) v | | / + | | | local-fs.target | | / + | | | | | | / + \____|______|_______________ ______|___________/ | / + \ / | / + v | / + sysinit.target | / + | | / + ______________________/|\_____________________ | / + / | | | \ | / + | | | | | | / + v v | v | | / + (various (various | (various | |/ + timers...) paths...) | sockets...) | | + | | | | | | + v v | v | | + timers.target paths.target | sockets.target | | + | | | | v | + v \_______ | _____/ rescue.service | + \|/ | | + v v | + basic.target rescue.target | + | | + ________v____________________ | + / | \ | + | | | | + v v v | + display- (various system (various system | + manager.service services services) | + | required for | | + | graphical UIs) v v + | | multi-user.target + emergency.service | | | + | \_____________ | _____________/ + v \|/ + emergency.target v + graphical.target +``` + +*图 3: systemd 启动图* + +`sysinit.target` 和 `basic.target` 目标可以看作启动过程中的检查点。尽管 systemd 的设计目标之一是并行启动系统服务,但是某些服务和功能目标必须先启动,然后才能启动其它服务和目标。直到该检查点所需的所有服务和目标被满足后才能通过这些检查点。 + +当 `sysinit.target` 所依赖的所有单元都完成时,就会到达 `sysinit.target`。所有这些单元,包括挂载文件系统、设置交换文件、启动 Udev、设置随机数生成器种子、启动低层服务以及配置安全服务(如果一个或多个文件系统是加密的)都必须被完成,但在 `sysinit.target` 中,这些任务可以并行执行。 + +`sysinit.target` 启动了系统接近正常运行所需的所有低层服务和单元,它们也是进入 `basic.target` 所需的。 + +在完成 `sysinit.target` 之后,systemd 会启动实现下一个目标所需的所有单元。`basic.target` 通过启动所有下一目标所需的单元来提供一些额外功能。包括设置为各种可执行程序目录的路径、设置通信套接字和计时器之类。 + +最后,用户级目标 `multi-user.target` 或 `graphical.target` 被初始化。要满足 `graphical.target` 的依赖必须先达到 `multi-user.target`。图 3 中带下划线的目标是通常的启动目标。当达到这些目标之一时,启动就完成了。如果 `multi-user.target` 是默认设置,那么你应该在控制台上看到文本模式的登录界面。如果 `graphical.target` 是默认设置,那么你应该看到图形的登录界面。你看到的具体的 GUI 登录界面取决于你的默认显示管理器。 + +引导手册页还描述并提供了引导到初始化 RAM 磁盘和 systemd 关机过程的图。 + +systemd 还提供了一个工具,该工具列出了完整的启动过程或指定单元的依赖项。单元是一个可控的 systemd 资源实体,其范围可以从特定服务(例如 httpd 或 sshd)到计时器、挂载、套接字等。尝试以下命令并滚动查看结果。 + +``` +systemctl list-dependencies graphical.target +``` + +注意,这会完全展开使系统进入 `graphical.target` 运行模式所需的顶层目标单元列表。也可以使用 `--all` 选项来展开所有其它单元。 + +``` +systemctl list-dependencies --all graphical.target +``` + +你可以使用 `less` 命令来搜索诸如 `target`、`slice` 和 `socket` 之类的字符串。 + +现在尝试下面的方法。 + +``` +systemctl list-dependencies multi-user.target +``` + +和 + +``` +systemctl list-dependencies rescue.target +``` + +和 + +``` +systemctl list-dependencies local-fs.target +``` + +和 + +``` +systemctl list-dependencies dbus.service +``` + +这个工具帮助我可视化我正用的主机的启动依赖细节。继续花一些时间探索一个或多个 Linux 主机的启动树。但是要小心,因为 systemctl 手册页包含以下注释: + +> “请注意,此命令仅列出当前被服务管理器加载到内存的单元。尤其是,此命令根本不适合用于获取特定单元的全部反向依赖关系列表,因为它不会列出被单元声明了但是未加载的依赖项。” + +### 结尾语 + +即使在没有深入研究 systemd 之前,很明显能看出它既强大又复杂。显然,systemd 不是单一、庞大、独体且不可知的二进制文件。相反,它是由许多较小的组件和旨在执行特定任务的子命令组成。 + +本系列的下一篇文章将更详细地探讨 systemd 的启动,以及 systemd 的配置文件,更改默认的目标以及如何创建简单服务单元。 + +### 资源 + +互联网上有大量关于 systemd 的信息,但是很多都很简短、晦涩甚至是带有误导。除了本文提到的资源外,以下网页还提供了有关 systemd 启动的更详细和可靠的信息。 + +* Fedora 项目有一个很好的实用的 [systemd 指南][7]。它有你需要知道的通过 systemd 来配置、管理和维护 Fedora 主机所需的几乎所有知识。 +* Fedora 项目还有一个不错的[速记表][8],将老的 SystemV 命令与对比的 systemd 命令相互关联。 +* 有关 systemd 的详细技术信息及创建它的原因,请查看 [Freedesktop.org][9] 对 [systemd 描述][10]。 +* [Linux.com][11] 的“systemd 的更多乐趣”提供了更高级的 systemd [信息和技巧][12]。 + +还有针对 Linux 系统管理员的一系列技术性很强的文章,作者是 systemd 的设计师和主要开发者 Lennart Poettering。这些文章是在 2010 年 4 月至 2011 年 9 月之间撰写的,但它们现在和那时一样有用。关于 systemd 及其生态的其它许多好文都基于这些论文。 + +* [重新思考 1 号进程][13] +* [systemd 系统管理员篇 I][14] +* [systemd 系统管理员篇 II][15] +* [systemd 系统管理员篇 III][16] +* [systemd 系统管理员篇 IV][17] +* [systemd 系统管理员篇 V][18] +* [systemd 系统管理员篇 VI][19] +* [systemd 系统管理员篇 VII][20] +* [systemd 系统管理员篇 VIII][21] +* [systemd 系统管理员篇 IX][22] +* [systemd 系统管理员篇 X][23] +* [systemd 系统管理员篇 XI][24] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/systemd + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: http://www.both.org/?page_id=1183 +[3]: http://www.osnews.com/story/28026/Editorial_Thoughts_on_Systemd_and_the_Freedom_to_Choose +[4]: https://www.zdnet.com/article/linus-torvalds-and-others-on-linuxs-systemd/ +[5]: http://0pointer.de/blog/projects/the-biggest-myths.html +[6]: https://opensource.com/sites/default/files/uploads/systemd-architecture.png (systemd architecture) +[7]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[8]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[9]: http://Freedesktop.org +[10]: http://www.freedesktop.org/wiki/Software/systemd +[11]: http://Linux.com +[12]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[13]: http://0pointer.de/blog/projects/systemd.html +[14]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[15]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[16]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[18]: http://0pointer.de/blog/projects/three-levels-of-off.html +[19]: http://0pointer.de/blog/projects/changing-roots +[20]: http://0pointer.de/blog/projects/blame-game.html +[21]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[22]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[23]: http://0pointer.de/blog/projects/instances.html +[24]: http://0pointer.de/blog/projects/inetd.html diff --git a/published/202005/20200417 Create a SDN on Linux with open source.md b/published/202005/20200417 Create a SDN on Linux with open source.md new file mode 100644 index 0000000000..e05b649ee1 --- /dev/null +++ b/published/202005/20200417 Create a SDN on Linux with open source.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12199-1.html) +[#]: subject: (Create a SDN on Linux with open source) +[#]: via: (https://opensource.com/article/20/4/quagga-linux) +[#]: author: (M Umer https://opensource.com/users/noisybotnet) + +在 Linux 上使用开源软件创建 SDN +====== + +> 使用开源路由协议栈 Quagga,使你的 Linux 系统成为一台路由器。 + +![](https://img.linux.net.cn/data/attachment/album/202005/09/093541rqx3zr5dxn3yvnq6.jpg) + +网络路由协议分为两大类:内部网关协议和外部网关协议。路由器使用内部网关协议在单个自治系统内共享信息。如果你用的是 Linux,则可以通过开源(GPLv2)路由协议栈 [Quagga][2] 使其表现得像一台路由器。 + +### Quagga 是什么? + +Quagga 是一个[路由软件包][3],并且是 [GNU Zebra][4] 的一个分支。它为类 Unix 平台提供了所有主流路由协议的实现,例如开放最短路径优先(OSPF),路由信息协议(RIP),边界网关协议(BGP)和中间系统到中间系统协议(IS-IS)。 + +尽管 Quagga 实现了 IPv4 和 IPv6 的路由协议,但它并不是一个完整的路由器。一个真正的路由器不仅实现了所有路由协议,而且还有转发网络流量的能力。 Quagga 仅仅实现了路由协议栈,而转发网络流量的工作由 Linux 内核处理。 + +### 架构 + +Quagga 通过特定协议的守护程序实现不同的路由协议。守护程序名称与路由协议相同,加了字母“d”作为后缀。Zebra 是核心,也是与协议无关的守护进程,它为内核提供了一个[抽象层][5],并通过 TCP 套接字向 Quagga 客户端提供 Zserv API。每个特定协议的守护程序负责运行相关的协议,并基于交换的信息来建立路由表。 + +![Quagga architecture][6] + +### 环境 + +本教程通过 Quagga 实现的 OSPF 协议来配置动态路由。该环境包括两个名为 Alpha 和 Beta 的 CentOS 7.7 主机。两台主机共享访问 **192.168.122.0/24** 网络。 + +**主机 Alpha:** + +IP:192.168.122.100/24 +网关:192.168.122.1 + +**主机 Beta:** + +IP:192.168.122.50/24 +网关:192.168.122.1 + +### 安装软件包 + +首先,在两台主机上安装 Quagga 软件包。它存在于 CentOS 基础仓库中: + +``` +yum install quagga -y +``` + +### 启用 IP 转发 + +接下来,在两台主机上启用 IP 转发,因为它将由 Linux 内核来执行: + +``` +sysctl -w net.ipv4.ip_forward = 1 +sysctl -p +``` + +### 配置 + +现在,进入 `/etc/quagga` 目录并为你的设置创建配置文件。你需要三个文件: + +* `zebra.conf`:Quagga 守护程序的配置文件,你可以在其中定义接口及其 IP 地址和 IP 转发 +* `ospfd.conf`:协议配置文件,你可以在其中定义将通过 OSPF 协议提供的网络 +* `daemons`:你将在其中指定需要运行的相关的协议守护程序 + +在主机 Alpha 上, + +``` + [root@alpha]# cat /etc/quagga/zebra.conf +interface eth0 + ip address 192.168.122.100/24 + ipv6 nd suppress-ra +interface eth1 + ip address 10.12.13.1/24 + ipv6 nd suppress-ra +interface lo +ip forwarding +line vty + +[root@alpha]# cat /etc/quagga/ospfd.conf +interface eth0 +interface eth1 +interface lo +router ospf + network 192.168.122.0/24 area 0.0.0.0 + network 10.12.13.0/24 area 0.0.0.0 +line vty + +[root@alphaa ~]# cat /etc/quagga/daemons +zebra=yes +ospfd=yes +``` + +在主机 Beta 上, + +``` +[root@beta quagga]# cat zebra.conf +interface eth0 + ip address 192.168.122.50/24 + ipv6 nd suppress-ra +interface eth1 + ip address 10.10.10.1/24 + ipv6 nd suppress-ra +interface lo +ip forwarding +line vty + +[root@beta quagga]# cat ospfd.conf +interface eth0 +interface eth1 +interface lo +router ospf + network 192.168.122.0/24 area 0.0.0.0 + network 10.10.10.0/24 area 0.0.0.0 +line vty + +[root@beta ~]# cat /etc/quagga/daemons +zebra=yes +ospfd=yes +``` + +### 配置防火墙 + +要使用 OSPF 协议,必须允许它通过防火墙: + +``` +firewall-cmd --add-protocol=ospf –permanent + +firewall-cmd –reload +``` + +现在,启动 `zebra` 和 `ospfd` 守护程序。 + +``` +# systemctl start zebra +# systemctl start ospfd +``` + +用下面命令在两个主机上查看路由表: + +``` +[root@alpha ~]# ip route show   +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 via 192.168.122.50 dev eth0 proto zebra metric 20 +10.12.13.0/24 dev eth1 proto kernel scope link src 10.12.13.1 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100 +``` + +你可以看到 Alpha 上的路由表包含通过 **192.168.122.50** 到达 **10.10.10.0/24** 的路由项,它是通过协议 zebra 获取的。同样,在主机 Beta 上,该表包含通过 **192.168.122.100** 到达网络 **10.12.13.0/24** 的路由项。 + +``` +[root@beta ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 dev eth1 proto kernel scope link src 10.10.10.1 +10.12.13.0/24 via 192.168.122.100 dev eth0 proto zebra metric 20 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.50 metric 100 +``` + +### 结论 + +如你所见,环境和配置相对简单。要增加复杂性,你可以向路由器添加更多网络接口,以为更多网络提供路由。你也可以使用相同的方法来实现 BGP 和 RIP 协议。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/quagga-linux + +作者:[M Umer][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/noisybotnet +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://www.quagga.net/ +[3]: https://en.wikipedia.org/wiki/Quagga_(software) +[4]: https://www.gnu.org/software/zebra/ +[5]: https://en.wikipedia.org/wiki/Abstraction_layer +[6]: https://opensource.com/sites/default/files/uploads/quagga_arch.png (Quagga architecture) diff --git a/published/202005/20200417 How to compress files on Linux 5 ways.md b/published/202005/20200417 How to compress files on Linux 5 ways.md new file mode 100644 index 0000000000..5ba0c7feeb --- /dev/null +++ b/published/202005/20200417 How to compress files on Linux 5 ways.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12190-1.html) +[#]: subject: (How to compress files on Linux 5 ways) +[#]: via: (https://www.networkworld.com/article/3538471/how-to-compress-files-on-linux-5-ways.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上压缩文件的 5 种方法 +====== + +> 在 Linux 系统上有很多可以用于压缩文件的工具,但它们的表现并不都是一样的,也不是所有的压缩效果都是一样的。在这篇文章中,我们比较其中的五个工具。 + +![](https://img.linux.net.cn/data/attachment/album/202005/06/231536tgxma941yb8dgl53.jpg) + +在 Linux 上有不少用于压缩文件的命令。最新最有效的一个方法是 `xz`,但是所有的方法都有节省磁盘空间和维护备份文件供以后使用的优点。在这篇文章中,我们将比较这些压缩命令并指出显著的不同。 + +### tar + +`tar` 命令不是专门的压缩命令。它通常用于将多个文件拉入一个单个的文件中,以便容易地传输到另一个系统,或者将文件作为一个相关的组进行备份。它也提供压缩的功能,这就很有意义了,附加一个 `z` 压缩选项能够实现压缩文件。 + +当使用 `z` 选项为 `tar` 命令附加压缩过程时,`tar` 使用 `gzip` 来进行压缩。 + +就像压缩一组文件一样,你可以使用 `tar` 来压缩单个文件,尽管这种操作与直接使用 `gzip` 相比没有特别的优势。要使用 `tar` 这样做,只需要使用 `tar cfz newtarfile filename` 命令来标识要压缩的文件,就像标识一组文件一样,像这样: + +``` +$ tar cfz bigfile.tgz bigfile + ^ ^ + | | + +- 新的文件 +- 将被压缩的文件 + +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 103270400 Apr 16 16:09 bigfile +-rw-rw-r-- 1 shs shs 21608325 Apr 16 16:08 bigfile.tgz +``` + +注意,文件的大小显著减少了。 + +如果你愿意,你可以使用 `tar.gz` 扩展名,这可能会使文件的特征更加明显,但是大多数的 Linux 用户将很可能会意识到与 `tgz` 的意思是一样的 – `tar` 和 `gz` 的组合来显示文件是一个压缩的 tar 文件。在压缩完成后,你将同时得到原始文件和压缩文件。 + +要将很多文件收集在一起并在一个命令中压缩出 “tar ball”,使用相同的语法,但要指定要包含的文件为一组,而不是单个文件。这里有一个示例: + +``` +$ tar cfz bin.tgz bin/* + ^ ^ + | +-- 将被包含的文件 + + 新的文件 +``` + +### zip + +`zip` 命令创建一个压缩文件,与此同时保留原始文件的完整性。语法像使用 `tar` 一样简单,只是你必需记住,你的原始文件名称应该是命令行上的最后一个参数。 + +``` +$ zip ./bigfile.zip bigfile +updating: bigfile (deflated 79%) +$ ls -l bigfile bigfile.zip +-rw-rw-r-- 1 shs shs 103270400 Apr 16 11:18 bigfile +-rw-rw-r-- 1 shs shs 21606889 Apr 16 11:19 bigfile.zip +``` + +### gzip + +`gzip` 命令非常容易使用。你只需要键入 `gzip`,紧随其后的是你想要压缩的文件名称。不像上述描述的命令,`gzip` 将“就地”“加密”文件。换句话说,原始文件将被“加密”文件替换。 + +``` +$ gzip bigfile +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 21606751 Apr 15 17:57 bigfile.gz +``` + +### bzip2 + +像使用 `gzip` 命令一样,`bzip2` 将在你选择的文件“就地”压缩,不留下原始文件。 + +``` +$ bzip bigfile +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 18115234 Apr 15 17:57 bigfile.bz2 +``` + +### xz + +`xz` 是压缩命令团队中的一个相对较新的成员,在压缩文件的能力方面,它是一个领跑者。像先前的两个命令一样,你只需要将文件名称提供给命令。再强调一次,原始文件被就地压缩。 + +``` +$ xz bigfile +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 13427236 Apr 15 17:30 bigfile.xz +``` + +对于大文件来说,你可能会注意到 `xz` 将比其它的压缩命令花费更多的运行时间,但是压缩的结果却是非常令人赞叹的。 + +### 对比 + +大多数人都听说过“大小不是一切”。所以,让我们比较一下文件大小以及一些当你计划如何压缩文件时的问题。 + +下面显示的统计数据都与压缩单个文件相关,在上面显示的示例中使用 `bigfile`。这个文件是一个大的且相当随机的文本文件。压缩率在一定程度上取决于文件的内容。 + +#### 大小减缩率 + +当比较时,上面显示的各种压缩命产生下面的结果。百分比表示压缩文件与原始文件的比较效果。 + +``` +-rw-rw-r-- 1 shs shs 103270400 Apr 16 14:01 bigfile +------------------------------------------------------ +-rw-rw-r-- 1 shs shs 18115234 Apr 16 13:59 bigfile.bz2 ~17% +-rw-rw-r-- 1 shs shs 21606751 Apr 16 14:00 bigfile.gz ~21% +-rw-rw-r-- 1 shs shs 21608322 Apr 16 13:59 bigfile.tgz ~21% +-rw-rw-r-- 1 shs shs 13427236 Apr 16 14:00 bigfile.xz ~13% +-rw-rw-r-- 1 shs shs 21606889 Apr 16 13:59 bigfile.zip ~21% +``` + +`xz` 命令获胜,最终只有压缩文件 13% 的大小,但是所有这些压缩命令都相当显著地减少原始文件的大小。 + +#### 是否替换原始文件 + +`bzip2`、`gzip` 和 `xz` 命令都用压缩文件替换原始文件。`tar` 和 `zip` 命令不替换。 + +#### 运行时间 + +`xz` 命令似乎比其它命令需要花费更多的时间来“加密”文件。对于 `bigfile` 来说,大概的时间是: + +``` +命令 运行时间 +tar 4.9 秒 +zip 5.2 秒 +bzip2 22.8 秒 +gzip 4.8 秒 +xz 50.4 秒 +``` + +解压缩文件很可能比压缩时间要短得多。 + +#### 文件权限 + +不管你对压缩文件设置什么权限,压缩文件的权限将基于你的 `umask` 设置,但 `bzip2` 除外,它保留了原始文件的权限。 + +#### 与 Windows 的兼容性 + +`zip` 命令创建的文件可以在 Windows 系统以及 Linux 和其他 Unix 系统上使用(即解压),而无需安装其他工具,无论这些工具可能是可用还是不可用的。 + +### 解压缩文件 + +解压文件的命令与压缩文件的命令类似。在我们运行上述压缩命令后,这些命令用于解压缩 `bigfile`: + + * tar: `tar xf bigfile.tgz` + * zip: `unzip bigfile.zip` + * gzip: `gunzip bigfile.gz` + * bzip2: `bunzip2 bigfile.gz2` + * xz: `xz -d bigfile.xz` 或 `unxz bigfile.xz` + +### 自己运行压缩对比 + +如果你想自己运行一些测试,抓取一个大的且可以替换的文件,并使用上面显示的每个命令来压缩它 —— 最好使用一个新的子目录。你可能需要先安装 `xz`,如果你想在测试中包含它的话。这个脚本可能更容易地进行压缩,但是可能需要花费几分钟完成。 + +``` +#!/bin/bash + +# 询问用户文件名称 +echo -n "filename> " +read filename + +# 你需要这个,因为一些命令将替换原始文件 +cp $filename $filename-2 + +# 先清理(以免先前的结果仍然可用) +rm $filename.* + +tar cvfz ./$filename.tgz $filename > /dev/null +zip $filename.zip $filename > /dev/null +bzip2 $filename +# 恢复原始文件 +cp $filename-2 $filename +gzip $filename +# 恢复原始文件 +cp $filename-2 $filename +xz $filename + +# 显示结果 +ls -l $filename.* + +# 替换原始文件 +mv $filename-2 $filename +``` + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538471/how-to-compress-files-on-linux-5-ways.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202005/20200420 4 Git scripts I can-t live without.md b/published/202005/20200420 4 Git scripts I can-t live without.md new file mode 100644 index 0000000000..43102c69e6 --- /dev/null +++ b/published/202005/20200420 4 Git scripts I can-t live without.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12180-1.html) +[#]: subject: (4 Git scripts I can't live without) +[#]: via: (https://opensource.com/article/20/4/git-extras) +[#]: author: (Vince Power https://opensource.com/users/vincepower) + +4 个不可或缺的 Git 脚本 +====== + +> Git Extras 版本库包含了 60 多个脚本,它们是 Git 基本功能的补充。以下是如何安装、使用和贡献的方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/03/211446dshwbzoh235b3gre.jpg) + +2005 年,[Linus Torvalds][2] 创建了 [Git][3],以取代他之前用于维护 Linux 内核的分布式源码控制管理的专有解决方案。从那时起,Git 已经成为开源和云原生开发团队的主流版本控制解决方案。 + +但即使是像 Git 这样功能丰富的应用程序,也没有人们想要或需要的每个功能,所以会有人花大力气去创建这些缺少的功能。就 Git 而言,这个人就是 [TJ Holowaychuk][4]。他的 [Git Extras][5] 项目承载了 60 多个“附加功能”,这些功能扩展了 Git 的基本功能。 + +### 使用 Git 附加功能 + +下面介绍一下如何使用四种最受欢迎的 Git 附加功能。 + +#### git-ignore + +`git ignore` 是一个方便的附加功能,它可以让你手动添加文件类型和注释到 `.git-ignore` 文件中,而不需要打开文本编辑器。它可以操作你的个人用户帐户的全局忽略文件和单独用于你正在工作的版本库中的忽略文件。 + +在不提供参数的情况下执行 `git ignore` 会先列出全局忽略文件,然后是本地的忽略文件。 + +``` +$ git ignore +Global gitignore: /home/alice/.gitignore +# Numerous always-ignore extensions +*.diff +*.err +*.orig +*.rej +*.swo +*.swp +*.vi +*~ +*.sass-cache + +# OS or Editor folders +Thumbs.db +--------------------------------- +Local gitignore: .gitignore +nbproject +``` + +#### git-info + +`git info` 可以检索你所需要的所有信息,以获取你正在使用的版本库的上下文信息。它包括远程 URL、远程分支、本地分支、配置信息和最后一次的提交信息。 + +``` +$ git info + +## Remote URLs: + +origin git@github.com:sampleAuthor/git-extras.git (fetch) +origin git@github.com:sampleAuthor/git-extras.git (push) + +## Remote Branches: + +origin/HEAD -> origin/master +origin/myBranch + +## Local Branches: + +myBranch +* master + +## Most Recent Commit: + +commit e3952df2c172c6f3eb533d8d0b1a6c77250769a7 +Author: Sample Author + +Added git-info command. + +Type ´git log´ for more commits, or ´git show ´ for full commit details. + +## Configuration (.git/config): + +color.diff=auto +color.status=auto +color.branch=auto +user.name=Sample Author +user.email=sampleAuthor@gmail.com +core.repositoryformatversion=0 +core.filemode=true +core.bare=false +core.logallrefupdates=true +core.ignorecase=true +remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* +remote.origin.url=git@github.com:mub/git-extras.git +branch.master.remote=origin +branch.master.merge=refs/heads/master +``` + +#### git-mr 和 git-pr + +这些附加功能的作用类似,工作方式也基本相同。 + +* `git mr` 检出来自 GitLab 的合并请求。 +* `git pr` 检出来自 GitHub 的拉取请求。 + +无论是哪种情况,你只需要合并请求号/拉取请求号或完整的 URL,它就会抓取远程引用,检出分支,并调整配置,这样 Git 就知道要替换哪个分支了。 + +``` +$ git mr 51 +From gitlab.com:owner/repository + * [new ref] refs/merge-requests/51/head -> mr/51 +Switched to branch 'mr/51' +``` + +#### git-release + +通过将 `commit`、`tag` 和 `push` 合并到一个命令中,`git release` 可以节省大量的按键来执行这三个命令,而这三个命令往往是依次运行的。 + +要用特定的 `` 和自定义消息提交: + +``` +$ git release 0.1.0 -m <+ powerful feature added> +``` + +#### 其他附加功能 + +这只是该版本库中 60 多个 Git 附加功能中的四个命令。要访问 Git Extras 中的全部命令,请查看该源代码库中的 [Commands.md][8] 文件,或者在安装 Git Extras 后运行以下命令。 + +``` +$ git extras --help +``` + +### 安装 Git 附加功能 + +使用 Git 附加功能的主要前提是安装了 Git 的命令行版本。如果你打算从源码中构建,还需要有额外的工具(例如:`make`)。 + +如果你使用的是最新版本的 macOS,那么 Git 附加功能的安装最好使用 [Homebrew][9](和大多数开源工具一样)。 + +``` +$ brew install git-extras +``` + +在 Linux 上,每个平台原生的包管理器中都包含有 Git Extras。有时,你需要启用额外的仓库,比如在 CentOS 上的 [EPEL][10],然后运行一条命令。 + +``` +$ sudo yum install git-extras +``` + +其他 Linux 发行版、BSD 和其他平台的完整安装说明可以在该版本库的 [Installation.md][11] 文件中找到。 + +### 贡献 + +你是否认为 Git 中有缺少的功能,并且已经构建了一个脚本来处理它?为什么不把它作为 Git Extras 发布版的一部分,与全世界分享呢? + +要做到这一点,请将该功能贡献到 Git Extras 仓库中。更多具体细节请参见仓库中的 [CONTRIBUTING.md][12] 文件,但基本的操作方法很简单: + +1. 创建一个处理该功能的 Bash 脚本。 +2. 创建一个基本的 man 文件,让大家知道如何使用它。 +3. 更新命令列表和补完脚本,让人们知道这个功能的存在。 +4. 运行完整性检查,确保你没有破坏任何东西。 +5. 为你的功能创建一个拉取请求。 + +向 Git Extras 贡献贡献,会让你的 Git 用户的生活更轻松一些。你可以在项目的 [README][13] 中了解更多。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/git-extras + +作者:[Vince Power][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/vincepower +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://en.wikipedia.org/wiki/Linus_Torvalds +[3]: https://git-scm.com/ +[4]: https://github.com/tj +[5]: https://github.com/tj/git-extras +[6]: mailto:git@github.com +[7]: mailto:sampleAuthor@gmail.com +[8]: https://github.com/tj/git-extras/blob/master/Commands.md +[9]: https://brew.sh/ +[10]: https://fedoraproject.org/wiki/EPEL +[11]: https://github.com/tj/git-extras/blob/master/Installation.md +[12]: https://github.com/tj/git-extras/blob/master/CONTRIBUTING.md +[13]: https://github.com/tj/git-extras/blob/master/Readme.md diff --git a/published/202005/20200421 Using Python to visualize COVID-19 projections.md b/published/202005/20200421 Using Python to visualize COVID-19 projections.md new file mode 100644 index 0000000000..aaf5fc72d0 --- /dev/null +++ b/published/202005/20200421 Using Python to visualize COVID-19 projections.md @@ -0,0 +1,238 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12172-1.html) +[#]: subject: (Using Python to visualize COVID-19 projections) +[#]: via: (https://opensource.com/article/20/4/python-data-covid-19) +[#]: author: (AnuragGupta https://opensource.com/users/999anuraggupta) + +使用 Python 来可视化 COVID-19 预测 +====== + +> 我将演示如何利用提供的全球病毒传播的开放数据,使用开源库来创建两个可视效果。 + +![](https://img.linux.net.cn/data/attachment/album/202005/01/193624a2p2osojyf0yg4go.jpg) + +使用 [Python][2] 和一些图形库,你可以预测 COVID-19 确诊病例总数,也可以显示一个国家(本文以印度为例)在给定日期的死亡总数。人们有时需要帮助解释和处理数据的意义,所以本文还演示了如何为五个国家创建一个动画横条形图,以显示按日期显示病例的变化。 + +### 印度的确诊病例和死亡人数预测 + +这要分三步来完成。 + +#### 1、下载数据 + +科学数据并不总是开放的,但幸运的是,许多现代科学和医疗机构都乐于相互之间及与公众共享信息。关于 COVID-19 病例的数据可以在网上查到,并且经常更新。 + +要解析这些数据,首先必须先下载。 。 + +直接将数据加载到 Pandas `DataFrame` 中。Pandas 提供了一个函数 `read_csv()`,它可以获取一个 URL 并返回一个 `DataFrame` 对象,如下所示。 + +``` +import pycountry +import plotly.express as px +import pandas as pd +URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv' +df1 = pd.read_csv(URL_DATASET) +print(df1.head(3)) # 获取数据帧中的前 3 项 +print(df1.tail(3)) # 获取数据帧中的后 3 项 +``` + +数据集的顶行包含列名。 + +1. `Date` +2. `Country` +3. `Confirmed` +4. `Recovered` +5. `Deaths` + +`head` 查询的输出包括一个唯一的标识符(不作为列列出)和每个列的条目。 + +``` +0 2020-01-22 Afghanistan 0 0 0 +1 2020-01-22 Albania 0 0 0 +1 2020-01-22 Algeria 0 0 0 +``` + +`tail` 查询的输出类似,但包含数据集的尾端。 + +``` +12597 2020-03-31 West Bank and Gaza 119 18 1 +12598 2020-03-31 Zambia 35 0 0 +12599 2020-03-31 Zimbabwe 8 0 1 +``` + +从输出中,可以看到 DataFrame(`df1`)有以下几个列: + +1. 日期 +2. 国家 +3. 确诊 +4. 康复 +5. 死亡 + +此外,你可以看到 `Date` 栏中的条目从 1 月 22 日开始到 3 月 31 日。这个数据库每天都会更新,所以你会有当前的值。 + +#### 2、选择印度的数据 + +在这一步中,我们将只选择 DataFrame 中包含印度的那些行。这在下面的脚本中可以看到。 + +``` +#### ----- Step 2 (Select data for India)---- +df_india = df1[df1['Country'] == 'India'] +print(df_india.head(3)) +``` + +#### 3、数据绘图 + +在这里,我们创建一个条形图。我们将把日期放在 X 轴上,把确诊的病例数和死亡人数放在 Y 轴上。这一部分的脚本有以下几个值得注意的地方。 + + * `plt.rcParams["figure.figsize"]=20,20` 这一行代码只适用于 Jupyter。所以如果你使用其他 IDE,请删除它。 + * 注意这行代码:`ax1 = plt.gca()`。为了确保两个图,即确诊病例和死亡病例的图都被绘制在同一个图上,我们需要给第二个图的 `ax` 对象。所以我们使用 `gca()` 来完成这个任务。(顺便说一下,`gca` 代表 “获取当前坐标轴get current axis”) + +完整的脚本如下所示。 + +``` +# Author:- Anurag Gupta # email:- 999.anuraggupta@gmail.com +%matplotlib inline +import matplotlib.pyplot as plt +import pandas as pd + +#### ----- Step 1 (Download data)---- +URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv' +df1 = pd.read_csv(URL_DATASET) +# print(df1.head(3)) # Uncomment to see the dataframe + +#### ----- Step 2 (Select data for India)---- +df_india = df1[df1['Country'] == 'India'] +print(df_india.head(3)) + +#### ----- Step 3 (Plot data)---- +# Increase size of plot +plt.rcParams["figure.figsize"]=20,20 # Remove if not on Jupyter +# Plot column 'Confirmed' +df_india.plot(kind = 'bar', x = 'Date', y = 'Confirmed', color = 'blue') + +ax1 = plt.gca() +df_india.plot(kind = 'bar', x = 'Date', y = 'Deaths', color = 'red', ax = ax1) +plt.show() +``` + +整个脚本[可在 GitHub 上找到][4]。 + +### 为五个国家创建一个动画水平条形图 + +关于 Jupyter 的注意事项:要在 Jupyter 中以动态动画的形式运行,而不是静态 png 的形式,你需要在单元格的开头添加一个神奇的命令,即: `%matplotlib notebook`。这将使图形保持动态,而不是显示为静态的 png 文件,因此也可以显示动画。如果你在其他 IDE 上,请删除这一行。 + +#### 1、下载数据 + +这一步和前面的脚本完全一样,所以不需要重复。 + +#### 2、创建一个所有日期的列表 + +如果你检查你下载的数据,你会发现它有一列 `Date`。现在,这一列对每个国家都有一个日期值。因此,同一个日期会出现多次。我们需要创建一个只具有唯一值的日期列表。这会用在我们条形图的 X 轴上。我们有一行代码,如 `list_dates = df[‘Date’].unique()`。`unique()` 方法将只提取每个日期的唯一值。 + +#### 3、挑选五个国家并创建一个 `ax` 对象。 + +做一个五个国家的名单。(你可以选择你喜欢的国家,也可以增加或减少国家的数量。)我也做了一个五个颜色的列表,每个国家的条形图的颜色对应一种。(如果你喜欢的话,也可以改一下。)这里有一行重要的代码是:`fig, ax = plt.subplots(figsize=(15, 8))`。这是创建一个 `ax` 对象所需要的。 + +#### 4、编写回调函数 + +如果你想在 Matplotlib 中做动画,你需要创建一个名为 `matplotlib.animation.FuncAnimation` 的类的对象。这个类的签名可以在网上查到。这个类的构造函数,除了其他参数外,还需要一个叫 `func` 的参数,你必须给这个参数一个回调函数。所以在这一步中,我们会写个回调函数,这个回调函数会被反复调用,以渲染动画。 + +#### 5、创建 `FuncAnimation` 对象 + +这一步在上一步中已经部分说明了。 + +我们创建这个类的对象的代码是: + +``` +my_anim = animation.FuncAnimation(fig = fig, func = plot_bar, + frames = list_dates, blit = True, + interval=20) +``` + +要给出的三个重要参数是: + +* `fig`,必须给出一个 fig 对象,也就是我们之前创建的 fig 对象。 +* `func`,必须是回调函数。 +* `frames`,必须包含要做动画的变量。在我们这里,它是我们之前创建的日期列表。 + +#### 6、将动画保存为 mp4 文件 + +你可以将创建的动画保存为 mp4 文件。但是,你需要 `ffmpeg`。你可以用 `pip` 下载:`pip install ffmpeg-python`,或者用 conda(在 Jupyter 上):`install -c conda-forge ffmpeg`。 + +最后,你可以使用 `plt.show()` 运行动画。请注意,在许多平台上,`ffmpeg` 可能无法正常工作,可能需要进一步“调整”。 + +``` +%matplotlib notebook +# Author:- Anurag Gupta # email:- 999.anuraggupta@gmail.com +import pandas as pd +import matplotlib.pyplot as plt +import matplotlib.animation as animation +from time import sleep + +#### ---- Step 1:- Download data +URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv' +df = pd.read_csv(URL_DATASET, usecols = ['Date', 'Country', 'Confirmed']) +# print(df.head(3)) # uncomment this to see output + +#### ---- Step 2:- Create list of all dates +list_dates = df['Date'].unique() +# print(list_dates) # Uncomment to see the dates + +#### --- Step 3:- Pick 5 countries. Also create ax object +fig, ax = plt.subplots(figsize=(15, 8)) +# We will animate for these 5 countries only +list_countries = ['India', 'China', 'US', 'Italy', 'Spain'] +# colors for the 5 horizontal bars +list_colors = ['black', 'red', 'green', 'blue', 'yellow'] + +### --- Step 4:- Write the call back function +# plot_bar() is the call back function used in FuncAnimation class object +def plot_bar(some_date): + df2 = df[df['Date'].eq(some_date)] + ax.clear() + # Only take Confirmed column in descending order + df3 = df2.sort_values(by = 'Confirmed', ascending = False) + # Select the top 5 Confirmed countries + df4 = df3[df3['Country'].isin(list_countries)] + # print(df4) # Uncomment to see that dat is only for 5 countries + sleep(0.2) # To slow down the animation + # ax.barh() makes a horizontal bar plot. + return ax.barh(df4['Country'], df4['Confirmed'], color= list_colors) + +###----Step 5:- Create FuncAnimation object--------- +my_anim = animation.FuncAnimation(fig = fig, func = plot_bar, + frames= list_dates, blit=True, + interval=20) + +### --- Step 6:- Save the animation to an mp4 +# Place where to save the mp4. Give your file path instead +path_mp4 = r'C:\Python-articles\population_covid2.mp4' +# my_anim.save(path_mp4, fps=30, extra_args=['-vcodec', 'libx264']) +my_anim.save(filename = path_mp4, writer = 'ffmpeg', + fps=30, + extra_args= ['-vcodec', 'libx264', '-pix_fmt', 'yuv420p']) +plt.show() +``` + +完整的脚本[可以在 GitHub 上找到][5]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-data-covid-19 + +作者:[AnuragGupta][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/999anuraggupta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://opensource.com/resources/python +[3]: mailto:999.anuraggupta@gmail.com +[4]: https://raw.githubusercontent.com/ag999git/jupyter_notebooks/master/corona_bar_india +[5]: https://raw.githubusercontent.com/ag999git/jupyter_notebooks/master/corona_bar_animated diff --git a/published/202005/20200423 Difference Between YUM and RPM Package Manager.md b/published/202005/20200423 Difference Between YUM and RPM Package Manager.md new file mode 100644 index 0000000000..bf916108e1 --- /dev/null +++ b/published/202005/20200423 Difference Between YUM and RPM Package Manager.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12170-1.html) +[#]: subject: (Difference Between YUM and RPM Package Manager) +[#]: via: (https://www.2daygeek.com/comparison-difference-between-yum-vs-rpm/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +YUM 和 RPM 包管理器的不同之处 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/30/215525o4e88nen85d8dzd7.jpg) + +软件包管理器在 Linux 系统中扮演着重要的角色。它允许你安装、更新、查看、搜索和删除软件包,以满足你的需求。 + +每个发行版都有自己的一套包管理器,依据你的 Linux 发行版来分别使用它们。 + +RPM 是最古老的传统软件包管理器之一,它是为基于 Red Hat 的系统设计的,如 Red Hat Enterprise Linux(RHEL)、CentOS、Fedora 和 openSUSE(它基于 suse Enterprise Linux)等系统。但在依赖解析和包更新(全系统更新/升级)方面,RPM 包管理器有一个突出的限制。 + +> 如果你想知道 [YUM 和 DNF 包管理器的区别][1]请参考该文章。 + +这意味着 `yum` 可以自动下载并安装所有需要的依赖项,但 `rpm` 会告诉你安装一个依赖项列表,然后你必须手动安装。 + +当你想用 [rpm 命令][2] 安装一组包时,这实际上是不可能的,而且很费时间。 + +这时,[YUM 包管理器][3] 就派上了用场,解决了这两个问题。 + +### 什么是 RPM? + +RPM 指的是 RPM Package Manager(原名 Red Hat Package Manager),是一个功能强大的命令行包管理工具,是为 Red Hat 操作系统开发的。 + +它现在被用作许多 Linux 发行版的核心组件,如 Centos、Fedora、Oracle Linux、openSUSE 和 Mageia 等。 + +RPM 软件包管理器允许你在基于 RPM 的 Linux 系统上安装、升级、删除、查询和验证软件包。 + +RPM 文件的扩展名为 `.rpm`。RPM 包由一个存档文件组成,其中包含了一个特定包的库和依赖关系,这些库和依赖关系与系统上安装的其他包不冲突。 + +在 Linux 上有很多前端工具可以用来安装 RPM 包,与 RPM 工具相比,这些工具可以使安装过程更加高效,尤其是在处理依赖关系方面。 + +如果你想了解更多关于 Linux 发行版的前端包管理器的信息,请到下面的链接。 + +* [Linux 命令行包管理器列表][4] + +如果你想了解 Linux 的 GUI 包管理器,请到下面的链接。 + +* [Linux GUI 包管理器列表][5] + +### 什么是 YUM? + +Yum 是一个 Linux 操作系统上的自由开源的命令行包管理程序,它使用 RPM 包管理器。Yum 是一个 RPM 的前端工具,可以自动解决软件包的依赖关系。它可以从发行版官方仓库和其他第三方仓库中安装 RPM 软件包。 + +Yum 允许你在系统中安装、更新、搜索和删除软件包。如果你想让你的系统保持更新,你可以通过 yum-cron 启用自动更新。 + +此外,如果你需要的话,它还允许你在 `yum update` 中排除一个或多个软件包。 + +Yum 是默认安装的,你不需要安装它。 + +编号 | RPM | YUM +--- | --- | --- +1 | 红帽在 1997 年引入了 RPM | Yellowdog UPdater(YUP)开发于 1999-2001 年,YUM 于 2003 年取代了原来的 YUP 工具 +2 | RPM 代表 RPM Package manager(原名 Red Hat package manager) | YUM 代表 Yellowdog Updater Modified +3 | RPM 文件的命名规则如下,`httpd-2.4.6-92.el7.x86_64.rpm`:`httpd` - 实际的包名;`2.4.6` - 包发布版本号;`92` - 包发布子版本号;`el7` - Red Hat 版本;`x86_64` - 硬件架构;`rpm` - 文件扩展名 | 后台使用 rpm 数据库 +4 | 不解析依赖关系,你必须手动安装依赖 | 可以自动解析依赖关系并同时安装它们(任何包都会和它的依赖关系一起安装) +5 | 允许你同时安装多个版本的软件包 | 不允许,并显示该软件包已经安装 +6 | 当使用 RPM 命令安装一个软件包时,你必须提供 `.rpm` 软件包的确切位置 | 你可以安装仓库中的任何软件包,而你只需要知道软件包的名称就可以了 +7 | RPM 不依赖于 YUM | 它是一个前端工具,在后台使用 RPM 包管理器来管理包 +8 | RPM 在安装包的管理方面比较难 | YUM 是最简单的管理 RPM 包的方法 +9 | RPM 不能让你将整个系统升级到最新的版本 | YUM 可以让你将系统升级到最新的版本(例如 7.0 到 7.x 的小版本升级) +10 | RPM 不能让你自动更新/升级安装在系统上的软件包 | YUM 可以让你自动更新/升级系统上的更新 +11 | 不使用在线仓库来执行任何操作 | 完全依赖在线仓库来完成所有的工作 +12 | RPM 是一种包格式,它也是一个底层的包管理器,只做基本的事情 | 这是一个上层的包管理器前端,它可以完成你所需要的一切工作 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/comparison-difference-between-yum-vs-rpm/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12161-1.html +[2]: https://www.2daygeek.com/linux-rpm-command-examples-manage-packages-fedora-centos-rhel-systems/ +[3]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/list-of-command-line-package-manager-for-linux/ +[5]: https://www.2daygeek.com/list-of-graphical-frontend-tool-for-linux-package-manager/ diff --git a/published/202005/20200424 16 Things to do After Installing Ubuntu 20.04.md b/published/202005/20200424 16 Things to do After Installing Ubuntu 20.04.md new file mode 100644 index 0000000000..ded221ab6c --- /dev/null +++ b/published/202005/20200424 16 Things to do After Installing Ubuntu 20.04.md @@ -0,0 +1,283 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12183-1.html) +[#]: subject: (16 Things to do After Installing Ubuntu 20.04) +[#]: via: (https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +安装完 Ubuntu 20.04 后要做的 16 件事 +====== + +> 以下是安装 Ubuntu 20.04 之后需要做的一些调整和事项,它将使你获得更流畅、更好的桌面 Linux 体验。 + +[Ubuntu 20.04 LTS(长期支持版)带来了许多新的特性][1]和观感上的变化。如果你要安装 Ubuntu 20.04,让我向你展示一些推荐步骤便于你的使用。 + +### 安装完 Ubuntu 20.04 LTS “Focal Fossa” 后要做的 16 件事 + +![][2] + +我在这里提到的步骤仅是我的建议。如果一些定制或调整不适合你的需要和兴趣,你可以忽略它们。 + +同样的,有些步骤看起来很简单,但是对于一个 Ubuntu 新手来说是必要的。 + +这里的一些建议适用于启用 GNOME 作为默认桌面 Ubuntu 20.04,所以请检查 [Ubuntu 版本][3]和[桌面环境][4]。 + +以下列表便是安装了代号为 Focal Fossa 的 Ubuntu 20.04 LTS 之后要做的事。 + +#### 1、通过更新和启用额外的软件仓库来准备你的系统 + +安装 Ubuntu 或任何其他 Linux 发行版之后,你应该做的第一件事就是更新它。Linux 的运作是建立在本地的可用软件包数据库上,而这个缓存需要同步以便你能够安装软件。 + +升级 Ubuntu 非常简单。你可以运行软件更新从菜单(按 `Super` 键并搜索 “software updater”): + +![Ubuntu 20.04 的软件升级器][5] + +你也可以在终端使用以下命令更新你的系统: + +``` +sudo apt update && sudo apt upgrade +``` + +接下来,你应该确保启用了 [universe(宇宙)和 multiverse(多元宇宙)软件仓库][6]。使用这些软件仓库,你可以访问更多的软件。我还推荐阅读关于 [Ubuntu 软件仓库][6]的文章,以了解它背后的基本概念。 + +在菜单中搜索 “Software & Updates”: + +![软件及更新设置项][7] + +请务必选中软件仓库前面的勾选框: + +![启用额外的软件仓库][8] + +#### 2、安装媒体解码器来播放 MP3、MPEG4 和其他格式媒体文件 + +如果你想播放媒体文件,如 MP3、MPEG4、AVI 等,你需要安装媒体解码器。由于各个国家的版权问题, Ubuntu 在默认情况下不会安装它。 + +作为个人,你可以[使用 Ubuntu Restricted Extra 安装包][9]很轻松地安装这些媒体编解码器。这将[在你的 Ubuntu 系统安装][10]媒体编解码器、Adobe Flash 播放器和微软 True Type 字体等。 + +你可以通过[点击这个链接][11]来安装它(它会要求在软件中心打开它),或者使用以下命令: + +``` +sudo apt install ubuntu-restricted-extras +``` + +如果遇到 EULA 或许可证界面,请记住使用 `tab` 键在选项之间进行选择,然后按回车键确认你的选择。 + +![按 tab 键选择 OK 并按回车键][12] + +#### 3、从软件中心或网络上安装软件 + +现在已经设置好了软件仓库并更新了软件包缓存,应该开始安装所需的软件了。 + +在 Ubuntu 中安装应用程序有几种方法,最简单和正式的方法是使用软件中心。 + +![Ubuntu 软件中心][14] + +如果你想要一些关于软件的建议,请参考这个[丰富的各种用途的 Ubuntu 应用程序列表][15]。 + +一些软件供应商提供了 .deb 文件来方便地安装他们的应用程序。你可以从他们的网站获得 .deb 文件。例如,要[在 Ubuntu 上安装谷歌 Chrome][16],你可以从它的网站上获得 .deb 文件,双击它开始安装。 + +#### 4、享受 Steam Proton 和 GameModeEnjoy 上的游戏 + +[在 Linux 上进行游戏][17]已经有了长足的发展。你不再受限于自带的少数游戏。你可以[在 Ubuntu 上安装 Steam][18]并享受许多游戏。 + +[Steam 新的 Proton 项目][19]可以让你在 Linux 上玩许多只适用于 Windows 的游戏。除此之外,Ubuntu 20.04 还默认安装了 [Feral Interactive 的 GameMode][20]。 + +GameMode 会自动调整 Linux 系统的性能,使游戏具有比其他后台进程更高的优先级。 + +这意味着一些支持 GameMode 的游戏(如[古墓丽影·崛起][21])在 Ubuntu 上的性能应该有所提高。 + +#### 5、管理自动更新(适用于进阶用户和专家) + +最近,Ubuntu 已经开始自动下载并安装对你的系统至关重要的安全更新。这是一个安全功能,作为一个普通用户,你应该让它保持默认开启。 + +但是,如果你喜欢自己进行配置更新,而这个自动更新经常导致你[“无法锁定管理目录”错误][22],也许你可以改变自动更新行为。 + +你可以选择“立即显示”,这样一有安全更新就会立即通知你,而不是自动安装。 + +![管理自动更新设置][23] + +#### 6、控制电脑的自动挂起和屏幕锁定 + +如果你在笔记本电脑上使用 Ubuntu 20.04,那么你可能需要注意一些电源和屏幕锁定设置。 + +如果你的笔记本电脑处于电池模式,Ubuntu 会在 20 分钟不活动后休眠系统。这样做是为了节省电池电量。就我个人而言,我不喜欢它,因此我禁用了它。 + +类似地,如果你离开系统几分钟,它会自动锁定屏幕。我也不喜欢这种行为,所以我宁愿禁用它。 + +![Ubuntu 20.04 的电源设置][24] + +#### 7、享受夜间模式 + +[Ubuntu 20.04 中最受关注的特性][25]之一是夜间模式。你可以通过进入设置并在外观部分中选择它来启用夜间模式。 + +![开启夜间主题 Ubuntu][26] + +你可能需要做一些[额外的调整来获得完整的 Ubuntu 20.04 夜间模式][27]。 + +#### 8、控制桌面图标和启动程序 + +如果你想要一个最简的桌面,你可以禁用桌面上的图标。你还可以从左侧禁用启动程序,并在顶部面板中禁用软件状态栏。 + +所有这些都可以通过默认的新 GNOME 扩展来控制,该程序默认情况下已经可用。 + +![禁用 Ubuntu 20 04 的 Dock][28] + +顺便说一下,你也可以通过“设置”->“外观”来将启动栏的位置改变到底部或者右边。 + +#### 9、使用表情符和特殊字符,或从搜索中禁用它 + +Ubuntu 提供了一个使用表情符号的简单方法。在默认情况下,有一个专用的应用程序叫做“字符”。它基本上可以为你提供表情符号的 [Unicode][29]。 + +不仅是表情符号,你还可以使用它来获得法语、德语、俄语和拉丁语字符的 unicode。单击符号你可以复制 unicode,当你粘贴该代码时,你所选择的符号便被插入。 + +![Ubuntu 表情符][30] + +你也能在桌面搜索中找到这些特殊的字符和表情符号。也可以从搜索结果中复制它们。 + +![表情符出现在桌面搜索中][31] + +如果你不想在搜索结果中看到它们,你应该禁用搜索功能对它们的访问。下一节将讨论如何做到这一点。 + +#### 10、掌握桌面搜索 + +GNOME 桌面拥有强大的搜索功能,大多数人使用它来搜索已安装的应用程序,但它不仅限于此。 + +按 `Super` 键并搜索一些东西,它将显示与搜索词匹配的任何应用程序,然后是系统设置和软件中心提供的匹配应用程序。 + +![桌面搜索][32] + +不仅如此,搜索还可以找到文件中的文本。如果你正在使用日历,它也可以找到你的会议和提醒。你甚至可以在搜索中进行快速计算并复制其结果。 + +![Ubuntu搜索的快速计算][33] + +你可以进入“设置”中来控制可以搜索的内容和顺序。 + +![][34] + +#### 11、使用夜灯功能,减少夜间眼睛疲劳 + +如果你在晚上使用电脑或智能手机,你应该使用夜灯功能来减少眼睛疲劳。我觉得这很有帮助。 + +夜灯的特点是在屏幕上增加了一种黄色的色调,比白光少了一些挤压感。 + +你可以在“设置”->“显示”切换到夜灯选项卡来开启夜光功能。你可以根据自己的喜好设置“黄度”。 + +![夜灯功能][35] + +#### 12、使用 2K/4K 显示器?使用分辨率缩放得到更大的图标和字体 + +如果你觉得图标、字体、文件夹在你的高分辨率屏幕上看起来都太小了,你可以利用分辨率缩放。 + +启用分辨率缩放可以让你有更多的选项来从 100% 增加到 200%。你可以选择适合自己喜好的缩放尺寸。 + +![在设置->显示中启用高分缩放][36] + +#### 13、探索 GNOME 扩展功能以扩展 GNOME 桌面可用性 + +GNOME 桌面有称为“扩展”的小插件或附加组件。你应该[学会使用 GNOME 扩展][37]来扩展系统的可用性。 + +如下图所示,天气扩展顶部面板中显示了天气信息。不起眼但十分有用。你也可以在这里查看一些[最佳 GNOME 扩展][38]。不需要全部安装,只使用那些对你有用的。 + +![天气扩展][39] + +#### 14、启用“勿扰”模式,专注于工作 + +如果你想专注于工作,禁用桌面通知会很方便。你可以轻松地启用“勿扰”模式,并静音所有通知。 + +![启用“请勿打扰”清除桌面通知][40] + +这些通知仍然会在消息栏中,以便你以后可以阅读它们,但是它们不会在桌面上弹出。 + +#### 15、清理你的系统 + +这是你安装 Ubuntu 后不需要马上做的事情。但是记住它会对你有帮助。 + +随着时间的推移,你的系统将有大量不再需要的包。你可以用这个命令一次性删除它们: + +``` +sudo apt autoremove +``` + +还有其他[清理 Ubuntu 以释放磁盘空间的方法][41],但这是最简单和最安全的。 + +#### 16、根据你的喜好调整和定制 GNOME 桌面 + +我强烈推荐[安装 GNOME 设置工具][42]。这将让你可以通过额外的设置来进行定制。 + +![Gnome 设置工具][43] + +比如,你可以[以百分比形式显示电池容量][44]、[修正在触摸板右键问题][45]、改变 Shell 主题、改变鼠标指针速度、显示日期和星期数、改变应用程序窗口行为等。 + +定制是没有尽头的,我可能仅使用了它的一小部分功能。这就是为什么我推荐[阅读这些][42]关于[自定义 GNOME 桌面][46]的文章。 + +你也可以[在 Ubuntu 中安装新主题][47],不过就我个人而言,我喜欢这个版本的默认主题。这是我第一次在 Ubuntu 发行版中使用默认的图标和主题。 + +#### 安装 Ubuntu 之后你会做什么? + +如果你是 Ubuntu 的初学者,我建议你[阅读这一系列 Ubuntu 教程][48]开始学习。 + +这就是我的建议。安装 Ubuntu 之后你要做什么?分享你最喜欢的东西,我可能根据你的建议来更新这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12146-1.html +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/things-to-do-after-installing-ubuntu-20-04.jpg?ssl=1 +[3]: https://linux.cn/article-9872-1.html +[4]: https://linux.cn/article-12124-1.html +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updater-ubuntu-20-04.jpg?ssl=1 +[6]: https://itsfoss.com/ubuntu-repositories/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/extra-repositories-ubuntu-20.jpg?ssl=1 +[9]: https://linux.cn/article-11906-1.html +[10]: https://linux.cn/article-12074-1.html +[11]: //ubuntu-restricted-extras/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/installing_ubuntu_restricted_extras.jpg?ssl=1 +[13]: https://itsfoss.com/remove-install-software-ubuntu/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-center-ubuntu-20.png?resize=800%2C509&ssl=1 +[15]: https://itsfoss.com/best-ubuntu-apps/ +[16]: https://itsfoss.com/install-chrome-ubuntu/ +[17]: https://linux.cn/article-7316-1.html +[18]: https://itsfoss.com/install-steam-ubuntu-linux/ +[19]: https://linux.cn/article-10054-1.html +[20]: https://github.com/FeralInteractive/gamemode +[21]: https://en.wikipedia.org/wiki/Rise_of_the_Tomb_Raider +[22]: https://itsfoss.com/could-not-get-lock-error/ +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/auto-updates-ubuntu.png?resize=800%2C361&ssl=1 +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/power-settings-ubuntu-20-04.png?fit=800%2C591&ssl=1 +[25]: https://www.youtube.com/watch?v=lpq8pm_xkSE +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-dark-theme-ubuntu.png?ssl=1 +[27]: https://linux.cn/article-12098-1.html +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/disable-dock-ubuntu-20-04.png?ssl=1 +[29]: https://en.wikipedia.org/wiki/List_of_Unicode_characters +[30]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/emoji-ubuntu.jpg?ssl=1 +[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/emojis-desktop-search-ubuntu.jpg?ssl=1 +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-desktop-search-1.jpg?ssl=1 +[33]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/quick-calculations-ubuntu-search.jpg?ssl=1 +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/search-settings-control-ubuntu.png?resize=800%2C534&ssl=1 +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/nightlight-ubuntu-20-04.png?ssl=1 +[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/fractional-scaling-ubuntu.jpg?ssl=1 +[37]: https://itsfoss.com/gnome-shell-extensions/ +[38]: https://itsfoss.com/best-gnome-extensions/ +[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/weather-extension-ubuntu.jpg?ssl=1 +[40]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/do-not-distrub-option-ubuntu-20-04.png?ssl=1 +[41]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[42]: https://itsfoss.com/gnome-tweak-tool/ +[43]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-tweaks-tool-ubuntu-20-04.png?fit=800%2C551&ssl=1 +[44]: https://itsfoss.com/display-battery-ubuntu/ +[45]: https://itsfoss.com/fix-right-click-touchpad-ubuntu/ +[46]: https://itsfoss.com/gnome-tricks-ubuntu/ +[47]: https://itsfoss.com/install-themes-ubuntu/ +[48]: https://itsfoss.com/getting-started-with-ubuntu/ diff --git a/published/202005/20200425 Inlining optimisations in Go.md b/published/202005/20200425 Inlining optimisations in Go.md new file mode 100644 index 0000000000..12f1cb67b7 --- /dev/null +++ b/published/202005/20200425 Inlining optimisations in Go.md @@ -0,0 +1,213 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12176-1.html) +[#]: subject: (Inlining optimisations in Go) +[#]: via: (https://dave.cheney.net/2020/04/25/inlining-optimisations-in-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Go 中的内联优化 +====== + +> 本文讨论 Go 编译器是如何实现内联的,以及这种优化方法如何影响你的 Go 代码。 + +![](https://img.linux.net.cn/data/attachment/album/202005/02/222202e3v3pppkhnndpbpn.jpg) + +*请注意:*本文重点讨论 *gc*,这是来自 [golang.org](https://github.com/golang/go) 的事实标准的 Go 编译器。讨论到的概念可以广泛适用于其它 Go 编译器,如 gccgo 和 llgo,但它们在实现方式和功效上可能有所差异。 + +### 内联是什么? + +内联inlining就是把简短的函数在调用它的地方展开。在计算机发展历程的早期,这个优化是由程序员手动实现的。现在,内联已经成为编译过程中自动实现的基本优化过程的其中一步。 + +### 为什么内联很重要? + +有两个原因。第一个是它消除了函数调用本身的开销。第二个是它使得编译器能更高效地执行其他的优化策略。 + +#### 函数调用的开销 + +在任何语言中,调用一个函数 [^1] 都会有消耗。把参数编组进寄存器或放入栈中(取决于 ABI),在返回结果时的逆反过程都会有开销。引入一次函数调用会导致程序计数器从指令流的一点跳到另一点,这可能导致管道滞后。函数内部通常有前置处理preamble,需要为函数执行准备新的栈帧,还有与前置相似的后续处理epilogue,需要在返回给调用方之前释放栈帧空间。 + +在 Go 中函数调用会消耗额外的资源来支持栈的动态增长。在进入函数时,goroutine 可用的栈空间与函数需要的空间大小进行比较。如果可用空间不同,前置处理就会跳到运行时runtime的逻辑中,通过把数据复制到一块新的、更大的空间的来增长栈空间。当这个复制完成后,运行时就会跳回到原来的函数入口,再执行栈空间检查,现在通过了检查,函数调用继续执行。这种方式下,goroutine 开始时可以申请很小的栈空间,在有需要时再申请更大的空间。[^2] + +这个检查消耗很小,只有几个指令,而且由于 goroutine 的栈是成几何级数增长的,因此这个检查很少失败。这样,现代处理器的分支预测单元可以通过假定检查肯定会成功来隐藏栈空间检查的消耗。当处理器预测错了栈空间检查,不得不放弃它在推测性执行所做的操作时,与为了增加 goroutine 的栈空间运行时所需的操作消耗的资源相比,管道滞后的代价更小。 + +虽然现代处理器可以用预测性执行技术优化每次函数调用中的泛型和 Go 特定的元素的开销,但那些开销不能被完全消除,因此在每次函数调用执行必要的工作过程中都会有性能消耗。一次函数调用本身的开销是固定的,与更大的函数相比,调用小函数的代价更大,因为在每次调用过程中它们做的有用的工作更少。 + +因此,消除这些开销的方法必须是要消除函数调用本身,Go 的编译器就是这么做的,在某些条件下通过用函数的内容来替换函数调用来实现。这个过程被称为*内联*,因为它在函数调用处把函数体展开了。 + +#### 改进的优化机会 + +Cliff Click 博士把内联描述为现代编译器做的优化措施,像常量传播(LCTT 译注:此处作者笔误,原文为 constant proportion,修正为 constant propagation)和死代码消除一样,都是编译器的基本优化方法。实际上,内联可以让编译器看得更深,使编译器可以观察调用的特定函数的上下文内容,可以看到能继续简化或彻底消除的逻辑。由于可以递归地执行内联,因此不仅可以在每个独立的函数上下文处进行这种优化决策,也可以在整个函数调用链中进行。 + +### 实践中的内联 + +下面这个例子可以演示内联的影响: + +```go +package main + +import "testing" + +//go:noinline +func max(a, b int) int { + if a > b { + return a + } + return b +} + +var Result int + +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = max(-1, i) + } + Result = r +} +``` + +运行这个基准,会得到如下结果:[^3] + +```bash +% go test -bench=. +BenchmarkMax-4 530687617 2.24 ns/op +``` + +在我的 2015 MacBook Air 上 `max(-1, i)` 的耗时约为 2.24 纳秒。现在去掉 `//go:noinline` 编译指令,再看下结果: + +```bash +% go test -bench=. +BenchmarkMax-4 1000000000 0.514 ns/op +``` + +从 2.24 纳秒降到了 0.51 纳秒,或者从 `benchstat` 的结果可以看出,有 78% 的提升。 + +```bash +% benchstat {old,new}.txt +name old time/op new time/op delta +Max-4 2.21ns ± 1% 0.49ns ± 6% -77.96% (p=0.000 n=18+19) +``` + +这个提升是从哪儿来的呢? + +首先,移除掉函数调用以及与之关联的前置处理 [^4] 是主要因素。把 `max` 函数的函数体在调用处展开,减少了处理器执行的指令数量并且消除了一些分支。 + +现在由于编译器优化了 `BenchmarkMax`,因此它可以看到 `max` 函数的内容,进而可以做更多的提升。当 `max` 被内联后,`BenchmarkMax` 呈现给编译器的样子,看起来是这样的: + +```go +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + if -1 > i { + r = -1 + } else { + r = i + } + } + Result = r +} +``` + +再运行一次基准,我们看一下手动内联的版本和编译器内联的版本的表现: + +```bash +% benchstat {old,new}.txt +name old time/op new time/op delta +Max-4 2.21ns ± 1% 0.48ns ± 3% -78.14% (p=0.000 n=18+18) +``` + +现在编译器能看到在 `BenchmarkMax` 里内联 `max` 的结果,可以执行以前不能执行的优化措施。例如,编译器注意到 `i` 初始值为 `0`,仅做自增操作,因此所有与 `i` 的比较都可以假定 `i` 不是负值。这样条件表达式 `-1 > i` 永远不是 `true`。[^5] + +证明了 `-1 > i` 永远不为 true 后,编译器可以把代码简化为: + +```go +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + if false { + r = -1 + } else { + r = i + } + } + Result = r +} +``` + +并且因为分支里是个常量,编译器可以通过下面的方式移除不会走到的分支: + +```go +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = i + } + Result = r +} +``` + +这样,通过内联和由内联解锁的优化过程,编译器把表达式 `r = max(-1, i))` 简化为 `r = i`。 + +### 内联的限制 + +本文中我论述的内联称作叶子内联leaf inlining:把函数调用栈中最底层的函数在调用它的函数处展开的行为。内联是个递归的过程,当把函数内联到调用它的函数 A 处后,编译器会把内联后的结果代码再内联到 A 的调用方,这样持续内联下去。例如,下面的代码: + +```go +func BenchmarkMaxMaxMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = max(max(-1, i), max(0, i)) + } + Result = r +} +``` + +与之前的例子中的代码运行速度一样快,因为编译器可以对上面的代码重复地进行内联,也把代码简化到 `r = i` 表达式。 + +下一篇文章中,我会论述当 Go 编译器想要内联函数调用栈中间的某个函数时选用的另一种内联策略。最后我会论述编译器为了内联代码准备好要达到的极限,这个极限 Go 现在的能力还达不到。 + +[^1]: 在 Go 中,一个方法就是一个有预先定义的形参和接受者的函数。假设这个方法不是通过接口调用的,调用一个无消耗的函数所消耗的代价与引入一个方法是相同的。 +[^2]: 在 Go 1.14 以前,栈检查的前置处理也被垃圾回收器用于 STW,通过把所有活跃的 goroutine 栈空间设为 0,来强制它们切换为下一次函数调用时的运行时状态。这个机制[最近被替换][8]为一种新机制,新机制下运行时可以不用等 goroutine 进行函数调用就可以暂停 goroutine。 +[^3]: 我用 `//go:noinline` 编译指令来阻止编译器内联 `max`。这是因为我想把内联 `max` 的影响与其他影响隔离开,而不是用 `-gcflags='-l -N'` 选项在全局范围内禁止优化。关于 `//go:` 注释在[这篇文章][10]中详细论述。 +[^4]: 你可以自己通过比较 `go test -bench=. -gcflags=-S` 有无 `//go:noinline` 注释时的不同结果来验证一下。 +[^5]: 你可以用 `-gcflags=-d=ssa/prove/debug=on` 选项来自己验证一下。 + +#### 相关文章: + +1. [使 Go 变快的 5 件事](https://dave.cheney.net/2014/06/07/five-things-that-make-go-fast) +2. [为什么 Goroutine 的栈空间会无限增长?](https://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite) +3. [Go 中怎么写基准测试](https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go) +4. [Go 中隐藏的编译指令](https://dave.cheney.net/2018/01/08/gos-hidden-pragmas) + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/04/25/inlining-optimisations-in-go + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/go +[2]: tmp.gBQ2tEtMHc#easy-footnote-bottom-1-4053 (In Go, a method is just a function with a predefined formal parameter, the receiver. The relative costs of calling a free function vs a invoking a method, assuming that method is not called through an interface, are the same.) +[3]: tmp.gBQ2tEtMHc#easy-footnote-bottom-2-4053 (Up until Go 1.14 the stack check preamble was also used by the garbage collector to stop the world by setting all active goroutine’s stacks to zero, forcing them to trap into the runtime the next time they made a function call. This system was recently replaced with a mechanism which allowed the runtime to pause an goroutine without waiting for it to make a function call.) +[4]: tmp.gBQ2tEtMHc#easy-footnote-bottom-3-4053 (I’m using the //go:noinline pragma to prevent the compiler from inlining max. This is because I want to isolate the effects of inlining on max rather than disabling optimisations globally with -gcflags='-l -N'. I go into detail about the //go: comments in this presentation.) +[5]: tmp.gBQ2tEtMHc#easy-footnote-bottom-4-4053 (You can check this for yourself by comparing the output of go test -bench=. -gcflags=-S with and without the //go:noinline annotation.) +[6]: tmp.gBQ2tEtMHc#easy-footnote-bottom-5-4053 (You can check this yourself with the -gcflags=-d=ssa/prove/debug=on flag.) +[7]: tmp.gBQ2tEtMHc#easy-footnote-1-4053 +[8]: https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md +[9]: tmp.gBQ2tEtMHc#easy-footnote-2-4053 +[10]: https://dave.cheney.net/2018/01/08/gos-hidden-pragmas +[11]: tmp.gBQ2tEtMHc#easy-footnote-3-4053 +[12]: tmp.gBQ2tEtMHc#easy-footnote-4-4053 +[13]: tmp.gBQ2tEtMHc#easy-footnote-5-4053 +[14]: https://dave.cheney.net/2014/06/07/five-things-that-make-go-fast (Five things that make Go fast) +[15]: https://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite (Why is a Goroutine’s stack infinite ?) +[16]: https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go (How to write benchmarks in Go) +[17]: https://dave.cheney.net/2018/01/08/gos-hidden-pragmas (Go’s hidden #pragmas) diff --git a/published/202005/20200427 How to secure your Linux email services with SSL-TLS.md b/published/202005/20200427 How to secure your Linux email services with SSL-TLS.md new file mode 100644 index 0000000000..48c2138c7a --- /dev/null +++ b/published/202005/20200427 How to secure your Linux email services with SSL-TLS.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (Acceleratorrrr) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12217-1.html) +[#]: subject: (How to secure your Linux email services with SSL/TLS) +[#]: via: (https://opensource.com/article/20/4/securing-linux-email) +[#]: author: (Marc Skinner https://opensource.com/users/marc-skinner) + +如何利用 SSL/TLS 保护你的 Linux 邮件服务 +====== + +> 通过理解安全证书来保护你的 Linux 邮件服务。 + +![](https://img.linux.net.cn/data/attachment/album/202005/13/215637khaogmririavnrlk.jpg) + +通常,不管你是通过简单邮件传输协议Simple Mail Transport Protocol(SMTP)或者互联网消息访问协议Internet Message Access Protocol(IMAP)或邮局协议Post Office Protocol(POP)发送或者接受邮件,邮件服务默认都是以无保护的明文来传输数据。近来随着数据加密成为越来越多程序的共识,你需要安全套接层Secure Sockets Layer/传输层安全性Transport Layer Security(SSL/TLS)的安全证书来保护你的邮件服务。 + +首先,快速回顾一下邮件服务和协议的基本流程。邮件通过 SMTP 从 TCP 端口 25 发出。这个协议依靠 DNS 邮件交换服务器Mail eXchanger(MX)记录的地址信息来传输邮件。当邮件到达邮件服务器后,可以被以下两种服务中的任意一种检索:使用 TCP 端口 143 的 IMAP,或者使用 TCP 端口 110 的 POP3(邮局协议第 3 版)。然而,以上服务都默认使用明文传输邮件和认证信息。这非常的不安全! + +为了保护电子邮件数据和认证,这些服务都增加了一个安全功能,使它们可以利用 SSL/TLS 证书对数据流和通讯进行加密封装。SSL/TLS 是如何加密数据的细节不在本文讨论范围,有兴趣的话可以阅读 [Bryant Son 关于互联网安全的文章][2]了解更多细节。概括的说,SSL/TLS 加密是一种基于公钥和私钥的算法。 + +通过加入这些安全功能后,这些服务将监听在新的 TCP 端口: + +服务 | 默认 TCP 端口 | SSL/TLS 端口 +---|---|--- +SMTP | 25 | 587 +IMAP | 143 | 993 +POP3 | 110 | 995 + +### 生成 SSL/TLS 证书 + +[OpenSSL][3] 可以生成免费的 SSL/TLS 证书,或者你也可以从公共证书颁发机构Certificate Authoritie(CA)购买。过去,生成自签发证书十分简单而且通用,但是由于安全被日益重视,大部分的邮件客户端是不信任自签发证书的,除非手动设置。 + +如果你只是自己使用或者做做测试,那就使用自签发证书省点钱吧。但是如果很多人或者客户也需要使用的话,那最好还是从受信任的证书颁发机构购买。 + +不管是哪种情况,开始请求新证书的过程是使用 Linux 系统上的 OpenSSL 工具来创建一个证书签发请求Certificate Signing Request完全合规域名Fully Qualified Domain Name(FQDN)、邮件联系信息等等。当你输入完这些信息后,私钥和 CSR 文件就生成完毕了。 + +#### 如果你想生成自签发证书 + +如果你想要生成自签发证书的话,在运行以上 CSR 命令之前,你必须先创建一个[自己的根 CA][4]。你可以通过以下方法创建自己的根 CA。 + +``` +$ openssl genrsa -des3 -out myCA.key 2048 +``` + +命令行会提示你输入一个密码。请输入一个复杂点的密码而且不要弄丢了,因为这将会是根 CA 私钥的密码,正如其名称所示,它是你的证书中所有信任关系的根。 + +接下来,生成根 CA 证书: + +``` +$ openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem +``` + +在回答完一些问题后,你就拥有一个有效期为 5 年的根 CA 证书了。 + +用之前生成的 CSR 文件,你可以请求生成一个新证书,并由您刚才创建的根 CA 签名。 + +``` +$ openssl x509 -req -in mail.mydomain.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out mail.mydomain.pem -days 1825 -sha256 +``` + +输入你的根 CA 私钥的密码来创建和签署证书。 + +现在你有了配置电子邮件服务以增强安全性所需的两个文件:私匙文件 `mail.mydomain.key` 和公开证书文件 `mail.mydomain.pem`。 + +#### 如果你愿意购买证书 + +如果你愿意从机构购买证书,则需要上传 CSR 文件到证书颁发机构的系统中,它将会被用于生成 SSL/TLS 证书。证书可作为文件下载,比如 `mail.mydomain.pem`。很多 SSL 机构也需要你下载一个中间证书。如果是这样的话,你必须把这个两个证书合并成一个,这样电子邮件服务就可以将这两个证书结合起来处理。可以使用以下命令把你的证书和第三方中间证书合并在一起: + +``` +$ cat mail.mydomain.pem gd_bundle-g2-g1.crt > mail.mydomain.pem +``` + +值得一提的是 `.pem` 文件后缀代表隐私增强邮件Privacy-Enhanced Mail。 + +现在你就有全部的设置邮件服务安全所需文件了:私匙文件 `mail.mydomain.key` 和组合的公开证书文件 `mail.mydomain.pem`。 + +### 为你的文件生成一个安全的文件夹 + +不管你是的证书是自签发的或者从机构购买,你都需要生成一个安全的,管理员拥有的文件夹用于保存这两个文件。可以使用以下命令来生成: + +``` +$ mkdir /etc/pki/tls +$ chown root:root /etc/pki/tls +$ chmod 700 /etc/pki/tls +``` + +在复制文件到 `/etc/pki/tls` 后,再次设置这些文件的权限: + +``` +$ chmod 600 /etc/pki/tls/* +``` + +### 配置你的 SMTP 和 IMAP 服务 + +接下来,让 SMTP 和 IMAP 服务使用新的安全证书。我们用 `postfix` 和 `dovecot` 来作为例子。 + +用你顺手的编辑器来编辑 `/etc/postfix/main.cf` 文件。添加以下几行: + +``` +smtpd_use_tls = yes +smtpd_tls_cert_file = /etc/pki/tls/mail.mydomain.pem +smtpd_tls_key_file = /etc/pki/tls/mail.mydomain.key +``` + +### 自定义选项 + +以下选项可以启用或禁用各种加密算法,协议等等: + +``` +smtpd_tls_eecdh_grade = strong +smtpd_tls_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtpd_tls_mandatory_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtpd_tls_mandatory_ciphers = high +smtpd_tls_security_level=may +smtpd_tls_ciphers = high +tls_preempt_cipherlist = yes +smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL +smtpd_tls_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL +smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +``` + +编辑 `/etc/dovecot/dovecot.conf` 文件,添加以下三行: + +``` +ssl = required +ssl_cert = </etc/pki/tls/mail.mydomain.pem +ssl_key = </etc/pki/tls/mail.mydomain.key +``` + +添加下列更多选项来启用或禁用各种加密算法、协议等等(我把这些留给你来理解): + +``` +ssl_cipher_list = EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:ALL:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SSLv2 +ssl_prefer_server_ciphers = yes +ssl_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1 +ssl_min_protocol = TLSv1.2 +``` + +### 设置 SELinux 上下文 + +如果你的 Linux 发行版启用了 SELinux,请为你的新证书文件设置正确的 SELinux 上下文。 + +对于 Postfix 设置 SELinux: + +``` +$ chcon -u system_u -t cert_t mail.mydomain.* +``` + +对于 Dovecot 设置 SELinux: + +``` +$ chcon -u system_u -t dovecot_cert_t mail.mydomain.* +``` + +重启这些服务,并与你相应更新过的电子邮件客户端配置连接。有些电子邮件客户端会自动探测到新的端口,有些则需要你手动更新。 + +### 测试配置 + +用 `openssl` 命令行和 `s_client` 插件来简单测试一下: + +``` +$ openssl s_client -connect mail.mydomain.com:993 +$ openssl s_client -starttls imap -connect mail.mydomain.com:143 +$ openssl s_client -starttls smtp -connect mail.mydomain.com:587 +``` + +这些测试命令会打印出很多信息,关于你使用的连接、证书、加密算法、会话和协议。这不仅是一个验证新设置的好方法,也可以确认你使用了适当的证书,以及在 postfix 或 dovecot 配置文件中定义的安全设置正确。 + +保持安全! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/securing-linux-email + +作者:[Marc Skinner][a] +选题:[lujun9972][b] +译者:[Acceleratorrrr](https://github.com/Acceleratorrrr) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/marc-skinner +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) +[2]: https://linux.cn/article-11699-1.html +[3]: https://www.openssl.org/ +[4]: https://en.wikipedia.org/wiki/Root_certificate diff --git a/published/202005/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/published/202005/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md new file mode 100644 index 0000000000..3b04dc37b8 --- /dev/null +++ b/published/202005/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12242-1.html) +[#]: subject: (Lubuntu 20.04 Review: Lightweight, Minimalistic, Polished) +[#]: via: (https://itsfoss.com/lubuntu-20-04-review/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Lubuntu 20.04 点评:轻量、简约、文雅 +====== + +> Lubuntu 20.04 LTS 与之前的 LTS 版本有很大的不同。它旨在给你一个更完善的体验,而不仅仅是关注旧电脑。请阅读更多关于 Lubuntu 20.04 的内容。 + +### Lubuntu 20.04 点评:第一个基于 LXQt 的长期支持版 + +我在 Lubuntu 20.04 发行前几天就已经开始使用它了。我通常使用 Arch 阵营中 Manjaro 和 Cinnamon 桌面,所以使用 Lubuntu 对我来说是一个愉快的改变。 + +以下是我在使用 Lubuntu 20.04.时的一些感受和注记。 + +#### 再见 LXDE,你好 LXQt! + +长期以来,[Lubuntu][1] 都依靠 [LXDE][2] 来提供轻量级的 Linux 体验。但现在,它使用的是 LXQt 桌面环境。 + +[LXDE][3] 是基于 GTK(GNOME 所使用的库),更具体地说是基于 2020 年的 GTK+ 2。由于对 GTK+ 3 不满意,LXDE 开发人员 Hong Jen Yee 决定将整个桌面移植到 Qt(KDE 所使用的库)。LXDE 的 Qt 移植版本和 [Razor-qt][4] 项目合并形成 [LXQt][5]。所以现在,LXDE 和 LXQt 作为单独的项目而共存。 + +既然 LXDE 开发者本身专注于 LXQt,那么 Lubuntu 坚持使用三年多前上一次稳定发布版的桌面环境 LXDE 是没有意义的。 + +因此,Lubuntu 18.04 是使用 [LXDE][3] 的最后一个版本。幸运的是,这是一个长期支持版本。Lubuntu 团队将提供支持直到 2021 年。 + +![][6] + +#### 不仅适于老机器 + +随着在 2020 年“老机器”的定义发生了变化,Lubuntu 18.04 成为了最后一个 32 位版本。现在,即使是一台 10 年前的老机器也至少有 2G 的内存和一个双核 64 位处理器。 + +因此,Lubuntu 团队将不再设置最低的系统需求,也不再主要关注旧硬件。尽管 LXQt 仍然是一个轻量级的、经典而不失精致的、功能丰富的桌面环境。 + +在 Lubuntu 20.04 LTS 发布之前,Lubuntu 的第一个 LXQt 发行版是 18.10,开发人员经历了三个标准发行版来完善 LXQt 桌面,这是一个很好的开发策略。 + +#### 不用常规的 Ubiquity,Lubuntu 20.04 使用的是 Calamares 安装程序 + +![Lubuntu 20.04 Calamares 安装程序][8] + +在新版本中使用了全新的 [Calamares][9] 安装程序,取代了其它 [Ubuntu 官方版本][10]使用的 Ubiquity 安装程序。 + +整个安装过程在大约能在 10 分钟内完成,比之前 Lubuntu 的版本稍微快一些。 + +由于镜像文件附带了预先安装的基本应用程序,所以你可以很快就可以完成系统的完全配置。 + +#### 不要直接从 Lubuntu 18.04 升级到 Lubuntu 20.04 + +通常,你可以[将 Ubuntu 从一个 LTS 版本升级到另一个 LTS 版本][11]。但是 Lubuntu 团队建议不要从 Lubuntu 18.04 升级到 20.04。他们建议重新安装,这才是正确的。 + +Lubuntu 18.04 使用 LXDE 桌面,20.04 使用 LXQt。由于桌面环境的巨大变化,从 18.04 升级到 20.04 将导致系统崩溃。 + +#### 更多的 KDE 和 Qt 应用程序 + +![][12] + +下面是在这个新版本中默认提供的一些应用程序,正如我们所看到的,并非所有应用程序都是轻量级的,而且大多数应用程序都是基于 Qt 的。 + +甚至使用的软件中心也是 KDE 的 Discover,而不是 Ubuntu 的 GNOME 软件中心。 + + * Ark – 归档文件管理器 + * Bluedevil – 蓝牙连接管理 + * Discover 软件中心 – 包管理系统 + * FeatherPad – 文本编辑器 + * FireFox – 浏览器 + * K3b – CD/DVD 刻录器 + * Kcalc – 计算器 + * KDE 分区管理器 – 分区管理工具 + * LibreOffice – 办公套件(Qt 界面版本) + * LXimage-Qt – 图片查看器及截图制作 + * Muon – 包管理器 + * Noblenote – 笔记工具 + * PCManFM-Qt – 文件管理器 + * Qlipper – 剪贴板管理工具 + * qPDFview – PDF 阅读器 + * PulseAudio – 音频控制器 + * Qtransmission – BT 下载工具(Qt 界面版本) + * Quassel – IRC 客户端 + * ScreenGrab – 截屏制作工具 + * Skanlite – 扫描工具 + * 启动盘创建工具 – USB 启动盘制作工具 + * Trojita – 邮件客户端 + * VLC – 媒体播放器 + * [MPV 视频播放器][13] + +#### 测试 Lubuntu 20.04 LTS + +LXQt 版 Lubuntu 的启动时间不到一分钟,虽然是从 SSD 启动的。 + +LXQt 目前需要的内存比基于 Gtk+ 2 的 LXDE 稍微多一点,但是另一种 Gtk+ 3 工具包也需要更多的内存。 + +在重新启动之后,系统以非常低的内存占用情况运行,大约只有 340 MB(按照现代标准),比 LXDE 多 100 MB。 + +![htop 在 Lubuntu 20.04 上运行][14] + +LXQt 不仅适用于硬件较旧的用户,也适用于那些希望在新机器上获得简约经典体验的用户。 + +桌面布局看起来类似于 KDE 的 Plasma 桌面,你觉得呢? + +![Lubuntu 20.04 桌面环境][15] + +在左下角有一个应用程序菜单,一个用于显示固定和活动的应用程序的任务栏,右下角有一个系统托盘。 + +Lubuntu 的 LXQt 版本可以很容易的定制,所有的东西都在菜单的首选项下,大部分的关键项目都在 LXQt “设置”中。 + +值得一提的是,LXQt 在默认情况下使用流行的 [Openbox 窗口管理器][16]。 + +与前三个发行版一样,20.04 LTS 附带了一个默认的黑暗主题 Lubuntu Arc,但是如果不适合你的口味,可以快速更换,也很方便。 + +就日常使用而言,事实证明,Lubuntu 20.04 向我证明,其实每一个 Ubuntu 的分支版本都完全没有问题。 + +#### 结论 + +Lubuntu 团队已经成功地过渡到一个现代的、依然轻量级的、极简的桌面环境。LXDE 看起来被遗弃了,迁移到一个活跃的项目也是一件好事。 + +我希望 Lubuntu 20.04 能够让你和我一样热爱,如果是这样,请在下面的评论中告诉我。请继续关注! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lubuntu-20-04-review/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://lubuntu.me/ +[2]: https://github.com/lxde +[3]: https://lxde.org/ +[4]: https://web.archive.org/web/20160220061334/http://razor-qt.org/ +[5]: https://lxqt.org/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Lubuntu-20-04-review.jpg?ssl=1 +[7]: https://itsfoss.com/lubuntu-no-more-old-distro/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/lubuntu-20-04-installer.jpg?ssl=1 +[9]: https://calamares.io/ +[10]: https://itsfoss.com/which-ubuntu-install/ +[11]: https://itsfoss.com/upgrade-ubuntu-version/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/Lubuntu-20.04.gif?ssl=1 +[13]: https://itsfoss.com/mpv-video-player/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/htop.jpg?fit=800%2C629&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/Lubuntu-20.04-desktop.jpg?fit=800%2C450&ssl=1 +[16]: https://en.wikipedia.org/wiki/Openbox diff --git a/published/202005/20200428 Upgrading Fedora 31 to Fedora 32.md b/published/202005/20200428 Upgrading Fedora 31 to Fedora 32.md new file mode 100644 index 0000000000..c2c4bc0301 --- /dev/null +++ b/published/202005/20200428 Upgrading Fedora 31 to Fedora 32.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12195-1.html) +[#]: subject: (Upgrading Fedora 31 to Fedora 32) +[#]: via: (https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/) +[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) + +将 Fedora 31 升级到 Fedora 32 +====== + +![][1] + +Fedora 32 [已经发布][2]。你可能想升级系统以获得 Fedora 中的最新功能。Fedora Workstation 有图形化的升级方法。另外,Fedora 提供了命令行方法,用于将 Fedora 31 升级到 Fedora 32。 + +升级前,请访问 [Fedora 32 个常见 bug 的维基页面][3],查看是否存在可能影响升级的问题。尽管 Fedora 社区试图确保升级正常进行,但是无法为用户可能使用的每种软硬件组合提供保证。 + +### 将 Fedora 31 Workstation 升级到 Fedora 32 + +在新版本发布不久之后就会出现通知,告诉你有可用的升级。你可以单击该通知启动 “GNOME 软件”。或者,你可以从 GNOME Shell 中选择“软件”。 + +在 “GNOME 软件”中选择更新Updates选项卡,你会看到一个页面通知你 Fedora 32 现在可用。 + +如果你在此页面看不到任何内容,请尝试使用左上方的重新加载按钮。发布后,所有系统可能都需要一段时间才能看到可用的升级。 + +选择下载Download获取升级包。你可以继续做事直到下载完成。然后使用 “GNOME 软件”重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再回来。 + +### 使用命令行 + +如果你是从 Fedora 的先前版本升级的,那么你可能对 `dnf upgrade` 插件很熟悉。这个方法是推荐和受支持的从 Fedora 31 升级到 Fedora 32 的方法。使用此插件将使你轻松地升级到 Fedora 32。 + +#### 1、更新软件并备份系统 + +在开始升级过程之前,请确保你有 Fedora 31 的最新软件。如果你安装了模块化软件modular software,这尤为重要。`dnf` 和 “GNOME 软件”的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用 “GNOME 软件” 或在终端中输入以下命令。 + +``` +sudo dnf upgrade --refresh +``` + +此外,在继续操作之前,请确保备份系统。有关备份的帮助,请参阅 Fedora Magazine 上的[备份系列][4]。 + +#### 2、安装 DNF 插件 + +接下来,打开终端并输入以下命令安装插件: + +``` +sudo dnf install dnf-plugin-system-upgrade +``` + +#### 3、使用 DNF 开始更新 + +现在,你的系统已更新、已备份、并且已安装 DNF 插件,你可以在终端中使用以下命令开始升级: + +``` +sudo dnf system-upgrade download --releasever=32 +``` + +这个命令将开始在本地下载所有的升级包,为升级做准备。如果你在升级的时候因为没有更新的包、依赖关系破损或退役的包而出现问题,请在输入上述命令时添加 `--allowerasing` 标志。这将允许 DNF 移除可能阻碍系统升级的软件包。 + +#### 4、重启并升级 + +当上一个命令完成了所有升级包的下载,你的系统就可以重新启动了。要将系统引导至升级过程,请在终端中输入以下命令: + +``` +sudo dnf system-upgrade reboot +``` + +此后,系统将重启。在许多版本之前,`fedup` 工具会在内核选择/启动页上创建一个新选项。使用 `dnf-plugin-system-upgrade` 包,你的系统会重启进入 Fedora 31 当前安装的内核;这个是正常的。在选择内核之后,你的系统会立即开始升级过程。 + +现在可能是喝杯咖啡休息的好时机!完成后,系统将重启,你将能够登录到新升级的 Fedora 32 系统。 + +![][5] + +### 解决升级问题 + +有时,升级系统时可能会出现意外问题。如果你遇到任何问题,请访问 [DNF 系统升级文档][6],以获取有关故障排除的更多信息。 + +如果升级时遇到问题,并且系统上安装了第三方仓库,那么在升级时可能需要禁用这些仓库。对于 Fedora 不提供的仓库的支持,请联系仓库的提供者。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/ + +作者:[Adam Šamalík][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/asamalik/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/31-32-816x345.png +[2]: https://linux.cn/article-12164-1.html +[3]: https://fedoraproject.org/wiki/Common_F32_bugs +[4]: https://fedoramagazine.org/taking-smart-backups-duplicity/ +[5]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png +[6]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues diff --git a/published/202005/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md b/published/202005/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md new file mode 100644 index 0000000000..a58f9a7895 --- /dev/null +++ b/published/202005/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12198-1.html) +[#]: subject: (Using Files and Folders on Desktop Screen in Ubuntu) +[#]: via: (https://itsfoss.com/add-files-on-desktop-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 桌面中使用文件和文件夹 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/08/224609chff5qn5ccah56af.jpg) + +> 此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可能遇到的一些困难。 + +我认识一些习惯将所有重要/常用文件放在桌面上以便快速访问的人。 + +![][1] + +我不喜欢杂乱的桌面,但是我可以想象它实际上可能对某些人有所帮助。 + +在过去的几个版本中,很难在 Ubuntu 的默认 GNOME 桌面上添加文件。这并不是 Ubuntu 的错。 + +[GNOME][2] 的开发者认为,桌面上没有图标和文件的存身之地。当你可以在菜单中轻松搜索文件时,无需将文件放在桌面上。这在部分情况下是事实。 + +这就是为什么 [GNOME 的文件管理器 Nautilus][3] 的较新版本不能很好地支持桌面上的图标和文件的原因。 + +也就是说,在桌面上添加文件和文件夹并非没有可能。让我告诉你如何做。 + +### 在 Ubuntu 的桌面上添加文件和文件夹 + +![][4] + +我在本教程中使用的是 Ubuntu 20.04。对于其他 Ubuntu 版本,步骤可能会有所不同。 + +#### 将文件和文件夹添加到“桌面文件夹” + +如果打开文件管理器,你应该在左侧边栏或文件夹列表中看到一个名为“桌面”的条目。此文件夹(以某种方式)代表你的桌面。 + +![Desktop folder can be used to add files to the desktop screen][5] + +你添加到此文件夹的所有内容都会反映在桌面上。 + +![Anything added to the Desktop folder will be reflected on the desktop screen][6] + +如果你从“桌面文件夹”中删除文件,那么文件也会从桌面中删除。 + +#### 将文件拖放到桌面不起作用 + +现在,如果你尝试从文件管理器往桌面上拖放文件,它会不起使用。这不是一个 bug,它是一个使很多人恼火的功能。 + +一种临时方案是打开两个文件管理器。在其中一个打开“桌面”文件夹,然后将文件拖放到该文件夹​​中,它们将被添加到桌面上。 + +我知道这并不理想,但是你没有太多选择。 + +#### 你不能使用 Ctrl+C 和 Ctrl+V 在桌面上复制粘贴,请使用右键单击菜单 + +更恼人的是,你不能使用 `Ctrl+V`(著名的键盘快捷键)将文件粘贴到桌面上。 + +但是,你仍然可以使用右键单击,然后选择“粘贴”,将文件复制到桌面上。你甚至可以通过这种方式创建新文件夹。 + +![Right click menu can be used for copy-pasting files to desktop][7] + +是否有意义?对我来说不是,但这就是 Ubuntu 20.04 的方式。 + +#### 你无法使用 Delete 键删除文件和文件夹,请再次使用右键菜单 + +更糟糕的是,你无法使用 `Delete` 键或 `Shift+Delete` 键从桌面上删除文件。但是你仍然可以右键单击文件或文件夹,然后选择“移至回收站”来删除文件。 + +![Delete files from desktop using right click][8] + +好了,你现在知道至少有一种方法可以在桌面上添加文件,但有一些限制。不幸的是,这还没有结束。 + +你无法在桌面上用名称搜索文件。通常,如果你开始输入 “abc”,那么以 “abc” 开头的文件会高亮显示。但是在这里不行。 + +我不知道为什么在桌面上添加文件受到了如此多的限制。值得庆幸的是,我不会经常使用它,否则我会感到非常沮丧。 + +如果有兴趣,你也可以阅读[在 Ubuntu 桌面上添加应用快捷方式][9]这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-files-on-desktop-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/files-on-desktop-ubuntu.jpg?ssl=1 +[2]: https://www.gnome.org/ +[3]: https://wiki.gnome.org/Apps/Files +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-ubuntu.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/desktop-folder-ubuntu.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-screen-ubuntu.jpg?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-new-files-ubuntu-desktop.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/delete-files-from-desktop-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/ubuntu-desktop-shortcut/ diff --git a/published/202005/20200428 What-s new in Fedora 32 Workstation.md b/published/202005/20200428 What-s new in Fedora 32 Workstation.md new file mode 100644 index 0000000000..17050794d2 --- /dev/null +++ b/published/202005/20200428 What-s new in Fedora 32 Workstation.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12201-1.html) +[#]: subject: (What’s new in Fedora 32 Workstation) +[#]: via: (https://fedoramagazine.org/whats-new-fedora-32-workstation/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/author/ryanlerch/) + +Fedora 32 Workstation 的新功能 +====== + +![][1] + +Fedora 32 Workstation 是我们免费的领先操作系统的[最新版本][2]。你现在可以从[官方网站][3]下载它。Fedora 32 Workstation 中有几个新的且值得注意的变化。请阅读下面的详情。 + +### GNOME 3.36 + +Fedora 32 Workstation 包含了适合所有用户的 GNOME 桌面环境的最新版本。Fedora 32 Workstation 中的 GNOME 3.36 包含了许多更新和改进,包括: + +#### 重新设计的锁屏界面 + +Fedora 32 中的锁屏是一种全新的体验。新设计消除了以前版本中使用的“窗口阴影”,并着重于易用性和速度。 + +![Unlock screen in Fedora 32][4] + +#### 新的扩展程序 + +Fedora 32 有新的“扩展”应用,它可轻松管理你的 GNOME 扩展。过去,扩展是使用“软件”和/或“调整工具”来安装、配置和启用的。 + +![The new Extensions application in Fedora 32][5] + +请注意,默认情况下,Fedora 32 上未安装这个“扩展”应用。需要使用“软件”进行搜索和安装,或在终端中使用以下命令: + +``` +sudo dnf install gnome-extensions-app +``` + +#### 重新组织的设置应用 + +敏锐的 Fedora 用户会注意到“设置”应用已重新组织。设置类别的结构更加扁平,因此可以一次看到更多设置。 + +此外,“关于”中现在有有关系统的更多信息,包括正在运行的窗口系统(例如 Wayland)。 + +![The reorganized settings application in Fedora 32][6] + +#### 重新设计的通知/日历弹出框 + +单击桌面顶部的“日期和时间”可切换“通知/日历”弹出窗口,其中有许多小的样式调整项。此外,弹出窗口现在有“请勿打扰”开关,可快速禁用所有通知。这在希望只显示屏幕而不显示个人通知时很有用。 + +![The new Notification / Calendar popover in Fedora 32 ][7] + +#### 重新设计的时钟应用 + +Fedora 32 完全重新设计了时钟。该设计在较小的窗口中效果更好。 + +![The Clocks application in Fedora 32][8] + +GNOME 3.36 还提供了许多其他功能和增强。有关更多信息,请查看 [GNOME 3.36 的发布说明][9]。 + +### 改进的内存不足处理 + +以前,如果系统内存不足,那么可能会遇到大量使用交换(也称为 [交换抖动][10])–有时会导致 Workstation UI 变慢或在一段时间内无响应。Fedora 32 Workstation 现在默认启用 EarlyOOM。EarlyOOM 可以让用户在低内存的情况下,存在大量使用交换的情况下,更快速地恢复和恢复对系统的控制。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/whats-new-fedora-32-workstation/ + +作者:[Ryan Lerch][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/ryanlerch/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/fedora32workstation-816x345.jpg +[2]: https://linux.cn/article-12164-1.html +[3]: https://getfedora.org/workstation +[4]: https://fedoramagazine.org/wp-content/uploads/2020/04/unlock.gif +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/extensions.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/04/settings.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/04/donotdisturb.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/04/clocks.png +[9]: https://help.gnome.org/misc/release-notes/3.36/ +[10]: https://en.wikipedia.org/wiki/Thrashing_(computer_science) diff --git a/published/202005/20200429 Drop PNG and JPG for your online images- Use WebP.md b/published/202005/20200429 Drop PNG and JPG for your online images- Use WebP.md new file mode 100644 index 0000000000..7f581e778f --- /dev/null +++ b/published/202005/20200429 Drop PNG and JPG for your online images- Use WebP.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12193-1.html) +[#]: subject: (Drop PNG and JPG for your online images: Use WebP) +[#]: via: (https://opensource.com/article/20/4/webp-image-compression) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) + +线上图片请抛弃 PNG 和 JPG:使用 WebP +====== + +> 了解一下这个开源的图片编辑工具来节省时间和空间。 + +![](https://img.linux.net.cn/data/attachment/album/202005/07/143932l22hot7ebhbbqjmm.jpg) + +WebP 是 2010 年 Google 开发的一种图片格式,它为网页上的图片提供了卓越的无损和有损压缩。网站开发者们可以使用 WebP 来创建尺寸更小、细节更丰富的图片,以此来提高网站的速度。更快的加载速度对于网站的用户体验和网站的营销效果是至关重要的。 + +为了在所有设备和用户中达到最佳加载效果,你网站上的图片文件大小不应该超过 500 KB。 + +与 PNG 图片相比,WebP 无损图片通常至少要比 PNG 图片小 25%。在同等的 SSIM(结构相似度structural similarity)质量指标下,WebP 有损图片通常比 JPEG 图片小 25% 到 34%。 + +无损 WebP 也支持透明度。而在可接受有损 RGB 压缩的情况下,有损 WebP 也支持透明度,通常其大小比 PNG 文件小三倍。 + +Google 报告称,把动画 GIF 文件转换为有损 WebP 后文件大小减少了 64%,转换为无损 WebP 后文件大小减少了 19%。 + +WebP 文件格式是一种基于 RIFF(资源互换文件格式resource interchange file format)的文档格式。你可以用 [hexdump][2] 看到文件的签名是 `52 49 46 46`(RIFF): + + +``` +$ hexdump --canonical pixel.webp +00000000  52 49 46 46 26 00 00 00  [...]  |RIFF&...WEBPVP8 | +00000010  1a 00 00 00 30 01 00 9d  [...]  |....0....*......| +00000020  0e 25 a4 00 03 70 00 fe  [...]  |.%...p...`....| +0000002e +``` + +独立的 libwebp 库作为 WebP 技术规范的参考实现,可以从 Google 的 [Git 仓库][3] 或 tar 包中获得。 + +全球在用的 80% 的 web 浏览器兼容 WebP 格式。本文撰写时,Apple 的 Safari 浏览器还不兼容。解决这个问题的方法是将 JPG/PNG 图片与 WebP 图片一起提供,有一些方法和 Wordpress 插件可以做到这一点。 + +### 为什么要这样做? + +我的部分工作是设计和维护我们组织的网站。由于网站是个营销工具,而网站的速度是衡量用户体验的重要指标,我一直致力于提高网站速度,通过把图片转换为 WebP 来减少图片大小是一个很好的解决方案。 + +我使用了 web.dev 来检测其中一个网页,该工具是由 Lighthouse 提供服务的,遵循 Apache 2.0 许可证,可以在 找到。 + +据其官方描述,“LIghthouse 是一个开源的,旨在提升网页质量的自动化工具。你可以在任何公共的或需要鉴权的网页上运行它。它有性能、可用性、渐进式 web 应用、SEO 等方面的审计。你可以在 Chrome 浏览器的开发工具中运行 Lighthouse,也可以通过命令行或作为 Node 模块运行。你输入一个 URL 给 Lighthouse,它会对这个网页进行一系列的审计,然后生成这个网页的审计结果报告。从报告的失败审计条目中可以知道应该怎么优化网页。每条审计都有对应的文档解释为什么该项目是重要的,以及如何修复它。” + +### 创建更小的 WebP 图片 + +我测试的页面返回了三张图片。在它生成的报告中,它提供了推荐和目标。我选择了它报告有 650 KB 的 `app-graphic` 图片。通过把它转换为 WebP 格式,预计可以把图片大小降到 61 KB,节省 589 KB。我在 Photoshop 中把它转换了,用默认的 WebP 设置参数保存它,它的文件大小为 44.9 KB。比预期的还要好!从下面的 Photoshop 截图中可以看出,两张图在视觉质量上完全一样。 + +![WebP vs JPG comparison][4] + +*左图:650 KB(实际大小)。右图: 44.9 KB(转换之后的目标大小)。* + +当然,也可以用开源图片编辑工具 [GIMP][5] 把图片导出为 WebP。它提供了几个质量和压缩的参数: + +![GIMP dialog for exporting webp, as a webp][6] + +另一张图放大后: + +![WebP vs PNG comparison][7] + +PNG(左图)和 WebP(右图),都是从 JPG 转换而来,两图对比可以看出 WebP 不仅在文件大小更小,在视觉质量上也更优秀。 + +### 把图片转换为 WebP + +你也可以用 Linux 的命令行工具把图片从 JPG/PNG 转换为 WebP: + +在命令行使用 `cwebp` 把 PNG 或 JPG 图片文件转换为 WebP 格式。你可以用下面的命令把 PNG 图片文件转换为质量参数为 80 的 WebP 图片。 + +``` +cwebp -q 80 image.png -o image.webp +``` + +你还可以用 [Image Magick][8],这个工具可能在你的发行版本软件仓库中可以找到。转换的子命令是 `convert`,它需要的所有参数就是输入和输出文件: + +``` +convert pixel.png pixel.webp +``` + +### 使用编辑器把图片转换为 WebP + +要在图片编辑器中来把图片转换为 WebP,可以使用 [GIMP][9]。从 2.10 版本开始,它原生地支持 WebP。 + +如果你是 Photoshop 用户,由于 Photoshop 默认不包含 WebP 支持,因此你需要一个转换插件。遵循 Apache License 2.0 许可证发布的 WebPShop 0.2.1 是一个用于打开和保存包括动画图在内的 WebP 图片的 Photoshop 模块,在 可以找到。 + +为了能正常使用它,你需要把它放进 Photoshop 插件目录下的 `bin` 文件夹: + +Windows x64 :`C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi` + +Mac:`Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin` + +### Wordpress 上的 WebP + +很多网站是用 Wordpress 搭建的(我的网站就是)。因此,Wordpress 怎么上传 WebP 图片?本文撰写时,它还不支持。但是,当然已经有插件来满足这种需求,因此你可以在你的网站上同时准备 WebP 和 PNG/JPG 图片(为 Apple 用户)。 + +在 [Marius Hosting][11] 有下面的[说明][10]: + +“直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 `functions.php` 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你介绍一下怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入‘外观/主题编辑器’找到 `functions.php`。复制下面的代码粘贴到该文件最后并保存: + +``` +//** *Enable upload for webp image files.*/ +function webp_upload_mimes($existing_mimes) { + $existing_mimes['webp'] = 'image/webp'; + return $existing_mimes; +} +add_filter('mime_types', 'webp_upload_mimes'); +``` + +如果你想在‘媒体/媒体库’时看到缩略图预览,那么你需要把下面的代码也添加到 `functions.php` 文件。为了找到 `functions.php` 文件,进入‘外观/主题编辑器’并搜索 `functions.php`,然后复制下面的代码粘贴到文件最后并保存: + +``` +//** * Enable preview / thumbnail for webp image files.*/ +function webp_is_displayable($result, $path) { + if ($result === false) { + $displayable_image_types = array( IMAGETYPE_WEBP ); + $info = @getimagesize( $path ); + + if (empty($info)) { + $result = false; + } elseif (!in_array($info[2], $displayable_image_types)) { + $result = false; + } else { + $result = true; + } + } + + return $result; +} +add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2); +``` + +” + +### WebP 和未来 + +WebP 是一个健壮而优化的格式。它看起来更好,压缩率更高,并具有其他大部分常见图片格式的所有特性。不必再等了,现在就使用它吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/webp-image-compression + +作者:[Jeff Macharyas][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen) +[2]: https://opensource.com/article/19/8/dig-binary-files-hexdump +[3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html +[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png (WebP vs JPG comparison) +[5]: http://gimp.org +[6]: https://img.linux.net.cn/data/attachment/album/202005/07/143538plu797s4wmhy9b1p.jpg (GIMP dialog for exporting webp, as a webp) +[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png (WebP vs PNG comparison) +[8]: https://imagemagick.org +[9]: https://en.wikipedia.org/wiki/GIMP +[10]: https://mariushosting.com/how-to-upload-webp-files-on-wordpress/ +[11]: https://mariushosting.com/ diff --git a/published/202005/20200429 The life-changing magic of git rebase -i.md b/published/202005/20200429 The life-changing magic of git rebase -i.md new file mode 100644 index 0000000000..54665c70fe --- /dev/null +++ b/published/202005/20200429 The life-changing magic of git rebase -i.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12231-1.html) +[#]: subject: (The life-changing magic of git rebase -i) +[#]: via: (https://opensource.com/article/20/4/git-rebase-i) +[#]: author: (Dave Neary https://opensource.com/users/dneary) + +完美生活:git rebase -i +====== + +> 让大家觉得你一次就能写出完美的代码,并让你的补丁更容易审核和合并。 + +![](https://img.linux.net.cn/data/attachment/album/202005/18/185911fvwztwyp4lvbzkw4.jpg) + +软件开发是混乱的。有很多错误的转折、有需要修复的错别字、有需要修正的错误、有需要稍后纠正的临时和粗陋的代码,还有在以后的开发过程中发现一次又一次的问题。有了版本控制,在创建“完美”的最终产品(即准备提交给上游的补丁)的过程中,你会有一个记录着每一个错误转折和修正的原始记录。就像电影中的花絮一样,它们会让人有点尴尬,有时也会让人觉得好笑。 + +如果你使用版本控制来定期保存你的工作线索,然后当你准备提交审核的东西时,又可以隐藏所有这些私人草稿工作,并只提交一份单一的、完美的补丁,那不是很好吗?`git rebase -i`,是重写历史记录的完美方法,可以让大家觉得你一次就写出了完美的代码! + +### git rebase 的作用是什么? + +如果你不熟悉 Git 的复杂性,这里简单介绍一下。在幕后,Git 将项目的不同版本与唯一标识符关联起来,这个标识符由父节点的唯一标识符的哈希以及新版本与其父节点的差异组成。这样就形成了一棵修订树,每个签出项目的人都会得到自己的副本。不同的人可以把项目往不同的方向发展,每个方向都可能从不同的分支点开始。 + +![Master branch vs. private branch][2] + +*左边是 origin 版本库中的主分支,右边是你个人副本中的私有分支。* + +有两种方法可以将你的工作与原始版本库中的主分支整合起来:一种是使用合并:`git merge`,另一种是使用变基:`git rebase`。它们的工作方式非常不同。 + +当你使用 `git merge` 时,会在主分支(`master`)上创建一个新的提交,其中包括所有来自原始位置(`origin`)的修改和所有本地的修改。如果有任何冲突(例如,如果别人修改了你也在修改的文件),则将这些冲突标记出来,并且你有机会在将这个“合并提交”提交到本地版本库之前解决这些冲突。当你将更改推送回父版本库时,所有的本地工作都会以分支的形式出现在 Git 版本库的其他用户面前。 + +但是 `git rebase` 的工作方式不同。它会回滚你的提交,并从主分支(`master`)的顶端再次重放这些提交。这导致了两个主要的变化。首先,由于你的提交现在从一个不同的父节点分支出来,它们的哈希值会被重新计算,并且任何克隆了你的版本库的人都可能得到该版本库的一个残破副本。第二,你没有“合并提交”,所以在将更改重放到主分支上时会识别出任何合并冲突,因此,你需要在进行变基rebase之前先修复它们。现在,当你现在推送你的修改时,你的工作不会出现在分支上,并且看起来像是你是在主分支的最新的提交上写入了所有的修改。 + +![Merge commits preserve history, and rebase rewrites history.][3] + +*合并提交(左)保留了历史,而变基(右)重写历史。* + +然而,这两种方式都有一个缺点:在你准备好分享代码之前,每个人都可以看到你在本地处理问题时的所有涂鸦和编辑。这就是 `git rebase` 的 `--interactive`(或简写 `-i`)标志发挥作用的地方。 + +### git rebase -i 登场 + +`git rebase` 的最大优点是它可以重写历史。但是,为什么仅止于假装你从后面的点分支出来呢?有一种更进一步方法可以重写你是如何准备就绪这些代码的:`git rebase -i`,即交互式的 `git rebase`。 + +这个功能就是 Git 中的 “魔术时光机” 功能。这个标志允许你在做变基时对修订历史记录进行复杂的修改。你可以隐藏你的错误! 将许多小的修改合并到一个崭新的功能补丁中! 重新排列修改历史记录中的显示顺序! + +![output of git rebase -i][4] + +当你运行 `git rebase -i` 时,你会进入一个编辑器会话,其中列出了所有正在被变基的提交,以及可以对其执行的操作的多个选项。默认的选择是选择(`Pick`)。 + +* `Pick`:会在你的历史记录中保留该提交。 +* `Reword`:允许你修改提交信息,可能是修复一个错别字或添加其它注释。 +* `Edit`:允许你在重放分支的过程中对提交进行修改。 +* `Squash`:可以将多个提交合并为一个。 +* 你可以通过在文件中移动来重新排序提交。 + +当你完成后,只需保存最终结果,变基操作就会执行。在你选择修改提交的每个阶段(无论是用 `reword`、`edit`、`squash` 还是发生冲突时),变基都会停止,并允许你在继续提交之前进行适当的修改。 + +上面这个例子的结果是 “One-liner bug fix” 和 “Integate new header everywhere” 被合并到一个提交中,而 “New header for docs website” 和 “D'oh - typo. Fixed” 合并到另一个提交中。就像变魔术一样,其他提交的工作还在你的分支中,但相关的提交已经从你的历史记录中消失了! + +这使得使用 `git send-email` 或者用你新整理好的补丁集在父版本库中创建一个拉取请求,然后来提交一个干净的补丁给上游项目变得很容易。这有很多好处,包括让你的代码更容易审核,更容易接受,也更容易合并。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/git-rebase-i + +作者:[Dave Neary][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dneary +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/sites/default/files/uploads/master-private-branches.png (Master branch vs. private branch) +[3]: https://opensource.com/sites/default/files/uploads/merge-commit-vs-rebase.png (Merge commits preserve history, and rebase rewrites history.) +[4]: https://opensource.com/sites/default/files/uploads/git-rebase-i.png (output of git rebase -i) diff --git a/published/202005/20200429 Why strace doesn-t work in Docker.md b/published/202005/20200429 Why strace doesn-t work in Docker.md new file mode 100644 index 0000000000..57e5a5b42e --- /dev/null +++ b/published/202005/20200429 Why strace doesn-t work in Docker.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12251-1.html) +[#]: subject: (Why strace doesn't work in Docker) +[#]: via: (https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/) +[#]: author: (Julia Evans https://jvns.ca/) + +为什么 strace 在 Docker 中不起作用? +====== + +在编辑“容器如何工作”爱好者杂志的能力页面时,我想试着解释一下为什么 `strace` 在 Docker 容器中无法工作。 + +这里的问题是 —— 如果我在笔记本上的 Docker 容器中运行 `strace`,就会出现这种情况: + +``` +$ docker run -it ubuntu:18.04 /bin/bash +$ # ... install strace ... +[email protected]:/# strace ls +strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted +``` + +`strace` 通过 `ptrace` 系统调用起作用,所以如果不允许使用 `ptrace`,它肯定是不能工作的! 这个问题很容易解决 —— 在我的机器上,是这样解决的: + +``` +docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash +``` + +但我对如何修复它不感兴趣,我想知道为什么会出现这种情况。为什么 `strace` 不能工作,为什么`--cap-add=SYS_PTRACE` 可以解决这个问题? + +### 假设 1:容器进程缺少 `CAP_SYS_PTRACE` 能力。 + +我一直以为原因是 Docker 容器进程默认不具备 `CAP_SYS_PTRACE` 能力。这和它可以被 `--cap-add=SYS_PTRACE` 修复是一回事,是吧? + +但这实际上是不合理的,原因有两个。 + +原因 1:在实验中,作为一个普通用户,我可以对我的用户运行的任何进程进行 `strace`。但如果我检查我的当前进程是否有 `CAP_SYS_PTRACE` 能力,则没有: + +``` +$ getpcaps $$ +Capabilities for `11589': = +``` + +原因 2:`capabilities` 的手册页对 `CAP_SYS_PTRACE` 的介绍是: + +``` +CAP_SYS_PTRACE + * Trace arbitrary processes using ptrace(2); +``` + +所以,`CAP_SYS_PTRACE` 的作用是让你像 root 一样,可以对任何用户拥有的**任意**进程进行 `ptrace`。你不需要用它来对一个只是由你的用户拥有的普通进程进行 `ptrace` 。 + +我用第三种方法测试了一下(LCTT 译注:此处可能原文有误) —— 我用 `docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash` 运行了一个 Docker 容器,去掉了 `CAP_SYS_PTRACE` 能力,但我仍然可以跟踪进程,虽然我已经没有这个能力了。什么?为什么?! + +### 假设 2:关于用户命名空间的事情? + +我的下一个(没有那么充分的依据的)假设是“嗯,也许这个过程是在不同的用户命名空间里,而 `strace` 不能工作,因为某种原因而行不通?”这个问题其实并不相关,但这是我观察时想到的。 + +容器进程是否在不同的用户命名空间中?嗯,在容器中: + +``` +root@e27f594da870:/# ls /proc/$$/ns/user -l +... /proc/1/ns/user -> 'user:[4026531837]' +``` + +在宿主机: + +``` +bork@kiwi:~$ ls /proc/$$/ns/user -l +... /proc/12177/ns/user -> 'user:[4026531837]' +``` + +因为用户命名空间 ID(`4026531837`)是相同的,所以容器中的 root 用户和主机上的 root 用户是完全相同的用户。所以,绝对没有理由不能够对它创建的进程进行 `strace`! + +这个假设并没有什么意义,但我(之前)没有意识到 Docker 容器中的 root 用户和主机上的 root 用户同一个,所以我觉得这很有意思。 + +### 假设 3:ptrace 系统的调用被 seccomp-bpf 规则阻止了 + +我也知道 Docker 使用 seccomp-bpf 来阻止容器进程运行许多系统调用。而 `ptrace` 在[被 Docker 默认的 seccomp 配置文件阻止的系统调用列表][2]中!(实际上,允许的系统调用列表是一个白名单,所以只是`ptrace` 不在默认的白名单中。但得出的结果是一样的。) + +这很容易解释为什么 `strace` 在 Docker 容器中不能工作 —— 如果 `ptrace` 系统调用完全被屏蔽了,那么你当然不能调用它,`strace` 就会失败。 + +让我们来验证一下这个假设 —— 如果我们禁用了所有的 seccomp 规则,`strace` 能在 Docker 容器中工作吗? + +``` +$ docker run --security-opt seccomp=unconfined -it ubuntu:18.04 /bin/bash +$ strace ls +execve("/bin/ls", ["ls"], 0x7ffc69a65580 /* 8 vars */) = 0 +... it works fine ... +``` + +是的,很好用!很好。谜底解开了,除了..... + +### 为什么 `--cap-add=SYS_PTRACE` 能解决问题? + +我们还没有解释的是:为什么 `--cap-add=SYS_PTRACE` 可以解决这个问题? + +`docker run` 的手册页是这样解释 `--cap-add` 参数的。 + +``` +--cap-add=[] + Add Linux capabilities +``` + +这跟 seccomp 规则没有任何关系! 怎么回事? + +### 我们来看看 Docker 源码 + +当文档没有帮助的时候,唯一要做的就是去看源码。 + +Go 语言的好处是,因为依赖关系通常是在一个 Go 仓库里,你可以通过 `grep` 来找出做某件事的代码在哪里。所以我克隆了 `github.com/moby/moby`,然后对一些东西进行 `grep`,比如 `rg CAP_SYS_PTRACE`。 + +我认为是这样的。在 `containerd` 的 seccomp 实现中,在 [contrib/seccomp/seccomp/seccomp_default.go][3] 中,有一堆代码来确保如果一个进程有一个能力,那么它也会(通过 seccomp 规则)获得访问权限,以使用与该能力相关的系统调用。 + +``` +case "CAP_SYS_PTRACE": + s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{ + Names: []string{ + "kcmp", + "process_vm_readv", + "process_vm_writev", + "ptrace", + }, + Action: specs.ActAllow, + Args: []specs.LinuxSeccompArg{}, + }) +``` + +在 moby 中的 [profile/seccomp/seccomp.go][4] 和 [默认的 seccomp 配置文件][5]中,也有一些其他的代码似乎做了一些非常类似的事情,所以有可能就是这个代码在做这个事情。 + +所以我想我们有答案了! + +### Docker 中的 `--cap-add` 做的事情比它说的要多 + +结果似乎是,`--cap-add` 并不像手册页里说的那样,它更像是 `--cap-add-and-also-whiteelist-some-extra-system-calls-if-required`。这很有意义! 如果你具有一个像 `--CAP_SYS_PTRACE` 这样的能力,可以让你使用 `process_vm_readv` 系统调用,但是该系统调用被 seccomp 配置文件阻止了,那对你没有什么帮助! + +所以当你给容器 `CAP_SYS_PTRACE` 能力时,允许使用 `process_vm_readv` 和 `ptrace` 系统调用似乎是一个合理的选择。 + +### 就这样! + +这是个有趣的小事情,我认为这是一个很好的例子,说明了容器是由许多移动的部件组成的,它们以不完全显而易见的方式一起工作。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://wizardzines.com/zines/containers +[2]: https://docs.docker.com/engine/security/seccomp/ +[3]: https://github.com/containerd/containerd/blob/4be98fa28b62e8a012491d655a4d6818ef87b080/contrib/seccomp/seccomp_default.go#L527-L537 +[4]: https://github.com/moby/moby/blob/cc0dfb6e7b22ad120c60a9ce770ea15415767cf9/profiles/seccomp/seccomp.go#L126-L132 +[5]: https://github.com/moby/moby/blob/master/profiles/seccomp/default.json#L723-L739 diff --git a/published/202005/20200430 10 ways to analyze binary files on Linux.md b/published/202005/20200430 10 ways to analyze binary files on Linux.md new file mode 100644 index 0000000000..35fedf607a --- /dev/null +++ b/published/202005/20200430 10 ways to analyze binary files on Linux.md @@ -0,0 +1,314 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12187-1.html) +[#]: subject: (10 ways to analyze binary files on Linux) +[#]: via: (https://opensource.com/article/20/4/linux-binary-analysis) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +在 Linux 上分析二进制文件的 10 种方法 +====== + +> 这些简单的命令和工具可以帮助你轻松完成分析二进制文件的任务。 + +![](https://img.linux.net.cn/data/attachment/album/202005/05/232115nn0oduodo4oztv0a.jpg) + +“这个世界上有 10 种人:懂二进制的人和不懂二进制的人。” + +我们每天都在与二进制文件打交道,但我们对二进制文件却知之甚少。我所说的二进制,是指你每天运行的可执行文件,从命令行工具到成熟的应用程序都是。 + +Linux 提供了一套丰富的工具,让分析二进制文件变得轻而易举。无论你的工作角色是什么,如果你在 Linux 上工作,了解这些工具的基本知识将帮助你更好地理解你的系统。 + +在这篇文章中,我们将介绍其中一些最流行的 Linux 工具和命令,其中大部分都是 Linux 发行版的一部分。如果没有找到,你可以随时使用你的软件包管理器来安装和探索它们。请记住:学习在正确的场合使用正确的工具需要大量的耐心和练习。 + +### file + +它的作用:帮助确定文件类型。 + +这将是你进行二进制分析的起点。我们每天都在与文件打交道,并非所有的文件都是可执行类型,除此之外还有各种各样的文件类型。在你开始之前,你需要了解要分析的文件类型。是二进制文件、库文件、ASCII 文本文件、视频文件、图片文件、PDF、数据文件等文件吗? + +`file` 命令将帮助你确定你所处理的文件类型。 + +``` +$ file /bin/ls +/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=94943a89d17e9d373b2794dcb1f7e38c95b66c86, stripped +$ +$ file /etc/passwd +/etc/passwd: ASCII text +$ +``` + +### ldd + +它的作用:打印共享对象依赖关系。 + +如果你已经在一个可执行的二进制文件上使用了上面的 `file` 命令,你肯定会看到输出中的“动态链接dynamically linked”信息。它是什么意思呢? + +在开发软件的时候,我们尽量不要重造轮子。有一组常见的任务是大多数软件程序需要的,比如打印输出或从标准输入/打开的文件中读取等。所有这些常见的任务都被抽象成一组通用的函数,然后每个人都可以使用,而不是写出自己的变体。这些常用的函数被放在一个叫 `libc` 或 `glibc` 的库中。 + +如何找到可执行程序所依赖的库?这就是 `ldd` 命令的作用了。对动态链接的二进制文件运行该命令会显示出所有依赖库和它们的路径。 + +``` +$ ldd /bin/ls + linux-vdso.so.1 => (0x00007ffef5ba1000) + libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fea9f854000) + libcap.so.2 => /lib64/libcap.so.2 (0x00007fea9f64f000) + libacl.so.1 => /lib64/libacl.so.1 (0x00007fea9f446000) + libc.so.6 => /lib64/libc.so.6 (0x00007fea9f079000) + libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fea9ee17000) + libdl.so.2 => /lib64/libdl.so.2 (0x00007fea9ec13000) + /lib64/ld-linux-x86-64.so.2 (0x00007fea9fa7b000) + libattr.so.1 => /lib64/libattr.so.1 (0x00007fea9ea0e000) + libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fea9e7f2000) +$ +``` + +### ltrace + +它的作用:库调用跟踪器。 + +我们现在知道如何使用 `ldd` 命令找到一个可执行程序所依赖的库。然而,一个库可以包含数百个函数。在这几百个函数中,哪些是我们的二进制程序正在使用的实际函数? + +`ltrace` 命令可以显示运行时从库中调用的所有函数。在下面的例子中,你可以看到被调用的函数名称,以及传递给该函数的参数。你也可以在输出的最右边看到这些函数返回的内容。 + +``` +$ ltrace ls +__libc_start_main(0x4028c0, 1, 0x7ffd94023b88, 0x412950 +strrchr("ls", '/') = nil +setlocale(LC_ALL, "") = "en_US.UTF-8" +bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale" +textdomain("coreutils") = "coreutils" +__cxa_atexit(0x40a930, 0, 0, 0x736c6974756572) = 0 +isatty(1) = 1 +getenv("QUOTING_STYLE") = nil +getenv("COLUMNS") = nil +ioctl(1, 21523, 0x7ffd94023a50) = 0 +<< snip >> +fflush(0x7ff7baae61c0) = 0 +fclose(0x7ff7baae61c0) = 0 ++++ exited (status 0) +++ +$ +``` + +### hexdump + +它的作用:以 ASCII、十进制、十六进制或八进制显示文件内容。 + +通常情况下,当你用一个应用程序打开一个文件,而它不知道如何处理该文件时,就会出现这种情况。尝试用 `vim` 打开一个可执行文件或视频文件,你屏幕上会看到的只是抛出的乱码。 + +在 `hexdump` 中打开未知文件,可以帮助你看到文件的具体内容。你也可以选择使用一些命令行选项来查看用 ASCII 表示的文件数据。这可能会帮助你了解到它是什么类型的文件。 + +``` +$ hexdump -C /bin/ls | head +00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00  |.ELF............| +00000010  02 00 3e 00 01 00 00 00  d4 42 40 00 00 00 00 00  |..>......B@.....| +00000020  40 00 00 00 00 00 00 00  f0 c3 01 00 00 00 00 00  |@...............| +00000030  00 00 00 00 40 00 38 00  09 00 40 00 1f 00 1e 00  |....@.8...@.....| +00000040  06 00 00 00 05 00 00 00  40 00 00 00 00 00 00 00  |........@.......| +00000050  40 00 40 00 00 00 00 00  40 00 40 00 00 00 00 00  |@.@.....@.@.....| +00000060  f8 01 00 00 00 00 00 00  f8 01 00 00 00 00 00 00  |................| +00000070  08 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00  |................| +00000080  38 02 00 00 00 00 00 00  38 02 40 00 00 00 00 00  |8.......8.@.....| +00000090  38 02 40 00 00 00 00 00  1c 00 00 00 00 00 00 00  |8.@.............| +$ +``` + +### strings + +它的作用:打印文件中的可打印字符的字符串。 + +如果你只是在二进制中寻找可打印的字符,那么 `hexdump` 对于你的使用场景来说似乎有点矫枉过正,你可以使用 `strings` 命令。 + +在开发软件的时候,各种文本/ASCII 信息会被添加到其中,比如打印信息、调试信息、帮助信息、错误等。只要这些信息都存在于二进制文件中,就可以用 `strings` 命令将其转储到屏幕上。 + +``` +$ strings /bin/ls +``` + +### readelf + +它的作用:显示有关 ELF 文件的信息。 + +ELF(可执行和可链接文件格式Executable and Linkable File Format)是可执行文件或二进制文件的主流格式,不仅是 Linux 系统,也是各种 UNIX 系统的主流文件格式。如果你已经使用了像 `file` 命令这样的工具,它告诉你文件是 ELF 格式,那么下一步就是使用 `readelf` 命令和它的各种选项来进一步分析文件。 + +在使用 `readelf` 命令时,有一份实际的 ELF 规范的参考是非常有用的。你可以在[这里][2]找到该规范。  + +``` +$ readelf -h /bin/ls +ELF Header: +  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 +  Class:                             ELF64 +  Data:                              2's complement, little endian +  Version:                           1 (current) +  OS/ABI:                            UNIX - System V +  ABI Version:                       0 +  Type:                              EXEC (Executable file) +  Machine:                           Advanced Micro Devices X86-64 +  Version:                           0x1 +  Entry point address:               0x4042d4 +  Start of program headers:          64 (bytes into file) +  Start of section headers:          115696 (bytes into file) +  Flags:                             0x0 +  Size of this header:               64 (bytes) +  Size of program headers:           56 (bytes) +  Number of program headers:         9 +  Size of section headers:           64 (bytes) +  Number of section headers:         31 +  Section header string table index: 30 +$ +``` + +### objdump + +它的作用:从对象文件中显示信息。 + +二进制文件是通过你编写的源码创建的,这些源码会通过一个叫做编译器的工具进行编译。这个编译器会生成相对于源代码的机器语言指令,然后由 CPU 执行特定的任务。这些机器语言代码可以通过被称为汇编语言的助记词来解读。汇编语言是一组指令,它可以帮助你理解由程序所进行并最终在 CPU 上执行的操作。 + +`objdump` 实用程序读取二进制或可执行文件,并将汇编语言指令转储到屏幕上。汇编语言知识对于理解 `objdump` 命令的输出至关重要。 + +请记住:汇编语言是特定于体系结构的。 + +``` +$ objdump -d /bin/ls | head + +/bin/ls: file format elf64-x86-64 + +Disassembly of section .init: + +0000000000402150 <_init@@Base>: + 402150: 48 83 ec 08 sub $0x8,%rsp + 402154: 48 8b 05 6d 8e 21 00 mov 0x218e6d(%rip),%rax # 61afc8 <__gmon_start__> + 40215b: 48 85 c0 test %rax,%rax +$ +``` + +### strace + +它的作用:跟踪系统调用和信号。 + +如果你用过前面提到的 `ltrace`,那就把 `strace` 想成是类似的。唯一的区别是,`strace` 工具不是追踪调用的库,而是追踪系统调用。系统调用是你与内核对接来完成工作的。 + +举个例子,如果你想把一些东西打印到屏幕上,你会使用标准库 `libc` 中的 `printf` 或 `puts` 函数;但是,在底层,最终会有一个名为 `write` 的系统调用来实际把东西打印到屏幕上。 + +``` +$ strace -f /bin/ls +execve("/bin/ls", ["/bin/ls"], [/* 17 vars */]) = 0 +brk(NULL) = 0x686000 +mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f967956a000 +access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +fstat(3, {st_mode=S_IFREG|0644, st_size=40661, ...}) = 0 +mmap(NULL, 40661, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9679560000 +close(3) = 0 +<< snip >> +fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0 +mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9679569000 +write(1, "R2 RH\n", 7R2 RH +) = 7 +close(1) = 0 +munmap(0x7f9679569000, 4096) = 0 +close(2) = 0 +exit_group(0) = ? ++++ exited with 0 +++ +$ +``` + +### nm + +它的作用:列出对象文件中的符号。 + +如果你所使用的二进制文件没有被剥离,`nm` 命令将为你提供在编译过程中嵌入到二进制文件中的有价值的信息。`nm` 可以帮助你从二进制文件中识别变量和函数。你可以想象一下,如果你无法访问二进制文件的源代码时,这将是多么有用。 + +为了展示 `nm`,我们快速编写了一个小程序,用 `-g` 选项编译,我们会看到这个二进制文件没有被剥离。 + +``` +$ cat hello.c +#include + +int main() { + printf("Hello world!"); + return 0; +} +$ +$ gcc -g hello.c -o hello +$ +$ file hello +hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=3de46c8efb98bce4ad525d3328121568ba3d8a5d, not stripped +$ +$ ./hello +Hello world!$ +$ + + +$ nm hello | tail +0000000000600e20 d __JCR_END__ +0000000000600e20 d __JCR_LIST__ +00000000004005b0 T __libc_csu_fini +0000000000400540 T __libc_csu_init + U __libc_start_main@@GLIBC_2.2.5 +000000000040051d T main + U printf@@GLIBC_2.2.5 +0000000000400490 t register_tm_clones +0000000000400430 T _start +0000000000601030 D __TMC_END__ +$ +``` + +### gdb + +它的作用:GNU 调试器。 + +好吧,不是所有的二进制文件中的东西都可以进行静态分析。我们确实执行了一些运行二进制文件(进行分析)的命令,比如 `ltrace` 和 `strace`;然而,软件由各种条件组成,这些条件可能会导致执行不同的替代路径。 + +分析这些路径的唯一方法是在运行时环境,在任何给定的位置停止或暂停程序,并能够分析信息,然后再往下执行。 + +这就是调试器的作用,在 Linux 上,`gdb` 就是调试器的事实标准。它可以帮助你加载程序,在特定的地方设置断点,分析内存和 CPU 的寄存器,以及更多的功能。它是对上面提到的其他工具的补充,可以让你做更多的运行时分析。 + +有一点需要注意的是,一旦你使用 `gdb` 加载一个程序,你会看到它自己的 `(gdb)` 提示符。所有进一步的命令都将在这个 `gdb` 命令提示符中运行,直到你退出。 + +我们将使用我们之前编译的 `hello` 程序,使用 `gdb` 来看看它的工作原理。 + +``` +$ gdb -q ./hello +Reading symbols from /home/flash/hello...done. +(gdb) break main +Breakpoint 1 at 0x400521: file hello.c, line 4. +(gdb) info break +Num Type Disp Enb Address What +1 breakpoint keep y 0x0000000000400521 in main at hello.c:4 +(gdb) run +Starting program: /home/flash/./hello + +Breakpoint 1, main () at hello.c:4 +4 printf("Hello world!"); +Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7_6.6.x86_64 +(gdb) bt +#0 main () at hello.c:4 +(gdb) c +Continuing. +Hello world![Inferior 1 (process 29620) exited normally] +(gdb) q +$ +``` + +### 结语 + +一旦你习惯了使用这些原生的 Linux 二进制分析工具,并理解了它们提供的输出,你就可以转向更高级和专业的开源二进制分析工具,比如 [radare2][3]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/linux-binary-analysis + +作者:[Gaurav Kamathe][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) +[2]: http://www.skyfree.org/linux/references/ELF_Format.pdf +[3]: https://github.com/radareorg/radare2 diff --git a/published/202005/20200430 Three Methods Boot CentOS-RHEL 7-8 Systems in Single User Mode.md b/published/202005/20200430 Three Methods Boot CentOS-RHEL 7-8 Systems in Single User Mode.md new file mode 100644 index 0000000000..4b7edb67e9 --- /dev/null +++ b/published/202005/20200430 Three Methods Boot CentOS-RHEL 7-8 Systems in Single User Mode.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12181-1.html) +[#]: subject: (Three Methods Boot CentOS/RHEL 7/8 Systems in Single User Mode) +[#]: via: (https://www.2daygeek.com/boot-centos-7-8-rhel-7-8-single-user-mode/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +以单用户模式启动 CentOS/RHEL 7/8 的三种方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/03/230109uw1f9zvv9upbhwv8.jpg) + +单用户模式,也被称为维护模式,超级用户可以在此模式下恢复/修复系统问题。 + +通常情况下,这类问题在多用户环境中修复不了。系统可以启动但功能不能正常运行或者你登录不了系统。 + +在基于 [Red Hat][1](RHEL)7/8 的系统中,使用 `runlevel1.target` 或 `rescue.target` 来实现。 + +在此模式下,系统会挂载所有的本地文件系统,但不开启网络接口。 + +系统仅启动特定的几个服务和修复系统必要的尽可能少的功能。 + +当你想运行文件系统一致性检查来修复损坏的文件系统,或忘记 root 密码后重置密码,或要修复系统上的一个挂载点问题时,这个方法会很有用。 + +你可以用下面三种方法以单用户模式启动 [CentOS][2]/[RHEL][3] 7/8 系统。 + + * 方法 1:通过向内核添加 `rd.break` 参数来以单用户模式启动 CentOS/RHEL 7/8 系统 + * 方法 2:通过用 `init=/bin/bash` 或 `init=/bin/sh` 替换内核中的 `rhgb quiet` 语句来以单用户模式启动 CentOS/RHEL 7/8 系统 + * 方法 3:通过用 `rw init=/sysroot/bin/sh` 参数替换内核中的 `ro` 语句以单用户模式启动 CentOS/RHEL 7/8 系统 + +### 方法 1 + +通过向内核添加 `rd.break` 参数来以单用户模式启动 CentOS/RHEL 7/8 系统。 + +重启你的系统,在 GRUB2 启动界面,按下 `e` 键来编辑选中的内核。你需要选中第一行,第一个是最新的内核,然而如果你想用旧的内核启动系统你也可以选择其他的行。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-2.png) + +根据你的 RHEL/CentOS 版本,找到 `linux16` 或 `linux` 语句,按下键盘上的 `End` 键,跳到行末,像下面截图中展示的那样添加关键词 `rd.break`,按下 `Ctrl+x` 或 `F10` 来进入单用户模式。 + +如果你的系统是 RHEL/CentOS 7,你需要找 `linux16`,如果你的系统是 RHEL/CentOS 8,那么你需要找 `linux`。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-3.png) + +这个修改会让你的 root 文件系统以 “只读(`ro`)” 模式挂载。你可以用下面的命令来验证下。下面的输出也明确地告诉你当前是在 “紧急模式Emergency Mode”。 + +``` +# mount | grep root +``` + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-5.png) + +为了修改 `sysroot` 文件系统,你需要用读写模式(`rw`)重新挂载它。 + +``` +# mount -o remount,rw /sysroot +``` + +运行下面的命令修改环境,这就是大家熟知的 “监禁目录” 或 “chroot 监狱”。 + +``` +# chroot /sysroot +``` + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-8.png) + +现在,单用户模式已经完全准备好了。当你修复了你的问题要退出单用户模式时,执行下面的步骤。 + +CentOS/RHEL 7/8 默认使用 SELinux,因此创建下面的隐藏文件,这个文件会在下一次启动时重新标记所有文件。 + +``` +# touch /.autorelabel +``` + +最后,用下面的命令重启系统。你也可以输入两次 `exit` 命令来重启你的系统。 + +``` +# reboot -f +``` + +### 方法 2 + +通过用 `init=/bin/bash` 或 `init=/bin/sh` 替换内核中的 `rhgb quiet` 语句来以单用户模式启动 CentOS/RHEL 7/8 系统。 + +重启你的系统,在 GRUB2 启动界面,按下 `e` 键来编辑选中的内核。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-2.png) + +找到语句 `rhgb quiet`,用 `init=/bin/bash` 或 `init=/bin/sh` 替换它,然后按下 `Ctrl+x` 或 `F10` 来进入单用户模式。 + +`init=/bin/bash` 的截图。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-1.png) + +`init=/bin/sh` 的截图。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-1a.png) + +默认情况下,上面的操作会以只读(`ro`)模式挂载你的 `/` 分区,因此你需要以读写(`rw`)模式重新挂载 `/` 文件系统,这样才能修改它。 + +``` +# mount -o remount,rw / +``` + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-4.png) + +现在你可以执行你的任务了。当结束时,执行下面的命令来开启重启时的 SELinux 重新标记。 + +``` +# touch /.autorelabel +``` + +最后,重启系统。 + +``` +# exec /sbin/init 6 +``` + +### 方法 3 + +通过用 `rw init=/sysroot/bin/sh` 参数替换内核中的 `ro` 单词,以单用户模式启动 CentOS/RHEL 7/8 系统。 + +为了中断自动启动的过程,重启你的系统并在 GRUB2 启动界面按下任意键。 + +现在会展示你系统上所有可用的内核,选择最新的内核,按下 `e` 键来编辑选中的内核参数。 + +找到以 `linux` 或 `linux16` 开头的语句,用 `rw init=/sysroot/bin/sh` 替换 `ro`。替换完后按下 `Ctrl+x` 或 `F10` 来进入单用户模式。 + +运行下面的命令把环境切换为 “chroot 监狱”。 + +``` +# chroot /sysroot +``` + +如果需要,做出必要的修改。修改完后,执行下面的命令来开启重启时的 SELinux 重新标记。 + +``` +# touch /.autorelabel +``` + +最后,重启系统。 + +``` +# reboot -f +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/boot-centos-7-8-rhel-7-8-single-user-mode/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/category/red-hat/ +[2]: https://www.2daygeek.com/category/centos/ +[3]: https://www.2daygeek.com/category/rhel/ +[4]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 diff --git a/published/202005/20200501 How to Handle Automatic Updates in Ubuntu.md b/published/202005/20200501 How to Handle Automatic Updates in Ubuntu.md new file mode 100644 index 0000000000..4339c22494 --- /dev/null +++ b/published/202005/20200501 How to Handle Automatic Updates in Ubuntu.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12257-1.html) +[#]: subject: (How to Handle Automatic Updates in Ubuntu) +[#]: via: (https://itsfoss.com/auto-updates-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 中处理自动的无人值守升级 +====== + +> 本教程教你如何处理无人值守的升级,即 Ubuntu Linux 的自动系统更新。 + +![](https://img.linux.net.cn/data/attachment/album/202005/27/234040fxb0nkc53pk0nxvx.jpg) + +有时,当你尝试[关闭 Ubuntu 系统][1]时,可能看到这个阻止你关闭的页面: + +> 关机过程中正在进行无人值守升级,请不要关闭计算机。 + +![Unattended Upgrade In Progress In Ubuntu][2] + +你可能会问这个“无人值守升级”是什么,怎么会在你不知情的情况下运行呢? + +原因是 [Ubuntu][3] 非常重视系统的安全性。默认情况下,它会每天自动检查系统更新,如果发现安全更新,它会下载这些更新并自行安装。对于正常的系统和应用更新,它会通过软件更新程序通知你。 + +由于所有这些都是在后台发生的,所以在你尝试关闭系统或尝试自行安装应用程序之前,你甚至不会意识到这一点。 + +在这些无人值守的升级过程中,尝试安装新软件,会导致著名的[无法获得锁定的错误][4]。 + +![][5] + +如你所见,自动更新带来了一些小麻烦。你可以选择禁用自动更新,但这意味着你必须一直手动检查并[更新你的 Ubuntu 系统][6]。 + +> **你真的需要禁用自动更新吗?** +> +> 请注意,这是一项安全功能。Linux 实际上允许你禁用系统中的所有功能,甚至禁用这些安全功能。 +> +> 但是我认为,作为普通用户,**你不应该禁用自动更新**。毕竟,它可以确保你的系统安全。 +> +> 为了确保系统的安全性,你可以忍受自动更新所带来的小麻烦。 + +现在,你已经收到警告,还是觉得承担手动更新系统的额外任务更好,那么让我们看看如何处理自动更新。 + +与往常一样,有两种方法可以做到:GUI 和命令行。 我将向你展示两种方法。 + +我在这里使用 Ubuntu 20.04,但是这些步骤对 Ubuntu 18.04 和任何其他 Ubuntu 版本均有效。 + +### 方法 1:以图形方式禁用 Ubuntu 中的自动更新 + +进入菜单并查找“软件和更新”工具。 + +![Software & Updates Settings][7] + +在此处,进入“更新”选项卡。查找“自动检查更新”。默认情况下,它设置为“每日”。 + +你可以将其更改为“从不”,你的系统将永远不会检查更新。如果不检查更新,它就不会找到要安装的新的更新。 + +![Disable Auto Updates in Ubuntu Completely][8] + +如果这样做,那么必须不时手动更新系统。但是,这是额外的工作,你可能不会一直记得。 + +#### 在 Ubuntu 中处理自动更新的更好方法 + +就个人而言,我建议让它自己检查更新。如果你不希望它自动安装更新,那么可以更改该行为,以通知有关安全更新的可用性。 + +保持“自动检查更新”为“每日”,然后将“有安全更新时”选项更改为“立即显示”,而不是“自动下载并安装”。 + +![Get notified for security updates instead of automatically installing them][9] + +这样,它会检查是否有更新,而不是在后台自动安装更新,软件更新程序会通知你有可用于系统的更新。而你的系统已经完成正常的系统和软件更新。 + +![Get notified about security updates][10] + +使用此设置,关闭系统时将不会看到“正在进行的无人值守升级”。但是,由于两个不同的进程无法同时使用 apt 包管理器,因此你仍然可能会遇到“无法锁定”错误。 + +我相信这是一个更好的解决方案,你不认为是么? + +如我承诺的同时有 GUI 和命令行方法一样,让我向你展示如何在终端中禁用无人值守的升级。 + +### 如何在 Ubuntu 中使用命令行禁用自动更新 + +你可以在 `/etc/apt/apt.conf.d/20auto-upgrades` 中找到自动升级设置。Ubuntu 终端中的默认文本编辑器是 Nano,因此你可以使用以下命令来编辑此文件: + +``` +sudo nano /etc/apt/apt.conf.d/20auto-upgrades +``` + +现在,如果你不希望系统自动检查更新,那么可以将 `APT::Periodic::Update-Package-Lists` 的值更改为 `"0"`。 + +``` +APT::Periodic::Update-Package-Lists "0"; +APT::Periodic::Unattended-Upgrade "0"; +``` + +如果你希望它检查更新但不自动安装无人值守的升级,那么可以选择将其设置为: + +``` +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "0"; +``` + +### 最后 + +由于某种原因,启用了自动安全更新,建议你保持这种状态。这个小烦恼实际上并不值得冒险损害系统安全性。你怎么看? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/auto-updates-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/unattended-upgrade-in-progress-in-ubuntu.png?ssl=1 +[3]: https://ubuntu.com/ +[4]: https://itsfoss.com/could-not-get-lock-error/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/Could_not_get_lock.jpg?ssl=1 +[6]: https://itsfoss.com/update-ubuntu/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/disable-auto-updates-ubuntu.jpg?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/handle-auto-updates-ubuntu.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?ssl=1 diff --git a/published/202005/20200501 Using mergerfs to increase your virtual storage.md b/published/202005/20200501 Using mergerfs to increase your virtual storage.md new file mode 100644 index 0000000000..de9b8af2c7 --- /dev/null +++ b/published/202005/20200501 Using mergerfs to increase your virtual storage.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12207-1.html) +[#]: subject: (Using mergerfs to increase your virtual storage) +[#]: via: (https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +使用 mergefs 增加虚拟存储 +====== + +![][1] + +如果你想在一个媒体项目中用到了多个磁盘或分区,不想丢失任何现有数据,但又想将所有文件都存放在一个驱动器下,该怎么办?这时,mergefs 就能派上用场! + +[mergerfs][2] 是一个联合文件系统,旨在简化存储和管理众多商业存储设备上的文件。 + +你需要从他们的 [GitHub][3] 页面获取最新的 RPM。Fedora 的版本名称中带有 “fc” 和版本号。例如,这是 Fedora 31 的版本: [mergerfs-2.29.0-1.fc31.x86_64.rpm][4]。 + +### 安装和配置 mergefs + +使用 `sudo` 安装已下载的 mergefs 软件包: + +``` +$ sudo dnf install mergerfs-2.29.0-1.fc31.x86_64.rpm +``` + +现在,你可以将多个磁盘挂载为一个驱动器。如果你有一台媒体服务器,并且希望所有媒体文件都显示在一个地方,这将很方便。如果将新文件上传到系统,那么可以将它们复制到 mergefs 目录,mergefs 会自动将它们复制具有足够可用空间的磁盘上。 + +这是使你更容易理解的例子: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 + +$ ls -l /disk1/Videos/ +total 1 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv + +$ ls -l /disk2/Videos/ +total 2 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv +``` + +在此例中挂载了两块磁盘,分别为 `disk1` 和 `disk2`。两个驱动器都有一个包含文件的 `Videos` 目录。 + +现在,我们将使用 mergefs 挂载这些驱动器,使它们看起来像一个更大的驱动器。 + +``` +$ sudo mergerfs -o defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M /disk1:/disk2 /media +``` + +mergefs 手册页非常庞杂,因此我们将说明上面提到的选项。 + + * `defaults`:除非指定,否则将使用默认设置。 + * `allow_other`:允许 `sudo` 或 `root` 以外的用户查看文件系统。 + * `use_ino`:让 mergefs 提供文件/目录 inode 而不是 libfuse。虽然不是默认值,但建议你启用它,以便链接的文件共享相同的 inode 值。 + * `category.create=mfs`:根据可用空间在驱动器间传播文件。 + * `moveonenospc=true`:如果启用,那么如果写入失败,将进行扫描以查找具有最大可用空间的驱动器。 + * `minfreespace=1M`:最小使用空间值。 + * `disk1`:第一块硬盘。 + * `disk2`:第二块硬盘。 + * `/media`:挂载驱动器的目录。 + +看起来是这样的: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 + +$ df -hT | grep media +1:2 fuse.mergerfs 66M 1.4M 60M 3% /media +``` + +你可以看到现在 mergefs 挂载显示的总容量为 66M,这是两块硬盘的总容量。 + +继续示例: + +有一个叫 `Baby's second Xmas.mkv` 的 30M 视频。让我们将其复制到用 mergerfs 挂载的 `/media` 文件夹中。 + +``` +$ ls -lh "Baby's second Xmas.mkv" +-rw-rw-r--. 1 curt curt 30M Apr 20 08:45 Baby's second Xmas.mkv +$ cp "Baby's second Xmas.mkv" /media/Videos/ +``` + +这是最终结果: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 31M 9.8M 76% /disk2 + +$ df -hT | grep media +1:2 fuse.mergerfs 66M 31M 30M 51% /media +``` + +从磁盘空间利用率中可以看到,因为 `disk1` 没有足够的可用空间,所以 mergefs 自动将文件复制到 `disk2`。 + +这是所有文件详情: + +``` +$ ls -l /disk1/Videos/ +total 1 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv + +$ ls -l /disk2/Videos/ +total 30003 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv + +$ ls -l /media/Videos/ +total 30004 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv +``` + +当你将文件复制到 mergefs 挂载点时,它将始终将文件复制到有足够可用空间的硬盘上。如果池中的所有驱动器都没有足够的可用空间,那么你将无法复制它们。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/mergerfs-816x346.png +[2]: https://github.com/trapexit/mergerfs +[3]: https://github.com/trapexit/mergerfs/releases +[4]: https://github.com/trapexit/mergerfs/releases/download/2.29.0/mergerfs-2.29.0-1.fc31.x86_64.rpm diff --git a/published/202005/20200502 Mid-stack inlining in Go.md b/published/202005/20200502 Mid-stack inlining in Go.md new file mode 100644 index 0000000000..588286626a --- /dev/null +++ b/published/202005/20200502 Mid-stack inlining in Go.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12184-1.html) +[#]: subject: (Mid-stack inlining in Go) +[#]: via: (https://dave.cheney.net/2020/05/02/mid-stack-inlining-in-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Go 中对栈中函数进行内联 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/04/230304avxkxlyoozbiw1bn.jpg) + +[上一篇文章][1]中我论述了叶子内联leaf inlining是怎样让 Go 编译器减少函数调用的开销的,以及延伸出了跨函数边界的优化的机会。本文中,我要论述内联的限制以及叶子内联与栈中内联mid-stack inlining的对比。 + +### 内联的限制 + +把函数内联到它的调用处消除了调用的开销,为编译器进行其他的优化提供了更好的机会,那么问题来了,既然内联这么好,内联得越多开销就越少,*为什么不尽可能多地内联呢?* + +内联可能会以增加程序大小换来更快的执行时间。限制内联的最主要原因是,创建许多函数的内联副本会增加编译时间,并导致生成更大的二进制文件的边际效应。即使把内联带来的进一步的优化机会考虑在内,太激进的内联也可能会增加生成的二进制文件的大小和编译时间。 + +内联收益最大的是[小函数][2],相对于调用它们的开销来说,这些函数做很少的工作。随着函数大小的增长,函数内部做的工作与函数调用的开销相比省下的时间越来越少。函数越大通常越复杂,因此优化其内联形式相对于原地优化的好处会减少。 + +### 内联预算 + +在编译过程中,每个函数的内联能力是用*内联预算*计算的 [^1]。开销的计算过程可以巧妙地内化,像一元和二元等简单操作,在抽象语法数Abstract Syntax Tree(AST)中通常是每个节点一个单位,更复杂的操作如 `make` 可能单位更多。考虑下面的例子: + +```go +package main + +func small() string { + s := "hello, " + "world!" + return s +} + +func large() string { + s := "a" + s += "b" + s += "c" + s += "d" + s += "e" + s += "f" + s += "g" + s += "h" + s += "i" + s += "j" + s += "k" + s += "l" + s += "m" + s += "n" + s += "o" + s += "p" + s += "q" + s += "r" + s += "s" + s += "t" + s += "u" + s += "v" + s += "w" + s += "x" + s += "y" + s += "z" + return s +} + +func main() { + small() + large() +} +``` + +使用 `-gcflags=-m=2` 参数编译这个函数能让我们看到编译器分配给每个函数的开销: + +```bash +% go build -gcflags=-m=2 inl.go +# command-line-arguments +./inl.go:3:6: can inline small with cost 7 as: func() string { s := "hello, world!"; return s } +./inl.go:8:6: cannot inline large: function too complex: cost 82 exceeds budget 80 +./inl.go:38:6: can inline main with cost 68 as: func() { small(); large() } +./inl.go:39:7: inlining call to small func() string { s := "hello, world!"; return s } +``` + +编译器根据函数 `func small()` 的开销(7)决定可以对它内联,而 `func large()` 的开销太大,编译器决定不进行内联。`func main()` 被标记为适合内联的,分配了 68 的开销;其中 `small` 占用 7,调用 `small` 函数占用 57,剩余的(4)是它自己的开销。 + +可以用 `-gcflag=-l` 参数控制内联预算的等级。下面是可使用的值: + + * `-gcflags=-l=0` 默认的内联等级。 + * `-gcflags=-l`(或 `-gcflags=-l=1`)取消内联。 + * `-gcflags=-l=2` 和 `-gcflags=-l=3` 现在已经不使用了。和 `-gcflags=-l=0` 相比没有区别。 + * `-gcflags=-l=4` 减少非叶子函数和通过接口调用的函数的开销。[^2] + +#### 不确定语句的优化 + +一些函数虽然内联的开销很小,但由于太复杂它们仍不适合进行内联。这就是函数的不确定性,因为一些操作的语义在内联后很难去推导,如 `recover`、`break`。其他的操作,如 `select` 和 `go` 涉及运行时的协调,因此内联后引入的额外的开销不能抵消内联带来的收益。 + +不确定的语句也包括 `for` 和 `range`,这些语句不一定开销很大,但目前为止还没有对它们进行优化。 + +### 栈中函数优化 + +在过去,Go 编译器只对叶子函数进行内联 —— 只有那些不调用其他函数的函数才有资格。在上一段不确定的语句的探讨内容中,一次函数调用就会让这个函数失去内联的资格。 + +进入栈中进行内联,就像它的名字一样,能内联在函数调用栈中间的函数,不需要先让它下面的所有的函数都被标记为有资格内联的。栈中内联是 David Lazar 在 Go 1.9 中引入的,并在随后的版本中做了改进。[这篇文稿][5]深入探究了保留栈追踪行为和被深度内联后的代码路径里的 `runtime.Callers` 的难点。 + +在前面的例子中我们看到了栈中函数内联。内联后,`func main()` 包含了 `func small()` 的函数体和对 `func large()` 的一次调用,因此它被判定为非叶子函数。在过去,这会阻止它被继续内联,虽然它的联合开销小于内联预算。 + +栈中内联的最主要的应用案例就是减少贯穿函数调用栈的开销。考虑下面的例子: + +```go +package main + +import ( + "fmt" + "strconv" +) + +type Rectangle struct {} + +//go:noinline +func (r *Rectangle) Height() int { + h, _ := strconv.ParseInt("7", 10, 0) + return int(h) +} + +func (r *Rectangle) Width() int { + return 6 +} + +func (r *Rectangle) Area() int { return r.Height() * r.Width() } + +func main() { + var r Rectangle + fmt.Println(r.Area()) +} +``` + +在这个例子中, `r.Area()` 是个简单的函数,调用了两个函数。`r.Width()` 可以被内联,`r.Height()` 这里用 `//go:noinline` 指令标注了,不能被内联。[^3] + +```bash +% go build -gcflags='-m=2' square.go +# command-line-arguments +./square.go:12:6: cannot inline (*Rectangle).Height: marked go:noinline +./square.go:17:6: can inline (*Rectangle).Width with cost 2 as: method(*Rectangle) func() int { return 6 } +./square.go:21:6: can inline (*Rectangle).Area with cost 67 as: method(*Rectangle) func() int { return r.Height() * r.Width() } +./square.go:21:61: inlining call to (*Rectangle).Width method(*Rectangle) func() int { return 6 } +./square.go:23:6: cannot inline main: function too complex: cost 150 exceeds budget 80 +./square.go:25:20: inlining call to (*Rectangle).Area method(*Rectangle) func() int { return r.Height() * r.Width() } +./square.go:25:20: inlining call to (*Rectangle).Width method(*Rectangle) func() int { return 6 } +``` + +由于 `r.Area()` 中的乘法与调用它的开销相比并不大,因此内联它的表达式是纯收益,即使它的调用的下游 `r.Height()` 仍是没有内联资格的。 + +#### 快速路径内联 + +关于栈中内联的效果最令人吃惊的例子是 2019 年 [Carlo Alberto Ferraris][7] 通过允许把 `sync.Mutex.Lock()` 的快速路径(非竞争的情况)内联到它的调用方来[提升它的性能][7]。在这个修改之前,`sync.Mutex.Lock()` 是个很大的函数,包含很多难以理解的条件,使得它没有资格被内联。即使锁可用时,调用者也要付出调用 `sync.Mutex.Lock()` 的代价。 + +Carlo 把 `sync.Mutex.Lock()` 分成了两个函数(他自己称为外联outlining)。外部的 `sync.Mutex.Lock()` 方法现在调用 `sync/atomic.CompareAndSwapInt32()` 且如果 CAS(比较并交换Compare and Swap)成功了之后立即返回给调用者。如果 CAS 失败,函数会走到 `sync.Mutex.lockSlow()` 慢速路径,需要对锁进行注册,暂停 goroutine。[^4] + +```bash +% go build -gcflags='-m=2 -l=0' sync 2>&1 | grep '(*Mutex).Lock' +../go/src/sync/mutex.go:72:6: can inline (*Mutex).Lock with cost 69 as: method(*Mutex) func() { if "sync/atomic".CompareAndSwapInt32(&m.state, 0, mutexLocked) { if race.Enabled { }; return }; m.lockSlow() } +``` + +通过把函数分割成一个简单的不能再被分割的外部函数,和(如果没走到外部函数就走到的)一个处理慢速路径的复杂的内部函数,Carlo 组合了栈中函数内联和[编译器对基础操作的支持][9],减少了非竞争锁 14% 的开销。之后他在 `sync.RWMutex.Unlock()` 重复这个技巧,节省了另外 9% 的开销。 + +[^1]: 不同发布版本中,在考虑该函数是否适合内联时,Go 编译器对同一函数的预算是不同的。 +[^2]: 时刻记着编译器的作者警告过[“更高的内联等级(比 -l 更高)可能导致错误或不被支持”][11]。 Caveat emptor。 +[^3]: 编译器有足够的能力来内联像 `strconv.ParseInt` 的复杂函数。作为一个实验,你可以尝试去掉 `//go:noinline` 注释,使用 `-gcflags=-m=2` 编译后观察。 +[^4]: `race.Enable` 表达式是通过传递给 `go` 工具的 `-race` 参数控制的一个常量。对于普通编译,它的值是 `false`,此时编译器可以完全省略代码路径。 + +### 相关文章: + + 1. [Go 中的内联优化][15] + 2. [goroutine 的栈为什么会无限增长?][16] + 3. [栈追踪和 errors 包][17] + 4. [零值是什么,为什么它很有用?][18] + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/02/mid-stack-inlining-in-go + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12176-1.html +[2]: https://medium.com/@joshsaintjacque/small-functions-considered-awesome-c95b3fd1812f +[3]: tmp.FyRthF1bbF#easy-footnote-bottom-1-4076 (The budget the Go compiler applies to each function when considering if it is eligible for inlining changes release to release.) +[4]: tmp.FyRthF1bbF#easy-footnote-bottom-2-4076 (Keep in mind that the compiler authors warn that “Additional levels of inlining (beyond -l) may be buggy and are not supported”. Caveat emptor.) +[5]: https://docs.google.com/presentation/d/1Wcblp3jpfeKwA0Y4FOmj63PW52M_qmNqlQkNaLj0P5o/edit#slide=id.p +[6]: tmp.FyRthF1bbF#easy-footnote-bottom-3-4076 (The compiler is powerful enough that it can inline complex functions like strconv.ParseInt. As a experiment, try removing the //go:noinline annotation and observe the result with -gcflags=-m=2.) +[7]: https://go-review.googlesource.com/c/go/+/148959 +[8]: tmp.FyRthF1bbF#easy-footnote-bottom-4-4076 (The expression race.Enable is a constant controlled by the -race flag passed to the go tool. It is false for normal builds which allows the compiler to elide those code paths entirely.) +[9]: https://dave.cheney.net/2019/08/20/go-compiler-intrinsics +[10]: tmp.FyRthF1bbF#easy-footnote-1-4076 +[11]: https://github.com/golang/go/blob/be08e10b3bc07f3a4e7b27f44d53d582e15fd6c7/src/cmd/compile/internal/gc/inl.go#L11 +[12]: tmp.FyRthF1bbF#easy-footnote-2-4076 +[13]: tmp.FyRthF1bbF#easy-footnote-3-4076 +[14]: tmp.FyRthF1bbF#easy-footnote-4-4076 +[15]: https://dave.cheney.net/2020/04/25/inlining-optimisations-in-go (Inlining optimisations in Go) +[16]: https://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite (Why is a Goroutine’s stack infinite ?) +[17]: https://dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package (Stack traces and the errors package) +[18]: 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?) diff --git a/published/202005/20200502 Pop OS 20.04 Review- Best Ubuntu-based Distribution Just Got Better.md b/published/202005/20200502 Pop OS 20.04 Review- Best Ubuntu-based Distribution Just Got Better.md new file mode 100644 index 0000000000..731c14fa0b --- /dev/null +++ b/published/202005/20200502 Pop OS 20.04 Review- Best Ubuntu-based Distribution Just Got Better.md @@ -0,0 +1,228 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12175-1.html) +[#]: subject: (Pop OS 20.04 Review: Best Ubuntu-based Distribution Just Got Better) +[#]: via: (https://itsfoss.com/pop-os-20-04-review/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Pop!_OS 20.04 点评:最好的基于 Ubuntu 的发行版越来越好了 +====== + +> Pop!_OS 20.04 是一款令人印象深刻的基于 Ubuntu 的 Linux 发行版。我在这篇评论中回顾了其主要的新功能,并分享了我对最新版本的体验。 + +现在,Ubuntu 20.04 LTS 及其官方变体版本已经发布了 - 是时候看看 [System76][1] 的 Pop!_OS 20.04 了,这是基于 Ubuntu 的最好的发行版之一。 + +老实说,Pop!_OS 是我最喜欢的 Linux 发行版,主要用于我做的所有事情。 + +现在,Pop!_OS 20.04 终于来了。是时候来看看它提供了哪些功能,以及你是否应该升级? + +### Pop!_OS 20.04 LTS 中有什么新东西? + +![][2] + +从视觉上看,Pop!\_OS 20.04 LTS 与 Pop!\_OS 19.10 并没有太大的区别。然而,你可以发现几个新功能和改进。 + +但是,如果你之前使用的是 Pop!_OS 18.04 LTS,则可以发现有很多东西可以尝试。 + +随着 [GNOME 3.36][3] 的到来,及其带来的一些新功能,Pop!_OS 20.04 成为了一个令人激动的版本。 + +总的来说,以下是一些主要的亮点。 + + * 自动窗口平铺 + * 新的应用程序切换器和启动器 + * 在 Pop!_Shop 中增加了对 Flatpack 的支持。 + * GNOME 3.36 + * Linux 内核 5.4 + * 改进的混合图形支持 + +虽然听起来很有趣,但我们还是来了解一下详细的变化,以及到目前为止 Pop!_OS 20.04 的体验如何。 + +#### Pop!_OS 20.04 中的用户体验提升 + +毫无疑问,很多 Linux 发行版都提供了开箱即用的用户体验。同样的,[Ubuntu 20.04 LTS 也有一流的改进和功能][4]。 + +而对于 System76 的 Pop!_OS,他们总是试图更进一步。并且,大多数新功能旨在通过提供有用的功能来改善用户体验。 + +在这里,我将介绍一些改进,其中包括 [GNOME 3.36][3] 和 Pop!_OS 特有的一些功能。 + +#### 支持系统托盘图标 + +总算是有了!这可能不是什么大的改变 —— 但 Pop!_OS 以前没有支持系统托盘图标(或小程序图标)。 + +![][5] + +随着 20.04 LTS 的发布,默认情况就有了系统托盘,不需要任何扩展。 + +依靠系统托盘图标的程序可能并不多 —— 但它仍然是重要的东西。 + +就我而言,我以前无法在 Pop!_OS 19.10 上使用 [ActivityWatch][6] —— 但现在可以了。 + +#### 自动窗口平铺 + +![][7] + +自动窗口平铺是我一直想尝试的东西 —— 但从来没花时间使用过 [i3][9] 这样的[平铺窗口管理器][8]来设置它,更别说是 [Regolith 桌面][10]了。 + +在 Pop!_OS 20.04 中,你就不需要这样做了。自动窗口平铺功能已经内置,无需设置。 + +它还提供了“显示活动提示”的选项,也就是说,它将高亮显示活动窗口以避免混淆。而且,你还可以调整窗口之间的间隙。 + +![][11] + +你可以在他们的官方视频中看到它是如何工作的: + +- [System76 Pop!_OS 20.04 - Auto Tiling](https://youtu.be/-fltwBKsMY0) + +而且,我得说,这是 Pop!_OS 20.04 上最大的新增功能之一,有可能帮助你更有效地进行多任务处理。 + +即使每次使用该功能都很方便,但为了最大程度地利用它,最好是使用一个大于 21 英寸的显示屏(至少)! 而且,因为这个原因 —— 我真的很想把我的显示器也升级一下! + +#### 新的扩展应用 + +![][13] + +Pop!_OS 内置了一些独特的 GNOME 扩展。但是,你不需要用 GNOME Tweaks 来管理扩展。 + +新增加的 “Extensions” 应用可以让你在 Pop!_OS 20.04 上配置和管理扩展程序。 + +#### 改进的通知中心 + +![][14] + +在新的 GNOME 3.36 中,通知中心的外观经过了改进。这里,我启用了黑暗模式。 + +#### 新的应用程序切换器 & 启动器 + +![][15] + +你仍然可以用 `ALT+TAB` 或 `Super+TAB` 来浏览正在运行的应用程序。 + +但是,当你有很多事情要做的时候,这很耗时。所以,在 Pop!_OS 20.04上,你可以使用 `Super+ /` 激活应用程序切换器和启动器。 + +一旦你习惯了这个快捷键,它将是非常方便的东西。 + +除此以外,你可能会发现 Pop!_OS 20.04 上的图标/窗口在视觉上有许多其它细微的改进。 + +#### 新的登录界面 + +嗯,这是 GNOME 3.36 带来的一个明显的变化。但是,它看起来确实很不错! + +![][16] + +#### Pop!_Shop 支持 Flatpak + +通常,Pop!_Shop 已经是一个非常有用的东西了,包括它自有的在内,它带有一个巨大的软件仓库。 + +现在,在 Pop!\_OS 20.04 中,你可以用 Pop!_Shop 安装任何可用软件的 Debian 包或 Flatpak(通过 Flathub) —— 当然,前提是某个软件有 Flatpak 软件包。 + +如果你没有使用 Pop!_OS 20.04,你可能要看看[如何在 Linux 上使用 Flatpak][18]。 + +![][19] + +就我个人而言,我并不是 Flatpak 的粉丝,但有些应用如 GIMP 需要你安装 Flatpak 包才能获得最新版本。所以,在 Pop!_Shop 上直接支持了 Flatpak 绝对是一件好事。 + +#### 键盘快捷键更改 + +如果你习惯了 Pop!_OS 19.10 或更早的版本上现有的键盘快捷键,这可能会让你很烦。 + +不管是哪种情况,有几个重要的键盘快捷键变化可能会改善你的体验,如下: + + * 锁定屏幕:`Super + L` 改为 `Super + Escape`。 + * 移动工作区:`Super + 上/下箭头键` 改为 `Super + CTRL + 上/下箭头键`。 + * 关闭窗口:`Super + W` 变更为 `Super + Q`。 + * 切换最大化:`Super +向上箭头` 改为 `Super + M`。 + +#### Linux 内核 5.4 + +与其他大多数最新的 Linux 发行版相似,Pop!_OS 20.04 搭载了 [Linux 内核 5.4][20]。 + +所以,很明显,你可以期望获得对 [exFAT 支持][21]、改进的 AMD 图形兼容性以及它附带所有其他功能。 + +#### 性能提升 + +尽管 Pop!_OS 并不称自己是轻量级的 Linux 发行版,但它仍然是一个资源节约型的发行版。而且,有了 GNOME 3.36 的支持,它的速度应该足够快了。 + +考虑到我已经将 Pop!\_OS 作为主要发行版使用已经一年多了,我从来没有遇到过性能问题。这就是你安装了 Pop!_OS 20.04 之后的资源使用情况(取决于你的系统配置)。 + +![][22] + +给你一个作为参考,我的台式机配置包括 i5-7400 处理器、16GB 内存(2400MHz)、NVIDIA GTX 1050ti 显卡和 SSD。 + +我不是一个系统基准测试的忠实拥护者,因为除非你去尝试,否则它并不能让你知道特定的应用或游戏的性能。 + +你可以试试 [Phoronix 测试套件][23]来分析你的系统表现。但是,Pop!_OS 20.04 LTS 应该是一个很爽快的体验! + +#### 软件包更新 & 其他改进 + +尽管每个基于Ubuntu的发行版都受益于Ubuntu 20.04 LTS的改进,但也有一些 Pop!_OS 特有的错误修复和改进。 + +除此之外,一些主要的应用程序/包(如 Firefox 75.0)也已经更新到了最新版本。 + +到现在为止,应该没有任何严重的错误,至少对我来说没有。 + +你可以在 [GitHub 上查看他们的开发进度][24],以了解他们在测试期间已经修复的问题和发布后即将修复的问题。 + +### 下载 & 支持 Pop!_OS 20.04 + +![][25] + +在这个版本中,System76 终于增加了一个可选的订阅模式来支持 Pop!_OS 的开发。 + +你可以免费下载 Pop!_OS 20.04 —— 但如果你想支持他们,我建议你只需要 \$1/月就可以订阅。 + +- [Pop!_OS 20.04][26] + +### 我对 Pop OS 20.04 的看法 + +我必须提到的是,我正在为最新的 20.04 版本提供全新的墙纸。但是,这没什么大不了的。 + +有了窗口平铺功能、支持 flatpak,以及众多其他改进,到目前为止,我对 Pop!_OS 20.04 的体验是一流的。另外,很高兴看到他们在一些流行软件的开箱即用支持上突出了他们对创意专业人士的关注。 + +![][27] + +Ubuntu 20.04 的所有优点,再加上 System76 的一些额外的加料,让我印象深刻! + +你试过 Pop!_OS 20.04 吗?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pop-os-20-04-review/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://system76.com +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/pop_os_20_04_review.jpg?ssl=1 +[3]: https://itsfoss.com/gnome-3-36-release/ +[4]: https://itsfoss.com/ubuntu-20-04-release-features/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/system-tray-icons-pop-os.jpg?ssl=1 +[6]: https://activitywatch.net/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-automatic-screen-tiling.png?ssl=1 +[8]: https://en.wikipedia.org/wiki/Tiling_window_manager +[9]: https://i3wm.org/ +[10]: https://itsfoss.com/regolith-linux-desktop/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/tile-feature-options-popos.jpg?ssl=1 +[12]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-extensions.jpg?ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/notification-center-pop-os.jpg?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-application-launcher.jpg?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-20-04-lock-screen.jpg?ssl=1 +[17]: https://launchpad.net/~system76/+archive/ubuntu/pop +[18]: https://itsfoss.com/flatpak-guide/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-flatpak-deb.jpg?ssl=1 +[20]: https://itsfoss.com/linux-kernel-5-4/ +[21]: https://itsfoss.com/mount-exfat/ +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-20-04-performance.jpg?ssl=1 +[23]: https://www.phoronix-test-suite.com/ +[24]: https://github.com/orgs/pop-os/projects/13 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/support-pop-os.jpg?ssl=1 +[26]: https://pop.system76.com/ +[27]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/pop-os-stem-focus.jpg?ssl=1 diff --git a/published/202005/20200504 4 cool new projects to try in COPR for May 2020.md b/published/202005/20200504 4 cool new projects to try in COPR for May 2020.md new file mode 100644 index 0000000000..9a63887910 --- /dev/null +++ b/published/202005/20200504 4 cool new projects to try in COPR for May 2020.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12230-1.html) +[#]: subject: (4 cool new projects to try in COPR for May 2020) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +COPR 仓库中 4 个很酷的新项目(2020.05) +====== + +![][1] + +COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + +本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。 + +### Ytop + +[ytop][4] 是类似于 `htop` 的命令行系统监视器。它们之间的主要区别是,`ytop` 在显示进程及其 CPU 和内存使用率的顶部显示了系统的 CPU、内存和网络使用率随时间变化的图表。此外,`ytop` 还显示磁盘使用情况和计算机温度。最后,`ytop` 支持多种配色方案以及创建新配色的选项。 + +![][5] + +#### 安装说明 + +[该仓库][6]当前为 Fedora 30、31、32 和 Rawhide 以及 EPEL 7 提供了 `ytop`。要安装 `ytop`,请[带上 sudo][7] 使用以下命令: + +``` +sudo dnf copr enable atim/ytop +sudo dnf install ytop +``` + +### Ctop + +[ctop][8] 是另一个命令行系统监视器。但是,与 `htop` 和 `ytop` 不同,`ctop` 专注于显示容器的资源使用情况。`ctop` 同时显示计算机上运行的所有容器的 CPU、内存、网络和磁盘使用情况的概要,以及单个容器的更全面的信息,包括一段时间内资源使用情况的图表。当前,`ctop` 支持 Docker 和 runc 容器。 + +![][9] + +#### 安装说明 + +[该仓库][10]当前为 Fedora 31、32 和 Rawhide 以及 EPEL 7 还有其他发行版提供了安装包。要安装 `ctop`,请使用以下命令: + +``` +sudo dnf copr enable fuhrmann/ctop +sudo dnf install ctop +``` + +### Shortwave + +[shortwave][11] 是用于收听广播电台的程序。`shortwave` 使用广播电台的社区数据库 [www.radio-browser.info][12]。在此数据库中,你可以发现或搜索广播电台,将它们添加到库中,然后收听。此外,`shortwave` 还提供有关当前播放歌曲的信息,并且还可以记录这些歌曲。 + +![][13] + +#### 安装说明 + +[该仓库][14] 当前为 Fedora 31、32 和 Rawhide 提供了 shortwave。要安装 `shortwave`,请使用以下命令: + +``` +sudo dnf copr enable atim/shortwave +sudo dnf install shortwave +``` + +### Setzer + +[setzer][15] 是 LaTeX 编辑器,它可以构建 pdf 文档并查看它们。它提供了各种类型文档(例如文章或幻灯片)的模板。此外,`setzer` 还有许多特殊符号、数学符号和希腊字母的按钮。 + +![][16] + +#### 安装说明 + +[该仓库][17] 当前为 Fedora 30、31、32 和 Rawhide 提供了 `setzer`。要安装 `setzer`,请使用以下命令: + +``` +sudo dnf copr enable lyessaadi/setzer +sudo dnf install setzer +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/ + +作者:[Dominik Turecek][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/dturecek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html# +[4]: https://github.com/cjbassi/ytop +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/ytop.png +[6]: https://copr.fedorainfracloud.org/coprs/atim/ytop/ +[7]: https://fedoramagazine.org/howto-use-sudo/ +[8]: https://github.com/bcicen/ctop +[9]: https://fedoramagazine.org/wp-content/uploads/2020/04/ctop.png +[10]: https://copr.fedorainfracloud.org/coprs/fuhrmann/ctop/ +[11]: https://github.com/ranfdev/shortwave +[12]: http://www.radio-browser.info/gui/#!/ +[13]: https://fedoramagazine.org/wp-content/uploads/2020/04/shortwave.png +[14]: https://copr.fedorainfracloud.org/coprs/atim/shortwave/ +[15]: https://www.cvfosammmm.org/setzer/ +[16]: https://fedoramagazine.org/wp-content/uploads/2020/04/setzer.png +[17]: https://copr.fedorainfracloud.org/coprs/lyessaadi/setzer/ diff --git a/published/202005/20200505 Browse the Peer-to-peer Web With Beaker Browser.md b/published/202005/20200505 Browse the Peer-to-peer Web With Beaker Browser.md new file mode 100644 index 0000000000..701d66156e --- /dev/null +++ b/published/202005/20200505 Browse the Peer-to-peer Web With Beaker Browser.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12203-1.html) +[#]: subject: (Browse the Peer-to-peer Web With Beaker Browser) +[#]: via: (https://itsfoss.com/beaker-browser/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +使用 Beaker 浏览器浏览对等 Web +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/10/082745ztmi4kqh4iq449ll.jpg) + +在过去 50 年中,我们所了解的互联网没有什么变化,全球的网民使用他们的设备从遍布在世界各地的服务器上检索数据。 + +一群专业的技术专家想改变现状,使互联网变成人们可以连接和直接分享信息的地方,而不是依赖一个中心服务器(去中心化)。 + +我们已经在 It’s FOSS 讨论过很多这样的去中心化的服务。[YouTube 竞品:LBRY][1]、[Twitter 竞品:Mastodon][2] 是其中的两个例子。 + +今天我将要介绍另一个这样的产品,名为 [Beaker 浏览器][3],它的设计目标是浏览对等 Web。 + +![Beaker Browser][4] + +### “对等 Web” 是什么? + +根据 Beaker 浏览器的[开发者之一][5]的描述,“对等 Web 是一项实验性的技术 ……旨在提高我们掌控 Web 的能力。” + +还有,他们说对等 Web 有三个主要原则:任何一点都可以成为服务器;多台计算机可以为同一个网站提供服务;没有后端。 + +从这些原则中你可以看出,对等 Web 的思想与 BitTorrent 很像,文件由多个对端做种,这些对端共同承担带宽负载。这减少了一个用户需要提供给他们的网站的总带宽。 + +![Beaker Browser Settings][6] + +对等 Web 另一个重要的方面是创作者对于他们自己的想法的控制能力。当今年代,平台都是由庞大的组织控制的,往往拿你的数据为他们所用。Beaker 把数据的控制能力返还给了内容创造者。 + +### 使用 Beaker 浏览去中心化的 web + +[Beaker 浏览器][3] 是在 2016 年被创建的。该项目(及其周边技术)由[蓝链实验室][7]的三人团队创建。Beaker 浏览器使用 [Dat 协议][8]在计算机之间共享数据。使用 Dat 协议的网站以 `dat://` 而不是 `http://` 开头。 + +Dat 协议的优势如下: + + * 快速 – 档案能立即从多个源同步。 + * 安全 – 所有的更新都是有签名和经过完整性检查的。 + * 灵活 – 可以在不修改档案 URL 的情况下迁移主机。 + * 版本控制 – 每次修改都被写到只能追加的版本日志中。 + * 去中心化 – 任何设备都可以作为承载档案的主机。 + +![Beaker Browser Seeding][9] + +Beaker 浏览器本质上是阉割版的 Chromium,原生支持 `dat://` 地址,也可以访问普通的 `http://` 站点。 + +每次访问一个 dat 站点,在你请求时该站点的内容才会下载到你的计算机。例如,在一个站点上的 about 页面中有一张 Linux Torvalds 的图片,只有在你浏览到该站点的这个页面时,才会下载这张图片。 + +此外,当你浏览一个 dat 网站时,“[你会短暂性的][10]重新上传或做种你从该网站上下载的所有文件。”你也可以选择为网站(主动)做种来帮助创造者。 + +![Beaker Browser Menu][11] + +由于 Beaker 的志向就是创建一个更开放的网络,因此你可以很容易地查看任何网站的源码。不像在大多数浏览器上你只能看到当前浏览的页面的源码那样,使用 Beaker 你能以类似 GitHub 的视图查看整个站点的结构。你甚至可以复刻这个站点,并托管你自己的版本。 + +除了浏览基于 dat 的网站外,你还可以创建自己的站点。在 Beaker 浏览器的菜单里,有创建新网站或空项目的选项。如果你选择了创建一个新网站,Beaker 会搭建一个小的演示站点,你可以使用浏览器里自带的编辑器来编辑。 + +然而,如果你像我一样更喜欢用 Markdown,你可以选择创建一个空项目。Beaker 会创建一个站点的结构,赋给它一个 `dat://` 地址。你只需要创建一个 `index.md` 文件后就行了。这有个[简短教程][12],你可以看到更多信息。你也可以用创建空项目的方式搭建一个 web 应用。 + +![Beaker Browser Website Template][13] + +由于 Beaker 的角色是个 Web 服务器和站点做种者,当你关闭它或关机后你的站点就不可用了。幸运的是,你不必一直开着你的计算机或浏览器。你也可以使用名为 [Hashbase][14] 的做种服务或者你可以搭建一个 [homebase][15] 做种服务器。 + +虽然 Beaker [适用于][16] Linux、Windows 和 macOS,但是在使用 Beaker 之前,还是要查阅下[各平台的教程][17]。 + +### Beaker 浏览器不是大众可用的,但它有这个意图 + +当第一次接触到时,我对 Beaker 浏览器有极高的热情。(但是)如它现在的名字一样(烧杯),Beaker 浏览器仍是非常实验性的。我尝试浏览过的很多 dat 站点还不可用,因为用户并没有为站点做种。当站点恢复可用时 Beaker 确实可以选择通知你。 + +![Beaker Browser No Peer][18] + +另一个问题是,Beaker 是真正阉割版的 Chromium。它不能安装扩展或主题。你只能使用白色主题和极少的工具集。我不会把 Beaker 浏览器作为常用浏览器,而且能访问 dat 网站并不是把它留在系统上的充分条件。 + +我曾经寻找一个能支持 `dat://` 协议的 Firefox 扩展。我确实找到了这样一款扩展,但它需要安装一系列其他的软件。相比而言,安装 Beaker 比安装那些软件容易点。 + +就如它现在的名字一样,Beaker 不适合我。也许在将来更多的人使用 Beaker 或者其他浏览器支持 dat 协议。那时会很有趣。目前而言,聊胜于无。 + +在使用 Beaker 的时间里,我用内建的工具创建了一个[网站][19]。不要担心,我已经为它做种了。 + +![Beaker Bowser Site Source][20] + +你怎么看 Beaker 浏览器?你怎么看对等 Web?请尽情在下面评论。 + +如果你觉得本文有意思,请花点时间把它分享到社交媒体,Hacker News 或 [Reddit][21]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/beaker-browser/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/lbry/ +[2]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ +[3]: https://beakerbrowser.com/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser.jpg?resize=800%2C426&ssl=1 +[5]: https://pfrazee.hashbase.io/blog/what-is-the-p2p-web +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-setting.jpg?resize=800%2C573&ssl=1 +[7]: https://bluelinklabs.com/ +[8]: https://www.datprotocol.com/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-seedding.jpg?resize=800%2C466&ssl=1 +[10]: https://beakerbrowser.com/docs/faq/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-menu.jpg?ssl=1 +[12]: https://beakerbrowser.com/docs/guides/create-a-markdown-site +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-website-template.jpg?resize=800%2C459&ssl=1 +[14]: https://hashbase.io/ +[15]: https://github.com/beakerbrowser/homebase +[16]: https://beakerbrowser.com/install/ +[17]: https://beakerbrowser.com/docs/guides/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-no-peer.jpg?resize=800%2C424&ssl=1 +[19]: https://41bfbd06731e8d9c5d5676e8145069c69b254e7a3b710ddda4f6e9804529690c/ +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-source.jpg?resize=800%2C544&ssl=1 +[21]: https://reddit.com/r/linuxusersgroup diff --git a/published/202005/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/published/202005/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md new file mode 100644 index 0000000000..fcf6c3b3ca --- /dev/null +++ b/published/202005/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12188-1.html) +[#]: subject: (After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements) +[#]: via: (https://itsfoss.com/inkscape-1-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +经过了 3 年,Inkscape 1.0 终于发布了 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/06/094055fvnh9nnnbybwl4jn.jpg) + +虽然我不是这方面的专业人员,但可以肯定地说,Inkscape 是[最好的矢量图形编辑器][1]之一。 + +不仅仅因为它是自由开源软件,而且对于数字艺术家来说,它是一个非常有用的应用程序。 + +上一次发布(0.92 版本)是在 3 年前。现在,终于,[Inkscape 宣布了它的 1.0 版本][2] —— 增加了很多新的功能和改进。 + +### Inkscape 1.0 里的新东西 + +![Inkscape 1.0][3] + +在这里,让我重点介绍一下 Inkscape 1.0 版本中重要关键变化。 + +#### 首个原生 macOS 应用 + +对于像 Inkscape 这样的神奇工具来说,适当的跨平台支持总是好的。在这个最新的版本中,它推出了原生的 macOS 应用。 + +请注意,这个 macOS 应用仍然是一个**预览版**,还有很多改进的空间。不过,在无需 [XQuartz][4] 的情况下就做到了更好的系统集成,对于 macOS 用户来说,应该是一个值得期许的进步。 + +#### 性能提升 + +不管是什么应用程序/工具,都会从显著的性能提升中受益,而 Inkscape 也是如此。 + +随着其 1.0 版本的发布,他们提到,当你使用 Inkscape 进行各种创意工作时,你会发现性能更加流畅。 + +除了在 macOS 上(仍为“预览版”),Inkscape 在 Linux 和 Windows 上的运行都是很好的。 + +#### 改进的 UI 和 HiDPI 支持 + +![][5] + +他们在发布说明中提到: + +> ……达成了一个重要的里程碑,使 Inkscape 能够使用最新的软件(即 GTK+3)来构建编辑器的用户界面。拥有 HiDPI(高分辨率)屏幕的用户要感谢 2018 年波士顿黑客节期间的团队合作,让更新后的 GTK 轮子开始运转起来。 + +从 GTK+3 的用户界面到高分辨率屏幕的 HiDPI 支持,这都是一次精彩的升级。 + +更不要忘了,你还可以获得更多的自定义选项来调整外观和感受。 + +#### 新增功能 + +![][6] + +即便是从纸面上看,这些列出新功能都看起来不错。根据你的专业知识和你的喜好,这些新增功能应该会派上用场。 + +以下是新功能的概述: + + * 新改进过的实时路径效果(LPE)功能。 + * 新的可搜索的 LPE 选择对话框。 + * 自由式绘图用户现在可以对画布进行镜像和旋转。 + * 铅笔工具的新的 PowerPencil 模式提供了压感的宽度,并且终于可以创建封闭路径了。 + * 包括偏移、PowerClip 和 PowerMask LPE 在内的新路径效果会吸引艺术类用户。 + * 能够创建复制引导、将网格对齐到页面上、测量工具的路径长度指示器和反向 Y 轴。 + * 能够导出带有可点击链接和元数据的 PDF 文件。 + * 新的调色板和网状渐变,可在网页浏览器中使用。 + +虽然我已经尝试着整理了这个版本中添加的关键功能列表,但你可以在他们的[发布说明][7]中获得全部细节。 + +#### 其他重要变化 + +作为重大变化之一,Inkscape 1.0 现在支持 Python 3。而且,随着这一变化,你可能会注意到一些扩展程序无法在最新版本中工作。 + +所以,如果你的工作依赖于某个扩展程序的工作流程,我建议你仔细看看他们的[发布说明][7],了解所有的技术细节。 + +### 在 Linux 上下载和安装 Inkscape 1.0 + +Inkscape 1.0 有用于 Linux 的 AppImage 和 Snap 软件包,你可以从 Inkscape 的网站上下载。 + +- [下载 Inkscape 1.0 for Linux][8] + +如果你还不知道,可以查看[如何在 Linux 上使用 AppImage 文件][9]来入门。你也可以参考[这个 Snap 指南][10]。 + +Ubuntu 用户可以在 Ubuntu 软件中心找到 Inskcape 1.0 的 Snap 版本。 + +我在 [Pop!_OS 20.04][11] 上使用了 AppImage 文件,工作的很好。你可以详细体验所有的功能,看看它的效果如何。 + +你试过了吗?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/inkscape-1-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/vector-graphics-editors-linux/ +[2]: https://inkscape.org/news/2020/05/04/introducing-inkscape-10/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-1-0.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/XQuartz +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-ui-customization.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-live-path-effects.jpg?ssl=1 +[7]: https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0 +[8]: https://inkscape.org/release/1.0/gnulinux/ +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://itsfoss.com/install-snap-linux/ +[11]: https://itsfoss.com/pop-os-20-04-review/ diff --git a/published/202005/20200506 Customizing my open source PHP framework for web development.md b/published/202005/20200506 Customizing my open source PHP framework for web development.md new file mode 100644 index 0000000000..de6b46f8b7 --- /dev/null +++ b/published/202005/20200506 Customizing my open source PHP framework for web development.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12235-1.html) +[#]: subject: (Customizing my open source PHP framework for web development) +[#]: via: (https://opensource.com/article/20/5/codeigniter) +[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) + +自定义用于 Web 开发的开源 PHP 框架 Codeigniter +====== + +> Codeigniter 是一个 PHP 框架,可以使公司进行开发具有灵活性和便捷性的高性能网站。 + +![](https://img.linux.net.cn/data/attachment/album/202005/21/102637vslj5zqk52x98a52.jpg) + +PHP Codeigniter 是一个开源框架,为商业应用提供易于使用的 PHP 编程语言和强大的编码工具。它还提供商务智能、服务器监视、开发和应用集成功能。这是一个相对冷清的项目,你很少听到它,但它功能强大,许多刚接触的开发人员都对此感到惊讶和耳目一新。 + +我在新加坡的一家在线学习服务提供商处使用 [Codeigniter][2]。我们提供的服务并不算常见,没有可以作为模板的默认功能集或现有后台管理系统,所以我需要一个能提供良好的、可靠的、可以建立在此基础上的原始材料。最初,我考虑用其他平台(如 Wordpress)用于我们的网站。但是,我决定使用 Codeigniter,因为它的灵活性,以及集成了在我们的补课匹配过程中需要的功能。 + +以下是打动我使用 Codeigniter 的原因: + +* 与 MySQL 数据库的集成 —— 主要功能是允许客户端浏览导师的数据库并添加导师,例如类似于电子商务平台的“购物车”。 +* 客户端界面系统 —— 用户可以登录来管理偏好并编辑详细信息,修改所教的科目、旅游的地区、手机号码、地址等。 +* 定制的管理员面板 —— 管理员可以使用定制的管理面板访问客户提交的资料,它与客户服务功能集成在一起,因此管理员可以单独跟进。 +* 付款系统 —— 管理面板带有与 Paypal 集成的发票和付款网关。 +* CMS 编辑器界面 —— 管理员能够编辑博客和文章中的文本和图像,以及添加新页面。 + +该项目花费了大约六个月的时间来完成,另外花了两个月的调试时间。如果我需要从头开始构建所有,或者尝试重新设计现有的框架以满足我们的需求,那将花费更长的时间,而且可能最终无法满足客户需求。 + +### 功能和优点 + +PHP Codeigniter还有很多吸引开发者的功能,包括错误处理和代码格式化,这些功能在各种编码情景下都非常有用。它支持模板,可用于向现有网站添加功能或生成新网站。有许多基于 web 系统商业需要的功能,包括使用自定义标签。即使没有编程经验的普通开发人员也可以使用大多数工具。 + +Codeigniter 的主要功能是: + +* XML 核心服务, +* HTTP/FTP 核心服务 +* AppData 和 PHP 沙箱功能 +* XSLT 和 HTML 模板 +* 加密的信息传输 +* PCM Codeigniter 服务器监控 +* 应用集成 +* 文件传输协议(FTP) +* 服务台支持 +* Apache POI(用于托管网站的内容管理基础架构) + +#### 兼容性 + +Codeigniter 与许多领先的软件程序兼容,例如 PHP、MySQL、[MariaDB][3]、[phpMyAdmin][4]、[Apache][5]、OpenBSD、XSLT、[SQLite][6] 等。许多公司更喜欢使用 Codeigniter 产品来满足网站要求,因为它们易于使用和集成。如果你不想创建自己的网站,你可以找到许多提供自定义 Web 开发服务的开发人员和设计机构。 + +#### 安全 + +Codeigniter 还通过 SSL 加密提供数据安全性。加密可以保护数据免受入侵者和防火墙外部威胁的侵害。数据存储功能还允许对公司网站进行安全审核。 + +#### 其它功能 + +一家优秀的 PHP Web 开发公司会使用几种高级技术和第三方技术,例如 XML 和 PHP。它为企业提供了一个完整的平台,可以开发出具有看起来专业的、好用的商业网站。Codeigniter 使得第三方技术的使用变得容易,并可以与常见的 Web 开发软件一起使用。这使得 Web 公司可以轻松地使用所选模块创建网站。大多数 PHP 开发者也为个人提供支持和培训服务。 + +### 使用 PHP 框架 Codeigniter + +Codeigniter 给企业提供了完整的 PHP 开发包,它将提供强大的功能、灵活性和性能完美结合在一起。到目前为止,我很满意我们的网站,并不断地升级和添加新的功能。并不断升级和增加新的功能。我期待着发现我们的网站还能用 Codeigniter 做些什么。你也是这样么? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/codeigniter + +作者:[Wee Ben Sen][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bswee14 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://codeigniter.com/ +[3]: http://mariadb.org/ +[4]: https://www.phpmyadmin.net/ +[5]: http://apache.org/ +[6]: http://sqlite.org/ diff --git a/published/202005/20200506 Managing Git projects with submodules and subtrees.md b/published/202005/20200506 Managing Git projects with submodules and subtrees.md new file mode 100644 index 0000000000..d52aef42a6 --- /dev/null +++ b/published/202005/20200506 Managing Git projects with submodules and subtrees.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12244-1.html) +[#]: subject: (Managing Git projects with submodules and subtrees) +[#]: via: (https://opensource.com/article/20/5/git-submodules-subtrees) +[#]: author: (Manaswini Das https://opensource.com/users/manaswinidas) + +使用子模块和子树来管理 Git 项目 +====== + +> 使用子模块和子树来帮助你管理多个存储库中共有的子项目。 + +![](https://img.linux.net.cn/data/attachment/album/202005/23/201323myyhob22eg2y2jqt.jpg) + +如果你参与了开源项目的开发,那么你很可能已经用了 Git 来管理你的源码。你可能遇到过有很多依赖和/或子项目的项目。你是如何管理它们的? + +对于一个开源组织,要实现社区**和**产品的单一来源文档和依赖管理比较棘手。文档和项目往往会碎片化和变得冗余,这致使它们很难维护。 + +### 必要性 + +假设你想把单个项目作为一个存储库内的子项目,传统的方法是把该项目复制到父存储库中,但是,如果你想要在多个父项目中使用同一个子项目呢?如果把子项目复制到所有父项目中,当有更新时,你都要在每个父项目中做修改,这是不太可行的。这会导致父项目中的冗余和数据不一致,使更新和维护子项目变得很困难。 + +### Git 子模块和子树 + +如果你可以用一条命令把一个项目放进另一个项目中,会怎样呢?如果你随时可以把一个项目作为子项目添加到任意数目的项目中,并可以同步更新修改呢?Git 提供了这类问题的解决方案:Git 子模块submodule和 Git 子树subtree。创建这些工具的目的是以更加模块化的水平来支持共用代码的开发工作流,旨在 Git 存储库源码管理source-code management(SCM)与它下面的子树之间架起一座桥梁。 + +![Cherry tree growing on a mulberry tree][2] + +*生长在桑树上的樱桃树* + +下面是本文要详细介绍的概念的一个真实应用场景。如果你已经很熟悉树形结构,这个模型看起来是下面这样: + +![Tree with subtrees][3] + +### Git 子模块是什么? + +Git 在它默认的包中提供了子模块,子模块可以把 Git 存储库嵌入到其他存储库中。确切地说,Git 子模块指向子树中的某次提交。下面是我 [Docs-test][4] GitHub 存储库中的 Git 子模块的样子: + +![Git submodules screenshot][5] + +[文件夹@提交 Id][6] 格式表明这个存储库是一个子模块,你可以直接点击文件夹进入该子树。名为 `.gitmodules` 的配置文件包含所有子模块存储库的详细信息。我的存储库的 `.gitmodules` 文件如下: + +![Screenshot of .gitmodules file][7] + +你可以用下面的命令在你的存储库中使用 Git 子模块: + +#### 克隆一个存储库并加载子模块 + +克隆一个含有子模块的存储库: + +``` +$ git clone --recursive +``` + +如果你之前已经克隆了存储库,现在想加载它的子模块: + +``` +$ git submodule update --init +``` + +如果有嵌套的子模块: + +``` +$ git submodule update --init --recursive +``` + +#### 下载子模块 + +串行地连续下载多个子模块是很枯燥的工作,所以 `clone` 和 `submodule update` 会支持 `--jobs` (或 `-j`)参数: + +例如,想一次下载 8 个子模块,使用: + +``` +$ git submodule update --init --recursive -j 8 +$ git clone --recursive --jobs 8 +``` + +#### 拉取子模块 + +在运行或构建父项目之前,你需要确保依赖的子项目都是最新的。 + +拉取子模块的所有修改: + +``` +$ git submodule update --remote +``` + +#### 使用子模块创建存储库: + +向一个父存储库添加子树: + +``` +$ git submodule add +``` + +初始化一个已存在的 Git 子模块: + +``` +$ git submodule init +``` + +你也可以通过为 `submodule update` 命令添加 `--update` 参数在子模块中创建分支和追踪提交: + +``` +$ git submodule update --remote +``` + +#### 更新子模块的提交 + +上面提到过,一个子模块就是一个指向子树中某次提交的链接。如果你想更新子模块的提交,不要担心。你不需要显式地指定最新的提交。你只需要使用通用的 `submodule update` 命令: + +``` +$ git submodule update +``` + +就像你平时创建父存储库和把父存储库推送到 GitHub 那样添加和提交就可以了。 + +#### 从一个父存储库中删除一个子模块 + +仅仅手动删除一个子项目文件夹不会从父项目中移除这个子项目。想要删除名为 `childmodule` 的子模块,使用: + +``` +$ git rm -f childmodule +``` + +虽然 Git 子模块看起来很容易上手,但是对于初学者来说,有一定的使用门槛。 + +### Git 子树是什么? + +Git 子树 subtree,是在 Git 1.7.11 引入的,让你可以把任何存储库的副本作为子目录嵌入另一个存储库中。它是 Git 项目可以注入和管理项目依赖的几种方法之一。它在常规的提交中保存了外部依赖信息。Git 子树提供了整洁的集成点,因此很容易复原它们。 + +如果你参考 [GitHub 提供的子树教程][8]来使用子树,那么无论你什么时候添加子树,在本地都不会看到 `.gittrees` 配置文件。这让我们很难分辨哪个是子树,因为它们看起来很像普通的文件夹,但是它们却是子树的副本。默认的 Git 包中不提供带 `.gittrees` 配置文件的 Git 子树版本,因此如果你想要带 `.gittrees` 配置文件的 git-subtree 命令,必须从 Git 源码存储库的 [/contrib/subtree 文件夹][9] 下载 git-subtree。 + +你可以像克隆其他常规的存储库那样克隆任何含有子树的存储库,但由于在父存储库中有整个子树的副本,因此克隆过程可能会持续很长时间。 + +你可以用下面的命令在你的存储库中使用 Git 子树。 + +#### 向父存储库中添加一个子树 + +想要向父存储库中添加一个子树,首先你需要执行 `remote add`,之后执行 `subtree add` 命令: + +``` +$ git remote add remote-name +$ git subtree add --prefix=folder/ remote-name subtree-branchname +``` + +上面的命令会把整个子项目的提交历史合并到父存储库。 + +#### 向子树推送修改以及从子树拉取修改 + +``` +$ git subtree push-all +``` + +或者 + +``` +$ git subtree pull-all +``` + +### 你应该使用哪个? + +任何工具都有优缺点。下面是一些可能会帮助你决定哪种最适合你的特性: + + * Git 子模块的存储库占用空间更小,因为它们只是指向子项目的某次提交的链接,而 Git 子树保存了整个子项目及其提交历史。 + * Git 子模块需要在服务器中可访问,但子树是去中心化的。 + * Git 子模块大量用于基于组件的开发,而 Git 子树多用于基于系统的开发。 + +Git 子树并不是 Git 子模块的直接可替代项。有明确的说明来指导我们该使用哪种。如果有一个归属于你的外部存储库,使用场景是向它回推代码,那么就使用 Git 子模块,因为推送代码更容易。如果你有第三方代码,且不会向它推送代码,那么使用 Git 子树,因为拉取代码更容易。 + +自己尝试使用 Git 子树和子模块,然后在评论中留下你的使用感想。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/git-submodules-subtrees + +作者:[Manaswini Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/manaswinidas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://opensource.com/sites/default/files/uploads/640px-bialbero_di_casorzo.jpg (Cherry tree growing on a mulberry tree) +[3]: https://opensource.com/sites/default/files/subtree_0.png (Tree with subtrees) +[4]: https://github.com/manaswinidas/Docs-test/ +[5]: https://opensource.com/sites/default/files/uploads/git-submodules_github.png (Git submodules screenshot) +[6]: mailto:folder@commitId +[7]: https://opensource.com/sites/default/files/uploads/gitmodules.png (Screenshot of .gitmodules file) +[8]: https://help.github.com/en/github/using-git/about-git-subtree-merges +[9]: https://github.com/git/git/tree/master/contrib/subtree diff --git a/published/202005/20200506 Speed up administration of Kubernetes clusters with k9s.md b/published/202005/20200506 Speed up administration of Kubernetes clusters with k9s.md new file mode 100644 index 0000000000..2d3665fc79 --- /dev/null +++ b/published/202005/20200506 Speed up administration of Kubernetes clusters with k9s.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12247-1.html) +[#]: subject: (Speed up administration of Kubernetes clusters with k9s) +[#]: via: (https://opensource.com/article/20/5/kubernetes-administration) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +k9s:你没看错,这是一个加速 k8s 集群管理的工具 +====== + +> 看看这个很酷的 Kubernetes 管理的终端 UI。 + +![](https://img.linux.net.cn/data/attachment/album/202005/25/104742pqjmiroc44honcs5.jpg) + +通常情况下,我写的关于 Kubernetes 管理的文章中用的都是做集群管理的 `kubectl` 命令。然而最近,有人给我介绍了 [k9s][2] 项目,可以让我快速查看并解决 Kubernetes 中的日常问题。这极大地改善了我的工作流程,我会在这篇教程中告诉你如何上手它。  + +它可以安装在 Mac、Windows 和 Linux 中,每种操作系统的说明可以在[这里][2]找到。请先完成安装,以便能够跟上本教程。 + +我会使用 Linux 和 Minikube,这是一种在个人电脑上运行 Kubernetes 的轻量级方式。按照[此教程][3]或使用[该文档][4]来安装它。 + +### 设置 k9s 配置文件 + +安装好 `k9s` 应用后,从帮助命令开始总是很好的起点。 + +``` +$ k9s help +``` + +正如你在帮助信息所看到的,我们可以用 `k9s` 来配置很多功能。我们唯一需要进行的步骤就是编写配置文件。而 `info` 命令会告诉我们该应用程序要在哪里找它的配置文件。 + +``` +$ k9s info + ____ __.________ +| |/ _/ __ \______ +| < \____ / ___/ +| | \ / /\___ \ +|____|__ \ /____//____ > + \/ \/ + +Configuration: /Users/jess/.k9s/config.yml +Logs: /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log +Screen Dumps: /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess +``` + +如果要添加配置文件,该配置目录不存在的话就创建它,然后添加一个配置文件。 + +``` +$ mkdir -p ~/.k9s/ +$ touch ~/.k9s/config.yml +``` + +在这篇介绍中,我们将使用 `k9s` 版本库中推荐的默认 `config.yml`。维护者请注意,这种格式可能会有变化,可以[在这里查看][5]最新版本。 + +``` +k9s: +  refreshRate: 2 +  headless: false +  readOnly: false +  noIcons: false +  logger: +    tail: 200 +    buffer: 500 +    sinceSeconds: 300 +    fullScreenLogs: false +    textWrap: false +    showTime: false +  currentContext: minikube +  currentCluster: minikube +  clusters: +    minikube: +      namespace: +        active: "" +        favorites: +        - all +        - kube-system +        - default +      view: +        active: dp +  thresholds: +    cpu: +      critical: 90 +      warn: 70 +    memory: +      critical: 90 +      warn: 70 +``` + +我们设置了 `k9s` 寻找本地的 minikube 配置,所以我要确认 minikube 已经上线可以使用了。 + +``` +$ minikube status +host: Running +kubelet: Running +apiserver: Running +kubeconfig: Configured +``` + +### 运行 k9s 来探索一个 Kubernetes 集群 + +有了配置文件,并指向我们的本地集群,我们现在可以运行 `k9s` 命令了。 + +``` +$ k9s +``` + +启动后,会弹出 `k9s` 的基于文本的用户界面。在没有指定命名空间标志的情况下,它会向你显示默认命名空间中的 Pod。 + +![K9s screenshot][6] + +如果你运行在一个有很多 Pod 的环境中,默认视图可能会让人不知所措。或者,我们可以将注意力集中在给定的命名空间上。退出该应用程序,运行 `k9s -n `,其中 `` 是已存在的命名空间。在下图中,我运行了 `k9s -n minecraft`,它显示了我损坏的 Pod: + +![K9s screenshot][7] + +所以,一旦你有了 `k9s` 后,有很多事情你可以更快地完成。  + +通过快捷键来导航 `k9s`,我们可以随时使用方向键和回车键来选择列出的项目。还有不少其他的通用快捷键可以导航到不同的视图。 + +* `0`:显示在所有命名空间中的所有 Pod + ![K9s screenshot][8] +* `d`:描述所选的 Pod + ![K9s screenshot][9] +* `l`:显示所选的 Pod 的日志 + ![Using k9s to show Kubernetes pod logs][10] + +你可能会注意到 `k9s` 设置为使用 [Vim 命令键][11],包括使用 `J` 和 `K` 键上下移动等。Emacs 用户们,败退吧 :) + +### 快速查看不同的 Kubernetes 资源 + +需要去找一个不在 Pod 里的东西吗?是的,我也需要。当我们输入冒号(`:`)键时,可以使用很多快捷方式。从那里,你可以使用下面的命令来导航。 + +* `:svc`:跳转到服务视图 + ![K9s screenshot][12] +* `:deploy`:跳转到部署视图 + ![K9s screenshot][13] +* `:rb`:跳转到角色绑定视图,用于 [基于角色的访问控制(RBAC)][14]管理 + ![K9s screenshot][15] +* `:namespace`:跳转到命名空间视图 + ![K9s screenshot][16] +* `:cj`:跳转到 cronjob 视图,查看集群中计划了哪些作业。 + ![K9s screenshot][17] + +这个应用最常用的工具是键盘;要在任何页面往上或下翻页,请使用方向键。如果你需要退出,记得使用 Vim 绑定键,键入 `:q`,然后按回车键离开。 + +### 用 k9s 排除 Kubernetes 的故障示例 + +当出现故障的时候,`k9s` 怎么帮忙?举个例子,我让几个 Pod 由于配置错误而死亡。下面你可以看到我那个可怜的 “hello” 部署死了。当我们将其高亮显示出来,可以按 `d` 运行 `describe` 命令,看看是什么原因导致了故障。 + +![K9s screenshot][18] + +![K9s screenshot][19] + +草草掠过那些事件并不能告诉我们故障原因。接下来,我按了 `esc` 键,然后通过高亮显示 Pod 并输入`shift-l` 来检查日志。 + +![K9s screenshot][20] + +不幸的是,日志也没有提供任何有用的信息(可能是因为部署从未正确配置过),而且 Pod 也没有出现。 + +然后我使用 `esc` 退了出来,我看看删除 Pod 是否能解决这个问题。要做到这一点,我高亮显示该 Pod,然后使用 `ctrl-d`。幸好 `k9s` 在删除前会提示用户。  + +![K9s screenshot][21] + +虽然我确实删除了这个 Pod,但部署资源仍然存在,所以新的 Pod 会重新出现。无论什么原因(我们还不知道),它还会继续重启并死掉。 + +在这里,我会重复查看日志,描述资源,甚至使用 `e` 快捷方式来编辑运行中的 Pod 以排除故障行为。在这个特殊情况下,失败的 Pod 是因为没有配置在这个环境下运行。因此,让我们删除部署来停止崩溃接着重启的循环。 + +我们可以通过键入 `:deploy` 并点击回车进入部署。从那里我们高亮显示并按 `ctrl-d` 来删除。 + +![K9s screenshot][22] + +![K9s screenshot][23] + +这个有问题的部署被干掉了! 只用了几个按键就把这个失败的部署给清理掉了。 + +### k9s 是极其可定制的 + +这个应用有很多自定义选项、乃至于 UI 的配色方案。这里有几个可编辑的选项,你可能会感兴趣。 + +* 调整你放置 `config.yml` 文件的位置(这样你就可以把它存储在[版本控制][24]中)。 +* 在 `alias.yml` 文件中添加[自定义别名][25]。 +* 在 `hotkey.yml` 文件中创建[自定义热键][26]。 +* 探索现有的[插件][27]或编写自己的插件。 + +整个应用是在 YAML 文件中配置的,所以定制化对于任何 Kubernetes 管理员来说都会觉得很熟悉。 + +### 用 k9s 简化你的生活 + +我倾向于以一种非常手动的方式来管理我团队的系统,更多的是为了锻炼脑力,而不是别的。当我第一次听说 `k9s` 的时候,我想,“这只是懒惰的 Kubernetes 而已。”于是我否定了它,然后回到了到处进行人工干预的状态。实际上,当我在处理积压工作时就开始每天使用它,而让我震惊的是它比单独使用 `kubectl` 快得多。现在,我已经皈依了。  + +了解你的工具并掌握做事情的“硬道理”很重要。还有一点很重要的是要记住,就管理而言,重要的是要更聪明地工作,而不是更努力。使用 `k9s`,就是我践行这个目标的方法。我想,我们可以把它叫做懒惰的 Kubernetes 管理,也没关系。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/kubernetes-administration + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z (Dogs playing chess) +[2]: https://github.com/derailed/k9s +[3]: https://opensource.com/article/18/10/getting-started-minikube +[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ +[5]: https://github.com/derailed/k9s#k9s-configuration +[6]: https://opensource.com/sites/default/files/uploads/k9s_1.png (K9s screenshot) +[7]: https://opensource.com/sites/default/files/uploads/k9s_2.png (K9s screenshot) +[8]: https://opensource.com/sites/default/files/uploads/k9s_3.png (K9s screenshot) +[9]: https://opensource.com/sites/default/files/uploads/k9s_5_0.png (K9s screenshot) +[10]: https://opensource.com/sites/default/files/uploads/k9s-show-logs-opensourcedotcom.png (Using k9s to show Kubernetes pod logs) +[11]: https://opensource.com/article/19/3/getting-started-vim +[12]: https://opensource.com/sites/default/files/uploads/k9s_5.png (K9s screenshot) +[13]: https://opensource.com/sites/default/files/uploads/k9s_6.png (K9s screenshot) +[14]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/ +[15]: https://opensource.com/sites/default/files/uploads/k9s_7.png (K9s screenshot) +[16]: https://opensource.com/sites/default/files/uploads/k9s_8.png (K9s screenshot) +[17]: https://opensource.com/sites/default/files/uploads/k9s_9.png (K9s screenshot) +[18]: https://opensource.com/sites/default/files/uploads/k9s_10.png (K9s screenshot) +[19]: https://opensource.com/sites/default/files/uploads/k9s_11.png (K9s screenshot) +[20]: https://opensource.com/sites/default/files/uploads/k9s_12.png (K9s screenshot) +[21]: https://opensource.com/sites/default/files/uploads/k9s_13.png (K9s screenshot) +[22]: https://opensource.com/sites/default/files/uploads/k9s_14.png (K9s screenshot) +[23]: https://opensource.com/sites/default/files/uploads/k9s_15.png (K9s screenshot) +[24]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[25]: https://k9scli.io/topics/aliases/ +[26]: https://k9scli.io/topics/hotkeys/ +[27]: https://github.com/derailed/k9s/tree/master/plugins diff --git a/published/202005/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md b/published/202005/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md new file mode 100644 index 0000000000..a319cb3be6 --- /dev/null +++ b/published/202005/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12263-1.html) +[#]: subject: (Three Methods to Check Uptime of MySQL/MariaDB Database Server on Linux) +[#]: via: (https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 上检查 MySQL/MariaDB 数据库正常运行时间的三种方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/29/211031hqb8qlyddtlrt2fl.jpg) + +我们都知道在 Linux 中使用 `uptime` 命令的目的。它用于检查 [Linux 系统的正常运行时间][1]以及系统上次启动以来运行的时间。 + +而 Linux 管理员的工作是保持系统正常运行。 + +如果要检查 Linux 上的其他服务(例如 [Apache][2]、MySQL、MariaDB、sftp 等)运行了多长时间,该怎么做? + +每个服务都有自己的命令来检查服务的正常运行时间。但是你也可以为此使用其他命令。 + +### 方法 1:如何使用 ps 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 + +[ps 命令][3]的意思是进程状态process status。这是最基本的命令之一,它显示了系统正在运行的进程的详细信息。 + +为此,你首先需要使用 [pidof 命令][5]查找 [MySQL][4]/[MariaDB][6] 的 PID。 + +``` +# pidof mysqld | cut -d" " -f1 + +2412 +``` + +获取 MySQL/MariaDB 的 PID 后,请在 `ps` 命令中使用 `--etime` 选项获得正常运行时间。 + +* `--etime`:自进程启动以来经过的时间,形式为 `[[DD-]hh:]mm:ss`。 + +``` +# ps -p 2412 -o etime + + ELAPSED +2-08:49:30 +``` + +或者,在 `ps` 命令中使用 `--lstart` 选项来获取指定 PID 的正常运行时间。 + +``` +# ps -p 2412 -o lstart + + STARTED +Sat May 2 03:02:15 2020 +``` + +MySQL/MariaDB 进程已经运行了 2 天 03 小时 02 分 15 秒。 + +### 方法 2:如何使用 systemctl 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 + +[systemctl 命令][7]用于控制 systemd 系统和服务管理器。 + +systemd 是新的初始化系统和系统管理器,现在大多数 Linux 发行版都淘汰了传统的 SysVinit 管理器而采用了 systemd。 + +``` +# systemctl status mariadb +或者 +# systemctl status mysql + +● mariadb.service - MariaDB 10.1.44 database server + Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) + Drop-In: /etc/systemd/system/mariadb.service.d + └─migrated-from-my.cnf-settings.conf + Active: active (running) since Sat 2020-05-02 03:02:18 UTC; 2 days ago + Docs: man:mysqld(8) + https://mariadb.com/kb/en/library/systemd/ + Process: 2448 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) + Process: 2388 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS) + Process: 2386 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) + Main PID: 2412 (mysqld) + Status: "Taking your SQL requests now…" + CGroup: /system.slice/mariadb.service + └─2412 /usr/sbin/mysqld + +May 03 21:41:26 ns2.2daygeek.com mysqld[2412]: 2020-05-03 21:41:26 140328136861440 [Warning] Host name '1.1.1.1' could not be resolved: … not known +May 04 02:00:46 ns2.2daygeek.com mysqld[2412]: 2020-05-04 2:00:46 140328436418304 [Warning] IP address '1.1.1.1' has been resolved to the host name '2…ss itself. +May 04 03:01:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 3:01:31 140328436111104 [Warning] IP address '1.1.1.1' could not be resolved: Temporary fai…resolution +May 04 04:03:06 ns2.2daygeek.com mysqld[2412]: 2020-05-04 4:03:06 140328136861440 [Warning] IP address '1.1.1.1' could not be resolved: Name or ser… not known +May 04 07:23:54 ns2.2daygeek.com mysqld[2412]: 2020-05-04 7:23:54 140328435189504 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +May 04 08:03:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:03:31 140328436418304 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +May 04 08:25:56 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:25:56 140328135325440 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. +Hint: Some lines were ellipsized, use -l to show in full. +``` + +### 方法 3:如何使用 MySQLAdmin 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 + +[MySQLAdmin][8] 是安装 MySQL 软件包时安装的 MySQL 服务器命令行程序。 + +MySQLAdmin 客户端允许你在 MySQL 服务器上执行一些基本的管理功能。 + +它用于创建数据库、删除数据库、设置 root 密码、更改 root 密码、检查 MySQL 状态、验证 MySQL 功能、监视 mysql 进程以及验证服务器的配置。 + +``` +# mysqladmin -u root -pPassword version + +mysqladmin Ver 8.42 Distrib 5.7.27, for Linux on x86_64 +Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Server version 5.7.27 +Protocol version 10 +Connection Localhost via UNIX socket +UNIX socket /var/lib/mysql/mysql.sock +Uptime: 1 day 10 hours 44 min 13 sec +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-system-server-uptime-check/ +[2]: https://www.2daygeek.com/check-find-apache-httpd-web-server-uptime-linux/ +[3]: https://www.2daygeek.com/linux-ps-command-find-running-process-monitoring/ +[4]: https://www.2daygeek.com/category/mysql/ +[5]: https://www.2daygeek.com/check-find-parent-process-id-pid-ppid-linux/ +[6]: https://www.2daygeek.com/category/mariadb/ +[7]: https://www.2daygeek.com/sysvinit-vs-systemd-cheatsheet-systemctl-command-usage/ +[8]: https://www.2daygeek.com/linux-mysqladmin-command-administrate-mysql-mariadb-server/ diff --git a/published/202005/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/published/202005/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md new file mode 100644 index 0000000000..d349c73567 --- /dev/null +++ b/published/202005/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12223-1.html) +[#]: subject: (Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment) +[#]: via: (https://itsfoss.com/ubuntu-studio-opts-for-kde/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu Studio 将用 KDE Plasma 桌面环境替换 Xfce +====== + +[Ubuntu Studio][1] 是一个流行的 [Ubuntu 官方变种][2],它是为从事音频制作、视频、图形、摄影和书籍出版的创意内容创建者量身定制的。它提供了许多多媒体内容创建应用,开箱即用,体验极佳。 + +在最近的 20.04 LTS 版本发布之后,Ubuntu Studio 团队在其[官方公告][3]中强调了一些非常重要的内容。而且,也许不是每个人都注意到关键信息,即 Ubuntu Studio 的未来。 + +Ubuntu Studio 20.04 将是带有 [Xfce 桌面环境][4]的最后一个版本。将来的所有发行版都将改用 [KDE Plasma][5]。 + +### 为什么 Ubuntu Studio 放弃 XFCE? + +![][6] + +据他们的澄清,Ubuntu Studio 并不专注于任何特定的外观/感受,而是旨在提供最佳的用户体验。同时,KDE 被证明是一个更好的选择。 + +> 事实证明,Plasma 为图形艺术家和摄影师提供了更好的工具,例如在 Gwenview、Krita 甚至文件管理器 Dolphin 中都可以看出。此外,它对 Wacom 平板的支持比其他任何桌面环境都更好。 + +> 它已经变得如此之好,以至于现在大部分 Ubuntu Studio 团队成员都在使用通过 Ubuntu Studio 安装程序添加了 Ubuntu Studio 的 Kubuntu 作为日常工作使用。既然我们中的这么多人都在使用 Plasma,因此在我们的下一个版本中过渡到 Plasma 似乎是个好时机。 + +当然,每一个桌面环境都是针对不同的用户量身定制的。在此,他们认为 KDE Plasma 是最适合取代 XFCE 的桌面环境,可以为所有用户提供更好的用户体验。 + +尽管我不确定用户对此会有何反应,因为每个用户都有不同的偏好。如果现有用户对 KDE 没有问题,那就没什么大问题。 + +值得注意的是,Ubuntu Studio 还提到了为什么 KDE 可能是它们的更好选择: + +> 在没有 Akonadi 的情况下,Plasma 桌面环境的资源使用与 Xfce 一样轻量级,甚至更轻。Fedora Jam 和 KXStudio 等其他以音频为重点的 Linux 发行版在历史上一直使用 KDE Plasma 桌面环境,并且在音频方面做得很好。 + +此外,他们还强调了 [Jason Evangelho 在福布斯杂志上的一篇文章][7],其中一些基准测试表明 KDE 几乎与 Xfce 一样轻量级。尽管这是一个好的迹象,我们仍然需要等待用户试驾 KDE 驱动的 Ubuntu Studio。只有这样,我们才能观察到 Ubuntu Studio 放弃 XFCE 桌面环境的决定是否正确。 + +### 更改后,Ubuntu Studio 用户将发生什么变化? + +在带有 KDE 的 Ubuntu Studio 20.10 及更高版本上的整体工作流程可能会受到影响(或改善)。 + +但是,升级过程(从 20.04 到 20.10)会导致系统损坏。因此,全新安装 Ubuntu Studio 20.10 或更高版本将是唯一的方法。 + +他们还提到,他们还会不断评估与预安装的应用是否存在重复。所以,相信在未来的日子里,更多的细节也会随之而来。 + +Ubuntu Studio 是最近一段时间内第二个改变了主桌面环境的发行版。先前,[Lubuntu][8] 从 LXDE 切换到 LXQt。 + +你如何看待这种变化?欢迎在下面的评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-studio-opts-for-kde/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntustudio.org/ +[2]: https://itsfoss.com/which-ubuntu-install/ +[3]: https://ubuntustudio.org/2020/04/ubuntu-studio-20-04-lts-released/ +[4]: https://xfce.org +[5]: https://kde.org/plasma-desktop +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-studio-kde-xfce.jpg?ssl=1 +[7]: https://www.forbes.com/sites/jasonevangelho/2019/10/23/bold-prediction-kde-will-steal-the-lightweight-linux-desktop-crown-in-2020 +[8]: https://itsfoss.com/lubuntu-20-04-review/ diff --git a/published/202005/20200508 5 ways to split your Linux terminal.md b/published/202005/20200508 5 ways to split your Linux terminal.md new file mode 100644 index 0000000000..3bc58045fa --- /dev/null +++ b/published/202005/20200508 5 ways to split your Linux terminal.md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12236-1.html) +[#]: subject: (5 ways to split your Linux terminal) +[#]: via: (https://opensource.com/article/20/5/split-terminal) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 种拆分 Linux 终端的方法 +====== + +> 本文介绍了 Linux 提供的拆分终端的方法,它能够帮助你完成多任务工作。那么,你最喜欢哪一款终端复用工具呢? + +![](https://img.linux.net.cn/data/attachment/album/202005/21/132437ypzpqqppqh1qfznh.jpg) + +没有什么问题是不能用一个 Linux 终端解决的,如果不行,那就用两个。 + +很早以前,[终端其实是一个物理设备][2],而现在的终端实际上是在计算机上被模拟出来的一个应用程序。当你使用终端和计算机进行交互的时候,就会发现,只打开一个终端是不够用的。在进行编译、数据处理等长时间任务的时候,你不得不打开一个新终端或新选项卡tab来同时进行其它工作。 + +如果你是系统管理员,你就需要更多的终端窗口,以便连接到多个不同的主机上并行工作了。 + +在 Linux 系统中,终端应用程序在很久之前就已经开始带有选项卡功能了。而现在的终端应用程序里,选项卡已经是标配功能了,这是非常流行的趋势。尽管如此,工作的时候在多个选项卡之间来回切换,或多或少也会分散我们的注意力,甚至带来不便。 + +而最好的解决方案就是将整个屏幕划分为多个部分,这样多个终端就可以在同一个终端应用程序窗口中同时存在。Linux 发行版中也有很多相关的工具可以实现这一功能。 + +### Shell、终端和控制台 + +在此之前,我们首先要明确 Shell、终端terminal控制台console这三个概念。想要详细了解的话,请参阅 [Enable Sysadmin][2] 博客上的相关文章。 + +简而言之: + +* **Shell** 是带有命令提示符prompt的用于输入、输出的界面。准确地说,[POSIX][3] 桌面底层也运行着一个 Shell,即使这个 Shell 对用户不可见,因为用户会话就是由这个 Shell 启动的。 +* **终端**是在图形界面服务器(例如 X11 或 Wayland)中运行的应用程序,其中加载了一个 Shell。只有在终端窗口启动之后,才算是运行了一个终端。终端可以认为是操作 Shell 的一个入口。 +* **控制台**(或称“虚拟控制台”)通常表示在桌面环境以外使用的 Shell,你可以通过 `Alt+Ctrl+F2` 进入控制台,通常情况下从 `F3` 到 `F7` 都是不同的控制台,其中桌面环境有可能是 `F1` 或者 `F7`,这在不同的发行版中可能会有所不同。 + +因此,有些应用程序提供的功能是拆分 Shell 或者控制台,有些应用程序的功能则是拆分终端。 + +### tmux + +![tmux terminal][4] + +[tmux][5] 可以说是最灵活、最强大的屏幕拆分工具了,它通过键盘控制对多个终端的复用,因此你可以将一个控制台叠放在另一个控制台上面,并在两个控制台之间切换。你还可以将整个屏幕等分为多个控制台,以便同时观察不同控制台上的状况。 + +`tmux` 的所有操作都是通过键盘完成的,这就意味着你的手不需要离开键盘去寻找鼠标。为此,你需要记住一些按键组合。 + +如果你只用 `tmux` 来做屏幕拆分,那你只需要记住一下这些命令: + + * `Ctrl-B %` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-B "` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-B O` 切换到另一个 Shell + * `Ctrl-B ?` 查看帮助 + * `Ctrl-B d` 断开 `tmux` 并让其在后台运行(可以使用 `tmux attach` 重新进入) + +`tmux` 的一大好处是,在一台计算机上启动 `tmux` 会话之后,也可以从另一台计算机上进入到这个会话,由此可以看出,`tmux` 对 Shell 进行了守护进程化daemonize。 + +例如,当我在树莓派上运行 `tmux`,我就可以从计算机上连接到树莓派并登录 IRC,当我断开连接时,树莓派上的 `tmux` 会继续运行,并等待我的下一次连接,在此期间 IRC 是处于持续登录状态的。 + +### GNU Screen + +![GNU Screen terminal][6] + +[GNU Screen][7] 也是一个 Shell 复用工具,类似于 `tmux`,你可以在断开一个活动会话后重连到其中,它也支持竖直或水平拆分屏幕。 + +`screen` 的灵活性比 `tmux` 要弱一些。它默认的绑定按键组合是 `Ctrl-A`,和 Bash 中光标移动到行首的快捷键是一样的。因此,当你正在运行 `screen` 的时候,如果想要将光标移动到行首,就需要多按一次 `Ctrl-A`。而我自己的做法是,在 `$HOME/.screenrc` 文件中将绑定按键组合重新设置为 `Ctrl-J`。 + +``` +escape ^jJ +``` + +尽管 `screen` 在屏幕拆分功能上做得很好,但 `tmux` 上的一些缺点在 Screen 上也同样存在。例如在拆分 Shell 时,在一个新的面板中不会启动新的 Shell ,而是需要使用 `Ctrl-A Tab` 导航到另一个面板(如果你按照我的方式重新设置了按键组合,需要对应地把 `Ctrl-A` 改为 `Ctrl-J`),然后通过 `Ctrl-A C` 手动创建一个新的 Shell。 + +和 `tmux` 不同的是,`screen` 在退出一个 Shell 的时候,屏幕拆分状态不会改变,这样的设计在某些情况下是比较适合的,但麻烦之处在于需要手动管理屏幕拆分状态。 + +尽管如此,`screen` 还是一个相当可靠灵活的应用程序,在无法使用 `tmux` 的时候,你可以选择 `screen` 作为备选方案。 + +在默认按键方案下,`screen` 常用的基本命令包括: + + * `Ctrl-A |` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-A S` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-A Tab` 切换到另一个 Shell + * `Ctrl-A ?` 查看帮助 + * `Ctrl-A d` 断开 `screen` 并让其在后台运行(可以使用 `screen -r` 重新进入) + +### Konsole + +![Konsole screen][8] + +[Konsole][9] 是 KDE Plasma 桌面使用的终端应用程序。和 KDE 一样,Konsole 也以高度可定制、功能强大的特点而著称。 + +和 `tmux`、GNU Screen 类似,Konsole 也具有拆分屏幕的功能。由于 Konsole 是图形界面的终端,因此还可以用鼠标来控制它的屏幕拆分。 + +Konsole 的屏幕拆分功能在“查看View”菜单中。它也支持竖直和水平方向的拆分,只要点击鼠标就可以切换到另一个面板上。每个面板都是一个独立的终端,因此都可以拥有独立的主题和标签页。 + +Konsole 和 `tmux`、GNU Screen 最大的不同之处在于不能断开和重新连接 Konsole。除非使用远程桌面软件,否则只能在打开 Konsole 时使用,这一点和大多数图形界面应用程序是一样的。 + +### Emacs + +![Emacs rpg][10] + +严格来说,Emacs 并不算是一个终端复用工具,但它的使用界面支持拆分和调整大小,同时还带有一个内建的终端。 + +如果 Emacs 是你日常使用的文本编辑器,你就可以在不关闭编辑器的情况下,在不同的应用程序之间轻松互相切换。由于 Emacs eshell 模块是通过 eLISP 实现的,因此你可以在 Emacs 中使用相同的命令进行交互,让一些繁琐的操作变得更为简单。 + +如果你是在图形界面中使用 Emacs,还可以使用鼠标进行操作。例如通过点击切换面板、用鼠标调整拆分屏幕的的大小等等。尽管如此,键盘的操作速度还是更快,因此记住一些键盘快捷键还是很有必要的。 + +Emacs 的一些重要快捷键包括: + + * `Ctrl-X 3` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-X 2` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-X O` (大写字母 `O`)切换到另一个 Shell(你也可以使用鼠标操作) + * `Ctrl-X 0` (数字 `0`)关闭当前面板 + +如果你运行了 emacs-client 的话,就可以像 tmux 和 GNU Screen 一样断开和重新连接到 Emacs 了。 + +### 窗口管理器 + +![Ratpoison split screen][11] + +除了文本编辑器之外,一些 Linux 桌面也同样具有拆分屏幕、加载终端这样的功能。例如 [Ratpoison][12]、[Herbsluftwm][13]、i3、Awesome,甚至是启用了特定设置的 KDE Plasma 桌面,都可以将多个应用程序在桌面上分块显示。 + +这些桌面可以让各个应用程序占据屏幕的固定位置,而不是浮在你的桌面“之上”,因此你可以在多个应用程序窗口之间轻松切换。你还可以打开多个终端,排布成网格,就像终端复用工具一样。更进一步,你还可以在你的桌面复用工具中加载一个终端复用工具。 + +而且,没有什么可以阻止你在里面载入 Emacs 并分割缓冲区。没有人知道,如果你把它更进一步,会发生什么,大多数 Linux 用户不会外传这种秘密。 + +和 `tmux`、GNU Screen 不同,你在断开与桌面的连接后无法重新连接到同一个桌面会话,除非你使用了远程桌面软件进行连接。 + +### 更多选择 + +除了上面介绍到的工具以外,还有诸如 [Tilix][14]、Terminator 这样的终端模拟器,它们同样可以实现屏幕拆分、嵌入终端组件等功能。欢迎在评论区分享你喜欢的终端拆分工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/split-terminal + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code) +[2]: https://www.redhat.com/sysadmin/terminals-shells-consoles +[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[4]: https://opensource.com/sites/default/files/uploads/terminal-split-tmux2.png (tmux terminal) +[5]: https://github.com/tmux/tmux +[6]: https://opensource.com/sites/default/files/uploads/terminal-split-screen.png (GNU Screen terminal) +[7]: https://www.gnu.org/software/screen/ +[8]: https://opensource.com/sites/default/files/uploads/konsole.jpg (Konsole screen) +[9]: https://konsole.kde.org +[10]: https://opensource.com/sites/default/files/uploads/emacs-rpg_0.jpg (Emacs rpg) +[11]: https://opensource.com/sites/default/files/uploads/advent-ratpoison-split_0.jpg (Ratpoison split screen) +[12]: https://opensource.com/article/19/12/ratpoison-linux-desktop +[13]: https://opensource.com/article/19/12/herbstluftwm-linux-desktop +[14]: https://gnunn1.github.io/tilix-web/ diff --git a/published/202005/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/published/202005/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..41c25c7d8d --- /dev/null +++ b/published/202005/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12216-1.html) +[#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/unable-to-parse-package-file/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +修复 Ubuntu 中的 “Unable to parse package file” 错误 +====== + +过去,我已经讨论了许多 [Ubuntu 更新错误][1]。如果你[使用命令行更新 Ubuntu][2],那可能会遇到一些“错误”。 + +其中一些“错误”基本上是内置功能,可防止对系统进行不必要的更改。在本教程中,我不会涉及那些细节。 + +在本文中,我将向你展示如何解决在更新系统或安装新软件时可能遇到的以下错误: + +``` +Reading package lists… Error! +E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease +E: The package lists or status file could not be parsed or opened. +``` + +在 Debian 中可能会遇到类似的错误: + +``` +E: Unable to parse package file /var/lib/apt/extended_states (1) +``` + +即使遇到 `The package cache file is corrupted` 也完全不必惊慌。这真的很容易“修复”。 + +### 在基于 Ubuntu 和 Debian 的 Linux 发行版中处理 “Unable to parse package file” 错误 + +![][3] + +以下是你需要做的。仔细查看 [Ubuntu][4] 报错文件的名称和路径。 + +``` +Reading package lists… Error! +E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease +E: The package lists or status file could not be parsed or opened. +``` + +例如,上面的错误是在报 `/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease` 文件错误。 + +这让你想到这个文件不正确。现在,你需要做的就是删除该文件并重新生成缓存。 + +``` +sudo rm +``` + +因此,这里我可以使用以下命令:`sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease`,然后使用 `sudo apt update` 命令重建缓存。 + +#### 给初学者的分步指导 + +如果你熟悉 Linux 命令,那么可能知道如何使用绝对路径删除文件。对于新手用户,让我指导你安全删除文件。 + +首先,你应该进入文件目录: + +``` +cd /var/lib/apt/lists/ +``` + +现在删除无法解析的文件: + +``` +sudo rm archive.ubuntu.com_ubuntu_dists_bionic_InRelease +``` + +现在,如果你再次运行更新,将重新生成 apt 缓存。 + +``` +sudo apt update +``` + +#### 有很多文件无法解析? + +如果你在更新系统时有一个或两个文件无法解析,那么问题不大。但是,如果系统报错有十个或二十个此类文件,那么一一删除它们就太累了。 + +在这种情况下,你可以执行以下操作来删除整个缓存,然后再次生成它: + +``` +sudo rm -r /var/lib/apt/lists/* +sudo apt update +``` + +#### 解释这为何能解决问题 + +`/var/lib/apt` 是与 apt 软件包管理器相关的文件和数据的存储目录。`/var/lib/apt/lists` 是用于保存系统 `source.list` 中指定的每个软件包资源信息的目录。 + +简单点来说,`/var/lib/apt/lists` 保存软件包信息缓存。当你要安装或更新程序时,系统会在此目录中检查该软件包中的信息。如果找到了该包的详细信息,那么它将进入远程仓库并实际下载程序或其更新。 + +当你运行 `sudo apt update` 时,它将构建缓存。这就是为什么即使删除 `/var/lib/apt/lists` 目录中的所有内容,运行更新也会建立新的缓存的原因。 + +这就是处理文件无法解析问题的方式。你的系统报某个软件包或仓库信息以某种方式损坏(下载失败或手动更改 `sources.list`)。删除该文件(或所有文件)并重建缓存即可解决此问题。 + +#### 仍然有错误? + +这应该能解决你的问题。但是,如果问题仍然存在,或者你还有其他相关问题,请在评论栏告诉我,我将尽力帮助你。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/unable-to-parse-package-file/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-update-error/ +[2]: https://itsfoss.com/update-ubuntu/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Unable-to-parse-package-file.png?ssl=1 +[4]: https://ubuntu.com/ diff --git a/published/202005/20200508 Getting started with FreeBSD as a desktop operating system.md b/published/202005/20200508 Getting started with FreeBSD as a desktop operating system.md new file mode 100644 index 0000000000..ef63e7b696 --- /dev/null +++ b/published/202005/20200508 Getting started with FreeBSD as a desktop operating system.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12225-1.html) +[#]: subject: (Getting started with FreeBSD as a desktop operating system) +[#]: via: (https://opensource.com/article/20/5/furybsd-linux) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +使用 FreeBSD 作为桌面操作系统 +====== + +> FuryBSD 的实时桌面环境能让你在实际使用之前先尝试。 + +![FuryBSD Post-Install XFCE Desktop][10] + +[FreeBSD][2] 是一个很棒的操作系统,但是从设计上讲,它并没有自带桌面环境。如果不从 FreeBSD 的 [ports 和软件包集][3]安装其他软件,那么 FreeBSD 仅能体验命令行。下面的截图显示了在安装过程中选择了每个“可选系统组件”后,登录 FreeBSD 12.1 的样子。 + +![FreeBSD][4] + +FreeBSD 可以用各种桌面环境中的任何一种来变成桌面操作系统,但是这需要时间、精力和[遵循大量书面说明][5]。使用使用 desktop-installer 包(为用户提供基于文本的菜单并帮助自动执行大部分过程)仍然非常耗时。这两种方法的最大问题是,用户可能在花了很多时间进行设置之后,可能会发现他们的硬件系统与 FreeBSD 不完全兼容。 + +[FuryBSD][6] 通过提供实时桌面镜像来解决此问题,用户可以在安装之前对其进行评估。目前,FuryBSD 提供 Xfce 镜像和 KDE 镜像。每个镜像都提供了一个已预安装桌面环境的 FreeBSD。如果用户试用该镜像并发现其硬件工作正常,那么他们可以安装 FuryBSD,并拥有一个由 FreeBSD 驱动的即用桌面操作系统。在本文中,我会使用 Xfce 镜像,但 KDE 镜像的工作原理完全一样。 + +对于安装过 Linux 发行版、BSD 或任何其他类 Unix 的开源操作系统的人,FuryBSD 的上手过程应该很熟悉。从 FuryBSD 网站下载 ISO,将它复制到闪存盘,然后从闪存盘启动计算机。如果从闪存盘引导失败,请确保“安全引导”已禁用。 + +![FuryBSD Live XFCE Desktop][7] + +从闪存盘启动后,桌面环境将自动加载。除了“家”、“文件系统”和“回收站”图标外,实时桌面还有用于配置 Xorg 的工具、入门指南、FuryBSD 安装程序和系统信息程序的图标。除了这些额外功能以及一些自定义的 Xfce 设置和壁纸外,桌面环境除了基本的 Xfce 应用和 Firefox 之外并没有其他功能。 + +![FuryBSD Xorg Tool][8] + +此时仅加载基本的图形驱动,但足以检查 FuryBSD 是否支持系统的有线和无线网络接口。如果网络接口没有一个能自动工作,那么 `Getting Started.txt` 文件包含有关尝试配置网络接口和其他配置任务的说明。如果至少有一个网络接口有效,那么可以使用 Configure Xorg 应用安装 Intel、NVidia 或 VirtualBox 图形驱动。它将下载并安装驱动,并且需要重新启动 Xorg。如果系统未自动重新登录到实时镜像用户,那么密码为 `furybsd`(你可以使用它来登录)。配置后,图形驱动将转移到已安装的系统中。 + +![FuryBSD Installer - ZFS Configuration][9] + +如果一切都可以在实时环境中正常运行,那么 FuryBSD 安装程序可以将 FuryBSD 配置并安装到计算机上。该安装程序在终端中运行,但提供与大多数其他 BSD 和 Linux 安装程序相同的选项。系统将要求用户设置系统的主机名、配置 ZFS 存储、设置 root 密码,添加至少一个非 root 用户以及配置时间和日期。完成后,系统可以引导到预装有 Xfce (或 KDE)的 FreeBSD 中。FuryBSD 完成了所有困难的工作,甚至还花了很多精力使桌面看起来更漂亮。 + + + +如上所述,桌面环境没有大量预装软件,因此几乎肯定要安装额外的软件包。最快的方法是在终端中使用 `pkg` 命令。该命令的行为很像 `dnf` 和 `apt`,因此使用过其中之一的来自 Linux 发行版的用户在查找和安装软件包时应该感到很熟悉。FreeBSD 的软件包集合非常多,因此大多数知名的开源软件包都可用。 + +如果用户在没有太多 FreeBSD 经验的情况下尝试 FuryBSD,应查阅 [FreeBSD 手册][11],以了解有关如何以 FreeBSD 的方式操作。有任何 Linux 发行版或其他 BSD 使用经验的用户应该能弄清很多事情,但是手册可以帮助你弄清一些差异。进一步了解 FreeBSD 的一个很好的资源是 Michael W. Lucas 的 《[Absolute FreeBSD,第三版][12]》。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/furybsd-linux + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) +[2]: https://www.freebsd.org +[3]: https://www.freebsd.org/ports/ +[4]: https://opensource.com/sites/default/files/uploads/freebsd.png (FreeBSD) +[5]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/ +[6]: https://www.furybsd.org +[7]: https://opensource.com/sites/default/files/uploads/furybsd_live_xfce_desktop.png (FuryBSD Live XFCE Desktop) +[8]: https://opensource.com/sites/default/files/uploads/furybsd_xorg_tool.png (FuryBSD Xorg Tool) +[9]: https://opensource.com/sites/default/files/uploads/furybsd_installer_-_zfs_configuration.png (FuryBSD Installer - ZFS Configuration) +[10]: https://opensource.com/sites/default/files/uploads/furybsd_post-install_xfce_desktop.png (FuryBSD Post-Install XFCE Desktop) +[11]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ +[12]: https://nostarch.com/absfreebsd3 diff --git a/published/202005/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/published/202005/20200509 Ensmallening Go binaries by prohibiting comparisons.md new file mode 100644 index 0000000000..1d1a6b1590 --- /dev/null +++ b/published/202005/20200509 Ensmallening Go binaries by prohibiting comparisons.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12238-1.html) +[#]: subject: (Ensmallening Go binaries by prohibiting comparisons) +[#]: via: (https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +通过禁止比较让 Go 二进制文件变小 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/22/101617lcha7vvqzhh7d565.jpg) + +大家常规的认知是,Go 程序中声明的类型越多,生成的二进制文件就越大。这个符合直觉,毕竟如果你写的代码不去操作定义的类型,那么定义一堆类型就没有意义了。然而,链接器的部分工作就是检测没有被程序引用的函数(比如说它们是一个库的一部分,其中只有一个子集的功能被使用),然后把它们从最后的编译产出中删除。常言道,“类型越多,二进制文件越大”,对于多数 Go 程序还是正确的。 + +本文中我会深入讲解在 Go 程序的上下文中“相等”的意义,以及为什么[像这样][1]的修改会对 Go 程序的大小有重大的影响。 + +### 定义两个值相等 + +Go 的语法定义了“赋值”和“相等”的概念。赋值是把一个值赋给一个标识符的行为。并不是所有声明的标识符都可以被赋值,如常量和函数就不可以。相等是通过检查标识符的内容是否相等来比较两个标识符的行为。 + +作为强类型语言,“相同”的概念从根源上被植入标识符的类型中。两个标识符只有是相同类型的前提下,才有可能相同。除此之外,值的类型定义了如何比较该类型的两个值。 + +例如,整型是用算数方法进行比较的。对于指针类型,是否相等是指它们指向的地址是否相同。映射和通道等引用类型,跟指针类似,如果它们指向相同的地址,那么就认为它们是相同的。 + +上面都是按位比较相等的例子,即值占用的内存的位模式是相同的,那么这些值就相等。这就是所谓的 memcmp,即内存比较,相等是通过比较两个内存区域的内容来定义的。 + +记住这个思路,我过会儿再来谈。 + +### 结构体相等 + +除了整型、浮点型和指针等标量类型,还有复合类型:结构体。所有的结构体以程序中的顺序被排列在内存中。因此下面这个声明: + +``` +type S struct { + a, b, c, d int64 +} +``` + +会占用 32 字节的内存空间;`a` 占用 8 个字节,`b` 占用 8 个字节,以此类推。Go 的规则说如果结构体所有的字段都是可以比较的,那么结构体的值就是可以比较的。因此如果两个结构体所有的字段都相等,那么它们就相等。 + +``` +a := S{1, 2, 3, 4} +b := S{1, 2, 3, 4} +fmt.Println(a == b) // 输出 true +``` + +编译器在底层使用 memcmp 来比较 `a` 的 32 个字节和 `b` 的 32 个字节。 + +### 填充和对齐 + +然而,在下面的场景下过分简单化的按位比较的策略会返回错误的结果: + +``` +type S struct { + a byte + b uint64 + c int16 + d uint32 +} + +func main() + a := S{1, 2, 3, 4} + b := S{1, 2, 3, 4} + fmt.Println(a == b) // 输出 true +} +``` + +编译代码后,这个比较表达式的结果还是 `true`,但是编译器在底层并不能仅依赖比较 `a` 和 `b` 的位模式,因为结构体有*填充*。 + +Go 要求结构体的所有字段都对齐。2 字节的值必须从偶数地址开始,4 字节的值必须从 4 的倍数地址开始,以此类推 [^1]。编译器根据字段的类型和底层平台加入了填充来确保字段都*对齐*。在填充之后,编译器实际上看到的是 [^2]: + +``` +type S struct { + a byte + _ [7]byte // 填充 + b uint64 + c int16 + _ [2]int16 // 填充 + d uint32 +} +``` + +填充的存在保证了字段正确对齐,而填充确实占用了内存空间,但是填充字节的内容是未知的。你可能会认为在 Go 中 填充字节都是 0,但实际上并不是 — 填充字节的内容是未定义的。由于它们并不是被定义为某个确定的值,因此按位比较会因为分布在 `s` 的 24 字节中的 9 个填充字节不一样而返回错误结果。 + +Go 通过生成所谓的相等函数来解决这个问题。在这个例子中,`s` 的相等函数只比较函数中的字段略过填充部分,这样就能正确比较类型 `s` 的两个值。 + +### 类型算法 + +呵,这是个很大的设置,说明了为什么,对于 Go 程序中定义的每种类型,编译器都会生成几个支持函数,编译器内部把它们称作类型的算法。如果类型是一个映射的键,那么除相等函数外,编译器还会生成一个哈希函数。为了维持稳定,哈希函数在计算结果时也会像相等函数一样考虑诸如填充等因素。 + +凭直觉判断编译器什么时候生成这些函数实际上很难,有时并不明显,(因为)这超出了你的预期,而且链接器也很难消除没有被使用的函数,因为反射往往导致链接器在裁剪类型时变得更保守。 + +### 通过禁止比较来减小二进制文件的大小 + +现在,我们来解释一下 Brad 的修改。向类型添加一个不可比较的字段 [^3],结构体也随之变成不可比较的,从而强制编译器不再生成相等函数和哈希函数,规避了链接器对那些类型的消除,在实际应用中减小了生成的二进制文件的大小。作为这项技术的一个例子,下面的程序: + +``` +package main + +import "fmt" + +func main() { + type t struct { + // _ [0][]byte // 取消注释以阻止比较 + a byte + b uint16 + c int32 + d uint64 + } + var a t + fmt.Println(a) +} +``` + +用 Go 1.14.2(darwin/amd64)编译,大小从 2174088 降到了 2174056,节省了 32 字节。单独看节省的这 32 字节似乎微不足道,但是考虑到你的程序中每个类型及其传递闭包都会生成相等和哈希函数,还有它们的依赖,这些函数的大小随类型大小和复杂度的不同而不同,禁止它们会大大减小最终的二进制文件的大小,效果比之前使用 `-ldflags="-s -w"` 还要好。 + +最后总结一下,如果你不想把类型定义为可比较的,可以在源码层级强制实现像这样的奇技淫巧,会使生成的二进制文件变小。 + +* * * + +附录:在 Brad 的推动下,[Cherry Zhang][5] 和 [Keith Randall][6] 已经在 Go 1.15 做了大量的改进,修复了最严重的故障,消除了无用的相等和哈希函数(虽然我猜想这也是为了避免这类 CL 的扩散)。 + +[^1]: 在 32 位平台上 `int64` 和 `unit64` 的值可能不是按 8 字节对齐的,因为平台原生的是以 4 字节对齐的。查看 [议题 599][7] 了解内部详细信息。 +[^2]: 32 位平台会在 `a` 和 `b` 的声明中填充 `_ [3]byte`。参见前一条。 +[^3]: Brad 使用的是`[0]func()`,但是所有能限制和禁止比较的类型都可以。添加了一个有 0 个元素的数组的声明后,结构体的大小和对齐不会受影响。 + +#### 相关文章: + + 1. [Go 运行时如何高效地实现映射(不使用泛型)][11] + 2. [空结构体][12] + 3. [填充很难][13] + 4. [Go 中有类型的 nil(2)][14] + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/net/commit/e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f +[2]: tmp.uBLyaVR1Hm#easy-footnote-bottom-1-4116 (On 32bit platforms int64 and uint64 values may not be 8 byte aligned as the natural alignment of the platform is 4 bytes. See issue 599 for the gory details.) +[3]: tmp.uBLyaVR1Hm#easy-footnote-bottom-2-4116 (32 bit platforms would see _ [3]byte padding between the declaration of a and b. See previous.) +[4]: tmp.uBLyaVR1Hm#easy-footnote-bottom-3-4116 (Brad used [0]func(), but any type that the spec limits or prohibits comparisons on will do. By declaring the array has zero elements the type has no impact on the size or alignment of the struct.) +[5]: https://go-review.googlesource.com/c/go/+/231397 +[6]: https://go-review.googlesource.com/c/go/+/191198 +[7]: https://github.com/golang/go/issues/599 +[8]: tmp.uBLyaVR1Hm#easy-footnote-1-4116 +[9]: tmp.uBLyaVR1Hm#easy-footnote-2-4116 +[10]: tmp.uBLyaVR1Hm#easy-footnote-3-4116 +[11]: https://dave.cheney.net/2018/05/29/how-the-go-runtime-implements-maps-efficiently-without-generics (How the Go runtime implements maps efficiently (without generics)) +[12]: https://dave.cheney.net/2014/03/25/the-empty-struct (The empty struct) +[13]: https://dave.cheney.net/2015/10/09/padding-is-hard (Padding is hard) +[14]: https://dave.cheney.net/2017/08/09/typed-nils-in-go-2 (Typed nils in Go 2) diff --git a/published/202005/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/published/202005/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md new file mode 100644 index 0000000000..bc6bc1aec8 --- /dev/null +++ b/published/202005/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12220-1.html) +[#]: subject: (Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do!) +[#]: via: (https://itsfoss.com/cant-install-deb-file-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +无法在 Ubuntu 20.04 上安装 Deb 文件?这是你需要做的! +====== + +> 双击 deb 文件后无法通过 Ubuntu 20.04 的软件中心安装?你不是唯一遇到此问题的人。本教程展示了解决方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/15/112149cfdyg556upv6vd66.jpg) + +在“[安装 Ubuntu 20.04 之后要做的事][1]”一文中,一些读者提到他们[用 Deb 文件安装软件][2]遇到了麻烦。 + +我发现这很奇怪,因为使用 deb 文件安装程序是最简单的方法之一。你要做的就是双击下载的文件,它会在软件中心中打开(默认情况下)。单击安装,它要求你输入密码,并在几秒钟/分钟内安装了该软件。 + +我[从 19.10 升级到 Ubuntu 20.04][3]直到今天都没有遇到这个问题。 + +我下载了 .deb 文件来安装 [Rocket Chat Messenger][4],然后双击该文件安装时,文件用存档管理器打开。这不是我所期望的。 + +![DEB files opened with Archive Manager instead of Software Center][5] + +“修复”很简单,我将在本教程中向你展示。 + +### 在 Ubuntu 20.04 中安装 deb 文件 + +由于某些原因,在 Ubuntu 20.04 中 deb 文件的默认打开程序被设置为存档管理器。存档管理器是用于[解压 zip][6] 和其他压缩文件。 + +解决此问题的方法非常简单。[在 Ubuntu 中更改默认应用][7],将打开 DEB 文件从“存档管理器”改到“软件安装”。让我告诉你步骤。 + +**步骤 1:**右键单击下载的 .deb 文件,然后选择**属性**: + +![][8] + +**步骤 2:**进入“**打开方式**”标签,选择“**软件安装**”,然后点击“**设置为默认**”。 + +![][9] + +这样,以后所有的 .deb 文件都将通过“软件安装”即软件中心打开。 + +双击 .deb 文件确认,看看是否在软件中心中打开。 + +### 忽视的 bug 还是愚蠢的功能? + +为什么会用存档管理器打开 deb 文件让人无法理解。我确实希望这是一个 bug,而不是像[在 Ubuntu 20.04 中不允许在桌面上拖放文件][10]这样的怪异功能。 + +既然我们在讨论 deb 文件的安装,就让我告诉你一个不错的工具 [gdebi][11]。它是一个轻量级应用,其唯一目的是安装 DEB 文件。有时它也可以处理依赖关系。 + +你可以了解更多有关[使用 gdebi 并默认设为安装 deb 文件的工具][12]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cant-install-deb-file-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12183-1.html +[2]: https://itsfoss.com/install-deb-files-ubuntu/ +[3]: https://itsfoss.com/upgrade-ubuntu-version/ +[4]: https://rocket.chat/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/error-opening-deb-file.png?ssl=1 +[6]: https://itsfoss.com/unzip-linux/ +[7]: https://itsfoss.com/change-default-applications-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/open-deb-files.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/deb-file-install-fix-ubuntu.png?fit=800%2C454&ssl=1 +[10]: https://itsfoss.com/add-files-on-desktop-ubuntu/ +[11]: https://launchpad.net/gdebi +[12]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ diff --git a/published/202005/20200520 How to configure your router using VTY shell.md b/published/202005/20200520 How to configure your router using VTY shell.md new file mode 100644 index 0000000000..5b2874fa82 --- /dev/null +++ b/published/202005/20200520 How to configure your router using VTY shell.md @@ -0,0 +1,188 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12268-1.html) +[#]: subject: (How to configure your router using VTY shell) +[#]: via: (https://opensource.com/article/20/5/vty-shell) +[#]: author: (M Umer https://opensource.com/users/noisybotnet) + +如何使用 VTY Shell 配置路由器 +====== + +> FRR(free range routing)给了你实现多种协议的选择。本指南将帮助你入门。 + +![](https://img.linux.net.cn/data/attachment/album/202005/31/122310xi9aag5iqihqgcxl.jpg) + +最近,我写了一篇文章,解释了如何使用 [Quagga][2] 路由套件实现开放式最短路径优先Open Shortest Path First(OSPF)。可以使用多个软件套件代替 Quagga 来实现不同的路由协议。其中一种是 FRR(free range routing)。 + +### FRR + +[FRR][3] 是一个路由软件套件,它衍生自 Quagga,并在 GNU GPL2 许可下分发。与 Quagga 一样,它为类 Unix 平台提供了所有主要路由协议的实现,例如 OSPF、路由信息协议Routing Information Protocol(RIP)、边界网关协议Border Gateway Protocol(BGP) 和中间系统到中间系统Intermediate system-to-intermediate system (IS-IS)。 + +开发了 Quagga 的一些公司,例如 Big Switch Networks、Cumulus、Open Source Routing 和 6wind,创建了 FRR 以在 Quagga 的良好基础上进行改善。 + +#### 体系结构 + +FRR 是一组守护进程,它们可以共同构建路由表。每个主协议都在其自己的守护进程中实现,并且这些守护进程与独立于协议的核心守护进程 Zebra 通信,后者提供内核路由表更新、接口查找以及不同路由协议之间路由的重新分配。每个特定协议的守护进程负责运行相关协议并根据交换的信息构建路由表。 + +![FRR architecture][4] + +### VTY shell + +[VTYSH][5] 是 FRR 路由引擎的集成 shell。它将每个守护进程中定义的所有 CLI 命令合并,并在单个 shell 中将它们呈现给用户。它提供了类似于 Cisco 的命令行模式,并且许多命令与 Cisco IOS 命令相似。CLI 有不同的模式,某些命令仅在特定模式下可用。 + +### 设置 + +在本教程中,我们将使用 FRR 配置动态路由来实现路由信息协议(RIP)。我们可以通过两种方式来做到这一点:在编辑器中编辑协议守护进程配置文件或使用 VTY Shell。在此例中,我们将使用 VTY shell。我们的设置包括两个名为 Alpha 和 Beta 的 CentOS 7.7 主机。这两台主机都有两个网络接口,并共享对 192.168.122.0/24 网络的访问。我们将广播 10.12.11.0/24 和 10.10.10.0/24 网络的路由。 + +对于主机 Alpha: + +* eth0 IP:192.168.122.100/24 +* 网关:192.168.122.1 +* eth1 IP:10.10.10.12/24 + +对于主机 Beta: + +* eth0 IP:192.168.122.50/24 +* 网关:192.168.122.1 +* eth1 IP:10.12.11.12/24 + +#### 安装软件包 + +首先,我们需要在两台主机上都安装 FRR 软件包。可以按照[官方 FRR 文档][6]中的说明进行操作。 + +#### 启用 IP 转发 + +对于路由,我们需要在两台主机上都启用 IP 转发,因为这将由 Linux 内核执行: + +``` +sysctl -w net.ipv4.conf.all.forwarding = 1 +sysctl -w net.ipv6.conf.all.forwarding = 1 +sysctl -p +``` + +#### 启用 RIPD 守护进程 + +安装后,所有配置文件将保存在 `/etc/frr` 目录中。 必须通过编辑 `/etc/frr/daemons` 文件显式启用守护进程。该文件确定启动 FRR 服务时激活哪些守护进程。要启用特定的守护进程,只需将相应的 `no` 改为 `yes`。之后的服务重启将启动守护进程。 + +![FRR daemon restart][7] + +#### 防火墙配置 + +由于 RIP 协议使用 UDP 作为传输协议,并被分配了 520 端口,因此我们需要在 `firewalld` 配置中允许该端口。 + +``` +firewall-cmd --add-port=520/udp –permanent +firewalld-cmd -reload +``` + +现在,我们可以使用以下命令启动 FRR 服务: + +``` +systemctl start frr +``` + +#### 使用 VTY 进行配置 + +现在,我们需要使用 VTY Shell 配置 RIP。 + +在主机 Alpha 上: + +``` +[root@alpha ~]# vtysh + +Hello, this is FRRouting (version 7.2RPKI). +Copyright 1996-2005 Kunihiro Ishiguro, et al. + +alpha# configure terminal +alpha(config)# router rip +alpha(config-router)# network 192.168.122.0/24 +alpha(config-router)# network 10.10.10.0/24 +alpha(config-router)# route 10.10.10.5/24 +alpha(config-router)# do write +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +alpha(config-router)# do write memory +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +alpha(config-router)# exit +``` + +类似地,在主机 Beta 上: + +``` +[root@beta ~]# vtysh + +Hello, this is FRRouting (version 7.2RPKI). +Copyright 1996-2005 Kunihiro Ishiguro, et al. + +beta# configure terminal +beta(config)# router rip +beta(config-router)# network 192.168.122.0/24 +beta(config-router)# network 10.12.11.0/24 +beta(config-router)# do write +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/zebra.conf +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +beta(config-router)# do write memory +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/zebra.conf +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +beta(config-router)# exit +``` + +完成后,像下面这样检查两台主机路由: + +``` +[root@alpha ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 dev eth1 proto kernel scope link src 10.10.10.12 metric 101 +10.12.11.0/24 via 192.168.122.50 dev eth0 proto 189 metric 20 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100 +``` + +我们可以看到 Alpha 上的路由表通过 `192.168.122.50` 包含了 `10.12.11.0/24` 的条目,它是通过 RIP 提供的。 + +类似地,在 Beta 上,该表通过 `192.168.122.100` 包含了 `10.10.10.0/24` 的条目。 + +``` +[root@beta ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 via 192.168.122.100 dev eth0 proto 189 metric 20 +10.12.11.0/24 dev eth1 proto kernel scope link src 10.12.11.12 metric 101 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.50 metric 100 +``` + +### 总结 + +如你所见,设置和配置相对简单。要增加复杂性,我们可以向路由器添加更多的网络接口,以为更多的网络提供路由。可以在编辑器中编辑配置文件来进行配置,但是使用 VTY Shell 在单个组合会话中为我们提供了所有 FRR 守护进程的前端。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/vty-shell + +作者:[M Umer][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/noisybotnet +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: https://linux.cn/article-12199-1.html +[3]: https://en.wikipedia.org/wiki/FRRouting +[4]: https://opensource.com/sites/default/files/uploads/frr_architecture.png (FRR architecture) +[5]: http://docs.frrouting.org/projects/dev-guide/en/latest/vtysh.html +[6]: http://docs.frrouting.org/projects/dev-guide/en/latest/building-frr-for-centos7.html +[7]: https://opensource.com/sites/default/files/uploads/frr_daemon_restart.png (FRR daemon restart) diff --git a/published/202005/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md b/published/202005/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md new file mode 100644 index 0000000000..93defdb7c9 --- /dev/null +++ b/published/202005/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12258-1.html) +[#]: subject: (How to Properly Install and Setup KDE Plasma on Arch Linux) +[#]: via: (https://itsfoss.com/install-kde-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Arch Linux 上正确安装和设置 KDE Plasma? +====== + +我相信你是按照[这份很棒的指南安装来 Arch Linux][1] 的,这篇指南最后提到了 [GNOME 桌面][2]的安装步骤。 + +但现在,不是每个人都是 GNOME 的粉丝,有几个读者要求我们向他们展示如何在 [Arch Linux][4] 上配置 [KDE 桌面][3]。 + +因此,我创建了这个指南来演示如何在 Arch Linux 上正确安装和配置 KDE 桌面(也被称为 KDE Plasma桌面)的步骤。 + +### 如何在 Arch Linux 上安装和设置 KDE 桌面环境? + +![][5] + +请记住,KDE 不允许直接以 root 身份登录。如果你已经安装了 Arch Linux 并以 root 身份使用,你应该创建一个新的用户,并给它以 root 身份运行命令的 sudo 权限。 + +如果你只是最小化安装了 Arch Linux,那么你可能是以 TTY 终端方式登录的。如果你使用的是其他桌面环境,步骤也是一样的。 + +让我们开始吧! + +#### 步骤 1:创建一个 sudo 用户(如果你只有 root 用户) + +你可以使用 [useradd 命令][6]来创建一个新用户。我创建的用户名为 `dimitrios`(这是我的名字)。你可以使用与你的名字匹配的东西。 + +选项 `-m` 为新创建的用户创建一个主目录。 + +``` +useradd -m dimitrios +``` + +你还应该为这个用户设置一个密码。使用此命令: + +``` +passwd dimitrios +``` + +现在你已经创建了用户,给它 sudo 权限。首先,安装 sudo 和一个像 [nano][8] 这样的[命令行文本编辑器][7]。 + +``` +pacman -S sudo nano +``` + +sudo 的配置文件是 `/etc/sudoers`。该文件应该使用 `visudo` 来编辑,它会锁定 `sudoers` 文件,将编辑的内容保存到一个临时文件中,并在复制到 `/etc/sudoers` 之前检查该文件的语法。 + +要使用 `nano` 作为 `visudo` 编辑器,请这样设置: + +``` +EDITOR=nano visudo +``` + +像我的示例那样添加下面这一行,然后保存并退出。 + +``` +dimitrios ALL=(ALL) ALL +``` + +![Adding Sudoer in Arch Linux][9] + +保存你的更改,然后退出编辑器。你现在在 Arch Linux 上有了一个 sudo 用户。 + +#### 步骤 2 :安装 KDE Plasma 桌面 + +要运行 KDE 桌面,你需要以下软件包。 + + * [Xorg][10] 组 + * [KDE Plasma][3] 桌面环境 + * [Wayland][11] KDE Plasma 的会话 + * [KDE 应用程序][12]组(包括 KDE 特有的应用程序:Dolphin 管理器和其他有用的应用程序)。 + +你可以用下面的命令安装上述部分。 + +``` +pacman -S xorg plasma plasma-wayland-session kde-applications +``` + +安装后,启用显示管理器和网络管理器服务。 + +``` +systemctl enable sddm.service +systemctl enable NetworkManager.service +``` + +快完成了。关闭你的系统。 + +``` +shutdown now +``` + +重新打开系统电源,你应该会看到 KDE 的登录界面。你还记得为你的 sudo 用户设置的密码吗?用它来登录。 + +![Arch KDE Plasma Desktop][13] + +#### 接下来? + +你可能会想探索一下[基本的 pacman 命令][14],了解一下 [Arch 用户资源库][15],了解一下 [AUR 助手][16]。 + +希望这篇教程对你在 Arch Linux 上安装 KDE 桌面有所帮助。如果你在安装过程中遇到任何障碍或困难,请在下面的评论中告诉我们。 + +你最喜欢的桌面环境或窗口管理器是什么?请告诉我们,别忘了在我们的社交媒体上订阅。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kde-arch-linux/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-9170-1.html +[2]: https://www.gnome.org/ +[3]: https://kde.org/plasma-desktop +[4]: https://www.archlinux.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-kde-arch-linux.png?ssl=1 +[6]: https://linuxhandbook.com/useradd-command/ +[7]: https://itsfoss.com/command-line-text-editors-linux/ +[8]: https://www.nano-editor.org/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/adding-sudoer-arch-linux.png?ssl=1 +[10]: https://wiki.archlinux.org/index.php/Xorg +[11]: https://wiki.archlinux.org/index.php/Wayland +[12]: https://www.archlinux.org/groups/x86_64/kde-applications/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-Plasma-desktop.jpg?fit=800%2C450&ssl=1 +[14]: https://itsfoss.com/pacman-command/ +[15]: https://linux.cn/article-12107-1.html +[16]: https://linux.cn/article-12019-1.html diff --git a/published/202005/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/published/202005/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md new file mode 100644 index 0000000000..21173f87f8 --- /dev/null +++ b/published/202005/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12254-1.html) +[#]: subject: (Now You Can Run Linux Apps in Windows (Thanks to WSL)) +[#]: via: (https://itsfoss.com/run-linux-apps-windows-wsl/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +现在你可以在 Windows 中运行 Linux 应用了 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/27/111439z64u19z6ct6r46kb.jpg) + +微软最近的 “[Build 2020][1]” 开发者大会公布了一些有趣的公告。我不确定这该令人兴奋还是该令人怀疑 —— 但是微软,你现在比以往任何时候都受到我们的关注。 + +同时,在所有的这些公告中,能够在 WSL(Windows Subsystem for Linux)上运行 GUI 应用程序的功能备受关注。 + +更不要忘了 [Xamrin.Forms 更名为 MAUI 的尴尬结局][2],它与 [Nitrux Linux][4] 的 Uri Herrera 的现有开源项目([Maui Project][3])名字冲突。 + +以防你不清楚,WSL 是一种环境,可让你在 Windows 10 中获得 Linux 控制台的体验。它也是在 [Windows 中运行 Linux 命令的最佳方法][5]之一。 + +正如 [Liam Dawe][7] 认为的那样,通过博客文章([DirectX ❤ Linux][6])发布的公告可能是只是个公关诱饵。但是,仍然值得一提。 + +### WSL 上对 Linux GUI 应用程序的支持 + +![][8] + +最近,Microsoft 在在线开发者大会上宣布了 WSL(即 WSL 2)的一系列新功能。 + +[Windows 包管理器][9]、[Windows 终端 1.0][10],以及其他一些功能的引入是其亮点。 + +但是, WSL 2 对 GPU 硬件加速的支持非常重要。 + +那么,是否意味着你可以使用 WSL 在 Windows 上运行 Linux 应用程序呢?看起来像是。 + +微软计划通过使用全新的 Linux 内核驱动程序 `dxgkrnl` 来实现它。为了给你一个技术性的简报, 我在这里引用他们的公告中的描述: + +![Linux Kernel Driver Wsl][11] + +> dxgkrnl 是一个全新的 Linux 内核驱动程序,它将 `/dev/dxg` 设备提供给用户模式的 Linux。 `/dev/dxg` 提供了一组 IOCTL,它们与 Winodws 上的原生 WDDM D3DKMT 内核服务层非常相似。Linux 内核中的 dxgkrnl 通过 VM 总线连接到 Windows 主机上,并使用此 VM 总线连接与物理 GPU 进行通讯。 + +我不是这方面的专家,但这意味着 WSL 上的 Linux 应用程序将与原生的 Windows 应用程序一样可以访问 GPU。 + +针对 GUI 应用程序的支持将在今年秋季的晚些时候提供(而不是 2020 年 5 月的更新) —— 所以我们要看看什么时候提供。 + +微软专门针对的是那些希望在 Windows 上轻松使用 Linux IDE 的开发人员。谷歌也在瞄准同样的用户群,[将 GUI Linux 应用程序引入到 Chromebook][12]。 + +那么,对于那些坚持使用 Windows 的用户来说,这是个好消息。但是,这是真的吗? + +### 微软爱上了 Linux —— 真的吗? + +![Microsoft Loves Linux][13] + +他们在 Windows 上整合 Linux 环境来拥抱 Linux 及其优势的努力,绝对是一件好事。 + +但是,它真的能给**桌面 Linux 用户**带来什么好处呢?到目前为止,我还没有看到任何实际的好处。 + +在这里,你可以有不同的看法。但是,我认为 WSL 的开发对于 Linux 桌面用户来说没有真正的价值。至少,到目前为止没有。 + +有趣的是,[Linux Unplugged podcast][14] 上有人强调了微软的举动,认为这与他们的 EEE(拥抱、延伸和扑灭Embrace, extend, and extinguish)的思路是一致的。 + +可能吧,谁知道呢?当然,他们为实现这一目标而付出的努力值得赞赏 —— 同时又令人感到兴奋和神秘。 + +### 这是否以为着 Windows 用户将不必再转到 Linux? + +微软之所以在其平台上集成 Linux,是因为他们知道 Liunx 的能力,也知道开发人员(或用户)喜欢使用它的原因。 + +但是,随着 WSL 2 的更新,如果这种情况持续下去,我倾向于同意 Abhishek 的看法: + +> 最终,桌面 Linux 将被限制在 Windows 下,成为桌面应用程序…… + +好吧,当然,原生的体验暂时还是比较好的。而且,很难看到现有的 Linux 桌面用户会使用 Windows 来将其替代。但是,这仍然值得担心。 + +你如何看待这一切?我不认为 WSL 对于被迫使用 Windows 的用户有什么好处 —— 但是,从长远来看,你认为微软在 WSL 方面的进展本质上是敌意还是对 Linux 有帮助? + +在评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/run-linux-apps-windows-wsl/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://news.microsoft.com/build2020/ +[2]: https://itsfoss.com/microsoft-maui-kde-row/ +[3]: https://mauikit.org/ +[4]: https://itsfoss.com/nitrux-linux/ +[5]: https://itsfoss.com/run-linux-commands-in-windows/ +[6]: https://devblogs.microsoft.com/directx/directx-heart-linux/ +[7]: https://www.gamingonlinux.com/2020/05/microsoft-build-directx-and-linux-plus-more +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux-GUI-app-Windows-WSL.png?ssl=1 +[9]: https://devblogs.microsoft.com/commandline/windows-package-manager-preview/ +[10]: https://devblogs.microsoft.com/commandline/windows-terminal-1-0/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-kernel-driver-wsl.png?ssl=1 +[12]: https://itsfoss.com/linux-apps-chromebook/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/microsoft-loves-linux.jpg?ssl=1 +[14]: https://linuxunplugged.com/354 diff --git a/published/202005/20200526 How to write about open source software.md b/published/202005/20200526 How to write about open source software.md new file mode 100644 index 0000000000..fb883d8e59 --- /dev/null +++ b/published/202005/20200526 How to write about open source software.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12267-1.html) +[#]: subject: (How to write about open source software) +[#]: via: (https://opensource.com/article/20/5/write-about-open-source-software) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +如何为开源软件写作文章 +====== + +> 通过以下提示,成为一个更好的作者。 + +![](https://img.linux.net.cn/data/attachment/album/202005/31/115044ecfpxc2q9z0ca8wq.jpg) + +开始接触开源社区的一个方法就是写关于它的文章。你可以贡献技术文档,分享你如何使用软件,或者为我们社区写一篇文章。但是开始写作说起来容易做起来难。我听到的最常见的两个不写文章的借口是:“我没有什么新东西可写”和“我不是一个好的作者”。我在这里是为了打破这两个误区。 + +### 你应该写什么? + +> “寻找那些经常被遗漏的故事。” +> 埃里克·拉尔森 + +对于某些人来说,写作的最大障碍是找到要写的想法或话题。很容易就落入了这样的思维陷阱:“这个话题已经写过了,何必再麻烦。” + +我不是第一个写文章的人,也不会是最后一个。我带来的是我独特的视角和这些年来所学到的东西。曾经有人向我请教过一些关于写作入门的建议,或者是如何让自己的写作更上一层楼。我决定把这些建议变成一篇文章。 + +文如其人,没有人会以你的方式来述事,你的经验和观点可能正是别人所需要的。 + +这里有一些提示,可以帮助你想出一个主题: + +* 你最近学到了什么东西?写出你是如何学习的,你学到了什么,或使你感到惊讶的事情。 +* 你经常被问到的问题是什么?把答案写出来。 +* 你最近是否在搜索一篇怎么做的文章,但在搜索结果中,你对排名靠前的文章不满意?请写出你要找的文章。 +* 你是否参加过会议或研讨会?写一篇会后总结来说明你所学到的东西。 +* 你开始使用新工具了吗?写一份操作指南或入门指南。 + +### 你写的是什么类型的文章? + +有不同类型的文章,包括: + +* 技术文档 +* 操作指南 +* 博客 +* 白皮书或电子书 +* 回顾性的文章 + +内容的类型会影响你的写作风格和语气。博客更加非正式和是对话式的。而技术文档更正式,更具有指导性。 + +### 你是为谁而写的? + +每一篇文章都应该有一个单一的受众。受众是指你为之写作的对象是什么类型的人。在你开始写作之前,写下你的读者的一些特征是有助于写作的。重要的是要考虑到你要为谁写,以及你**不是为**谁写的 —— 确定你的目标受众将决定要包括哪些内容和不包括哪些内容。 + +例如,我在写这篇文章的时候,我设想的目标受众是这样的: + +* 有基本的写作和语法知识 +* 有兴趣提高写作能力 +* 在技术领域担任开发人员、销售工程师、客户经理或类似职位的工作 +* 不是经验丰富或资深的作者,可能在个人或工作博客上发表过几篇文章,想写更多的文章。 +* 非虚构写作 + +如果你有针对多个受众的内容,可以考虑针对不同的受众将其分解成不同的内容。对你的受众要考虑的一些方面: + +* 专业水平:新手、中级、高级 +* 作用:管理人员、个人贡献者 +* 目标:他们为什么要阅读这些? + +### 言语很重要 + +你选择的言语会对读者产生影响。晦涩难懂的词汇会使文章更难理解,不常见的词汇会让读者觉得自己很笨,某些词汇可能会不小心冒犯读者。作为一个作者,你的目标是避免所有这些。下面是怎么做的: + +#### 使用日常用语 + +不要把写作作为炫耀你的词汇量或你从“每日一字”台历上学到的单词的方式。写作是为了让读者能够理解。每一篇文章都有相关的阅读水平。如果你写的是技术文档,那么你的目标大约是初中的阅读水平。这并不意味着你的受众只有初中的教育水平。它意味着你的写作会更容易被人理解。你想让人们对这些言语过目不忘,还是想让他们觉得自己学到了什么?虽然你可以使用长而复杂的词汇,但并不意味着你应该这样做。使用简单的语言不一定意味着你的文章会很无聊。 + +使用 [Hemingway 应用][2]等工具来检查你的作品的可读性(它不是开源的,但很优秀)。比如说,在初稿之后,这篇文章被评定为五年级的阅读水平。Hemingway 还提供了如何改进写作的建议 —— 找出难以理解的句子或需要改变选词的地方。 + +如果你想要找出替代的词汇,可以查看 [Plain English Campaign][3] 的建议或 [Power Thesaurus][4] 的众包建议。 + +#### 知道应该规避哪些词 + +> “每次你想写‘非常’的时候,就用‘该死的’代替;你的编辑会把它删掉,而作品就会如它应有的那样。” +> 马克·吐温 + +在写教程或指南的时候,这里有一些要避免的词,包括“简单simple”、“容易easy”和“就这样just”。你是你所写的主题的专家,经过多年的实践,可能会觉得事情很简单。而初学者可能会觉得事情不“简单”,也不“容易”。你的读者可能会感到沮丧,因为他们觉得过程或解释并不简单。 + +你是否曾经因为无法理解作者的意思而不得不反复重读一个句子或段落?你有没有因为一篇文章对你来说没有意义而放弃过?我有过。 + +作为一个作者,你希望你的读者感到困惑或不理解吗?我希望不会。 + +在你的写作中要避免的其它词语: + +* 这件事That +* 真的Really +* 非常Very +* 所以So +* 为了In order to + +一般来说,这些词可以在不改变句子意思的情况下删除。 + +在我写完之后,我会在文档中搜索这些词。当我在这篇文章中搜索时,我发现了以下这句话: + +> “这并不意味着你的受众只有初中的教育水平*这件事*,而意味着你的写作会更容易被理解*这件事*。” + +这句话中出现了两个“这件事That”的例子。它们并没有给句子增加价值。它们可以被删除而不改变其含义。删除这些词汇可以缩短句子,并且更短的句子更容易理解。而说到短句,我还把它改写成了两句话。 + +> “这并不意味着你的受众只有初中的教育水平。它意味着你的写作会更容易被人理解。” + +#### 使用包容性语言 + +词语和短语的历史背景可能会导致人们感到被排斥或冒犯。在写作时,你要让读者感到被包容。当你使用包容性的语言时,会让读者感到被理解、被尊重,感觉被包容。我参考了 Buffer 中的这篇[关于使用包容性语言的指南][5]。 + +### 修订和编辑 + +> “几乎所有好的写作都是从糟糕的第一次努力开始的。你需要从某个地方开始。” +> 安妮·拉莫特 + +写作是一个迭代的过程。如果你认为作者们坐在办公桌前,在一个小时内就能完成一篇文章准备发表,那么请你再想一想。有些文章需要我花几个星期的时间来完成。以下是我的标准流程: + +* 写一个粗略的初稿。我说的粗略,我的意思是*粗陋*。写的时候不用担心语法问题。目的是让文字从我的脑海中浮现出来,写在纸上。这一步可能需要一个小时到几周的时间。 +* 将草稿放一段时间。这可能需要几个小时到几天的时间,这取决于出版时间线。 +* 审阅草稿。进行调整和编辑。 +* 征求反馈意见,可以是同事或朋友的反馈意见。在这个阶段的反馈中,我的重点是明确性。是否有意义?是否有什么令人困惑的地方?有什么缺失的部分? +* 纳入反馈意见。无论你的写作经验有多丰富,让其他作者审阅你的作品,都会让你的作品变得更好。 + +在这个阶段,我有了一个相当扎实的草稿。现在到了我最不喜欢的写作部分 —— 编辑。我之前提到的 Hemingway 应用不仅能告诉你阅读水平,还能提供改进写作的建议。我还使用 Grammarly 来帮助编辑语法。关于 Grammarly 的开源替代工具,请查看[语言工具网站][6]或这篇文章中的[开源写作工具][7]。 + +我的写作挑战之一就是适当地使用逗号。Grammarly 可以帮助我找出我缺失或滥用逗号的地方。Grammarly 发现了 43 个这篇文章的最终草稿的正确性问题。其中大部分是逗号错误。 + +![Errors identified by Grammarly][8] + +除了语法错误之外,该应用程序还提供了一些建议,以帮助提高清晰度、参与度和表达能力(其中一些功能可能在免费版中没有)。这包括单词选择和使用主动语气与被动语气等。有些建议我接受,有些则拒绝。在审查了所有的警报和建议后,Grammarly 会在各个方面进行反馈。 + +![Grammarly results][10] + +不要害怕寻求写作上的帮助。每一个好的作者背后都有一个好的编辑或好的编辑应用。 + +### 文体指南 + +文体指南为改善书面交流提供了标准。它们包括标点符号、语法和用词等方面。如果是为你的公司撰写文档,请检查一下公司是否有文体指南。如果没有文体指南,或者你是为自己写的,下面是一些常用的文体指南: + +* [芝加哥文体手册][11] +* [谷歌开发者文档指南][12] +* [微软写作文体指南][13] +* [美联社文体手册][14] + +写作是一种与社区分享自己的思想和知识的方式。开始写作的唯一方法就是开始打字。用这些建议来微调你的写作。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/write-about-open-source-software + +作者:[Dawn Parzych][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead.png?itok=h3fCkVmU (Typewriter in the grass) +[2]: http://www.hemingwayapp.com/ +[3]: http://www.plainenglish.co.uk/the-a-z-of-alternative-words.html +[4]: https://www.powerthesaurus.org/ +[5]: https://open.buffer.com/inclusive-language-tech/ +[6]: https://languagetool.org/ +[7]: https://opensource.com/article/20/3/open-source-writing-tools +[8]: https://opensource.com/sites/default/files/uploads/grammarlyerrors.png (Errors identified by Grammarly) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://opensource.com/sites/default/files/uploads/grammarlyresults.png (Grammarly results) +[11]: https://www.chicagomanualofstyle.org/home.html +[12]: https://developers.google.com/style +[13]: https://docs.microsoft.com/en-us/style-guide/welcome/ +[14]: https://www.apstylebook.com/ diff --git a/published/20200519 24 Linux desktops you need to try.md b/published/20200519 24 Linux desktops you need to try.md new file mode 100644 index 0000000000..f96ba38567 --- /dev/null +++ b/published/20200519 24 Linux desktops you need to try.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12487-1.html) +[#]: subject: (24 Linux desktops you need to try) +[#]: via: (https://opensource.com/article/20/5/linux-desktops) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +24 个值得尝试的 Linux 桌面环境 +====== + +> 我全要! + +![](https://img.linux.net.cn/data/attachment/album/202008/04/222604tj9mpc66zyzxppbx.jpg) + +Linux 桌面的最大优点之一是它提供给用户选择的权利。如果你不喜欢你屏幕左下角的应用程序菜单,你可以移除它。如果你不喜欢你的文件管理器组织文件的方式,你可以使用另外一个文件管理器。不过,不可否认的是,这对那些不习惯自己选择如何使用计算机的用户来说可能会感到困惑。如果你正在考虑安装 Linux,你要做的选择之一就是你想使用哪一个桌面,最好的方法就是尝试几个不同的桌面,直到你找到感觉适合你的桌面。 + +### 默认桌面 + +![][2] + +作为在 Fedora、Ubuntu、Debian 和一些其它操作系统上的默认桌面,GNOME 桌面可能是最流行的 Linux 桌面。它有一个易于使用和现代化的界面,并带有为手机环境设计的小点缀,因此即使在触摸屏上也感觉很自然。 + +不过,一些 Linux 发行版选择了不同的桌面环境,如 KDE Plasma、Pantheon、Cinnamon 和 Mate。 + + * [GNOME][3]: 现代化和易于使用,默认桌面 + * [Mate][4]: 传统的 GNOME + * [KDE][5]: 功能强大、可配置的 Plasma 桌面 + * [Cinnamon][6]: 经典的 GNOME + * [Pantheon][7]: [ElementaryOS][8] 的默认桌面 + * [Budgie][9]: 一个柔和的桌面 + * [Trinity][10]: 传统的 KDE + +### 传统的 Unix + +![运行在 Fedora 上的 Window Maker][11] + +Unix 是现代操作系统的鼻祖,也是 Linux 的直接灵感来源,拥有令人吃惊的丰富的桌面历史。大多数人都不熟悉 Unix 桌面设计,因为 Unix 计算机被认为是学术界、科学界和电影界常见的专业机器,而不是家用计算机。如果你是一名 Unix、IRIX 或 NeXT 的用户,那么你可能会对类似于 [CDE][12] 或 NeXTStep 的桌面有着美好的回忆。你很幸运,因为这一传统延续至今: + + * [Windowmaker][13]: NeXT 界面的复兴 + * [Enlightenment][14]: 一个现代化的改进型 Windowmaker 风格的桌面 + * [Fluxbox][15]: 跳出 Blackbox 思维定式 + * [Openbox][16]: 改善 Blackbox 的可用性 + * [TWM][17]: 与 X11 绑定至死的示例桌面 + * [Fvwm][18]: 改进的 TWM + +### 轻量级桌面 + +![XFCE in 2019 年 在 Mageia Linux 上的][19] + +你可能想知道为什么 Linux 有那么多的桌面可供选择。你可以把它归结为个人喜好和对效率低下的低容忍度,但优化用户界面也有技术上的好处。例如,老电脑难以跟上用户界面的更新,可以使用轻量级桌面[赋予它新的生命]() 。另外,你可能只是想把 CPU 处理能力分配到除桌面以外的其它东西上,所以保持你的主用户界面极简是有意义的。不管你的动机是什么,这里有一些你可以尝试的桌面: + + * [XFCE][20]: 熟悉的桌面,极少的性能损失 + * [LXQT 和 LXDE][21]: 熟悉的桌面,较少的性能损失 + * [PekWM][22]: 一个 Blackbox 式的窗口管理器 + * [Joe's Window Manager][23]: 另一个 Blackbox 式的窗口管理器 + * [Ratpoison][24]: 不使用鼠标 + * [Herbstluftwm][25]: 针对 [Vim 用户][26] 的Ratpoison + * [Lumina][27]: 一个为 PC-BSD 开发的桌面 + +### 实验性桌面 + +![Unix 桌面环境][28] + +当创建一个桌面并将其集成到一个系统中相对容易的时候,会发生的事情之一就是你会得到一些有趣的概念验证项目和试验性项目。有一些会比其它的更精致,有一些则不是很容易安装。这些很可能注定不会成为你的永久桌面,但是它们可以是很有趣的体验: + + * [Unix Desktop Environment][29]: 该桌面的重塑版 + * [Rox][30]: 在它那个时代是先进和现代的桌面 + * [MLVWM][31]: 要是 Apple IIe 运行 Unix 怎么样? + * [Equinox][32]: 只是个最基础的东西 + +### 选择你的桌面 + +如果太多的选择让你不知所措,那么记住:桌面意味着 *可选*。你没有义务来尝试发行版附带的多个桌面。 + +许多 Linux 的高级用户都会满足于他们的发行版所提供的某个桌面。最重要的是得到一个可以与你的计算机一起工作的 Linux 系统系统,并花费时间来学习它是如何工作的。归根结底,所有的桌面都只是为了做同一件事:帮助你组织和管理你的重要数据。让你了解你的桌面是如何工作的,这才是最重要的。但是如果你已经了解了你的默认桌面的各个方面,那你现在有了可以在周末尝试的大量选择。祝你玩得开心! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/linux-desktops + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ (Penguins) +[2]: https://opensource.com/sites/default/files/advent-gnome.jpg +[3]: https://linux.cn/article-11675-1.html +[4]: https://linux.cn/article-11703-1.html +[5]: https://linux.cn/article-11728-1.html +[6]: https://linux.cn/article-8606-1.html +[7]: https://linux.cn/article-11660-1.html +[8]: https://elementary.io/ +[9]: https://linux.cn/article-10547-1.html +[10]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde +[11]: https://opensource.com/sites/default/files/uploads/advent-windowmaker.jpg (Window Maker running on Fedora) +[12]: https://sourceforge.net/projects/cdesktopenv/ +[13]: https://linux.cn/article-11650-1.html +[14]: https://opensource.com/article/19/12/linux-enlightenment-desktop +[15]: https://linux.cn/article-12082-1.html +[16]: https://linux.cn/article-11698-1.html +[17]: https://linux.cn/article-11734-1.html +[18]: https://linux.cn/article-11712-1.html +[19]: https://opensource.com/sites/default/files/advent-xfce.jpg (XFCE on Mageia Linux in 2019) +[20]: https://linux.cn/article-10413-1.html +[21]: https://opensource.com/article/19/12/lxqt-lxde-linux-desktop +[22]: https://linux.cn/article-11670-1.html +[23]: https://opensource.com/article/19/12/joes-window-manager-linux-desktop +[24]: https://opensource.com/article/19/12/ratpoison-linux-desktop +[25]: https://linux.cn/article-11734-1.html +[26]: https://opensource.com/resources/what-vim +[27]: https://linux.cn/article-11706-1.html +[28]: https://opensource.com/sites/default/files/uploads/advent-ude.jpg (Unix Desktop Environment) +[29]: https://opensource.com/article/19/12/linux-unix-desktop-environment-ude +[30]: https://linux.cn/article-12123-1.html +[31]: https://linux.cn/article-11720-1.html +[32]: https://opensource.com/article/19/12/ede-linux-desktop diff --git a/published/20200521 Easy DNS configuration with PowerDNS for nameservers.md b/published/20200521 Easy DNS configuration with PowerDNS for nameservers.md new file mode 100644 index 0000000000..0a0f7aa7ae --- /dev/null +++ b/published/20200521 Easy DNS configuration with PowerDNS for nameservers.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12496-1.html) +[#]: subject: (Easy DNS configuration with PowerDNS for nameservers) +[#]: via: (https://opensource.com/article/20/5/powerdns) +[#]: author: (Jonathan Garrido https://opensource.com/users/jgarrido) + +使用 PowerDNS 轻松配置 DNS 名称服务器 +====== + +> 使用 PDNS 为你的项目提供稳定可靠的域名系统(DNS)服务器。 + +![](https://img.linux.net.cn/data/attachment/album/202008/07/202953copoqjmkefkdf3j4.jpg) + +几个月前,我们接到了一个要求,为一个新项目提供一个稳定可靠的域名系统([DNS][2])服务器。该项目使用容器进行自动部署,每个新环境都会生成唯一的随机 URL。在对可能的方案进行了大量研究之后,我们决定尝试一下 [PowerDNS][3](PDNS)。 + +一开始,我们发现 PowerDNS 在所有主流 Linux 发行版中都得到了支持,它采用 GPL 许可,且仓库保持更新。我们还在官方网站上发现了整洁、组织良好的[文档][4],以及大量来自真正喜欢和使用该产品的人在网络上的使用方法。看了一些并学习了一些基本命令之后,安装了 PDNS,启动并运行,我们的旅程开始了。 + +### 数据库驱动 + +PowerDNS 将记录保存在 SQL 数据库中。这对我们来说是新变化,不必使用文本文件来保存记录是一个不错的更改。我们选择 MariaDB 作为首选的强大工具,由于有大量的正确地设置来安装名称服务器的信息,我们可以完美地设置和加固我们的数据库。 + +### 简单配置 + +其次使我们感兴趣的是 PDNS 的所有功能都在配置文件中。`pdns.conf` 有许多选项,你可以通过添加或删除 `#` 号来启用或禁用这些选项。这真是太神奇了,因为它使我们有机会将这项新的服务集成到我们现有的基础架构中,并且只有我们想要的功能,不多也不少。一个简单的例子: + +谁可以访问你的网络服务器? + +``` +webserver-allow-from=172.10.0.1,172.10.1.2 +``` + +我可以转发基于域的请求吗?当然! + +``` +forward-zones=mylocal.io=127.0.0.1:5300 +forward-zones+=example.com=172.10.0.5:53 +forward-zones+=lucky.tech=172.10.1.5:53 +``` + +### 包含 API + +我们可以使用配置文件进行激活 API 服务,解决了我们开发团队的第一个需求,让我们见识到了 PDNS 的强大。这个功能让我们通过发送请求,简单、干净地创建、修改或删除 DNS 服务器中的记录。 + +这个 API 有一些基本的安全性参数,因此,只需几步,你就可以基于 IP 地址和预共享密钥验证的组合来控制谁有权与名称服务器进行交互。这是配置文件的样子: + +``` +api=yes +api-key=lkjdsfpoiernf +webserver-allow-from=172.10.7.13,172.10.7.5 +``` + +### 日志 + +在日志方面,PDNS 做得非常出色。你可以使用日志文件和一个简单的内置 Web 服务器来监控服务器并查看计算机的运行状况。你可以使用浏览器查看服务器不同类型的统计信息,例如 CPU 使用率和收到的 DNS 查询。这非常有价值。例如,我们能够检测到一些“不太健康”的 PC,它们正在向我们的服务器发送与恶意流量相关的站点的 DNS 请求。深入查看日志后,我们可以看到流量来自何处,并对这些 PC 进行清理操作。 + +### 其他功能 + +这只是你使用 PowerDNS 可以做的所有事情的一点点。它还有更多的功能。它是一个拥有很多功能和特性的完整名称服务器,因此值得一试。 + +目前,我们尚未部署 [DNSSEC][5],但似乎只需点击一下即可将其快速投入生产环境。另外,在将递归服务与名称服务器分离时,PowerDNS 有个不错的方法。我了解到它还支持 [DNS RPZ][6](响应策略区域),并且还提供了非常不错且设计良好的前端,可让你使用 Web 浏览器来管理服务器,如下图。 + +![PowerDNS frontend][7] + +信不信由你,你只需花费几个小时了解 PDNS,就可以大大提高你对 DNS 和 IT 操作的了解。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/powerdns + +作者:[Jonathan Garrido][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jgarrido +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://en.wikipedia.org/wiki/Domain_Name_System +[3]: https://www.powerdns.com/opensource.html +[4]: https://doc.powerdns.com/ +[5]: https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions +[6]: https://dnsrpz.info/ +[7]: https://opensource.com/sites/default/files/uploads/pdns.jpg (PowerDNS frontend) diff --git a/published/202006/20190218 Talk, then code.md b/published/202006/20190218 Talk, then code.md new file mode 100644 index 0000000000..5e4c56af1d --- /dev/null +++ b/published/202006/20190218 Talk, then code.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12319-1.html) +[#]: subject: (Talk, then code) +[#]: via: (https://dave.cheney.net/2019/02/18/talk-then-code) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +给开源项目贡献代码时:先讨论,再编码 +====== + +我所参与的开源项目遵循的是一种这样的理念,我把它描述为 “先讨论,再编码”。我认为一般来说这是开发软件的好方法,我想花一点时间来谈谈这种方法的好处。 + +### 避免伤害感情 + +先讨论你想做的改变最重要的原因是避免伤害感情。我经常看到一个贡献者闭门造车地提交了一个 PR,却发现他的努力工作被拒绝了。这可能有一堆原因:PR 太大了,PR 没有遵循本地风格,PR 修复了一个对项目不重要的问题或者最近间接修复了的问题,等等。 + +这些问题的根本原因都是缺乏沟通。“先讨论,再编码” 理念的目标不是阻碍你或给你带来挫折,而是确保一个功能第一次就能正确落地,而不至于产生大量的维护债务。无论是改动的作者,还是审查者,当一个改动突然出现时,并暗示说 “好吧,我已经做完了,你要做的就是合并它,对吧?”,先讨论可以让他们不必背负伤害感情的情绪负担。 + +### 讨论应该如何进行? + +每一个新功能或错误修复都应该在工作开始前与项目的维护者讨论。私下试验是可以的,但不要在没有讨论之前就发送修改。 + +对于简单的改动,“讨论” 的定义可以只是 GitHub 议题中的一个设计草图。如果你的 PR 修复了一个 bug,你应该链接到它修复的 bug。如果没有,你应该先提出一个 bug,等待维护者确认后再发送 PR。这可能看起来有点落后 —— 谁不希望一个 bug 被修复呢 —— 但考虑到这个 bug 可能是对软件工作方式的误解,也可能是一个更大问题的症状,这需要进一步调查。 + +对于比较复杂的改动,尤其是功能请求,我建议在发送代码之前,先分发一份设计文档并达成一致。这不一定是一个完整的文档,发一个议题,带个草图可能就足够了,但关键是在用代码搞定之前,先用文字达成一致。 + +在任何情况下,你都不应该继续发送你的代码,直到维护者同意你的方法是他们所满意的。拉取请求是日常生活,而不仅仅是为了赶着过节。 + +### 代码审查,而不是由委员会设计 + +代码审查不是争论设计的地方。这有两个原因。首先,大多数代码审查工具都不适合长长的评论会话,GitHub 的 PR 界面在这方面非常糟糕,Gerrit 比较好,但很少有管理员团队会维护 Gerrit 实例。更重要的是,在代码审查阶段就出现了分歧,说明大家对如何实现这个变化并没有达成一致。 + +* * * + +讨论你想写的代码,然后再写你所讨论的代码。请不要反其道而行之。 + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/02/18/talk-then-code + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://dave.cheney.net/2013/09/07/how-to-include-c-code-in-your-go-package (How to include C code in your Go package) +[2]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) +[3]: https://dave.cheney.net/2016/04/11/the-value-of-tdd (The value of TDD) +[4]: https://dave.cheney.net/2016/03/12/suggestions-for-contributing-to-an-open-source-project (Suggestions for contributing to an Open Source project) diff --git a/published/202006/20190510 Learn to change history with git rebase.md b/published/202006/20190510 Learn to change history with git rebase.md new file mode 100644 index 0000000000..339e4ef696 --- /dev/null +++ b/published/202006/20190510 Learn to change history with git rebase.md @@ -0,0 +1,605 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12271-1.html) +[#]: subject: (Learn to change history with git rebase!) +[#]: via: (https://git-rebase.io/) +[#]: author: (git-rebase https://git-rebase.io/) + +学习用 Git 变基来改变历史! +====== + +[Git][1] 核心的附加价值之一就是编辑历史记录的能力。与将历史记录视为神圣的记录的版本控制系统不同,在 Git 中,我们可以修改历史记录以适应我们的需要。这为我们提供了很多强大的工具,让我们可以像使用重构来维护良好的软件设计实践一样,编织良好的提交历史。这些工具对于新手甚至是有经验的 Git 用户来说可能会有些令人生畏,但本指南将帮助我们揭开强大的 git-rebase 的神秘面纱。 + +> 值得注意的是:一般建议不要修改公共分支、共享分支或稳定分支的历史记录。编辑特性分支和个人分支的历史记录是可以的,编辑还没有推送的提交也是可以的。在编辑完提交后,可以使用 `git push -f` 来强制推送你的修改到个人分支或特性分支。 + +尽管有这么可怕的警告,但值得一提的是,本指南中提到的一切都是非破坏性操作。实际上,在 Git 中永久丢失数据是相当困难的。本指南结尾介绍了在犯错误时进行纠正的方法。 + +### 设置沙盒 + +我们不想破坏你的任何实际的版本库,所以在整个指南中,我们将使用一个沙盒版本库。运行这些命令来开始工作。[^1] + +``` +git init /tmp/rebase-sandbox +cd /tmp/rebase-sandbox +git commit --allow-empty -m"Initial commit" +``` + +如果你遇到麻烦,只需运行 `rm -rf /tmp/rebase-sandbox`,并重新运行这些步骤即可重新开始。本指南的每一步都可以在新的沙箱上运行,所以没有必要重做每个任务。 + +### 修正最近的提交 + +让我们从简单的事情开始:修复你最近的提交。让我们向沙盒中添加一个文件,并犯个错误。 + +``` +echo "Hello wrold!" >greeting.txt +git add greeting.txt +git commit -m"Add greeting.txt" +``` + +修复这个错误是非常容易的。我们只需要编辑文件,然后用 `--amend` 提交就可以了,就像这样: + +``` +echo "Hello world!" >greeting.txt +git commit -a --amend +``` + +指定 `-a` 会自动将所有 Git 已经知道的文件进行暂存(例如 Git 添加的),而 `--amend` 会将更改的内容压扁到最近的提交中。保存并退出你的编辑器(如果需要,你现在可以修改提交信息)。你可以通过运行 `git show` 看到修复的提交。 + +``` +commit f5f19fbf6d35b2db37dcac3a55289ff9602e4d00 (HEAD -> master) +Author: Drew DeVault +Date: Sun Apr 28 11:09:47 2019 -0400 + + Add greeting.txt + +diff --git a/greeting.txt b/greeting.txt +new file mode 100644 +index 0000000..cd08755 +--- /dev/null ++++ b/greeting.txt +@@ -0,0 +1 @@ ++Hello world! +``` + +### 修复较旧的提交 + +`--amend` 仅适用于最近的提交。如果你需要修正一个较旧的提交会怎么样?让我们从相应地设置沙盒开始: + +``` +echo "Hello!" >greeting.txt +git add greeting.txt +git commit -m"Add greeting.txt" + +echo "Goodbye world!" >farewell.txt +git add farewell.txt +git commit -m"Add farewell.txt" +``` + +看起来 `greeting.txt ` 像是丢失了 `"world"`。让我们正常地写个提交来解决这个问题: + +``` +echo "Hello world!" >greeting.txt +git commit -a -m"fixup greeting.txt" +``` + +现在文件看起来正确,但是我们的历史记录可以更好一点 —— 让我们使用新的提交来“修复”(`fixup`)最后一个提交。为此,我们需要引入一个新工具:交互式变基。我们将以这种方式编辑最后三个提交,因此我们将运行 `git rebase -i HEAD~3`(`-i` 代表交互式)。这样会打开文本编辑器,如下所示: + +``` +pick 8d3fc77 Add greeting.txt +pick 2a73a77 Add farewell.txt +pick 0b9d0bb fixup greeting.txt + +# Rebase f5f19fb..0b9d0bb onto f5f19fb (3 commands) +# +# Commands: +# p, pick = use commit +# f, fixup = like "squash", but discard this commit's log message +``` + +这是变基计划,通过编辑此文件,你可以指导 Git 如何编辑历史记录。我已经将该摘要削减为仅与变基计划这一部分相关的细节,但是你可以在文本编辑器中浏览完整的摘要。 + +当我们保存并关闭编辑器时,Git 将从其历史记录中删除所有这些提交,然后一次执行一行。默认情况下,它将选取(`pick`)每个提交,将其从堆中召唤出来并添加到分支中。如果我们对此文件根本没有做任何编辑,则将直接回到起点,按原样选取每个提交。现在,我们将使用我最喜欢的功能之一:修复(`fixup`)。编辑第三行,将操作从 `pick` 更改为 `fixup`,并将其立即移至我们要“修复”的提交之后: + +``` +pick 8d3fc77 Add greeting.txt +fixup 0b9d0bb fixup greeting.txt +pick 2a73a77 Add farewell.txt +``` + +> **技巧**:我们也可以只用 `f` 来缩写它,以加快下次的速度。 + +保存并退出编辑器,Git 将运行这些命令。我们可以检查日志以验证结果: + +``` +$ git log -2 --oneline +fcff6ae (HEAD -> master) Add farewell.txt +a479e94 Add greeting.txt +``` + +### 将多个提交压扁为一个 + +在工作时,当你达到较小的里程碑或修复以前的提交中的错误时,你可能会发现写很多提交很有用。但是,在将你的工作合并到 `master` 分支之前,将这些提交“压扁”(`squash`)到一起以使历史记录更清晰可能很有用。为此,我们将使用“压扁”(`squash `)操作。让我们从编写一堆提交开始,如果要加快速度,只需复制并粘贴这些: + +``` +git checkout -b squash +for c in H e l l o , ' ' w o r l d; do + echo "$c" >>squash.txt + git add squash.txt + git commit -m"Add '$c' to squash.txt" +done +``` + +要制作出一个写着 “Hello,world” 的文件,要做很多事情!让我们开始另一个交互式变基,将它们压扁在一起。请注意,我们首先签出了一个分支来进行尝试。因此,因为我们使用 `git rebase -i master` 进行的分支,我们可以快速变基所有提交。结果: + +``` +pick 1e85199 Add 'H' to squash.txt +pick fff6631 Add 'e' to squash.txt +pick b354c74 Add 'l' to squash.txt +pick 04aaf74 Add 'l' to squash.txt +pick 9b0f720 Add 'o' to squash.txt +pick 66b114d Add ',' to squash.txt +pick dc158cd Add ' ' to squash.txt +pick dfcf9d6 Add 'w' to squash.txt +pick 7a85f34 Add 'o' to squash.txt +pick c275c27 Add 'r' to squash.txt +pick a513fd1 Add 'l' to squash.txt +pick 6b608ae Add 'd' to squash.txt + +# Rebase 1af1b46..6b608ae onto 1af1b46 (12 commands) +# +# Commands: +# p, pick = use commit +# s, squash = use commit, but meld into previous commit +``` + +> **技巧**:你的本地 `master` 分支独立于远程 `master` 分支而发展,并且 Git 将远程分支存储为 `origin/master`。结合这种技巧,`git rebase -i origin/master` 通常是一种非常方便的方法,可以变基所有尚未合并到上游的提交! + +我们将把所有这些更改压扁到第一个提交中。为此,将第一行除外的每个“选取”(`pick`)操作都更改为“压扁”(`squash`),如下所示: + +``` +pick 1e85199 Add 'H' to squash.txt +squash fff6631 Add 'e' to squash.txt +squash b354c74 Add 'l' to squash.txt +squash 04aaf74 Add 'l' to squash.txt +squash 9b0f720 Add 'o' to squash.txt +squash 66b114d Add ',' to squash.txt +squash dc158cd Add ' ' to squash.txt +squash dfcf9d6 Add 'w' to squash.txt +squash 7a85f34 Add 'o' to squash.txt +squash c275c27 Add 'r' to squash.txt +squash a513fd1 Add 'l' to squash.txt +squash 6b608ae Add 'd' to squash.txt +``` + +保存并关闭编辑器时,Git 会考虑片刻,然后再次打开编辑器以修改最终的提交消息。你会看到以下内容: + +``` +# This is a combination of 12 commits. +# This is the 1st commit message: + +Add 'H' to squash.txt + +# This is the commit message #2: + +Add 'e' to squash.txt + +# This is the commit message #3: + +Add 'l' to squash.txt + +# This is the commit message #4: + +Add 'l' to squash.txt + +# This is the commit message #5: + +Add 'o' to squash.txt + +# This is the commit message #6: + +Add ',' to squash.txt + +# This is the commit message #7: + +Add ' ' to squash.txt + +# This is the commit message #8: + +Add 'w' to squash.txt + +# This is the commit message #9: + +Add 'o' to squash.txt + +# This is the commit message #10: + +Add 'r' to squash.txt + +# This is the commit message #11: + +Add 'l' to squash.txt + +# This is the commit message #12: + +Add 'd' to squash.txt + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# Date: Sun Apr 28 14:21:56 2019 -0400 +# +# interactive rebase in progress; onto 1af1b46 +# Last commands done (12 commands done): +# squash a513fd1 Add 'l' to squash.txt +# squash 6b608ae Add 'd' to squash.txt +# No commands remaining. +# You are currently rebasing branch 'squash' on '1af1b46'. +# +# Changes to be committed: +# new file: squash.txt +# +``` + +默认情况下,这是所有要压扁的提交的消息的组合,但是像这样将其保留肯定不是你想要的。不过,旧的提交消息在编写新的提交消息时可能很有用,所以放在这里以供参考。 + +> **提示**:你在上一节中了解的“修复”(`fixup`)命令也可以用于此目的,但它会丢弃压扁的提交的消息。 + +让我们删除所有内容,并用更好的提交消息替换它,如下所示: + +``` +Add squash.txt with contents "Hello, world" + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# Date: Sun Apr 28 14:21:56 2019 -0400 +# +# interactive rebase in progress; onto 1af1b46 +# Last commands done (12 commands done): +# squash a513fd1 Add 'l' to squash.txt +# squash 6b608ae Add 'd' to squash.txt +# No commands remaining. +# You are currently rebasing branch 'squash' on '1af1b46'. +# +# Changes to be committed: +# new file: squash.txt +# +``` + +保存并退出编辑器,然后检查你的 Git 日志,成功! + +``` +commit c785f476c7dff76f21ce2cad7c51cf2af00a44b6 (HEAD -> squash) +Author: Drew DeVault +Date: Sun Apr 28 14:21:56 2019 -0400 + + Add squash.txt with contents "Hello, world" +``` + +在继续之前,让我们将所做的更改拉入 `master` 分支中,并摆脱掉这一草稿。我们可以像使用 `git merge` 一样使用 `git rebase`,但是它避免了创建合并提交: + +``` +git checkout master +git rebase squash +git branch -D squash +``` + +除非我们实际上正在合并无关的历史记录,否则我们通常希望避免使用 `git merge`。如果你有两个不同的分支,则 `git merge` 对于记录它们合并的时间非常有用。在正常工作过程中,变基通常更为合适。 + +### 将一个提交拆分为多个 + +有时会发生相反的问题:一个提交太大了。让我们来看一看拆分它们。这次,让我们写一些实际的代码。从一个简单的 C 程序 [^2] 开始(你仍然可以将此代码段复制并粘贴到你的 shell 中以快速执行此操作): + +``` +cat <main.c +int main(int argc, char *argv[]) { + return 0; +} +EOF +``` + +首先提交它: + +``` +git add main.c +git commit -m"Add C program skeleton" +``` + +然后把这个程序扩展一些: + +``` +cat <main.c +#include <stdio.h> + +const char *get_name() { + static char buf[128]; + scanf("%s", buf); + return buf; +} + +int main(int argc, char *argv[]) { + printf("What's your name? "); + const char *name = get_name(); + printf("Hello, %s!\n", name); + return 0; +} +EOF +``` + +提交之后,我们就可以准备学习如何将其拆分: + +``` +git commit -a -m"Flesh out C program" +``` + +第一步是启动交互式变基。让我们用 `git rebase -i HEAD~2` 来变基这两个提交,给出的变基计划如下: + +``` +pick 237b246 Add C program skeleton +pick b3f188b Flesh out C program + +# Rebase c785f47..b3f188b onto c785f47 (2 commands) +# +# Commands: +# p, pick = use commit +# e, edit = use commit, but stop for amending +``` + +将第二个提交的命令从 `pick` 更改为 `edit`,然后保存并关闭编辑器。Git 会考虑一秒钟,然后向你建议: + +``` +Stopped at b3f188b... Flesh out C program +You can amend the commit now, with + + git commit --amend + +Once you are satisfied with your changes, run + + git rebase --continue +``` + +我们可以按照以下说明为提交*添加*新的更改,但我们可以通过运行 `git reset HEAD^` 来进行“软重置” [^3]。如果在此之后运行 `git status`,你将看到它取消了提交最新的提交,并将其更改添加到工作树中: + +``` +Last commands done (2 commands done): + pick 237b246 Add C program skeleton + edit b3f188b Flesh out C program +No commands remaining. +You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. + (Once your working directory is clean, run "git rebase --continue") + +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git checkout -- ..." to discard changes in working directory) + + modified: main.c + +no changes added to commit (use "git add" and/or "git commit -a") +``` + +为了对此进行拆分,我们将进行*交互式提交*。这使我们能够选择性地仅提交工作树中的特定更改。运行 `git commit -p` 开始此过程,你将看到以下提示: + +``` +diff --git a/main.c b/main.c +index b1d9c2c..3463610 100644 +--- a/main.c ++++ b/main.c +@@ -1,3 +1,14 @@ ++#include <stdio.h> ++ ++const char *get_name() { ++ static char buf[128]; ++ scanf("%s", buf); ++ return buf; ++} ++ + int main(int argc, char *argv[]) { ++ printf("What's your name? "); ++ const char *name = get_name(); ++ printf("Hello, %s!\n", name); + return 0; + } +Stage this hunk [y,n,q,a,d,s,e,?]? +``` + +Git 仅向你提供了一个“大块”(即单个更改)以进行提交。不过,这太大了,让我们使用 `s` 命令将这个“大块”拆分成较小的部分。 + +``` +Split into 2 hunks. +@@ -1 +1,9 @@ ++#include ++ ++const char *get_name() { ++ static char buf[128]; ++ scanf("%s", buf); ++ return buf; ++} ++ + int main(int argc, char *argv[]) { +Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? +``` + +> **提示**:如果你对其他选项感到好奇,请按 `?` 汇总显示。 + +这个大块看起来更好:单一、独立的更改。让我们按 `y` 来回答问题(并暂存那个“大块”),然后按 `q` 以“退出”交互式会话并继续进行提交。会弹出编辑器,要求输入合适的提交消息。 + +``` +Add get_name function to C program + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# interactive rebase in progress; onto c785f47 +# Last commands done (2 commands done): +# pick 237b246 Add C program skeleton +# edit b3f188b Flesh out C program +# No commands remaining. +# You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. +# +# Changes to be committed: +# modified: main.c +# +# Changes not staged for commit: +# modified: main.c +# +``` + +保存并关闭编辑器,然后我们进行第二次提交。我们可以执行另一次交互式提交,但是由于我们只想在此提交中包括其余更改,因此我们将执行以下操作: + +``` +git commit -a -m"Prompt user for their name" +git rebase --continue +``` + +最后一条命令告诉 Git 我们已经完成了此提交的编辑,并继续执行下一个变基命令。这样就行了!运行 `git log` 来查看你的劳动成果: + +``` +$ git log -3 --oneline +fe19cc3 (HEAD -> master) Prompt user for their name +659a489 Add get_name function to C program +237b246 Add C program skeleton +``` + +### 重新排序提交 + +这很简单。让我们从设置沙箱开始: + +``` +echo "Goodbye now!" >farewell.txt +git add farewell.txt +git commit -m"Add farewell.txt" + +echo "Hello there!" >greeting.txt +git add greeting.txt +git commit -m"Add greeting.txt" + +echo "How're you doing?" >inquiry.txt +git add inquiry.txt +git commit -m"Add inquiry.txt" +``` + +现在 `git log` 看起来应如下所示: + +``` +f03baa5 (HEAD -> master) Add inquiry.txt +a4cebf7 Add greeting.txt +90bb015 Add farewell.txt +``` + +显然,这都是乱序。让我们对过去的 3 个提交进行交互式变基来解决此问题。运行 `git rebase -i HEAD~3`,这个变基规划将出现: + +``` +pick 90bb015 Add farewell.txt +pick a4cebf7 Add greeting.txt +pick f03baa5 Add inquiry.txt + +# Rebase fe19cc3..f03baa5 onto fe19cc3 (3 commands) +# +# Commands: +# p, pick = use commit +# +# These lines can be re-ordered; they are executed from top to bottom. +``` + +现在,解决方法很简单:只需按照你希望提交出现的顺序重新排列这些行。应该看起来像这样: + +``` +pick a4cebf7 Add greeting.txt +pick f03baa5 Add inquiry.txt +pick 90bb015 Add farewell.txt +``` + +保存并关闭你的编辑器,而 Git 将为你完成其余工作。请注意,在实践中这样做可能会导致冲突,参看下面章节以获取解决冲突的帮助。 + +### git pull --rebase + +如果你一直在由上游更新的分支 ``(比如说原始远程)上做一些提交,通常 `git pull` 会创建一个合并提交。在这方面,`git pull` 的默认行为等同于: + +``` +git fetch origin +git merge origin/ +``` + +假设本地分支 `` 配置为从原始远程跟踪 `` 分支,即: + +``` +$ git config branch..remote +origin +$ git config branch..merge +refs/heads/ +``` +还有另一种选择,它通常更有用,并且会让历史记录更清晰:`git pull --rebase`。与合并方式不同,这基本上 [^4] 等效于以下内容: + +``` +git fetch origin +git rebase origin/ +``` + +合并方式更简单易懂,但是如果你了解如何使用 `git rebase`,那么变基方式几乎可以做到你想要做的任何事情。如果愿意,可以将其设置为默认行为,如下所示: + +``` +git config --global pull.rebase true +``` + +当你执行此操作时,从技术上讲,你在应用我们在下一节中讨论的过程……因此,让我们也解释一下故意执行此操作的含义。 + +### 使用 git rebase 来变基 + +具有讽刺意味的是,我最少使用的 Git 变基功能是它以之命名的功能:变基分支。假设你有以下分支: + +``` +A--B--C--D--> master + \--E--F--> feature-1 + \--G--> feature-2 +``` + +事实证明,`feature-2` 不依赖于 `feature-1` 的任何更改,它依赖于提交 E,因此你可以将其作为基础脱离 `master`。因此,解决方法是: + +``` +git rebase --onto master feature-1 feature-2 +``` + +非交互式变基对所有牵连的提交都执行默认操作(`pick`)[^5] ,它只是简单地将不在 `feature-1` 中的 `feature-2` 中提交重放到 `master` 上。你的历史记录现在看起来像这样: + +``` +A--B--C--D--> master + | \--G--> feature-2 + \--E--F--> feature-1 +``` + +### 解决冲突 + +解决合并冲突的详细信息不在本指南的范围内,将来请你注意另一篇指南。假设你熟悉通常的解决冲突的方法,那么这里是专门适用于变基的部分。 + +有时,在进行变基时会遇到合并冲突,你可以像处理其他任何合并冲突一样处理该冲突。Git 将在受影响的文件中设置冲突标记,`git status` 将显示你需要解决的问题,并且你可以使用 `git add` 或 `git rm` 将文件标记为已解决。但是,在 `git rebase` 的上下文中,你应该注意两个选项。 + +首先是如何完成冲突解决。解决由于 `git merge` 引起的冲突时,与其使用 `git commit` 那样的命令,更适当的变基命令是 `git rebase --continue`。但是,还有一个可用的选项:`git rebase --skip`。 这将跳过你正在处理的提交,它不会包含在变基中。这在执行非交互性变基时最常见,这时 Git 不会意识到它从“其他”分支中提取的提交是与“我们”分支上冲突的提交的更新版本。 + +### 帮帮我! 我把它弄坏了! + +毫无疑问,变基有时会很难。如果你犯了一个错误,并因此而丢失了所需的提交,那么可以使用 `git reflog` 来节省下一天的时间。运行此命令将向你显示更改一个引用(即分支和标记)的每个操作。每行显示你的旧引用所指向的内容,你可对你认为丢失的 Git 提交执行 `git cherry-pick`、`git checkout`、`git show` 或任何其他操作。 + +[^1]: 我们添加了一个空的初始提交以简化本教程的其余部分,因为要对版本库的初始提交进行变基需要特殊的命令(即` git rebase --root`)。 +[^2]: 如果要编译此程序,请运行 `cc -o main main.c`,然后运行 `./main` 查看结果。 +[^3]: 实际上,这是“混合重置”。“软重置”(使用 `git reset --soft` 完成)将暂存更改,因此你无需再次 `git add` 添加它们,并且可以一次性提交所有更改。这不是我们想要的。我们希望选择性地暂存部分更改,以拆分提交。 +[^4]: 实际上,这取决于上游分支本身是否已变基或删除/压扁了某些提交。`git pull --rebase` 尝试通过在 `git rebase` 和 `git merge-base` 中使用 “复刻点fork-point” 机制来从这种情况中恢复,以避免变基非本地提交。 +[^5]: 实际上,这取决于 Git 的版本。直到 2.26.0 版,默认的非交互行为以前与交互行为稍有不同,这种方式通常并不重要。 + +-------------------------------------------------------------------------------- + +via: https://git-rebase.io/ + +作者:[git-rebase][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://git-rebase.io/ +[b]: https://github.com/lujun9972 +[1]: https://git-scm.com/ +[2]: https://git-scm.com/docs/git-rebase + diff --git a/published/202006/20190814 How to install Python on Windows.md b/published/202006/20190814 How to install Python on Windows.md new file mode 100644 index 0000000000..b49ab0d1de --- /dev/null +++ b/published/202006/20190814 How to install Python on Windows.md @@ -0,0 +1,195 @@ +[#]: collector: (lujun9972) +[#]: translator: (011011100010110101101111) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12335-1.html) +[#]: subject: (How to install Python on Windows) +[#]: via: (https://opensource.com/article/19/8/how-install-python-windows) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) + +如何在 Windows 上安装 Python +====== + +> 安装 Python,启动 IDE,然后你就可以在 Windows 系统下进行编程了。 + +![](https://img.linux.net.cn/data/attachment/album/202006/20/232632iggga8agp5gablg5.jpg) + +你是否想学习编程呢?可以从 [Python][2] 开始,它因为简洁的语法和面向对象的特性而非常受欢迎,是最常见的编程语言之一。而且 Python 是一门解释型语言,这意味着你无需知道如何把 Python 代码编译为机器语言 —— Python 会帮你做到这一点,从而使你能够在编写代码的同时立即进行测试。 + +但是你也不能仅仅因为 Python 学习起来简单而低估了它强大的潜能,无论是在[电影][4][工作室][5]、视频游戏工作室,还是在金融机构、IT 机构、制造业,都有 Python 的身影,甚至很多业余爱好者、[艺术家][6]、教师和许多其他人都使用 Python。 + +另一方面,Python 也是一门严肃的编程语言,学习它需要付出和实践。还有,你什么都不需要马上做,就几乎可以在任何计算机平台上安装并尝试使用 Python ,因此,如果你使用的是 Windows 操作系统,那本文正适合你。 + +如果你使用的是开源的 Linux 操作系统,那你可以 [在 Linux 上安装][7] 并 [尝试使用 Python][8]。 + +### 如何获取 Python + +你可以从 [Python 官方网站][9] 上去下载 Python。在 Python 官方网站下载页,可以将鼠标悬停在 “Downloads” 按钮上,待菜单展开后,再将鼠标悬停在 “Windows” 选项,最后点击按钮就可以下载最新版的 Python 了。 + +![Downloading Python on Windows][10] + +或者你也可以直接点击 “Downloads” 按钮,然后在下载页中选择特定的版本去下载。 + +### 安装 Python + +下载好安装包后,直接打开就可以启动安装程序了。 + +安装时,选择默认的安装路径比较好,最重要的是要将 Python 添加到搜索路径中,否则 Python 应用程序不知道它该从哪里找到 Python 必须的运行时环境;默认认安装时并没有选中这一项,需要手动勾选安装窗口的 “Add Python 3.7 to Path” ,然后点击继续。 + +![Select "Add Python 3 to PATH"][11] + +由于 Windows 需要经过你的批准才会允许安装非微软官方发行的应用程序,因此你必须要在弹出 “User Account Control”(UAC) 系统提示窗口的时候 点击 “Yes” 来继续完成安装。 + +![Windows UAC][12] + +这时候你就需要耐心等待,系统会自动将 Python 软件包分发到合适的位置,等待过后,也就意味着你已经成功的安装了 Python ,你就可以愉快的与 Python 玩耍了! + +### 安装一个 IDE + +虽然说你仅需要一个文本编辑器,就可以开始编写 Python 代码了,但是我依然建议你使用 IDE(集成开发环境)来进行开发,这样开发起来就会变得方便很多。IDE 会将文本编辑器和一些好用的 Python 功能集成到一起,使用起来非常友好。你可以考虑选择 IDLE 3 或者 NINJA-IDE 来作为你的 IDE。 + +#### IDLE 3 + +Python 自带一款 IDE,名字叫 IDLE。虽然你可以使用任何文本编辑器编写 Python 代码,但 IDE 通常会提供 [Notepad++][13] 之类的纯文本编辑器所没有的代码高亮、语法检测等功能,甚至在 IDE 里可以直接通过鼠标点击 “Run” 按钮就能快速运行 Python 代码。 + +想要启动 IDLE ,可以点击 Windows 的 “开始” (或者 “Windows”)按钮,然后输入 `python` 来进行搜索。这时候可能会搜索到多个选项,选择 IDLE 启动就好了。 + +![IDLE 3 IDE][14] + +如果在 “开始” 菜单中没有搜到,你也可以在 “开始” 菜单输入 `cmd` (或同时按下键盘 `win + R` 键) 来启动 Windows 命令提示符,然后输入下面命令来启动 IDLE : + +``` +C:\Windows\py.exe +``` + +如果还是无法启动的话,可是试着重新安装 Python ,安装时记得务必要在安装向导中选中 “Add Python to PATH”。详细说明,可以参考 [Python 官方文档][15] 。 + +#### Ninja-IDE + +如果你已经有一些编程经验,而且你觉得 IDLE 对你来说有些简陋的话,你也可以试试 [Ninja-IDE][16]。 Ninja-IDE 是一款非常出色的 Python IDE,它具有代码高亮功能,并且它会自动帮你检测诸如拼写错误、引号或括号缺失以及其他语法错误。而且它还可以显示行号(调试的时候会非常有用)、缩进标记甚至可以直接通过点击 “Run” 按钮来运行你的代码。 + +![Ninja-IDE][17] + +如果要安装 Ninja-IDE ,你可以访问 Ninja-IDE 的官网 [下载 Windows 安装程序][18] 。步骤跟安装 Python 大同小异:下载安装包、允许 Windows 安装非微软官方的应用程序,然后等待完成安装即可。 + +Ninja-IDE 安装完成后,双击 Windows 桌面或开始菜单下的 Ninja-IDE 就可以启动了。 + +### 告诉 Python 怎么做 + +关键字能让 Python 知道你想要做什么。在 IDLE 或者 Ninja-IDE ,打开 “文件” 菜单,创建一个新文件。 + +在 Ninja-IDE 中,不要创建一个新项目,而是单独创建一个新文件就可以了。 + +在你用 IDLE 或者 Ninja-IDE 新建的文件中,输入以下代码: + +``` +print("Hello world.") +``` + +* 如果你使用的是 IDLE ,请点击 “运行” 菜单,选择 “运行模块” 选项来运行你的程序。 +* 如果你使用的是 Ninja ,请单击左侧按钮栏中的 “运行文件” 按钮。 + +![Running code in Ninja-IDE][19] + +任何时间当你想要执行代码,IDE 都会提示你先保存当前正在处理的文件,然后再继续。 + +`print` 关键字会告诉 Python 打印出你在括号和引号中输入的所有文本。 + +但是别高兴地太早,Python 的核心库也就只能访问 `print` 和 `help` 之类的基本关键字、函数等。 + +如果想要使用更多的关键字和函数,你就需要使用 `import` 关键字去加载它们。好了,先在你的 IDLE 或者 Ninja 中新建一个文件,命名为 `pen.py` 。 + +**警告**:不要把你新建的文件命名为 `turtle.py` ,因为 `turtle.py` 是包含了你要控制的 turtle 程序的文件名称,使用 `turtle.py` 作为文件名会让 Python 感到困惑,因为它以为你想要引入你自己的文件。 + +在你新建的文件中输入一下代码,并运行: + +``` +import turtle +``` + +[Turtle][20] 是一个用起来非常有意思的模块. 把这段代码添加到你的文件内: + +``` +turtle.begin_fill() +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.end_fill() +``` + +来看看你可以使用 turtle 模块来绘制出哪些图案。 + +想要清空 turtle 绘制的区域的话,你可以使用 `turtle.clear()` 函数。那你知道 `turtle.color("blue")` 是用来做什么的吗? + +我们来试一下更复杂点的程序: + +``` +import turtle as t +import time + +t.color("blue") +t.begin_fill() + +counter = 0 + +while counter < 4: +    t.forward(100) +    t.left(90) +    counter = counter+1 + +t.end_fill() +time.sleep(2) +``` + +给你个挑战,试试修改代码,让它得到下图所示的结果: + +![Example Python turtle output][21] + +当你完成这段代码后,你就可以继续学习更多有意思的模块了。这个 [入门级骰子游戏][22] 就是个不错的开始。 + +### 保持 Pythonic + +Python 是一门非常有趣的语言,它的模块几乎能实现所有你想要实现的功能。正如你所看到的,Python 入门很容易,只要你对自己有耐心,很快就会发现自己在理解和编写 Python 时能像写汉字一样流畅。你可以多阅读关于 [Python 的文章][23],试着自己编写一些小片段,然后看看 Python 会执行出什么结果。如果想要把 Python 真正融合到你实际工作中,你可以试试 Linux ,Linux 具有在本地可编写脚本的功能,而其他系统却没有。 + +祝你好运,记得保持 Pythonic。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-install-python-windows + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[LiuWenlong](https://github.com/011011100010110101101111) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sethhttps://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://www.python.org/ +[3]: https://opensource.com/article/19/7/get-modular-python-classes +[4]: https://github.com/edniemeyer/weta_python_db +[5]: https://www.python.org/about/success/ilm/ +[6]: https://opensource.com/article/19/7/rgb-cube-python-scribus +[7]: https://opensource.com/article/19/7/ways-get-started-linux +[8]: https://opensource.com/article/17/10/python-101 +[9]: https://www.python.org/downloads/ +[10]: https://opensource.com/sites/default/files/uploads/win-python-install.jpg (Downloading Python on Windows) +[11]: https://opensource.com/sites/default/files/uploads/win-python-path.jpg (Select "Add Python 3 to PATH") +[12]: https://opensource.com/sites/default/files/uploads/win-python-publisher.jpg (Windows UAC) +[13]: https://notepad-plus-plus.org/ +[14]: https://opensource.com/sites/default/files/uploads/idle3.png (IDLE 3 IDE) +[15]: http://docs.python.org/3/using/windows.html +[16]: http://ninja-ide.org/ +[17]: https://opensource.com/sites/default/files/uploads/win-python-ninja.jpg (Ninja-IDE) +[18]: http://ninja-ide.org/downloads/ +[19]: https://opensource.com/sites/default/files/uploads/ninja_run.png (Running code in Ninja-IDE) +[20]: https://opensource.com/life/15/8/python-turtle-graphics +[21]: https://opensource.com/sites/default/files/uploads/win-python-idle-turtle.jpg (Example Python turtle output) +[22]: https://opensource.com/article/17/10/python-101#python-101-dice-game +[23]: https://opensource.com/sitewide-search?search_api_views_fulltext=Python diff --git a/published/202006/20190816 Cockpit and the evolution of the Web User Interface.md b/published/202006/20190816 Cockpit and the evolution of the Web User Interface.md new file mode 100644 index 0000000000..779df7312d --- /dev/null +++ b/published/202006/20190816 Cockpit and the evolution of the Web User Interface.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12324-1.html) +[#]: subject: (Cockpit and the evolution of the Web User Interface) +[#]: via: (https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Cockpit 及其网页用户界面的演变 +====== + +![][1] + +3 年多以前,Fedora 杂志发表了一篇题为《[Cockpit 概览][2]》的文章。从那时起,Cockit 的界面有了一些引人注目的变化。今天的 Cockpit 更加简洁,更大的字体更好地利用了屏幕的空间。 + +本文将介绍它的用户界面的一些变化。还将探讨一些在网页界面中可用的通用工具,以简化那些单调的系统管理员任务。 + +### Cockpit 驾驶舱安装 + +Cockpit 可以使用 `dnf install cockpit` 命令安装。这提供了一个最小的设置,提供了使用该界面所需的基本工具。 + +另一个选择是安装 “Headless Management” 组,这将安装用于扩展 Cockpit 功能的附加包。它包括用于 NetworkManager、软件包、磁盘和 SELinux 管理的扩展。 + +运行以下命令,在启动时启用 Web 服务并打开防火墙端口: + +``` +$ sudo systemctl enable --now cockpit.socket +Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket -> /usr/lib/systemd/system/cockpit.socket + +$ sudo firewall-cmd --permanent --add-service cockpit +success +$ sudo firewall-cmd --reload +success +``` + +### 登录网页界面 + +要访问网页界面,打开你最喜欢的浏览器,在地址栏中输入该服务器的域名或 IP,然后输入服务端口(9090)。由于 Cockpit 使用 HTTPS,安装过程中会创建一个自签证书来加密密码和其他敏感数据。你可以安全地接受这个证书,或者向你的系统管理员或受信任的来源请求 CA 证书。 + +一旦证书被接受,就会出现新改进的登录屏幕。长期使用的用户会注意到用户名和密码字段已被移到顶部。此外,凭证字段后面的白色背景会立即吸引用户的注意力。 + +![][3] + +自上一篇文章后,登录界面增加了一个功能,就是用 `sudo` 权限登录 —— 如果你的账号是 `wheel` 组的成员。勾选 “对于特权任务,重用我的密码” 旁边的方框,就可以提升你的权限。 + +登录界面的另一个版本是连接到同样运行 Cockpit Web 服务的远程服务器的选项。点击 “其他选项” 并输入远程机器的主机名或 IP 地址,从本地浏览器管理它。 + +### 主屏幕视图 + +一开始,我们就会看到基本概述,带有常见的系统信息,这包括机器的品牌和型号、操作系统、系统是否是最新的,等等。 + +![][4] + +点击系统的品牌/型号会显示硬件信息,如 BIOS/固件。它还包括与 `lspci` 中可以看到的组件的详情。 + +![][5] + +点击任何一个选项,右边都会显示该设备的详细信息。例如,“CPU 核心百分比” 选项显示了用户和内核使用了多少 CPU 核心的详细信息。此外,“内存和交换” 图表显示了系统内存的使用量、缓存量和交换分区的活动量。“磁盘 I/O” 和 “网络流量” 图表连到了 Cockpit 的 “存储和网络” 部分。这些内容将在接下来详细探讨系统工具的一篇文章中重新探讨。 + +#### SSH 密钥和认证 + +由于安全是系统管理员的关键因素,Cockpit 现在有了查看机器 MD5 和 SHA256 密钥指纹的选项。点击 “显示指纹” 选项可以显示服务器的 ECDSA、ED25519 和 RSA 指纹密钥。 + +![][6] + +你也可以通过点击右上角的用户名,选择“验证”,添加自己的密钥。点击 “添加密钥”,可以在其他系统上验证该机器。你也可以通过点击右侧的 “X” 按钮,撤销你在 Cockpit Web 服务中的权限。 + +![][7] + +#### 更改主机名和加入域 + +更改主机名可以在主页上一键解决。单击当前显示的主机名,并在“更改主机名”框中输入新名称。最新的功能之一是提供了一个 “简称” 的选项。 + +Cockpit 增加的另一个功能是可以连接到目录服务器。点击 “加入域”,会出现一个弹窗,要求提供域地址或名称、组织单位(可选)和域管理员的凭证。“Domain Membership” 组提供了加入 LDAP 服务器所需的所有包,包括 FreeIPA,以及流行的 Active Directory。 + +要退出域,请点击域名,然后点击 “离开域”。将会出现一个警告,解释一旦系统不再在域上将会发生的变化。要确认,点击红色的 “离开域” 按钮。 + +![][8] + +#### 配置 NTP 和系统日期和时间 + +使用命令行和编辑配置文件绝对可以完成最大限度的调整。然而,有些时候,一些更直接的方法就足够了。通过 Cockpit,你可以选择手动设置或使用 NTP 自动设置系统的日期和时间。一旦同步,右边的信息图标就会由红色变成蓝色。如果你手动设置日期和时间,该图标将消失。 + +要更改时区,请输入洲,下面会弹出城市列表。 + +![][9] + +#### 关机和重启 + +你可以在 Cockpit 的主屏幕上轻松关闭和重启服务器。你也可以延迟关机/重启,并发送消息警告用户。 + +![][10] + +#### 设置性能配置文件 + +如果安装了 `tuned` 和 `tuned-utils` 包,可以在主屏幕上更改性能配置文件。默认情况下,它被设置为推荐的配置文件。然而,如果服务器的用途需要更多的性能,我们可以在 Cockpit 中更改配置文件以满足这些需求。 + +![][11] + +### 网页版终端控制台 + +一个 Linux 系统管理员的工具箱如果不能访问终端,将毫无用处。终端使得管理员可以对服务器进行微调,而不仅仅是 Cockpit 中的内容。随着主题功能的加入,管理员可以根据自己的喜好快速调整文字和背景颜色。 + +另外,如果你错输入了 `exit` 命令,点击右上角的 “重置” 按钮,会提供一个闪烁着光标的新屏幕。 + +![][12] + +### 添加远程服务器和仪表板布局 + +“Headless Management” 组包括了仪表盘模块(`cockpit-dashboard`)。它以实时图表的形式提供了 CPU、内存、网络和磁盘性能的概览。远程服务器也可以通过同一界面进行添加和管理。 + +例如,要在仪表盘中添加远程计算机,请单击 “+” 按钮。输入服务器的名称或 IP 地址,并选择你要的颜色。这有助于你在图中区分服务器的统计数据。要在服务器之间进行切换,请点击主机名称(如下面的屏幕动画所示)。要从列表中删除一个服务器,点击勾选标记图标,然后点击红色垃圾桶图标。下面的例子演示了 Cockpit 如何管理一台名为 `server02.local.lan` 的远程机器。 + +![][13] + +### 文档和寻找帮助 + +一如既往,手册页是查找文档的好地方。在命令行结果中进行简单搜索即可找到与使用和配置该 Web 服务的不同方面有关的页面。 + +``` +$ man -k cockpit +cockpit (1) - Cockpit +cockpit-bridge (1) - Cockpit Host Bridge +cockpit-desktop (1) - Cockpit Desktop integration +cockpit-ws (8) - Cockpit web service +cockpit.conf (5) - Cockpit configuration file +``` + +Fedora 仓库中也有一个名为 `cockpit-doc` 的软件包。这个软件包的描述是最好的解释。 + +> 《Cockpit 部署和开发者指南》向系统管理员展示了如何在他们的机器上部署 Cockpit,并帮助开发者嵌入或扩展 Cockpit。 + +更多文档请访问 。 + +### 结论 + +本文只涉及 Cockpit 中的一些主要功能。管理存储设备、网络、用户账户和软件控制将在下一篇文章中介绍。此外,可选的扩展,如 389 目录服务,以及用于处理 Fedora Silverblue 中的软件包的`cockpit-ostree` 模块。 + +随着越来越多的用户采用 Cockpit,可选的功能会继续增加。这个界面对于想要一个轻量级界面来控制服务器的管理员来说是非常理想的。 + +你对 Cockpit 有什么看法?在下面的评论中分享你的经验和想法。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ + +作者:[Shaun Assam][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-816x345.jpg +[2]: https://fedoramagazine.org/cockpit-overview/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-login-screen.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-home-screen.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-system-info.gif +[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-ssh-key-fingerprints.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-authentication.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-hostname-domain.gif +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-date-time.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-power-options.gif +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-tuned.gif +[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-terminal.gif +[13]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-add-remote-servers.gif diff --git a/published/202006/20191125 My top 5 Ansible modules.md b/published/202006/20191125 My top 5 Ansible modules.md new file mode 100644 index 0000000000..f114d6ca59 --- /dev/null +++ b/published/202006/20191125 My top 5 Ansible modules.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12304-1.html) +[#]: subject: (My top 5 Ansible modules) +[#]: via: (https://opensource.com/article/19/11/ansible-modules) +[#]: author: (Mark Phillips https://opensource.com/users/markp) + +我最喜欢用的 5 个 Ansible 模块 +====== + +> 了解如何通过这些 Ansible 模块实现几乎任何事情。 + +![](https://img.linux.net.cn/data/attachment/album/202006/10/214614z2jv4zvet5kw322o.jpg) + +在我成长的时候,我爷爷在他的花园里有一个棚子。他经常会花几个小时在那里制作和修复东西。这是在我们有互联网之前的事情,所以我花了很多时间看他在那个棚子里创造东西。虽然棚子里有很多工具,从钻头到车床到电器配件,还有很多东西我至今都无法辨认,但他使用的只是他手头的一小部分。然而,他能做到的事情似乎永远没有极限。 + +我之所以告诉你这个故事,是因为我觉得我的职业生涯是在一个隐喻的棚子里度过的。计算机也是如此多的工具,都在一个狭小(虚拟?)的空间里。而工具棚中又有工具棚 —— 我最喜欢的是 Ansible。最近的 2.9 版本有 3,681 个模块! **3,681 个啊!**当我在 2013 年夏天第一次开始使用 Ansible 时,1.2.1 版本只有 113 个模块,然而,正如[我当时写的][2],我仍然可以实现任何我想象到的东西。 + +模块是 Ansible 的支柱,是让重任轻装上阵的齿轮。它们被设计为做好一项工作,从而实现了 [Unix 哲学][3]。我们就是这样来把这么多的模块捆绑在一起,作为乐团的指挥,Ansible 现在有很多乐器可以听从它的指挥。 + +回顾一下我多年来的 Ansible 剧本和角色的 Git 仓库,我发现我只用了 35 个模块。这个小的子集被用来构建大型基础设施。不过,我想知道如果用一个更小的子集可以实现什么?当我回顾这 35 个模块时,我在思考,我能否只用 5 个模块就能达到同样的效果。因此,以下是我最喜欢的五个模块,顺序无关。 + +### 5. authorized_key + +SSH 是 Ansible 的核心,至少对于除了 Windows 以外的几乎所有其他功能都是如此。在 Ansible 中高效使用 SSH 的关键(没有双关语)是……[密钥][5]!顺便提一下,你可以用 SSH 密钥为安全性做很多非常酷的事情。值得仔细阅读 [sshd 手册页][6]中的 “authorized_keys” 部分。如果你需要精细的用户访问控制,管理 SSH 密钥可能会变得很费力,尽管我可以用接下来的两个我最爱的模块中的任何一个,但我更喜欢使用 [authorized_key][4] 这个模块,因为它[可以通过变量轻松管理][7]。 + +### 4. file + +除了显而易见的将文件放置在某个地方的功能外,[file][8] 模块还可以设置所有权和权限。我想说的是,这样一个模块就能带来很多的好处。很大一部分安全问题也与设置权限有关,所以 [file][8] 模块和 [authorized_key][4] 可以很好地配合在一起使用。 + +### 3. template + +操作文件内容的方法太多了,我看到很多人都在使用 [lineinfile][10]。我自己也用它做过小任务。但是,[template][9] 模块就清晰多了,因为你维护了整个文件的上下文。我更喜欢以任何人都可以*轻松*理解的方式编写 Ansible 的内容 —— 对我而言,这意味着容易理解正在发生的事情。[template][9] 的使用意味着能够看到你正在放置内容的整个文件、全部你正在改变的变量。 + +### 2. uri + +当前发布版中的许多模块利用 Ansible 作为编排工具。它们与另一个服务对话,而不是做一些具体的事情,比如把一个文件放到一个地方。通常,这种对话也是通过 HTTP 进行的。在许多这样的模块出现之前,你*可以*直接使用 [uri][11] 模块对 API 进行编程。它是一个强大的访问工具,可以使你能够做很多事情。在我的 Ansible 虚拟棚子里,我不会少了它。 + +### 1. shell + +这是我们工具包里的王牌、瑞士军刀。如果你为如何控制其他东西而非常苦恼,别说,说就是 [shell][12]。有人会说,我们这样说是让 Ansible 成为了 Bash 脚本 —— 但是,我想说的是,这还是有点好处的,因为可以在你的剧本和角色中使用 `name` 参数记录下每一步。对我来说,这就像一个很大的奖励一样。早在我还在做咨询的时候,我曾经帮助一个数据库管理员(DBA)迁移到 Ansible。这位 DBA 并不喜欢改变,对改变工作方法也是推三阻四。于是,为了简化迁移到 Ansible 方式,我们在 Ansible 中使用 [shell][12] 模块调用了一些现有的数据库管理脚本。并在任务中附带了翔实的 `name` 声明。 + +通过这五个模块,你可以实现很多事情。是的,为完成特定任务而设计的模块会让你的生活更加轻松。但是,借助简单的工程设计,你几乎可以事半功倍。Ansible 开发者 Brian Coca 是这方面的大师,[他的技巧和窍门讲座][13]总是值得一看。 + +* * * + +你觉得我喜欢的五大模块怎么样?如果你也必须限制在这么多模块,你会选择哪五个,为什么?在下面的评论中告诉我吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/ansible-modules + +作者:[Mark Phillips][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/markp +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mandelbrot_set.png?itok=bmPc0np5 +[2]: http://probably.co.uk/post/puppet-vs-chef-vs-ansible/ +[3]: https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well +[4]: https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html +[5]: https://linux.die.net/man/1/ssh-keygen +[6]: https://linux.die.net/man/8/sshd +[7]: https://github.com/phips/ansible-demos/blob/3bf59df1eb2390b31b5c42333197e2fbb7fec93f/roles/ansible-users/tasks/main.yml#L35 +[8]: https://docs.ansible.com/ansible/latest/modules/file_module.html +[9]: https://docs.ansible.com/ansible/latest/modules/template_module.html +[10]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html +[11]: https://docs.ansible.com/ansible/latest/modules/uri_module.html +[12]: https://docs.ansible.com/ansible/latest/modules/shell_module.html +[13]: https://www.ansible.com/ansible-tips-and-tricks diff --git a/published/202006/20200304 Getting started with the Gutenberg editor in Drupal.md b/published/202006/20200304 Getting started with the Gutenberg editor in Drupal.md new file mode 100644 index 0000000000..55ad82e25a --- /dev/null +++ b/published/202006/20200304 Getting started with the Gutenberg editor in Drupal.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12273-1.html) +[#]: subject: (Getting started with the Gutenberg editor in Drupal) +[#]: via: (https://opensource.com/article/20/3/gutenberg-editor-drupal) +[#]: author: (MaciejLukianski https://opensource.com/users/maciejlukianski) + +Drupal 中的 Gutenberg 编辑器入门 +====== + +> 了解如何在 Drupal 中集成使用 WordPress 中流行的所见即所得编辑器。 + +![Text editor on a browser, in blue][1] + +自 2017 年以来,WordPress 的 [Gutenberg][2] 插件中的所见即所得编辑器就真的很不错。但是,Drupal 社区尚未就内容管理系统(CMS)编辑体验的最佳方法达成共识。但在社区的大量努力下,出现了一个强有力的新选择,将 [Gutenberg 与 Drupal 集成在一起][3]。 + +以前,Drupal 8 中有两种主要的内容创建方法: + +* 在[基于段落的方法][4]中,内容是由称为段落的实体组合而成。目前,大约有 100,000 个网站使用“段落”(Paragraphs)模块(根据 Drupal 说法)。 +* [Layout-Builder 方法][5]使用 Drupal 8.5 附带的编辑工具。它仍然在改进,但是它是下一个强有力的竞争者,因为它确实与 Drupal 内核很好地集成在一起。由于 Layout-Builder 是 Drupal 的一部分,因此无法获得使用情况的统计信息。 + +在 2018 年底,由 Fronkom(一家专注于开源解决方案的挪威数字机构)领导的 Drupal 社区将 WordPress Gutenberg 项目作为贡献模块移植到了 Drupal 中。让我们看一下 Gutenberg 在 Drupal 中的工作方式(包括一些很酷的 Drupal 特有的集成)。 + +### 安装 + +安装 [Gutenberg 模块][6]与安装任何 Drupal 模块一样简单,并且有良好的[安装文档][7]。 + +### 配置 + +Gutenberg 已集成到 Drupal 的默认内容实体创建工作流中。你可以将其用于你选择的任何内容类型,前提是内容类型至少有一个文本区域字段,它是 Gutenberg 编辑器输出的位置。 + +要在 Drupal 中的内容类型启用 Gutenberg 项目,你必须进入设置:“结构 -> 内容类型”,并且,从要你想使用 Gutenberg 的内容类型旁边的下拉框中单击“编辑”。 + +![Drupal settings][8] + +在出现的窗口中,向下滚动并选择左侧的“Gutenberg 体验”选项卡,你可以在其中找到下面描述的设置。选择“启用 Gutenberg 体验”。 + +![Drupal Gutenberg settings][9] + +#### 模板 + +这是 WordPress 开箱即用的很酷的功能之一。它能让你用 JSON 结构定义新页面模板。它将使用虚拟占位符内容预填充所有新创建的文章,这将有助于编辑者正确地构造内容。在上面的截图中,我添加了一个标题和一个段落。请注意,必须转义任何双引号。 + +#### 模板锁 + +此设置允许你定义是否允许用户删除占位符内容,添加新块或仅编辑现有的预填充内容。 + +#### 允许的 Gutenberg 和 Drupal 块 + +这是 Gutenberg Drupal 侧的另一个超酷功能。Drupal 允许用户创建各种类型的块来设计页面。例如,你可以创建一个块,其中包含五个最新博客的列表、最新评论或用于收集用户电子邮件的表单。 + +Gutenberg 与 Drupal 的深度集成允许用户在编辑时选择哪些 Drupal 块可供用户使用(例如,限制嵌入 YouTube),并将块用作内联内容。这是一个非常方便的功能,允许对用户体验进行精细控制。 + +在全新安装的 Drupal 中,没有太多的选择,但站点通常有许多提供各种功能的块。在下面的截图中,选择了“搜索表单”的 Drupal 块。 + +![Drupal Gutenberg blocks][10] + +完成配置后,点击“保存内容类型”。 + +### 使用 Drupal Gutenberg 发布内容 + +启用 Gutenberg 内容类型后,它将接管大部分编辑体验。 + +![Drupal Gutenberg content screen][11] + +在主窗口中,你可以看到我在上面的模板配置中添加的虚拟占位符内容。 + +#### 特定于 Drupal 的选项 + +在右侧,Drupal 提供了一些字段和设置。例如,“标题” 字段是 Drupal 中所需的单独字段,因此它不在主页面上。 + +在“标题”下面,根据在 Drupal 中安装的模块和设置的选项,其他设置可能有所不同。你可以看到“修订日志消息”、“菜单设置”、“评论设置”以及添加“URL 别名”。 + +通常,Drupal 内容类型由多个文本字段组成,如标记、类别、复选框、图像字段等。当你启用 Gutenberg 内容类型时,这些附加字段可在“更多设置”选项卡中提供。 + +你现在可以添加内容 —— 它的工作方式与 WordPress Gutenberg 中的相同,并有额外的添加 Drupal 块的选项。 + +在下面的截图中,你可以看到当我添加一些文本替换占位符文本、来自 Drupal 的搜索块、标题、标记和自定义 URL 别名后发生的情况。 + +![Drupal Gutenberg entering text][12] + +点击“保存”后,你的内容将发布。 + +![Drupal Gutenberg output][13] + +就是这样,它工作良好。 + +### 共同工作以获得更好的软件体验 + +Drupal 中的 Gutenberg 工作良好。这是一个可供选择的方式,允许编辑者控制网站的外观,直至最细微的细节。它的采用率正在增长,截至本文撰写时,已有 1,000 多个安装,每月有 50 个新安装。Drupal 集成添加了其他很酷的功能,如细粒度权限、占位符内容,以及内联包含 Drupal 块的功能,这些功能在 WordPress 插件中没有。 + +很高兴看到两个独立项目的社区共同努力实现为人们提供更好的软件的共同目标。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/gutenberg-editor-drupal + +作者:[MaciejLukianski][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/maciejlukianski +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://wordpress.org/plugins/gutenberg/ +[3]: https://drupalgutenberg.org/ +[4]: https://www.droptica.com/blog/flexible-and-easy-content-creation-drupal-paragraphs-module/ +[5]: https://www.droptica.com/blog/layout-builder-building-drupal-8-layouts/ +[6]: https://www.drupal.org/project/gutenberg +[7]: https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules +[8]: https://opensource.com/sites/default/files/uploads/gutenberg_edit.png (Drupal settings) +[9]: https://opensource.com/sites/default/files/uploads/gutenberg_settings.png (Drupal Gutenberg settings) +[10]: https://opensource.com/sites/default/files/uploads/gutenberg_blocks.png (Drupal Gutenberg blocks) +[11]: https://opensource.com/sites/default/files/uploads/gutenberg_contentwindow.png (Drupal Gutenberg content screen) +[12]: https://opensource.com/sites/default/files/uploads/gutenberg_entry.png (Drupal Gutenberg entering text) +[13]: https://opensource.com/sites/default/files/uploads/gutenberg-demo.png (Drupal Gutenberg output) diff --git a/published/202006/20200506 6 open source alternatives to Wunderlist.md b/published/202006/20200506 6 open source alternatives to Wunderlist.md new file mode 100644 index 0000000000..e79d80ac5d --- /dev/null +++ b/published/202006/20200506 6 open source alternatives to Wunderlist.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12314-1.html) +[#]: subject: (6 open source alternatives to Wunderlist) +[#]: via: (https://opensource.com/article/20/5/alternatives-list) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +6 个开源的奇妙清单(Wunderlist)替代品 +====== + +> 喜欢列表?看看这个便捷的开源应用程序列表,以管理你所有的列表! + +![](https://img.linux.net.cn/data/attachment/album/202006/14/142722a639gqqrgg7x6hb5.jpg) + +奇妙清单(Wunderlist)是一款清单应用,受到很多人的喜爱,但从 2020 年 5 月 6 日起,它就永远停止了。它的网站鼓励现有用户下载并使用“微软待办”来代替它。这很诱人,因为它可以轻松导入你多年来制作的所有这些列表。不过话又说回来,也许这是个机会,可以“近藤麻理惠”一下这些列表,并削减一些事务。(你真的需要 30 个列表吗?很显然,我觉得我需要,所以我不做评判。) + +我有各种各样的清单,从“2020 年花园的植物”到“给丈夫的礼物”。有些是清单,有些是待办事项清单,有些是为了清单而清单。 + +对我和我丈夫来说,最有用的清单是我们共享的杂货清单。我们都有手机上的应用程序,我们都把东西添加到列表中,但在他去购物之前,我们分别在手机上审查它(是的,你没看错),他把东西放进购物车时,他就会勾掉它。这让整个过程变得出奇的高效,我想我们节省了一些钱,因为我们喜欢坚持按清单购物。 + +虽然奇妙清单的用户很喜欢它,但它并不是完全独一无二的。还有无数的列表应用。对于奇妙清单,我特别喜欢它将简洁性和设计感结合在一起,而且它成功实现了一些有用的功能,比如与他人分享和协作,列表的动态复选框,以及在移动和网页界面上的良好用户体验。我也很喜欢用它来做一个不“活跃”文档的列表:一个我不会每周都回顾或定期进展的列表,就像我用来进行头脑风暴的许多列表一样(包括我一直想写的小说...)。 + +从这些年来我们发表的许多精彩文章中,我整理了一系列奇妙清单的开源替代方案,从简单的任务管理和待办事项清单到复杂的笔记记录和流程管理,这些列表工具可能会满足你的需求。或者,如果你是那个在丢得到处都是的纸条和便签上书写任务和备注的人,这可能是尝试这些数字工具之一的好时机。 + +### Tasks:可与 OwnCloud 配合 + +Tasks 是一款自由开源的应用,你可以从 [F-droid][2] 安装。Tasks 是一款只适用于手机的应用,但它可以同步到各种地方,非常灵活。你可以将你的列表保存到 NextCloud 或 OwnCloud、Google Tasks、Apple Reminders 以及几乎所有你有账户的 CalDAV 服务器上。 + +Tasks 的默认视图是每日视图,所以你输入的任何任务都被假定为从今天开始的任务。如果你像我一样,想维护几个不同的列表,你可以用标签来实现。当你创建一个标签时,你就为任务创建了一个类别。你可以为它指定一种颜色和一个图标,这样每个任务列表都是独一无二的。 + +这需要一点时间来适应,但标签有很多优点。因为所有的任务都是有标签的,你可以通过点击你想过滤的标签来查看任务组,但你也可以按天甚至按地点过滤。这意味着,当你去采购杂货时,你的杂货列表会成为活跃的默认列表,而当你回到家时,你的日常生活列表又会成为活跃的列表。 + +通过将你的数据同步到你的一个在线账户,你可以与亲人、合作者和同事分享列表。 + +另一个伟大的功能是,如果你每天早上上班时都有相同的任务,或者每周杂货清单中有 20 个相同的项目,你可以创建定期重复的任务。 + +评测者:Seth Kenlon + +![Screenshot of Tasks interface][3] + +### OpenTasks:适于长列表 + +[OpenTasks][4] 是一款优秀的任务管理工具,可以创建带有各种设置的个人任务。它在创建任务时支持多种字段,从基本的东西,如名称和描述,到更复杂的项目,如选择任务是私人、公共还是机密。OpenTasks 与其他替代品最大的不同之处在于它在应用的主屏幕上使用了选项卡。这些选项卡可以让你快速看到到期的任务、即将开始的任务、按优先级排序的任务,以及按当前完成进度排序的任务。许多其他应用程序支持做这样的事情,但 OpenTasks 很快就能轻松访问这些列表。 + +[阅读完整的 OpenTasks 评测][5],作者:Joshua Allen Holm。 + +![OpenTasks in Google Play store][6] + +### Mirakel:嵌套列表的绝佳之选 + +[Mirakel][7] 是一款任务管理应用,它拥有现代化的用户界面,并支持你在这样一款程序中可能想要的几乎所有格式。Mirakel 在基础层面上支持多个被称为“元列表”的列表。创建一个单独的任务有大量的选项,有截止日期、提醒、进度跟踪、标签、备注、子任务和文件附件,所有这些都构成了任务条目的一部分。 + +[阅读完整的 Mirakel 评测][5],作者:Joshua Allen Holm。 + +![Screenshot from website of Mirakel app][8] + +### Todo:简单有效,随处可用 + +[Todo.txt][9] 是我不断反复推荐的两个待办事项和任务管理应用之一(另一个是 Org 模式)。而让我不断推荐的原因是,它简单、便携、易懂,而且有很多很棒的附加组件,即使一台机器有这个程序而其他机器上没有,也不会破坏它。而且由于它是一个 Bash shell 脚本,我从来没有发现不支持它的系统。阅读更多关于[如何安装和使用 Todo.txt][10]。 + +[阅读完整的 todo.txt 评测][10],作者:Kevin Sonney。 + +![Drop-down menu for Todo.txt][11] + +### Joplin:最佳私人列表 + +[Joplin][12] 是一个 NodeJS 应用程序,它可以在本地运行和存储信息,允许你加密任务,并支持多种同步方法。Joplin 可以作为控制台或图形应用程序在 Windows、Mac 和 Linux 上运行。Joplin 还拥有 Android 和 iOS 的移动应用,这意味着你的笔记随处可用,而不需要大费周章。Joplin 甚至允许你用 Markdown、HTML 或纯文本来格式化你的笔记。 + +[阅读完整的 Joplin 评测][13],作者:Kevin Sonney。 + +![Joplin graphical version ][14] + +### CherryTree:最好的 Evernote / OneNote / Keep 替代品 + +[CherryTree][15] 是一个 GPLv3 许可的应用程序,它以节点的形式组织信息。每个节点都可以有子节点,让你轻松组织你的列表和思想。而且,子节点可以有自己的子节点,具有独立的属性。 + +[阅读完整的 CherryTree 评测][16],作者:Ben Cotton。 + +![CherryTree's hierarchical note layout][17] + +### 附赠:Wekan,给看板粉丝 + +看板kanban是当今敏捷流程的主流。我们中的许多人(包括我自己)不仅用它们来组织我们的工作,还用它们来组织我们的个人生活。我认识一些艺术家,他们使用 Trello 这样的应用程序来跟踪他们的委托清单,以及正在进行和已经完成的工作。但这些应用往往与工作账户或商业服务挂钩。让我们看看 [Wekan][18],这是一个开源的看板,你可以在本地或你选择的服务上运行。Wekan 提供了与其他看板应用相同的功能,比如创建面板、列表、泳道和卡片,在列表之间拖放,分配给用户,给卡片贴标签,以及做几乎所有你在现代看板中期待的事情。 + +[阅读完整的 Wekan 评测][19],作者:Kevin Sonney。 + +![Wekan kanban board][20] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/alternatives-list + +作者:[Jen Wike Huger][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://f-droid.org/en/packages/org.tasks/ +[3]: https://opensource.com/sites/default/files/uploads/screenshot_tasks_resized.jpg (Screenshot of Tasks interface) +[4]: https://play.google.com/store/apps/details?id=org.dmfs.tasks +[5]: https://opensource.com/article/17/1/task-management-time-tracking-android +[6]: https://opensource.com/sites/default/files/uploads/opentasks_rezied.jpg (OpenTasks in Google Play store) +[7]: https://mirakel.azapps.de/ +[8]: https://opensource.com/sites/default/files/uploads/mirakel_web_resized.jpg (Screenshot from website of Mirakel app) +[9]: http://todotxt.org/ +[10]: https://linux.cn/article-11835-1.html +[11]: https://opensource.com/sites/default/files/uploads/todo.txtmenu_3.png (Drop-down menu for Todo.txt) +[12]: https://joplin.cozic.net/ +[13]: https://linux.cn/article-10476-1.html +[14]: https://opensource.com/sites/default/files/uploads/joplin-1.png (Joplin graphical version ) +[15]: https://www.giuspen.com/cherrytree/ +[16]: https://opensource.com/article/19/5/cherrytree-notetaking +[17]: https://opensource.com/sites/default/files/uploads/cherrytree.png (CherryTree's hierarchical note layout) +[18]: https://wekan.github.io/ +[19]: https://linux.cn/article-10454-1.html +[20]: https://opensource.com/sites/default/files/uploads/wekan-board.png (Wekan kanban board) diff --git a/published/202006/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md b/published/202006/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md new file mode 100644 index 0000000000..322e26fa60 --- /dev/null +++ b/published/202006/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12316-1.html) +[#]: subject: (Ubuntu Cinnamon Remix 20.04 Review: The Perfect Blend of Ubuntu With Cinnamon) +[#]: via: (https://itsfoss.com/ubuntu-cinnamon-remix-review/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Ubuntu Remix Cinnamon 20.04 评测:Ubuntu 与 Cinnamon 的完美融合 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/15/113226uq8ohzycrrc52q52.jpeg) + +推出于 2011 年的 GNOME 3,其 GNOME Shell 迎来了社区的赞扬的同时,也招致了一些人的反对。很多用户和开发者都很喜欢原来的 GNOME 界面,以至于有几个小组复刻了它,其中的一个小组 —— Linux Mint 团队创建了 [Cinnamon 桌面环境][1]。 + +Cinnamon 桌面成为了 Linux Mint 的标志型产品。多年来,Cinnamon 一直是 [Linux Mint][2] 的代名词。在过去的几年里,随着 Cinnamon 的普及,这种情况略有改变。现在其他发行版也开始提供 Cinnamon 桌面环境,[Manjaro][3] 就是这样一个例子。 + +几个月前,我们向大家介绍了一个[新 Ubuntu 变体][4],它提供了开箱即用的 Cinnamon 桌面体验,今天就让我们来深入了解一下 [Ubuntu Cinnamon Remix][5]。 + +### 为什么是 Ubuntu Cinnamon Remix 而不是 Linux Mint? + +的确,Linux Mint 是基于 Ubuntu 的,很多 Linux Mint 的用户都会有这样的疑问:既然 Linux Mint 已经如此成熟,而且用户体验也大致相同,那么换成 Ubuntu 有什么意义吗? + +Ubuntu Cinnamon Remix 与 Linux Mint 有很多小的区别,但有一个关键的区别是 Linux 爱好者不能忽视的。 + +Linux Mint 是基于 “LTS”(长期支持)版本的 Ubuntu,这意味着它一直落后于 Canonical 的 6 个月的更新节奏。Ubuntu Cinnamon Remix 则可以得益于较新的内核以及其他 6 个月周期内的功能升级和较新的软件。 + +另一个关键的区别是,Ubuntu Cinnamon Remix 将 “继承” [Snap 支持][6],而 Linux Mint 则拥抱 [FlatPak][7]。Ubuntu Cinnamon Remix 使用 Ubuntu 软件中心而不是 Mint 软件管理器。 + +我是 Cinnamon 的忠实粉丝,所以我选择了评测这款 Ubuntu 和 Cinnamon 的混合版,在这里我分享一下我的体验。 + +### 体验 Ubuntu Cinnamon Remix + +只要有机会,我总会提到 [Calamares 安装程序][8]有多快,感谢 Ubuntu Cinnamon Remix 团队如此选择。 + +![Calamares Installer][9] + +新安装的 Ubuntu Cinnamon Remix 会消耗大约 750 MB 的内存。这与 Linux Mint Cinnamon 非常相似。 + +![An idle Cinnamon takes 750 MB of RAM][10] + +美丽的 [Kimmo 主题][11]和橙色调的 Ubuntu 壁纸也给我留下了深刻的印象,看来这是一个非常细致的努力的结果。 + +![Ubuntu Cinammon Remix 20.04 Desktop][12] + +#### 足够让你开始的工具 + +和其他 Ubuntu 发行版一样,Ubuntu Cinnamon Remix 也包含了一些重要的生产力工具,下面是其中一些: + +* 火狐浏览器 +* Thunderbird - 电子邮件客户端 +* LibreOffice套件 +* Celluloid - 多媒体播放器 +* [GIMP][13] - 图像处理软件 +* Synaptic 软件包管理器 +* Gnome 软件中心 +* [Gparted][14] - 分区管理器 + +使用 Ubuntu Cinnamon Remix 作为我的主要平台已经有几天了,它满足了我的高期望。Ubuntu 稳定如磐石,速度非常快,在日常工作中我没有遇到任何问题。 + +#### 给 Linux Mint 爱好者的 Ubuntu + +你是否热衷于 Ubuntu Cinnamon,却习惯了 Linux Mint 主题?点击下面的内容,看看如何获得一个完整的 Linux Mint 主题包,以及如何配置它来保持 Ubuntu 的传统。 + +给 Ubuntu Cinnamon Remix 以真正的 Mint 感受: + +首先你必须下载并解压以下内容,通过终端很容易完成。 + +获取 Linux Mint-X 图标包: + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-x-icons/mint-x-icons_1.5.5_all.deb +``` + +获取 Linux Mint-Y 图标包: + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-y-icons/mint-y-icons_1.3.9_all.deb +``` + +获取 Linux Mint 主题: + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-themes/mint-themes_1.8.4_all.deb +``` + +安装下载的软件包: + +``` +sudo dpkg -i ./mint-x-icons_1.5.5_all.deb ./mint-y-icons_1.3.9_all.deb ./mint-themes_1.8.4_all.deb +``` + +完成后,点击左下角的菜单按钮,输入 “themes”。你也可以在系统设置中找到“主题”功能。 + +![Accessing Themes][15] + +打开后更换 kimmo 图标和主题,如下图所示。Linux Mint 默认的“绿色”是普通的 Mint-Y,而橙色是 Ubuntu 的最佳选择。 + +![Linux Mint Theme Settings][16] + +#### 为 Cinnamon 迷们准备的美食 + +让我们承认吧,审美很重要。Cinnamon 拥有简洁优雅的外观、易于阅读的字体和漂亮的色彩对比主题。Cinnamon 提供了一个整洁的桌面,只需进入系统设置下的桌面菜单,即可轻松配置桌面图标。你也可以选择桌面图标只显示在主显示器上、只显示在副显示器上,或者同时显示在两个显示器上。这也适用于超过两台显示器的设置。 + +![Ubuntu Cinnamon Remix Desklets][17] + +桌面组件和小程序是一种小型的、单一用途的应用程序,可以分别添加到你的桌面或面板上。在众多的应用程序中,最常用的是 CPU 或资源监控器、天气小程序、便签和日历。 + +Cinnamon 控制中心集中提供许多桌面配置选项。通过访问 “主题” 部分,你可以选择桌面基本方案和图标、窗口边框、鼠标指针和控件外观。字体对桌面的整体外观有很大的影响,而 Cinnamon 让改变字体比以往任何时候都要容易。 + +Cinnamon 控制中心配置对新用户来说也足够简单,相比之下,KDE Plasma 会因为大量的配置选项而导致新用户感到困惑。 + +![][18] + +Cinnamon 面板包含用于启动程序的菜单、基本的系统托盘和应用程序选择器。面板的配置很简单,添加新的程序启动器只需在主菜单中找到你要添加的程序,右击图标,选择 “添加到面板” 即可。你也可以将启动程序图标添加到桌面,以及 Cinnamon 的 “收藏夹” 启动栏中。如果你不喜欢面板上图标的顺序,只需在面板栏上点击右键,进入面板的 “编辑” 模式,重新排列图标即可。 + +### 结论 + +无论你是决定给你的桌面 “加点料”,还是考虑从 [Windows 迁移到 Linux][19],Cinnamon 社区都为你制作了大量的香料。 + +传统而又优雅,可定制而又简单,Ubuntu Cinnamon Remix 是一个有趣的项目,前途无量,对于喜欢 Ubuntu 的 Cinnamon 桌面爱好者来说,这可能是一个不二之选。 + +你觉得 Ubuntu Cinnamon Remix 怎么样?你已经使用过它了吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-cinnamon-remix-review/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) +[2]: https://www.linuxmint.com/ +[3]: https://manjaro.org/ +[4]: https://itsfoss.com/ubuntudde/ +[5]: https://ubuntucinnamon.org/ +[6]: https://snapcraft.io/ +[7]: https://flatpak.org/ +[8]: https://calamares.io/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/Calamares-Installer.png?resize=800%2C426&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/htop-running-on-Ubuntu-Cinnamon-Remix-20.04.png?ssl=1 +[11]: https://github.com/Ubuntu-Cinnamon-Remix/kimmo-gtk-theme +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Ubuntu-Cinammon-Remix-20.04-desktop.png?resize=800%2C450&ssl=1 +[13]: https://itsfoss.com/gimp-2-10-release/ +[14]: https://itsfoss.com/gparted/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/accessing-themes.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/Linux-Mint-theme-settings.png?ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-cinnamon-remix-desklets.jpg?fit=800%2C450&ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-cinnamon-control.jpg?fit=800%2C450&ssl=1 +[19]: https://itsfoss.com/windows-like-linux-distributions/ diff --git a/published/202006/20200511 How to manage network services with firewall-cmd.md b/published/202006/20200511 How to manage network services with firewall-cmd.md new file mode 100644 index 0000000000..6fcbfc11b9 --- /dev/null +++ b/published/202006/20200511 How to manage network services with firewall-cmd.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12276-1.html) +[#]: subject: (How to manage network services with firewall-cmd) +[#]: via: (https://fedoramagazine.org/how-to-manage-network-services-with-firewall-cmd/) +[#]: author: (dan01 https://fedoramagazine.org/author/dan01/) + +如何使用 firewall-cmd 管理网络服务 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/03/090806hcmc9cxcbbcuccbe.jpg) + +在上一篇文章中,我们探讨了如何在 Fedora 中[用命令行控制防火墙][2]。 + +现在你将看到如何“添加”、“删除”和“列出”服务、协议和端口,以便“阻止”或“允许”它们。 + +### 简短回顾 + +首先,最好检查一下防火墙的*状态*,看它是否正在运行。如我们先前所学,你可以使用状态选项(`firewall-cmd ‐‐state`)来得到。 + +下一步是获取网络接口适用的zone。例如,我使用的桌面有两个网络接口:一个*物理*接口(`enp0s3`),代表我实际的*网卡*,和*虚拟*接口(`virbr0`),它由 KVM 等虚拟化软件使用。要查看哪些域处于活动状态,请运行 `firewall-cmd ‐‐get-active-zones`。 + +现在,你知道了你感兴趣的域,可以使用 `firewall-cmd ‐‐info-zone=FedoraWorkstation` 这样的命令列出该域的规则。 + +### 读取区域信息 + +要显示*特定域*的信息,请运行 `firewall-cmd ‐‐zone=ZoneName ‐‐list-all`,或使用以下命令显示默认域的信息: + +``` +[dan@localhost ~]$ firewall-cmd --list-all +FedoraWorkstation (active) +target: default +icmp-block-inversion: no +interfaces: enp0s3 +sources: +services: dhcpv6-client mdns samba-client ssh +ports: 1025-65535/udp 1025-65535/tcp +protocols: +masquerade: no +forward-ports: +source-ports: +icmp-blocks: +rich rules: +``` + +现在,让我们查看输出。第一行表明以下信息关联的域以及该域当前是否在使用中。 + +`target: default`:告诉我们这是默认域。可以通过 `‐‐set-default-zone=ZoneName` 和 `‐‐get-default-zone` 设置或获取。 + +`icmp-block-inversion` 表明是否阻止 [ICMP][3] 请求。例如,如果机器响应来自网络上其他机器的 ping 请求。 + +`interfaces` 字段显示接受此域的所有接口。 + +### 处理服务、端口和协议 + +现在,重点关注 `services`、`ports` 和 `protocols` 所在行。默认情况下,防火墙将阻止所有端口、服务和协议,而只允许列出的。 + +在这里,你可以看到允许的服务是非常基本的客户端服务。例如,访问网络上的共享文件夹(`samba-client`)、与 DNS 服务器通信或通过 SSH(`ssh` 服务)连接到计算机。你可以将 `service` 视为与端口组合的协议,例如 `ssh` 服务使用 SSH 协议,并且按照惯例使用 22 端口。通过允许 `ssh` 服务,你实际上所做的就是允许传入的连接在默认 22 端口上使用 SSH 协议。 + +请注意,根据经验,名称中带有 `client` 字样的服务是指传出连接,也就是你使用你的 IP 作为源对外部的*连接*,与之相反的是 `ssh` 服务,比如,它将接受传入连接(监听来自外部的连接)。 + +你可以在文件 `/etc/services` 中查找服务。例如,如果你想知道这些服务使用什么端口和协议: + +``` +[dan@localhost ~]$ cat /etc/services | grep ssh +ssh 22/tcp # The Secure Shell (SSH) Protocol +ssh 22/udp # The Secure Shell (SSH) Protocol +``` + +你可以看到 SSH 同时使用 TCP 和 UDP 的 22 端口。此外,如果你希望查看所有可用的服务,只需使用 `firewall-cmd --get-services`。 + +#### 打开端口 + +如果要阻止端口、服务或协议,请确保在此处未列出它们。展开来说,如果要允许服务,那么需要将它添加到列表中。 + +假设你要打开 `5000` 端口用于 TCP 连接。为此,请运行: + +``` +sudo firewall-cmd --zone=FedorwaWorkstation --permanent --add-port=5000/tcp +``` + +请注意,你需要指定规则适用的域。添加规则时,还需要如上指定它是 `tcp` 还是 `udp` 端口。`--permanent` 参数将规则设置为即使系统重启后也可以保留。 + +再次查看你所在区域的信息: + +``` +[dan@localhost ~]$ firewall-cmd --list-all +FedoraWorkstation (active) +target: default +icmp-block-inversion: no +interfaces: enp0s3 +sources: +services: dhcpv6-client mdns samba-client ssh +ports: 1025-65535/udp 1025-65535/tcp 5000/tcp +protocols: +masquerade: no +forward-ports: +source-ports: +icmp-blocks: +rich rules: +``` + +类似地,如果你想从列表删除该端口,请运行: + +``` +sudo firewall-cmd --zone=FedorwaWorkstation --permanent --remove-port=5000/tcp +``` + +相同的 `remove` (`‐‐remove-protocol`、`‐‐remove-service`) 和 `add`(`‐‐add-protocol`、`‐‐add-service`)选项同样适用于*服务*和*协议*。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-manage-network-services-with-firewall-cmd/ + +作者:[dan01][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/dan01/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/services-firewall-cmd-816x345.jpg +[2]: https://linux.cn/article-12103-1.html +[3]: https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol +[4]: https://unsplash.com/@tkaiser?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[5]: https://unsplash.com/s/photos/poke-hole?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202006/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md b/published/202006/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md new file mode 100644 index 0000000000..256945adc4 --- /dev/null +++ b/published/202006/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12277-1.html) +[#]: subject: (Modify a disk image to create a Raspberry Pi-based homelab) +[#]: via: (https://opensource.com/article/20/5/disk-image-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +修改磁盘镜像来创建基于树莓派的家庭实验室 +====== + +> 使用树莓派或其它单板机创建一个“家庭私有云”。 + +![](https://img.linux.net.cn/data/attachment/album/202006/03/123435csm7ys7mkbw7ggjy.jpg) + +构建一个[家庭实验室][2]可以是一个有趣的方式,可以让你学习的新概念和实验新技术时还能自娱自乐。得益于以 [树莓派][3] 为首的单板计算机(SBC)的流行,在舒适的家里就可以轻松构建一个多计算机实验室。比起试图在主流的云服务商建立的相同配置,创建一个“家庭私有云”以花更少的钱来体验到云原生技术,也是一个极好的方法。 + +这篇文章阐述如何修改树莓派或其它的单板机的磁盘镜像,预配置主机的 SSH,并禁用首次启动时强制竞选交互配置的服务。这是一个让你的设备“即启动,即运行”的极好方法,类似于云端实例。之后,你可以使用自动化的流程通过 SSH 连接来进行更专业和更深入的配置。 + +此外, 当向你的实验室添加更多的树莓派时,修改磁盘镜像可以来让你只需要将该镜像写到一个 SD 卡、放入树莓派中就可以了! + +![Multiple Raspberry Pi computers, a switch, and a power bank][4] + +### 解压缩和挂载镜像 + +对于这个项目,你需要修改一个服务器磁盘镜像。在测试期间,我使用 [Fedora Server 31 ARM][5]。在你下载该磁盘镜像并[验证其校验和][6]之后,你需要将其解压缩并挂载其到宿主机的文件系统的某个位置上,以便你可以根据需要修改它。 + +你可以使用 [xz][7] 命令通过 `--decompress` 参数来解压缩 Fedora 服务器镜像: + + +``` +xz --decompress Fedora-Server-armhfp-X-y.z-sda.raw.xz +``` + +这会留下一个解压缩后的原始磁盘镜像(它会自动地替换 `.xz` 压缩文件)。这个原始磁盘镜像就像它听起来的那样:一个包含格式化后安装好的磁盘上的所有数据的文件。这包含分区信息、启动分区、root 分区以及其它分区。你需要挂载你打算在其中进行修改的分区,但是要做到这一点,你需要知道磁盘镜像中的分区起始位置和扇区大小,这样你才可以挂载该文件正确的扇区。 + +幸运的是,你可以在一个磁盘镜像上使用 [fdisk][8] 命令,就像在实际磁盘上使用一样容易。使用 `--list` 或 `-l` 参数来查看分区的列表和其信息: + +``` +# 使用 fdisk 来列出原始镜像文件的分区: +$ fdisk -l Fedora-Server-armhfp-31-1.9-sda.raw +Disk Fedora-Server-armhfp-X-y.z-sda.raw: 3.2 GiB, 3242196992 bytes, 6332416 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xdaad9f57 + +Device                               Boot   Start     End Sectors  Size Id Type +Fedora-Server-armhfp-X-y.z-sda.raw1         8192  163839  155648   76M  c W95 F +Fedora-Server-armhfp-X-y.z-sda.raw2 *     163840 1163263  999424  488M 83 Linux +Fedora-Server-armhfp-X-y.z-sda.raw3      1163264 6047743 4884480  2.3G 83 Linux +``` + +你需要的所有信息都可在上面的输出中获得。第 3 行表示扇区大小(包括逻辑和物理的):512 字节 / 512 字节。 + +设备列表显示的是原始磁盘镜像中的分区。第一个,`Fedora-Server-armhfp-X-y.z-sda.raw1` 毫无疑问是引导程序分区,因为它是第一个,很小(仅仅 76MB),而且类型被标识为 `c`,即 W95 FAT32(LBA),这是一个从 SD 卡启动的 FAT32 分区。 + +第二个分区也不是非常大,只有 488MB。这个分区是一个 Linux 原生类型分区(Id 83),它可能是包含内核和 [initramfs][9] 的 Linux 启动分区。 + +第三个分区可能是你需要的东西:它有 2.3GB 大小,所以在它其中应该有发行版的主要部分,并且它是一个 Linux 原生分区类型,这也是在预料之中的。这个分区应该包含了你需要修改的分区和数据。 + +第三个分区从扇区 1163264 开始(在 `fdisk` 的输出中被显示为 `Start` 列),所以你的挂载偏移量是 `595591168`,计算方法是将扇区大小(512)乘以起始扇区(1163264)(即 `512 * 1163264`)。这意味着你需要以偏移量 `595591168` 挂载该文件,才能挂载到正确位置。 + +装备了这些信息,现在你可以将第三个分区挂载到你的家目录中了: + +``` +$ mkdir ~/mnt +$ sudo mount -o loop,offset=595591168 Fedora-Server-armhfp-X-y.z-sda.raw ~/mnt +$ ls ~/mnt +``` + +### 直接在磁盘镜像中作业 + +在磁盘镜像被解压缩和被挂载到宿主机上的一个位置后,就可以修改镜像以符合你的需求。在我看来,对镜像进行更改的最简单的方法是使用 `chroot` 来将你会话的工作根目录更改为挂载镜像的工作根目录。不过,有点棘手。 + +在你改变了根目录后,你的会话将使用新的根目录下的二进制文件。除非你是在一个 ARM 系统做这些所有的操作,否则解压缩后的磁盘镜像的架构将与你正在使用的宿主机系统不同。即使在 chroot 环境中,宿主机系统也无法使用一个不同架构的二进制文件。至少,不能在本机使用。 + +幸运的是,这里有一个解决方案:qemu-user-static。来自 [Debian Wiki][10] 的说明: + +> “[qemu-user-static] 提供了用户模式的仿真二进制文件,是静态构建的。在这个模式中,QEMU 可以在一个 CPU 上启动为另一个 CPU 编译的 Linux 进程 …… 如果安装了 binfmt-support 软件包,qemu-user-static 软件包会注册提供的仿真器可以处理的二进制文件格式,以便其能够直接运行其他架构的二进制文件。” + +这正是你需要在 chroot 环境中非本地架构中工作所需的。如果宿主机系统是 Fedora,使用 DNF 来安装 `qemu-user-static` 软件包,并重新启动 `systemd-binfmt.service`: + +``` +# 使用 DNF 启用非本地的 arch chroot 环境,添加新的二进制文件格式信息 +# 输出镜像了精简 +$ dnf install qemu-user-static +$ systemctl restart systemd-binfmt.service +``` + +使用这种方法,你一个能够更改根目录到挂载的磁盘镜像,运行 `uname` 命令来验证一切都在正常: + +``` +sudo chroot ~/mnt/ /usr/bin/uname -a -r +Linux marvin 5.5.16-200.fc31.x86_64 #1 SMP Wed Apr 8 16:43:33 UTC 2020 armv7l armv7l armv7l GNU/Linux +``` + +在 chroot 环境中运行 `uname` 将在输出中显示 `armv7l`,这个原始磁盘镜像的架构, 而不是宿主机的架构。一切如预期,可以继续修改镜像了。 + +### 修改磁盘镜像 + +现在你可以直接切换到这个基于 ARM 的磁盘镜像中,并在该环境中工作了,你可以对镜像自身镜像修改了。你需要设置该镜像,以便它能够启动并可立即访问,而不需要在树莓派上做任何额外的设置。为此,你需要安装并启用 sshd(OpenSSH 守护进程),并为 SSH 访问添加授权密码。 + +为了使其表现得更像一个云环境,实现在家里建立私有云的梦想,添加一个本地用户,给予该用户 `sudo` 权限,并(为了像云端的重度用户一样)允许该用户无需密码就可以使用 `sudo`。 + +所以,你将做的事情是: + + * 安装并启用 SSHD(SSHD 已经在 Fedora ARM 镜像中安装并启用,但是你可能需要为你发行版手动执行这些工作) + * 设置一个本地用户 + * 允许本地用户来使用 `sudo`(无需密码,可选) + * 添加授权密钥 + * 允许 root 使用授权密码镜像 SSH(可选) + +我使用 GitHub 功能,它允许你上传你的 SSH 公钥,并在 [https://github.com/.keys][11] 处可访问。我发现这是一种很方便的分发公钥的方法,不过我生性多疑,我总是检查下载的密钥是否与我预期的匹配。如果你不想使用这种方法,你可以从你宿主机中复制你公钥到 chroot 环境中,或者你可以将公钥托管在你控制的 Web 服务器上以便使用相同的工作流。 + +要开始修改磁盘镜像,再次切换根目录到挂载的磁盘镜像中,这次启动一个 shell,以便可以运行多个命令: + +``` +# 为了简洁起见,省略了这些命令的输出(如果有的话) +$ sudo chroot ~/mnt /bin/bash + +# 安装 openssh-server ,并启用它 (在 Fedora 上已经完成) +$ dnf install -y openssh-server +$ systemctl enable sshd.service + +# 允许 root 使用授权密码访问 SSH +$ mkdir /root/.ssh + +# 下载或者另外添加授权密码文件,你的公共密码 +# 将 URL 替换为你自己公共密码的路径 +$ curl -o /root/.ssh/authorized_keys +$ chmod 700 /root/.ssh +$ chmod 600 /root/.ssh/authorized_keys + +# 添加一个本地用户,并放置他们到 wheel 组中 +# 将组和用户更改为您想要的一切 +useradd -g chris -G wheel -m -u 1000 chris + +# 下载并添加你的授权密码 +# 像你上面所做的那样更改 home 目录和URL +mkdir /home/chris/.ssh +curl -o /home/chris/.ssh/authorized_keys +chmod 700 /home/chris/.ssh +chmod 600 /home/chris/.ssh/authorized_keys +chown -R chris.chris /home/chris/.ssh/ + +# 允许 wheel 组( 使用你的本地用户) 不需要使用密码来使用 suso +echo "%wheel ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/91-wheel-nopasswd +``` + +这就是树莓派或其它单板机在首次启动时需要完成设置 SSH 的全部工作。不过,每个发行版都有自己的特点。例如,Raspbian 已经包含一个本地用户:`pi`,并且不使用 `wheel` 组。因此对于 Raspbian 来说,最好使用现有用户,或者删除 `pi` 用户,并使用另一个用户来替换它。 + +在 Fedora ARM 的情况下,镜像会在首次引导启动时提示你完成设置。这会破坏你在上面所做的修改的目的,尤其是在设置完成之前,它会完全阻止启动。你的目标是使树莓派的功能类似于私有云的基础设施的一部分一样运行,而这个工作流程包括在主机启动时通过 SSH 远程设置主机。 禁用初始化设置,它由 `initial-setup.service` 控制: + +``` +# 对多用户和图形目标禁用 initial-setup.service +unlink /etc/systemd/system/multi-user.target.wants/initial-setup.service +unlink /etc/systemd/system/graphical.target.wants/initial-setup.service +``` + +当你在 chroot 环境时,你可以对你系统做任何你想做的其它更改,或者就放在那里,在第一次启动后,按照云原生的工作流通过 SSH 进行配置。 + +### 重新压缩并安装修改后的镜像 + +完成了这些更改后,剩下的就是重新压缩磁盘镜像,并将其安装其到你的树莓派的 SD 卡上。 + +确保退出 chroot 环境,然后卸载磁盘镜像: + +``` +$ sudo umount ~/mnt/ +``` + +就像最初解压缩镜像一样,你可以再次使用 `xz` 命令来压缩镜像。通过使用 `--keep` 参数,`xz` 将保留原始的镜像,而不是清理掉它。虽然这会占用更多的磁盘空间,但保留下来的未压缩镜像将允许你对正在处理的镜像进行增量更改,而不需要每次都对其进行解压缩。这对于在测试和调整镜像时节省时间是非常好的。 + +``` +# 压缩压缩磁盘镜像为一个 .xz 文件,但保留原始磁盘镜像 +xz --compress Fedora-Server-armhfp-31-1.9-sda.raw --keep +``` + +压缩过程将花费一些时间,所以趁着这个时间站起来,舒展身体,让你的血液再次流动。 + +在压缩完成后,可以将新的、已修改过的磁盘镜像复制到 SD 卡上,以便与树莓派一起使用。标准的 `dd` 方法将镜像放置到 SD 卡上也很好用,但是我喜欢使用 Fedora 的 `arm-image-installer`,因为它因为它在处理未经编辑的镜像时提供了一些选项。它对编辑过的镜像也很好用,并且比 `dd` 命令更友好一些。 + +确保检查 SD 卡在哪个磁盘驱动器上,并用 `--media` 参数使用它: + +``` +# 使用 arm-image-installer 来复制已修改的磁盘镜像到 SD 卡上 +arm-image-installer --image=Fedora-Server-armhfp-X-y.z-sda.raw.xz --target=rpi3 --media=/dev/sdc --norootpass --resizefs -y +``` + +现在,你已经为树莓派或其它单板机准备好了一个新的、已修改的 Fedora Server ARM 镜像,准备好启动并立即 SSH 到你的修改镜像中。这种方法也可以用来做其它的修改,并且你也可以使用其它发行版的原始磁盘镜像,如果你更喜欢它们,而不是 Fedora 的话。这是一个开始构建家庭实验室私有云的良好基础。在以后的文章中,我将指导你使用云技术和自动化建立一个家庭实验室。 + +### 延伸阅读 + +为了学习如何做这篇文章中的事情,我做了很多研究。以下是我找到的两个对学习如何定制磁盘映像和使用非原生架构最有帮助的资料。它们对我从“不知道自己在做什么”到“我能够完成它!”非常有帮助。 + + * [如何修改你的自定义 Linux 发行版的原始磁盘镜像][12] + * [使用 DNF 维基][13] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/disk-image-raspberry-pi + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/science_experiment_beaker_lab.png?itok=plKWRhlU (Science lab with beakers) +[2]: https://opensource.com/article/19/3/home-lab +[3]: https://opensource.com/resources/raspberry-pi +[4]: https://opensource.com/sites/default/files/uploads/raspberrypi_homelab.jpg (Multiple Raspberry Pi computers, a switch, and a power bank) +[5]: https://arm.fedoraproject.org/ +[6]: https://arm.fedoraproject.org/verify.html +[7]: https://tukaani.org/xz/ +[8]: https://en.wikipedia.org/wiki/Fdisk +[9]: https://wiki.debian.org/initramfs +[10]: https://wiki.debian.org/RaspberryPi/qemu-user-static +[11]: https://github.com/%3Cyour_github_username%3E.keys +[12]: https://www.linux.com/news/how-modify-raw-disk-image-your-custom-linux-distro/ +[13]: https://wiki.mageia.org/en/Using_DNF#Setting_up_a_container_for_a_non-native_architectur diff --git a/published/202006/20200514 How IoT will rescue aviation.md b/published/202006/20200514 How IoT will rescue aviation.md new file mode 100644 index 0000000000..c6cd6c0ee8 --- /dev/null +++ b/published/202006/20200514 How IoT will rescue aviation.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12367-1.html) +[#]: subject: (How IoT will rescue aviation) +[#]: via: (https://www.networkworld.com/article/3543318/how-iot-will-rescue-aviation.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +物联网将如何拯救航空业 +====== + +> 为防止感染新冠病毒的乘客登机,欧洲飞机制造商,空中客车公司正在研究能够识别病毒的物联网传感器。 + +![Stéphan Valentin][1] + +一家开发传感器来探测飞机上和机场中的爆炸物和其他化学物品的生物技术公司正在和空中客车合作,一同开发一种可以检测已经感染新冠病毒乘客的传感器。 + +Koniku 的创始人兼首席执行管 Osh Agabi 在[一篇博文][3]中说,总部位于加州的 Konibu 公司和空中客车(Airbus)公司从 2017 年就开始合作共同开发能够探测出不同化学物质的非接触式设备。 + +他们希望通过识别从呼吸或者汗液中的气味来判断是否感染新冠病毒,因为这些气味可能是新冠病毒中化学物质的标记。“大多数感染和疾病都会或多或少的改变我们呼吸和汗液里的化学成分,也就会产生不同的气味,” Agabi 写道。“如果我们检测到这些气味,我们就可以检测是否存在感染。” + +这两家公司希望能够识别这种新冠病毒的特异性标记,并且能找到一种可以检测这些标记的物联网(IoT)传感器,这些传感器配备有通过基因工程改造过的受体,从而对病毒进行探测。“那些受体会过滤空气中的分子,并且当它们接触到已经提前被编程检测的存在威胁或危险的分子化合物的时候,就会产生一个信号,”他写道。 + +他说,乘客将通过走过一个装有传感器的封闭通道来进行筛选。“通过对构成这些受体细胞中的 DNA 进行编程,使其对出现在感染者呼吸或者汗液中的化合物作出反应,我们相信,我们将能够迅速且可靠地筛查新冠病毒,并且确定一个人是否已经被感染,”他写道。 + +其他类型的非接触检测器已经在使用中了,包括皮肤温度升高elevated-skin-temperature(EST)摄像头。 + +意大利的最主要的机场 Leonardo da Vinci 购置了三个热成像头盔来发现发烧的人。机场已经配备了固定的热感应扫描仪,并且订购了更多的这种设备。[根据当地媒体 Fiumicino Online 的报道][5],被发现潜在发烧的乘客被会要求做进一步的医学检查。 + +位于中国深圳制造这种头盔的 KC Wearable 公司表示,这种头盔可以由员工佩戴,并且可以与乘客保持一定的距离。 + +制造热感应摄像头的 FLIR Systems 公司在其本月的[财报][6]中表示,对 EST 系统的需求正在持续增加。 + +“尽管这些热感应摄像头不能检测或者诊断任何医疗状况,但这些摄像头可以作为识别皮肤温度升高的有效工具。”报告说。 + +FLIR 公司 CEO Jim Cannon 在本月的收入电话会议上表示,“许多公司都在寻求在他们的设施中安装这种技术,以便解除就地避难shelter-in-place法令”。[根据路透社报道][8],通用汽车就是其中之一。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543318/how-iot-will-rescue-aviation.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2018/08/passenger-view_of_airplane_wing_above_clouds_travel_journey_transportation_by_stephan_valentin_cc0_via_unsplash_1200x800-100766542-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.linkedin.com/pulse/what-happens-when-airports-open-back-up-osh-agabi/?src=aff-lilpar&veh=aff_src.aff-lilpar_c.partners_pkw.10078_plc.Skimbit%20Ltd._pcrid.449670_learning&trk=aff_src.aff-lilpar_c.partners_pkw.10078_plc.Skimbit%20Ltd._pcrid.449670_learning&clickid=WNmzMlyalxyOUI7wUx0Mo34HUkiwwpy%3APQ3X1Y0&irgwc=1 +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.fiumicino-online.it/articoli/cronaca-2/fase-2-all-aeroporto-di-fiumicino-lo-smart-helmet-per-controllare-la-febbre-a-distanza +[6]: https://flir.gcs-web.com/news-releases/news-release-details/flir-systems-announces-first-quarter-2020-financial-results +[7]: https://www.fool.com/earnings/call-transcripts/2020/05/06/flir-systems-inc-flir-q1-2020-earnings-call-transc.aspx +[8]: https://uk.reuters.com/article/us-flir-systems-gm/general-motors-taps-flir-systems-for-fever-check-cameras-at-factories-idUKKBN22J02B +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/published/202006/20200525 How to Execute a Command or Script at Reboot or Startup.md b/published/202006/20200525 How to Execute a Command or Script at Reboot or Startup.md new file mode 100644 index 0000000000..f3e2a0e45d --- /dev/null +++ b/published/202006/20200525 How to Execute a Command or Script at Reboot or Startup.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12279-1.html) +[#]: subject: (How to Execute a Command or Script at Reboot or Startup) +[#]: via: (https://www.2daygeek.com/execute-run-linux-scripts-command-at-reboot-startup/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在重启或启动时执行命令或脚本 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/04/091837g664qu0y206aqoo9.jpg) + +众总所周知 Linux 可以在启动时添加服务。例如,如果要在[启动时添加][1] Apache Httpd 服务,你可以在 `chkconfig` 和 `systemctl` 命令的帮助下完成此操作。 + +有时你需要在启动时添加自定义脚本、命令或服务,该怎么做?你可以使用以下三种方法来做到。 + +在本文中,我们将通过示例向你展示如何使用这些方法。 + +### 方法 1:如何使用 /etc/rc.d/rc.local 文件在重启或启动时运行脚本或命令 + +传统上,`/etc/rc.local` 文件是在切换到多用户运行级别的过程结束时,在所有正常的计算机服务启动之后执行的。 + +此方法也适用于 systemd 系统。 + +你需要将你的脚本位置添加到 `/etc/rc.d/rc.local` 文件中以在启动时运行。 + +确保该文件有运行权限: + +``` +# chmod +x /etc/rc.d/rc.local +``` + +作为演示,我们将创建一个简单的示例脚本。你可以根据需要创建任何脚本。 + +``` +# vi /opt/scripts/run-script-on-boot.sh + +#!/bin/bash +date > /root/on-boot-output.txt +hostname > /root/on-boot-output.txt +``` + +脚本完成后,设置可执行权限: + +``` +# chmod +x /opt/scripts/run-script-on-boot.sh +``` + +最后,将该脚本添加到文件底部: + +``` +# vi /etc/rc.d/rc.local + +/opt/scripts/run-script-on-boot.sh +``` + +[重启系统][2]进行检查: + +``` +# reboot +``` + +### 方法 2:如何使用 crontab 在重启或启动时执行命令或脚本 + +cron 在特定时间在后台自动执行计划的作业。可以在 [cron 任务][3]中使用特殊的字符串 `@reboot` 来完成。`@reboot` 是一个特殊的字符串,它允许用户在启动时运行任何命令或脚本。 + +此示例在系统重启时运行 `/opt/scripts/run-script-on-boot.sh` 文件。我们将使用与上面相同的脚本。 + +为此,只需在 crontab 文件中添加以下条目: + +``` +# crontab -e + +@reboot /opt/scripts/run-script-on-boot.sh +``` + +重启系统进行检查: + +``` +# reboot +``` + +### 方法 3:如何使用 systemd 服务单元在重启或启动时运行命令或脚本 + +此方法仅适用于 systemd 系统。该方法非常简单。 + +我们将使用上面相同的脚本进行演示。 + +为此,你需要创建一个 systemd 启动脚本并将其放在 `/etc/systemd/system/` 目录中。 + +这是我们的示例 systemd 启动单元脚本: + +``` +# vi sample-on-boot-script.service + +[Unit] +Description=Run a Custom Script at Startup +After=default.target + +[Service] +ExecStart=/opt/scripts/run-script-on-boot.sh + +[Install] +WantedBy=default.target +``` + +将单元脚本放置在 systemd 所在位置后,运行以下命令更新 systemd 配置文件并启用服务: + +``` +# systemctl daemon-reload +# systemctl enable sample-on-boot-script.service +``` + +重启系统进行检查: + +``` +# reboot +``` + +### 额外提示 + +如果你想在后台运行脚本,你需要在最后加上 `&` 符号 + +``` +/Path/To/My_Script & +``` + +如果你想以不同用户运行命令,使用以下格式: + +``` +su - $USER -c /Path/To/My_Script +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/execute-run-linux-scripts-command-at-reboot-startup/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/enable-disable-services-on-boot-linux-chkconfig-systemctl-command/ +[2]: https://www.2daygeek.com/6-commands-to-shutdown-halt-poweroff-reboot-the-linux-system/ +[3]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ diff --git a/published/202006/20200525 How to Make a GIF in GIMP -Simple Tutorial.md b/published/202006/20200525 How to Make a GIF in GIMP -Simple Tutorial.md new file mode 100644 index 0000000000..5d9f949b7f --- /dev/null +++ b/published/202006/20200525 How to Make a GIF in GIMP -Simple Tutorial.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12289-1.html) +[#]: subject: (How to Make a GIF in GIMP [Simple Tutorial]) +[#]: via: (https://itsfoss.com/make-gif-in-gimp/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +初级:如何在 GIMP 中制作 GIF +====== + +制作一个 GIF 可能是一件很有趣的事,很多用户可能都想如何制作一个 GIF。你可以使用功能强大的开源图像编辑软件 [GIMP][1] 创建一个非常简单的 GIF。 + +在这篇 GIMP 教程中,我将向你展示如何在 GIMP 中创建一个简单的 GIF。 + +### 在 GIMP 中制作一个 GIF + +![][2] + +使用 GIMP 作为一个动画制作工具需要你把每个图层都看作动画的一帧。在这篇教程中,我将创建一个简单的基于我们的徽标的网页横幅。我将使用 2 个图像作为我的图层,但当你制作自己的 GIF 时,你可以随意添加更多的图像。 + +我在这里使用的方法叫做“组合法”,在这个方法中,新的帧被添加到先前的帧中。我的想法是制作一个“频闪”的网页横幅,来在对一些重要的事情引起注意。 + +我假设你已经 [在 Ubuntu 或其它使用的操作系统中安装了 GIMP][3]。让我们开始制作 GIF 吧。 + +#### 步骤 1 + +从“文件”菜单中,单击“作为图层打开”,并选择你想包含在 GIF 中的所有图像。然后单击“打开”。 + +![][4] + +你可以排序图层标签页中的图像。GIF 的帧序列将从最下面的图层开始,从下到上运行每一层图层。 + +![][5] + +从主菜单中选择“滤镜”,接着选择“动画”,最后单击“优化(用于 GIF)”。 + +![][6] + +> “优化”做了什么? +> +> 优化会检查每一个图层,如果来自前一帧的信息在下一帧中没有改变,则重复使用这些信息。它只存储新更改的像素值,并清除任何重复的部分。 +> +> 如果一帧与前一帧完全相同,那么它将完全删除这一幅帧,并且前一帧将恰当地在屏幕上停留更长时间。 + +要查看该 GIF,从主菜单中单击“滤镜”,接着单击“动画”和“回放”。 + +![][7] + +按下“回放”按钮来启动 GIF。要保存该 GIF,在文件菜单上选择“文件”,单击“导出为”。 + +![][8] + +命名你的 GIF,并选择你想将其保存到的文件夹。在“选择文件类型”时,选择 “GIF 图像”。 + +![][9] + +当提示时,选择“作为动画”、“反复循环”,设置期望的延迟值,并单击“上面输入的延迟用于所有帧”来生效。 + +最重要的选项是设置帧处理动作为“累积各图层(组合)”,以便为我们的横幅获取“频闪”效果。单击“导出”作为最后一个步骤。 + +![][10] + +你的 GIF 已经准备好了! + +![][11] + +这是一个浅显易懂的示例,不过 GIMP 在动画创作方面有很多能力,需要大量的学习和实践才能掌握它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/make-gif-in-gimp/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/create-gif-in-gimp.jpg?ssl=1 +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/1.-open-as-layers.jpeg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/layers-order.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.-optimize-for-gif-1.png?fit=800%2C647&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.-playback.png?fit=800%2C692&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/4.-export-as.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/5.-save-as-gif.png?fit=800%2C677&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/6.-export-options-1.png?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/its-foss-logo.gif?fit=800%2C417&ssl=1 +[12]: https://itsfoss.com/subscribe-to-newsletter/ diff --git a/published/202006/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md b/published/202006/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md new file mode 100644 index 0000000000..faf7eb196d --- /dev/null +++ b/published/202006/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md @@ -0,0 +1,304 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12290-1.html) +[#]: subject: (How to Manipulate an Ethernet Card Using the ethtool Command) +[#]: via: (https://www.2daygeek.com/linux-ethtool-command-view-change-ethernet-adapter-settings-nic-card/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 ethtool 命令管理以太网卡 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/06/223359syh8n37luz8hhllh.jpg) + +`ethtool` 用于查看和修改网络设备(尤其是有线以太网设备)的驱动参数和硬件设置。你可以根据需要更改以太网卡的参数,包括自动协商、速度、双工和局域网唤醒等参数。通过对以太网卡的配置,你的计算机可以通过网络有效地进行通信。该工具提供了许多关于接驳到你的 Linux 系统的以太网设备的信息。 + +在这篇文章中,我们将告诉你如何更改以下的参数以及如何查看这些参数。这篇文章将帮助你在 Linux 系统中排除与以太网卡相关的问题。 + +下面的信息将帮助你了解以太网卡的工作原理。 + +* **半双工**:半双工模式允许设备一次只能发送或接收数据包。 +* **全双工**:全双工模式允许设备可以同时发送和接收数据包。 +* **自动协商**:自动协商是一种机制,允许设备自动选择最佳网速和工作模式(全双工或半双工模式)。 +* **速度**:默认情况下,它会使用最大速度,你可以根据自己的需要改变它。 +* **链接检测**:链接检测可以显示网卡的状态。如果显示为 `no`,请尝试重启网卡。如果链路检测仍显示 `no`,则检查交换机与系统之间连接的线缆是否有问题。 + +### 如何在 Linux 上安装 ethtool + +默认情况下,大多数系统上应该已经安装了 `ethtool`。如果没有,你可以从发行版的官方版本库中安装。 + +对于 RHEL/CentOS 6/7 系统,请使用 [yum 命令][1] 安装 `ethtool`: + +``` +$ sudo yum install -y ethtool +``` + +对于 RHEL/CentOS 8 和 Fedora 系统,请使用 [dnf 命令][2] 安装 `ethtool`: + +``` +$ sudo yum install -y ethtool +``` + +对于基于 Debian 的系统,请使用 [apt 命令][3] 或 [apt-get 命令][4] 安装 `ethtool`: + +``` +$ sudo apt-get install ethtool +``` + +对于 openSUSE 系统,使用 [zypper 命令][5] 安装 `ethtool`: + +``` +$ sudo zypper install -y ethtool +``` + +对于 Arch Linux 系统,使用 [pacman 命令][6] 安装 `ethtool`: + +``` +$ sudo pacman -S ethtool +``` + +### 如何检查 Linux 上的可用网络接口 + +你可以使用 [ip 命令][7]或 `ifconfig` 命令(在现代发行版中已被淘汰)来验证可用的、活动的网卡的名称和其他细节: + +``` +# ip a +或 +# ifconfig + +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever +2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 + link/ether 00:10:22:35:23:sf brd ff:ff:ff:ff:ff:ff + inet 192.164.23.100/24 brd 192.164.23.255 scope global eth0 + valid_lft forever preferred_lft forever +``` + +### 如何检查 Linux 上的网卡(NIC)信息 + +掌握了以太网卡名称后,就可以使用 `ethtool` 命令轻松查看其详细信息,如下所示。 + +在 Linux 系统中,每个网卡(NIC)都被分配了唯一的名称,如 ethX、enpXXX 等。 + +* 旧的 Linux 发行版使用的是 `eth[X]` 格式。例如,RHEL 6 和它们的旧版本。 +* 现代的 Linux 发行版使用 `enp[XXX]` 或 `ens[XXX]` 格式。例如,大多数现代 Linux 发行版都使用这种格式,包括 RHEL 7、Debian 10、Ubuntu 16.04 LTS。 + +``` +# ethtool eth0 + +Settings for eth0: + Supported ports: [ TP ] + Supported link modes: 1000baseT/Full + 10000baseT/Full + Supported pause frame use: No + Supports auto-negotiation: No + Supported FEC modes: Not reported + Advertised link modes: Not reported + Advertised pause frame use: No + Advertised auto-negotiation: No + Advertised FEC modes: Not reported + Speed: 10000Mb/s + Duplex: Full + Port: Twisted Pair + PHYAD: 0 + Transceiver: internal + Auto-negotiation: off + MDI-X: Unknown + Supports Wake-on: uag + Wake-on: d + Link detected: yes +``` + +### 如何检查以太网卡的驱动程序和固件版本 + +你可以使用 `ethtool` 命令的 `-i` 选项检查驱动程序版本、固件版本和总线的详细信息,如下所示: + +``` +# ethtool -i eth0 + +driver: vmxnet3 +version: 1.4.16.0-k-NAPI +firmware-version: +expansion-rom-version: +bus-info: 0000:0b:00.0 +supports-statistics: yes +supports-test: no +supports-eeprom-access: no +supports-register-dump: yes +supports-priv-flags: no +``` + +### 如何检查网络使用情况统计 + +你可以使用 `ethtool` 命令中的 `-S` 选项来查看网络使用情况统计。它可以显示传输的字节数、接收的字节数、错误数等。 + +``` +# ethtool -S eth0 + +NIC statistics: + Tx Queue#: 0 + TSO pkts tx: 2053 + TSO bytes tx: 7167572 + ucast pkts tx: 4028081 + ucast bytes tx: 399093197 + mcast pkts tx: 0 + mcast bytes tx: 0 + bcast pkts tx: 0 + bcast bytes tx: 0 + pkts tx err: 0 + pkts tx discard: 0 + drv dropped tx total: 0 + too many frags: 0 + giant hdr: 0 + hdr err: 0 + tso: 0 + ring full: 0 + pkts linearized: 0 + hdr cloned: 0 + giant hdr: 0 + Tx Queue#: 1 + TSO pkts tx: 1955 + TSO bytes tx: 6536945 + ucast pkts tx: 3711838 + ucast bytes tx: 346309662 + mcast pkts tx: 0 + mcast bytes tx: 0 + bcast pkts tx: 1186 + bcast bytes tx: 49812 + pkts tx err: 0 + pkts tx discard: 0 + drv dropped tx total: 0 + too many frags: 0 + giant hdr: 0 + hdr err: 0 + tso: 0 + ring full: 0 + pkts linearized: 0 + hdr cloned: 0 + giant hdr: 0 + Rx Queue#: 0 + LRO pkts rx: 0 + LRO byte rx: 0 + ucast pkts rx: 5084776 + ucast bytes rx: 4673133395 + mcast pkts rx: 0 + mcast bytes rx: 0 + bcast pkts rx: 154143 + bcast bytes rx: 45415676 + pkts rx OOB: 0 + pkts rx err: 0 + drv dropped rx total: 0 + err: 0 + fcs: 0 + rx buf alloc fail: 0 + Rx Queue#: 1 + LRO pkts rx: 0 + LRO byte rx: 0 + ucast pkts rx: 6346769 + ucast bytes rx: 4835534292 + mcast pkts rx: 0 + mcast bytes rx: 0 + bcast pkts rx: 3464 + bcast bytes rx: 714646 + pkts rx OOB: 0 + pkts rx err: 0 + drv dropped rx total: 0 + err: 0 + fcs: 0 + rx buf alloc fail: 0 + tx timeout count: 0 +``` + +### 如何改变以太网设备的速度 + +你可以根据需要改变以太网的速度。当你进行此更改时,网卡将自动掉线,你需要使用 [ifup 命令][8] 或 `ip` 命令或 `nmcli` 命令将其重新上。 + +``` +# ethtool -s eth0 speed 100 +# ip link set eth0 up +``` + +### 如何在 Linux 上启用/禁用以太网卡的自动协商? + +你可以使用 `ethtool` 命令中的 `autoneg` 选项启用或禁用自动协商,如下图所示: + +``` +# ethtool -s eth0 autoneg off +# ethtool -s eth0 autoneg on +``` + +### 如何同时更改多个参数 + +如果你想使用 `ethtool` 命令同时更改以太网卡的多个参数,请使用下面的格式: + +``` +Syntax: +ethtool –s [device_name] speed [10/100/1000] duplex [half/full] autoneg [on/off] +``` + +``` +# ethtool –s eth0 speed 1000 duplex full autoneg off +``` + +### 如何检查特定网卡的自动协商、RX 和 TX + +要查看关于特定以太网设备的自动协商等详细信息,请使用以下格式: + +``` +# ethtool -a eth0 +``` + +### 如何从多个设备中识别出特定的网卡(闪烁网卡上的 LED) + +如果你想识别一个特定的物理接口,这个选项非常有用。下面的 `ethtool` 命令会使 `eth0` 端口的 LED 灯闪烁: + +``` +# ethtool -p eth0 +``` + +### 如何在 Linux 中永久设置这些参数 + +在系统重启后,你使用 `ethtool` 所做的更改将被默认恢复。 + +要使自定义设置永久化,你需要更新网络配置文件中的值。根据你的 Linux 发行版,你可能需要将此值更新到正确的文件中。 + +对于基于 RHEL 的系统。你必须使用 `ETHTOOL_OPTS` 变量: + +``` +# vi /etc/sysconfig/network-scripts/ifcfg-eth0 + +ETHTOOL_OPTS="speed 1000 duplex full autoneg off" +``` + +对于基于 Debian 的系统: + +``` +# vi /etc/network/interfaces + +post-up ethtool -s eth0 speed 1000 duplex full autoneg off +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-ethtool-command-view-change-ethernet-adapter-settings-nic-card/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[2]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[6]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[7]: https://www.2daygeek.com/ip-command-configure-network-interface-usage-linux/ +[8]: https://www.2daygeek.com/enable-disable-up-down-nic-network-interface-port-linux-using-ifconfig-ifdown-ifup-ip-nmcli-nmtui/ diff --git a/published/202006/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md b/published/202006/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md new file mode 100644 index 0000000000..5f0859154c --- /dev/null +++ b/published/202006/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12284-1.html) +[#]: subject: (How to Remove Files Older than N Days Using Tmpwatch/Tmpreaper on Linux) +[#]: via: (https://www.2daygeek.com/how-to-remove-files-older-than-n-days-using-tmpwatch-tmpreaper-on-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 Tmpwatch/Tmpreaper 删除旧文件 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/05/091806zrnwahdl9fdyznrw.jpg) + +你可能忘记了删除计算机上某个目录中不再需要的文件的操作。这可能是“下载”或任何其他目录。它可能已经增长了一段时间。 + +即便有足够的存储空间,你也应该删除它们,因为这会在列出文件时降低系统速度。同样,当一个目录中有成千上万个文件时,它可能很会很臃肿。 + +当你不知道要检查的文件名时,很难在特定目录中找到文件。 + +我们可以通过结合使用 `find` 命令和一些组合来做到这一点,我们过去已经写过一篇文章。 + +* [使用 Bash 脚本在 Linux 中删除早于 “X” 天的文件/文件夹][1] + +今天,我们将向你展示如何在 Linux 上使用 Tmpwatch 程序来实现这一目标。 + +### 什么是 tmpwatch + +`tmpwatch` 会在指定目录中递归删除指定时间段内未被访问的文件。通常,它用于自动清除临时文件系统目录,例如 `/tmp` 和 `/var/tmp`。 + +它只会删除空目录、常规文件和符号链接。它不会切换到其他文件系统,并避开了属于根用户的 `lost+found` 目录。 + +默认情况下,`tmpwatch` 会根据文件的 atime(访问时间)而不是 mtime(修改时间)删除文件。 + +你可以在 `tmpwatch` 命令中添加其他参数来更改这些行为。 + +**警告:** 请不要在 `/` 中运行 `tmpwatch` 或 `tmpreaper`,因为该程序中没有防止这种情况的机制。 + +### 如何在 Linux 上安装 tmpwatch + +可以在官方仓库中按以下方式安装 `tmpwatch`。 + +对于 RHEL/CentOS 6 系统,请使用 [yum 命令][2]安装 `tmpwatch`。 + +``` +$ sudo yum install -y tmpwatch +``` + +对于 Debian 和 Ubuntu 系统,请使用 [apt 命令][3] 或 [apt-get 命令][4] 安装 `tmpreaper`。 + +``` +$ sudo apt-get install tmpreaper +``` + +对于 openSUSE 系统,请使用 [zypper 命令][5] 安装 `tmpwatch`。 + +``` +$ sudo zypper install -y tmpwatch +``` + +对于 Fedora 系统,请使用 [dnf 命令][6] 安装 `tmpwatch`。 + +``` +$ sudo dnf install -y tmpwatch +``` + +**请注意:** 如果你使用的是基于 Debian 的系统,请使用 `tmpreaper` 而不是 `tmpwatch`。所有示例都可以如预期工作。 + +### 了解关键选项和参数 + +* `atime`(文件上次访问时间):显示命令或脚本等任意进程最后一次访问文件中数据的时间。 +* `mtime`(文件上次修改时间):显示修改文件内容或保存文件的时间。除非是更改文件属性,否则大多数情况下 `ctime` 和 `mtime` 会相同。 +* `ctime`(文件上次更改时间):显示文件元数据更改时间。这意味着更改文件属性的时间(如所有权或组等)。 +* `dirmtime`(目录的上次修改时间):显示目录的上一次修改时间。 + +时间参数定义删除文件的阈值。 + +* `d` – 天 +* `h` – 小时 +* `m` – 分钟 +* `s` – 秒 + +### 如何使用 tmpwatch 命令删除一段时间未访问的文件 + +正如我在本文开头所说,`tmpwatch` 默认根据文件访问时间(`atime`)来删除文件。另外,由于小时是默认参数,因此如果使用小时单位,那么无需在时间上添加后缀。 + +例如,运行以下命令以递归方式删除过去 5 个小时未访问的文件。 + +``` +# tmpwatch 5 /tmp +``` + +运行以下命令删除最近 10 个小时未修改的文件。如果要使用修改时间(`mtime`)来删除文件,那么需要在 `tmpwatch` 命令中添加 `-m` 选项。 + +``` +# tmpwatch -m 10 /home/daygeek/Downloads +``` + +### 如何使用 tmpwatch 命令删除超过 “X” 天未访问的文件 + +如果要使用天数删除文件,那么需要添加后缀 `d`。以下示例删除了 30 天以上的文件。 + +``` +# tmpwatch 30d /home/daygeek/Downloads +``` + +### 如何使用 tmpwatch 命令删除一段时间内未访问的所有文件 + +以下命令将基于修改时间(`mtime`)删除所有类型的文件,而不仅仅是常规文件、符号链接和目录。 + +``` +# tmpwatch -am 12 /tmp +``` + +### 如何在 tmpwatch 中排除目录 + +以下命令将删除过去 10 个小时未修改的所有文件,并排除目录。 + +``` +# tmpwatch -am 10 --nodirs /home/daygeek/Downloads +``` + +### 如何在 tmpwatch 中排除特定路径 + +以下命令将删除过去 10 个小时未被修改的所有文件,除了下面排除的文件夹。 + +``` +# tmpwatch -am 10 --exclude=/home/daygeek/Downloads/Movies /home/daygeek/Downloads +``` + +### 如何在 tmpwatch 中排除特定模式 + +以下命令将删除过去 10 小时未被修改的所有文件,除了满足下面列出的模式的文件。 + +``` +# tmpwatch -am 10 --exclude-pattern='*.pdf' /home/daygeek/Downloads +``` + +### 如何让 tmpwatch 命令空运行 + +如果要空运行,请运行以下命令。 + +``` +# tmpwatch -t 5h /home/daygeek/Downloads +``` + +### 如何设置 cronjob 来使用 tmpwatch 定期删除文件 + +默认情况下,它在 `/etc/cron.daily/tmpreaper` 目录下有一个 [cronjob][7] 文件。该 cronjob 根据位于 `/etc/timereaper.conf` 中的配置文件工作。你可以根据需要自定义文件。 + +它每天运行一次,并删除 7 天之前的文件。 + +另外,如果你希望常规执行某项操作,那么可以根据需要手动添加一个 cronjob。 + +``` +# crontab -e + +0 10 * * * /usr/sbin/tmpwatch 15d /home/daygeek/Downloads +``` + +上面的 cronjob 将在每天上午 10 点删除早于 15 天的文件。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-remove-files-older-than-n-days-using-tmpwatch-tmpreaper-on-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11490-1.html +[2]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[6]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[7]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ diff --git a/published/202006/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md b/published/202006/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md new file mode 100644 index 0000000000..77ec2ec8d7 --- /dev/null +++ b/published/202006/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12297-1.html) +[#]: subject: (Linux Mint 20: Release Date, Features and Everything Important Associated With it) +[#]: via: (https://itsfoss.com/linux-mint-20/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Mint 20 发布前一窥 +====== + +[Ubuntu 20.04 LTS 版本发布了][1]。这对 Linux Mint 用户来说也是一个好消息。一个新的 Ubuntu LTS 版本意味着新的 Linux Mint 主要版本也将很快随之出现。 + +为什么这么说呢?因为 Linux Mint 是基于 Ubuntu 的长期支持(LTS)版本的。Mint 18 系列是基于 Ubuntu 16.04 LTS,Mint 19 是基于 Ubuntu 18.04 LTS 等等。 + +与 Ubuntu 不同,Linux Mint 没有固定的发布时间表。根据以往的趋势,我可以做出一个明智的猜测,[Linux Mint][2] 20 应该会在今年 6 月发布。 + +### Linux Mint 20 “Ulyana” 即将推出的新功能 + +![][3] + +让我们来看看代号为 Ulyana 的 Linux Mint 20 中提出的一些主要新功能和变化。 + +#### 1. 提高 Nemo 文件管理器的性能 + +Nemo 文件管理器计划中的性能改进之一是它处理缩略图的方式。你可能还没有意识到,但缩略图的生成需要相当多的系统资源(以及磁盘空间)。试着打开一个有几千张图片的文件夹,你会发现 CPU 的消耗会上升。 + +在 Linux Mint 20 中,其目标是优先考虑内容和导航,并尽可能地延迟缩略图的渲染。这意味着在缩略图渲染之前,文件夹的内容会以通用图标显示出来。这不会让人觉得赏心悦目,但你会注意到性能的改善。 + +#### 2. 两种焕然一新的颜色变体 + +默认情况下,Linux Mint 是绿色/薄荷色的风格。还有一些其它的颜色点缀。Linux Mint 20 新添加了两种可爱的的粉红色和青蓝色。 + +以及新的青蓝色风格: + +![Linux Mint Aqua][4] + +这里是新的粉红色风格: + +![Linux Mint Pink][5] + +#### 3. 没有过度偏重于 Snap 包 + +Ubuntu 20.04 将 snap 包的优先级放在了通常的 apt 包之前。事实上,如果你在 Ubuntu 20.04 中使用 `apt` 命令安装 Chromium 浏览器时,它会自动安装 snap 版本。 + +Linux Mint 团队显然对此不满意,他们确认 Mint 20 将不会安装 snaps 或 snapd。它还将禁止 `apt` 使用 snapd。 + +你仍然可以自己手动安装 snap 包。只是不会由 `apt` 来安装它们。 + +#### 4. 有了这个新工具,跨网络共享文件变得很简单。 + +Linux Mint 20 将提供一个[新的 GUI 工具][6],可以轻松地在本地网络上共享文件,而无需任何额外的配置。 + +![New tool for sharing files across the network][7] + +#### 5. 更好地整合了 Electron 应用程序的桌面 + +[Electron][8] 是一个开源框架,它允许使用 Web 技术构建跨平台的桌面应用程序。有些人称它为懒惰的方法,因为应用程序运行在 Chromium 浏览器之上。然而,这可以让开发人员轻松地将他们的应用程序提供给 Linux(和 macOS)。[Linux 上的 Slack][9] 就是众多这样的例子之一。 + +Linux Mint 20 将对 Electron 应用提供更好的支持,并改进系统托盘和桌面通知的集成。 + +#### 6. 改进的支持多显示器的比例缩放功能 + +![improved multi-monitor support][10] + +一个提议的改变是在 Linux Mint 20 中加入支持多显示器的比例缩放功能。如果你有一个 HiDPI 和非 HiDPI 显示器的组合,你可以为它们每一个选择不同的分辨率、刷新率和不同的分数缩放。 + +在 Mint 20 的登录屏幕,可以让你跨多个显示器拉伸显示背景。 + +#### 7. 改进对 Nvidia Optimus 的支持 + +在 Mint 20 中,Nvidia prime 小程序会显示 GPU 渲染器。你也可以直接从系统托盘中的菜单中选择切换到哪块卡。 + +![Switch between GPUs][12] + +你也可以使用 Nvidia “On-Demand” 模式。在这种模式下,将使用英特尔卡来渲染会话。而如视频播放器或视频编辑器这样的兼容应用程序可以在应用程序菜单中打开时使用 Nvidia GPU。 + +![Run an application with NVIDIA GPU][13] + +#### 8. 不再支持 32 位 + +虽然 Ubuntu 18.04 在两年前就放弃了 32 位 ISO,但 Linux Mint 19 系列一直提供 32 位 ISO 的下载和安装。 + +这种情况在 Linux Mint 20 中有所改变。Linux Mint 20 已经没有 32 位版本了。这是因为 32 位支持从 Ubuntu 20.04 中完全消失了。 + +#### 还有什么? + +Cinnamon 4.6 桌面版的发布带来了很多视觉上的变化。 + +在 Ubuntu 20.04 中,应该会有一些“引擎盖下”的变化,比如 Linux Kernel 5.4,取消了 Python 2 的支持,加入 [Wireguard VPN][11] 等。 + +随着开发的进展,我会在本文中更新更多的功能。敬请期待。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-mint-20/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://www.linuxmint.com/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Linux-Mint-20.png?ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-aqua.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-pink-1.jpg?ssl=1 +[6]: https://blog.linuxmint.com/?p=3863 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-warpinator-1.png?ssl=1 +[8]: https://www.electronjs.org/ +[9]: https://itsfoss.com/slack-use-linux/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/monitor_display_Linux_mint_20.png?ssl=1 +[11]: https://itsfoss.com/wireguard/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/nvidia-prime-applet-linux-mint-20.png?w=386&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/nvidia-on-deman-feature-linux-mint-20.png?w=526&ssl=1 diff --git a/published/202006/20200525 Track Your Screen Time in Linux with ActivityWatch.md b/published/202006/20200525 Track Your Screen Time in Linux with ActivityWatch.md new file mode 100644 index 0000000000..e1b6cd5fa1 --- /dev/null +++ b/published/202006/20200525 Track Your Screen Time in Linux with ActivityWatch.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12302-1.html) +[#]: subject: (Track Your Screen Time in Linux with ActivityWatch) +[#]: via: (https://itsfoss.com/activitywatch/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +使用 ActivityWatch 跟踪你在 Linux 中的屏幕使用时间 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/10/104854yumcnhp8smmjxcht.jpg) + +> ActivityWatch 是一款开源的隐私友好型应用程序,可追踪你在台式电脑或移动设备上的使用时间。 + +### ActivityWatch: 一个追踪你在哪个应用程序上花了多少时间的开源应用程序 + +![ActivityWatch lets you check the time spent on various applications][1] + +[ActivityWatch][2] 是一款跨平台的开源应用,可以帮助你追踪使用时间,衡量你的工作效率。它可以追踪你花在应用程序、浏览器上的时间,以及你是否 AFK(远离键盘)或系统处于休眠状态。 + +不只是追踪时间,它还提供了一堆有用的功能,通过可视化的方式帮助你轻松分析你是如何花费时间的,从而有可能提高你的生产力。 + +![][3] + +它是 [RescueTime][4] 和 [ManicTime][5] 等专有产品的绝佳替代品。 + +ActivityWatch 可用于 Linux、Windows、macOS 和 [Android][6]。它还提供了 Chrome 和 Firefox 的浏览器扩展。截至目前,App Store 上还没有它的 iOS 版应用。 + +![][7] + +它刚刚进入该领域,正在积极开发,以解决任何现有的问题并引入新的功能,如在多个设备上同步你的活动数据的能力。 + +**对于注重隐私的用户来说,我应该提到,收集的数据被存储在你本地的设备上。这是一件好事,因为你可以跟踪你的花费时间,而不会被别人跟踪。** + +### ActivityWatch 的功能 + +![][8] + +基本上,ActivityWatch 可以让你监控你的活动,以分析不良的屏幕使用时间,或改善你在设备上工作的时间管理。 + +具体来说,它提供了几个有用的功能,主要有: + +* 摘要你的日常活动及按使用时间排序的应用和程序列表。 +* 追踪你的浏览器活动的时间,使用浏览器扩展来获得每个活动标签所花费时间的确切数据。 +* 追踪 AFK 和非 AFK 时间。(AFK - “Away From Keyboard” 的缩写,即不在电脑前) +* 提供不同的可视化时间线,以监测你的活动。 +* 能够使用 [watchers][9] 跟踪你在编辑器上写代码的时间。 +* 记录你的活动,以分析你的生产力。 +* 将花费的时间进行分类,可以帮助你详细分析。 +* 可以添加更多的类别和调整时间轴的持续时长。 +* 能够将数据导出/导入为 [JSON][10] 文件。 +* 实验性的秒表功能。 +* 本地存储数据,以尊重用户隐私。 + +### 在 Linux 上安装 ActivityWatch + +> 注:如果你的 Linux 发行版不支持系统托盘图标,你需要遵循这个[文档][11]来解决这个问题。 + +不幸的是,你找不到 AppImage、Flatpak 或 Snap 软件包。然而,对于 Manjaro 或 Arch Linux 有可以安装的 [AUR][12] 包。 + +对于所有其它的 Linux 发行版,你会得到一个 ZIP 文件,其中包括一个要运行的 `aw-qt` 应用程序。 + +要运行它,你需要[解压 zip 归档文件][13],然后通过双击 `aw-qt` 应用程序运行二进制文件来安装它。 + +![Aw Qt][14] + +你也可以使用终端: + +``` +cd activitywatch-v0.9.2-linux-x86_64 +sudo ./aw-qt +``` + +解压文件夹的位置和文件名可能会有所不同 —— 所以请确保你导航到正确的目录,然后使用上面的命令。完成后,你可以从系统托盘图标访问 ActivityWatch,或者直接前往 [localhost:5600][15] 访问它。 + +你也可以查看他们的 [GitHub 页面][16]或[官方网站][2]来探索更多关于它的信息。 + +- [下载 ActivityWatch][2] + +顺便提一句,如果你计划经常使用 ActivityWatch,你应该将下载的文件移动到 `/opt` 目录下,并在 `/usr/share/bin` 目录下创建一个链接到 `aw-qt` 可执行文件符号链接。这样一来,该应用程序可以作为一个常规命令供系统上的所有用户使用。类似的方法在 [PopcornTime 安装教程][17]中也有演示。 + +### 我对 ActivityWatch 的看法 + +![][18] + +在 [Pop!_OS 20.04][19] 上,时间跟踪功能可以完全正常地工作,也支持系统托盘图标。你可能会遇到一个错误,不能让你从系统托盘图标访问 ActivityWatch(这也是一个 [GitHub 上的已知问题][20])。在这种情况下,你需要通过 [localhost:5600][15] 来访问它。 + +就个人而言,考虑到我在桌面上使用它,并且没有计划在智能手机上使用它,我对提供的功能相当满意。 + +我必须得向你推荐尝试这个不错的开源项目,并一路支持他们。如果你喜欢这个项目,请随时通过添加星标或赞助[他们的 GitHub 仓库][21]来表示你的赞赏。 + +欢迎在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/activitywatch/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch.png?fit=800%2C607&ssl=1 +[2]: https://activitywatch.net/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-afk.jpg?ssl=1 +[4]: https://itsfoss.com/recommends/rescuetime/ +[5]: https://www.manictime.com/ +[6]: https://play.google.com/store/apps/details?id=net.activitywatch.android +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-timeline.jpg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-settings.jpg?ssl=1 +[9]: https://docs.activitywatch.net/en/latest/watchers.html +[10]: https://en.wikipedia.org/wiki/JSON +[11]: https://docs.activitywatch.net/en/latest/getting-started.html +[12]: https://aur.archlinux.org/packages/activitywatch-bin/ +[13]: https://itsfoss.com/unzip-linux/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/aw-qt.jpg?ssl=1 +[15]: https://itsfoss.com/activitywatch/5600 +[16]: https://github.com/ActivityWatch +[17]: https://itsfoss.com/popcorn-time-ubuntu-linux/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-screenshot.jpg?ssl=1 +[19]: https://itsfoss.com/pop-os-20-04-review/ +[20]: https://github.com/ActivityWatch/activitywatch/issues/208 +[21]: https://github.com/ActivityWatch/activitywatch diff --git a/published/202006/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md b/published/202006/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md new file mode 100644 index 0000000000..26bcd153cd --- /dev/null +++ b/published/202006/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12354-1.html) +[#]: subject: (Ubuntu Budgie 20.04 Review: Smooth, Polished & Plenty of Changes) +[#]: via: (https://itsfoss.com/ubuntu-budgie-20-04-review/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Ubuntu Budgie 20.04 LTS:平滑、精致和丰富的变化 +====== + +正如我们向读者承诺的那样,我们将对 [Ubuntu 20.04 LTS 版本][1]的所有主要特色版进行评测。在这个续篇中,我们将对 Ubuntu Budgie 进行评测。 + +![Ubuntu Budgie Desktop][2] + +顾名思义,[Ubuntu Budgie][3] 是使用 [Budgie 桌面环境][5]的 [Ubuntu 官方特色版][4]。这个版本是 Ubuntu 家族中较新的一位成员。Ubuntu Budgie 的第一个版本是 16.04,它在 17.04 版本时被接受为官方特色版。 + +他们的[目标][6]是“结合 Budgie 界面的简洁和优雅,以生产具有现代范式的面向桌面的传统发行版。” + +### Ubuntu Budgie 20.04 评测:哪些改变了,哪些没有! + +[自 18.04 LTS 发布以来,Ubuntu Budgie][7] 有了令人惊讶的更新和改进: + + * 苹果风格的新菜单 + * 默认采用基于 Budgie 的网络管理小程序 + * 新的 Window Shuffler 允许你通过快捷键平铺应用程序 + * 快速切换桌面布局的新工具 + * 支持 4k 分辨率 + * 新的默认应用程序:GNOME Firmware 和 Drawing + * 现在已经为 20.04 重构了向后移植包 + * 默认浏览器是火狐 + * 默认使用 Catfish 搜索文件和文本 + * 在 Budgie 中集成了 Nemo 文件管理器 + * 由于错误,系统托盘小程序被移除了 + * 默认情况下,事件警报声被禁用 + * 修复了键盘快捷键神秘失踪的问题 + * 更好的锁屏样式 + * 由于社区的需求,文件应用 Nautilus 已被 Nemo 取代 + * Plank 坞站现在已经切换到屏幕底部,是透明的,并且默认有弹跳动画 + * 快速笔记和热角小程序已从 Python 移植到 Vala,以提高速度 + * Celluloid 取代了 MPV + * 更新了 GNOME 的依赖性 + +![][8] + +Ubuntu Budgie 现在随附了 Budgie 桌面环境的最新版本(10.5.1)。改进包括: + + * 在 Budgie 桌面设置中新增 Raven 部分 + * Raven 通知可以分组,通知可以关闭 + * 重新打造了图标任务列表 + * 能够设置虚拟桌面的数量 + +Ubuntu Budgie 自带了大量的 Budgie 小程序applet微应用min-app。它们可以通过 Ubuntu Budgie “欢迎”应用来安装。 + +![Ubuntu Budgie Welcome][9] + + * WeatherShow:显示未来五天的天气预报,每 3 小时更新一次 + * Wallstreet:一个可以循环展示你的图像文件夹中的壁纸工具 + * Visual-space:一个紧凑的工作区切换器 + * Dropby:这个小程序可让你在面板上快速管理 U 盘 + * Kangaroo:从面板上快速浏览文件夹 + * 垃圾桶小程序:管理你的垃圾桶 + * Fuzzyclock:以模糊的方式显示时间 + * 工作区秒表:允许你跟踪在每个工作区花费的时间 + +完整的变更和更新列表,请访问[变更日志][10]。 + +#### 系统要求 + +Ubuntu Budgie 20.04 更新了[系统要求][11]: + + * 4GB 或以上的内存 + * 64 位的 Intel 和 AMD 处理器 + * 在 CSM 模式下启动的 UEFI 电脑 + * 基于英特尔的现代苹果电脑 + +如你所见,Budgie 并不是一个真正的轻量级选择。 + +#### 安装的应用 + +![][12] + +Ubuntu Budgie 中默认包含了以下有用的应用程序: + + * AisleRiot Solitaire + * Geary + * Catfish 搜索工具 + * Cheese 网络摄像头工具 + * GNOME Drawing + * GNOME 2048 + * GNOME Mahjongg + * GNOME Mines + * GNOME Sudoku + * Gthumb + * LibreOffice + * Maps + * Rhythmbox + * Tilix + * Ubuntu Budgie 欢迎应用 + * Evince 文档查看器 + * Plank + * Celluloid + +![Ubuntu Budgie Ram Usage][13] + +### 安装 + +起初,我无法让 Ubuntu Budgie 进入即用live环境来安装它。结果发现 Ubuntu Budgie 试图通过 EFI 来启动,我从 [Ubuntu Budgie 论坛][14]得到了解决方案。 + +当出现紫色的闪屏时,我必须按下 `ESC` 键并选择 `legacy`。之后,它就如常启动了,安装也没有问题了。我只在 Ubuntu Budgie 上遇到过这个问题。我下载并尝试了 Ubuntu MATE 20.04 ISO,但没有遇到类似的问题。 + +### Ubuntu Budgie 20.04 的体验 + +![][15] + +除了这个安装上的小问题,我使用 Ubuntu Budgie 的体验非常愉快。自 [Ikey][16] 第一次创建 Budgie 桌面以来,Budgie 桌面已经进步了很多,并且已经成为一个非常成熟的选择。Ubuntu Budgie 的目标是“生产一个面向桌面的传统发行版”。它确实做到了极致。他们所做的所有改变都在不断地为他们的产品增添更多的光彩。 + +总的来说,Ubuntu Budgie 是一个非常漂亮的发行版。从默认的主题到壁纸选择,你可以看出他们付出了很多努力,视觉体验非常吸引人。 + +需要注意的是,Ubuntu Budgie 并不适合低配置的系统。我在戴尔 Latitude D630 上运行它。在没有打开任何应用程序的情况下,它使用了大约 700MB 的内存。 + +在 Ubuntu Budgie 中,让我喜欢的部分超乎我的预期,其中一个部分是 [Tilix 终端模拟器][17]。Tilix 允许你在右侧或下方添加终端窗口。它有很多很多功能,我简直爱死了它,我打算在我的其他 Linux 系统上也安装它。 + +### 关于 Ubuntu Budgie 20.04 的最后感想 + +Ubuntu Budgie 是众多官方版本中一个很受欢迎的新版本。Budgie 给人的感觉非常流畅和精致。它不会让你觉得碍手碍脚,而是帮你完成工作。 + +如果你厌倦了当前的桌面环境,想体验一下新的东西,不妨来看看。如果你对当前的环境感到满意,那么就试试 Ubuntu Budgie 的即用 DVD。你可能会喜欢上它。 + +![关于 Ubuntu Budgie][18] + +你是否已经尝试过 Ubuntu 20.04 Budgie?你对它的使用体验如何?如果没有用过,你现在使用的是哪个版本的 Ubuntu 20.04? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-budgie-20-04-review/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/download-ubuntu-20-04/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-busgie-desktop.png?resize=800%2C500&ssl=1 +[3]: https://ubuntubudgie.org/ +[4]: https://itsfoss.com/which-ubuntu-install/ +[5]: https://en.wikipedia.org/wiki/Budgie_ +[6]: https://ubuntubudgie.org/about-us/ +[7]: https://itsfoss.com/ubuntu-budgie-18-review/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-desktop-settings.jpeg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-welcome.png?resize=800%2C472&ssl=1 +[10]: https://ubuntubudgie.org/2020/04/21/ubuntu-budgie-20-04lts-release-notes-for-18-04-upgraders/ +[11]: https://ubuntubudgie.org/downloads/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-applications.jpeg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-ram-usage.png?resize=800%2C600&ssl=1 +[14]: https://discourse.ubuntubudgie.org/t/cant-get-ub-to-boot/3397 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-20-04.jpg?ssl=1 +[16]: https://itsfoss.com/ikey-doherty-serpent-interview/ +[17]: https://gnunn1.github.io/tilix-web/ +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-about.png?resize=800%2C648&ssl=1 diff --git a/published/202006/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md b/published/202006/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md new file mode 100644 index 0000000000..86e6a6c6d2 --- /dev/null +++ b/published/202006/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12341-1.html) +[#]: subject: (Ubuntu MATE 20.04 LTS Review: Better Than Ever) +[#]: via: (https://itsfoss.com/ubuntu-mate-20-04-review/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu MATE 20.04 LTS:士别三日,当刮目相待 +====== + +Ubuntu MATE 20.04 LTS 无疑是最流行的 [Ubuntu 官方特色版本][1]之一。 + +不仅仅是我,这份[Ubuntu 20.04 调查报告][2]也持同样观点。不过不管流行与否,它都是一个令人印象深刻的 Linux 发行版,尤其是用在较旧的硬件上时。事实上,它也是可用的[最轻量的 Linux 发行版][3]之一。 + +所以,我想在一个虚拟机中尝试一下,为你提供一个概览,这样你可以了解其中有何值得期盼的变化,以及是否值得尝试。 + +### 在 Ubuntu MATE 20.04 LTS 中有什么新功能? + +- [video](https://www.youtube.com/embed/WBZyXDHw4HA) + +Ubuntu MATE 20.04 LTS 的主要亮点应该是增加了 MATE Desktop 1.24。 + +你可以期待 MATE Desktop 1.24 中的所有新特色都被打包到 Ubuntu MATE 20.04 中。除此之外,还有很多重要的变化、改进和增补。 + +这是 Ubuntu MATE 20.04 中变化的概述: + + * 新增 MATE Desktop 1.24 + * 大量视觉改进 + * 数十处错误修复 + * 基于 [Linux 内核 5.4][5] 系列 + * 添加了实验性的 [ZFS][6] 支持 + * 添加了来自 [Feral Interactive][7] 的 GameMode + * 一些软件包更新 + +现在,为了更好地了解 Ubuntu MATE 20.04,我将给你提供更多的细节。 + +### 用户体验改善 + +![][8] + +考虑到越来越多的用户倾向于在桌面上使用 Linux,而用户体验在桌面中起着至关重要的作用。 + +如果有一些易于使用和令人愉悦的东西,那么第一印象就会有很大不同。 + +对于 Ubuntu MATE 20.04 LTS,我没有感到失望。就我个人而言,我是最新的 [GNOME 3.36][9] 的粉丝。我喜欢在我 [Pop!_OS 20.04][10] 上使用它,但是随着 [MATE 1.24][11] 的出现,使得 Ubuntu MATE 也同样具有很好的体验。 + +你会看到窗口管理器有一些重大更改,包括:增加了用于重新调整大小的隐形边框,HiDPI 图标渲染,重新设计了 `ALT+TAB` 工作区切换器的弹出窗口和一些其它的更改,这些是最新的 MATE 1.24 桌面环境的一部分。 + +![][12] + +此外, MATE Tweak 也得到了一些贴心的改进,即使你更改桌面的布局,也可以保留用户偏好。新的 MATE 欢迎屏幕也会告知用户更改桌面布局的能力,因此,用户无需不断摸索就能知道这个变化。 + +此外,我最喜欢的新增功能之一是可以预览最小化的应用程序。 + +例如,你已经最小化了一个应用程序,但是你想在拉起它之前看到它的预览 —— 现在你只需将鼠标悬停在任务栏上就可以做到这一点,如下图所示: + +![][13] + +不过,我必须指出,并不是每个应用程序都可以如预期般的工作。因此,这个功能是有缺陷的,还需要改进。 + +### 应用程序新增或升级 + +![][14] + +在 MATE 20.04 中,你会注意到有一个新的固件更新器,它是 [fwupd][15] 的 GTK 前端。你可以使用这个更新器来轻松地管理你的固件驱动。 + +这个版本也使用 Evolution 替换了 Thunderbird 电子邮件客户端。尽管 [Thunderbird][16] 是一个非常流行的电子邮件客户端,但是 [Evolution][17] 与 MATE 桌面集成得更好,并且证明它更有用。 + +![][18] + +考虑到我们已经搭载了 MATE 1.24,你也将发现一个新的时间和日期管理应用程序。不仅如此,如果你需要一个放大镜,Ubuntu MATE 20.04 还内置了 [Magnus][19]。 + +![][20] + +Ubuntu MATE 20.04 也包括了众多预安装的软件包/应用程序的升级包。 + +![][21] + +尽管这些是小的增补,但却能在很大程度上帮助发行版变得更有用。 + +### Linux Kernel 5.4 + +Ubuntu MATE 20.04 带有 2019 年最后一个主要的稳定版内核,即 [Linux 内核 5.4][5]。 + +使用该内核,你可以获得原生的 [exFAT 支持][22]、改进的硬件支持。更不用说,拥有 [WireGuard][23] VPN 的支持也是一件极好的事。 + +所以,你会注意到 Linux Kernel 5.4 的众多好处,包括内核锁定功能。如果你好奇,你可以阅读我们关于 [Linux Kernel 5.4][5] 的新闻报道来了解更多的细节。 + +### 增加了 Feral Interactive 的 GameMode + +以将游戏带到 Linux 平台而闻名的 Feral Interactive 带来了一款实用的命令行工具,即 [GameMode][7]。 + +它没有提供图形界面,但是在启动一个游戏前,你可以使用命令行请求临时性的系统优化。 + +虽然这可能不会给每个系统都带来很大的不同,而是给玩游戏提供了更多的资源,并且 GameMode 可以确保你获得必要的优化。 + +### 实验性的 ZFS 安装选项 + +你可以使用 ZFS 作为根文件系统了。值得注意的是,它是一个实验性的功能,如果你不确定自己在做什么,那么就不应该使用它。 + +要更好地了解 ZFS,我建议你阅读我们的一篇文章,[John Paul][24] 所写的《[ZFS 是什么][6]》的文章。 + +### 性能和其它的改进 + +Ubuntu MATE 是一款完美的轻量级发行版,同时也是一款适合现代台式机的发行版。 + +![][25] + +在这个评测中,我没有运行任何特殊的基准测试工具,以一个普通用户来说,我在虚拟机设置中没有发现任何性能问题。我在一台使用了一颗 i5-7400 处理器、配备 GTX 1050 显卡和 16 GB 内存的主机系统上进行了测试。并且,我将 7 GB 的内存 + 768 MB 的显存 + 2 个处理器核心分配给了虚拟机。 + +![][26] + +如果你要自己测试它,请随时告诉我你对它的感觉如何。 + +总的来说,除了所有主要的改进之外,还有一些细微的改变/修复/改进,使得 Ubuntu MATE 20.04 LTS 成为了一个很好的升级版本。 + +### 我应该升级吗? + +如果你正在运行 Ubuntu MATE 19.10,你应该立即升级它,因为它的支持将在 2020 年 6 月结束。 + +对于 Ubuntu MATE 18.04 用户(支持到 2021 年 4 月)来说,这取决于你的需求。如果你需要最新发布版本的功能,你应该选择立即升级它。 + +但是,如果你不一定需要新的功能,你可以查看[现存的错误列表][27] 并加入 [Ubuntu MATE 社区][28] 来了解更多最新发布版本的问题。 + +在你做完必要的研究后,你可以继续升级你的系统到 Ubuntu MATE 20.04 LTS,它将支持到 2023 年 4 月。 + +你试过最新的 Ubuntu MATE 20.04 吗?你认为它怎么样?在评论中让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-mate-20-04-review/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/which-ubuntu-install/ +[2]: https://ubuntu.com/blog/ubuntu-20-04-survey-results +[3]: https://itsfoss.com/lightweight-linux-beginners/ +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://itsfoss.com/linux-kernel-5-4/ +[6]: https://itsfoss.com/what-is-zfs/ +[7]: https://github.com/FeralInteractive/gamemode +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-20-04.jpg?ssl=1 +[9]: https://itsfoss.com/gnome-3-36-release/ +[10]: https://linux.cn/article-12175-1.html +[11]: https://mate-desktop.org/blog/2020-02-10-mate-1-24-released/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-desktop-layout.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-minimized-app.png?ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-20-04-firmware.png?ssl=1 +[15]: https://fwupd.org +[16]: https://www.thunderbird.net/en-US/ +[17]: https://wiki.gnome.org/Apps/Evolution +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-evolution.png?ssl=1 +[19]: https://kryogenix.org/code/magnus/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-magnus.jpg?ssl=1 +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-apps.png?ssl=1 +[22]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/ +[23]: https://wiki.ubuntu.com/WireGuard +[24]: https://itsfoss.com/author/john/ +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-system-reosource.jpg?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-focal-neofetch.png?ssl=1 +[27]: https://bugs.launchpad.net/ubuntu-mate +[28]: https://ubuntu-mate.community/ diff --git a/published/202006/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md b/published/202006/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md new file mode 100644 index 0000000000..9252d16b1c --- /dev/null +++ b/published/202006/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12294-1.html) +[#]: subject: (How to Format a USB Disk as exFAT on Linux [Graphically and Command Line]) +[#]: via: (https://itsfoss.com/format-exfat-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Linux 上将 USB 盘格式化为 exFAT +====== + +> 本教程教你如何在 Linux 系统上以 exFAT 格式格式化 USB 盘。同时包括 GUI 和命令行两种方法。 + +长期以来,[FAT][1] 是用于格式化磁盘文件系统的默认选择。它与几乎所有主要操作系统兼容。 + +FAT 文件系统的一个主要问题是你不能传输大于 4GB 的文件。这意味着即使你的 USB 盘有 32GB 的可用空间,如果你尝试传输 ISO 镜像或其他大于 4GB 的文件,传输也会失败。 + +这会[在 Linux 中创建 Windows 的可启动 USB 盘][2]的情况下造成问题。你不能使用 [NTFS][3],并且 FAT 文件系统有 4GB 的大小限制。 + +为了克服 FAT 文件系统的限制,微软推出了 [exFAT 文件系统][4]。在本教程中,我将向你展示如何使用 exFAT 文件系统中格式化 USB 盘。 + +### 先决条件 + +从 [Linux kernel 5.4][7] 开始,Linux 内核本身中启用了 exFAT 文件系统支持。[检查正在运行的 Linux 内核版本][8]。如果是内核 5.4 或更高版本,那么应该没问题。 + +不然,你必须[启用 exFAT 支持][9]。在基于 Ubuntu 的发行版中,你可以安装以下软件包: + +``` +sudo apt install exfat-fuse exfat-utils +``` + +### 方法 1:使用 GNOME 磁盘工具将磁盘格式化为 exFAT + +![][10] + +使用 “[GNOME 磁盘][11]” 格式化驱动器是一项简单的工作。它预装在许多 Linux 发行版中。 + +插入外部 USB 盘。在菜单中查找 “Disk”,然后打开 “GNOME 磁盘” 应用。第一步,选择要格式化的驱动器,然后按照我的步骤操作。 + +**警告:请注意你要选择格式化的磁盘。请勿意外格式化主磁盘。** + +![][12] + +诸如 Ext4、NTFS、FAT 之类的常用文件系统将首先出现。要使用 exFAT,请选择 “其它”,然后单击 “下一步”。 + +![][13] + +最后一步:在此页面上选择 exFAT 文件系统,然后单击 “创建”。完成了! + +![][14] + +看到在 Linux 中以图形方式创建 exFAT 磁盘有多么容易了吧?现在,让我向你展示终端方法。 + +### 方法 2:在 Linux 命令行中将磁盘格式化为 exFAT(适用于高级用户) + +[fdisk][15] 是一个交互式命令行程序,它可在硬盘上创建和操作分区表和分区。实际上,它被认为是 [Linux 最佳分区工具][16]之一。 + +插入外部硬盘,然后在终端中输入以下命令: + +``` +sudo fdisk -l +``` + +![][17] + +这将列出计算机中的所有硬盘和分区。识别出要在外部硬盘上格式化的分区。应该会提示磁盘大小。对我而言,USB 盘被标记为 `/dev/sdb1`。 + +识别出 USB 盘后,请使用以下命令将它格式化为 exfat。将 `/dev/sdXn` 替换为你的磁盘 ID。`LABEL` 是你要为磁盘命名的名称,例如 `Data`、`MyUSB` 等。 + +``` +sudo mkfs.exfat -n LABEL /dev/sdXn +``` + +![][18] + +可选地,运行 `fsck` 检查,以确保格式化正确。 + +``` +sudo fsck.exfat /dev/sdXn +``` + +就是这样。享受 exFAT 盘吧。 + +### 你是否成功创建了exFAT 盘? + +我希望你觉得本教程足够简单,并建立坚实的分区知识基础的第一步。 + +从长远来看,有时简单易用的技巧将让你拥有一个更好的 Linux。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/format-exfat-linux/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/File_Allocation_Table +[2]: https://itsfoss.com/bootable-windows-usb-linux/ +[3]: https://en.wikipedia.org/wiki/NTFS +[4]: https://en.wikipedia.org/wiki/ExFAT +[5]: tmp.YPwoWNgq9W#graphical-method +[6]: tmp.YPwoWNgq9W#command-line +[7]: https://itsfoss.com/linux-kernel-5-4/ +[8]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[9]: https://itsfoss.com/mount-exfat/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/format-exfat-linux.jpg?ssl=1 +[11]: https://wiki.gnome.org/Apps/Disks +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/1.-gnome-disks-2.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.-gnome-disks.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.-gnome-disks.jpg?ssl=1 +[15]: https://www.tldp.org/HOWTO/Partition/fdisk_partitioning.html +[16]: https://itsfoss.com/partition-managers-linux/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/sudo-fdisk-l-1.jpg?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/sdXn.jpg?ssl=1 diff --git a/published/202006/20200528 Simplify data visualization in Python with Plotly.md b/published/202006/20200528 Simplify data visualization in Python with Plotly.md new file mode 100644 index 0000000000..870947b3e2 --- /dev/null +++ b/published/202006/20200528 Simplify data visualization in Python with Plotly.md @@ -0,0 +1,353 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12356-1.html) +[#]: subject: (Simplify data visualization in Python with Plotly) +[#]: via: (https://opensource.com/article/20/5/plotly-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Plotly 来简化 Python 中的数据可视化 +====== + +> Plotly 是一个数据绘图库,具有整洁的接口,它旨在允许你构建自己的 API。 + +![](https://img.linux.net.cn/data/attachment/album/202006/27/215314y0rkrz0e9zw7wd2o.jpg) + +Plotly 是一个绘图生态系统,可以让你在 [Python][2] 以及 JavaScript 和 R 中进行绘图。在本文中,我将重点介绍[使用 Python 库进行绘图][3]。 + +Plotly 有三种不同的 Python API,你可以选择不同的方法来使用它: + + * 类似于 Matplotlib 的面向对象的 API + * 数据驱动的 API,通过构造类似 JSON 的数据结构来定义绘图 + * 类似于 Seaborn 的高级绘图接口,称为 “Plotly Express” API + +我将通过使用每个 API 来绘制相同的图来探索它们:英国大选结果的分组柱状图。 + +在我们进一步探讨之前,请注意,你可能需要调整你的 Python 环境来让这段代码运行,包括以下内容: + +- 运行最新版本的Python([Linux][4]、[Mac][5] 和 [Windows][6] 的说明) +- 确认你运行的 Python 版本能与这些库一起工作 + +数据可在线获得,可以用 Pandas 导入。 + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们可以继续进行了。 + +### 使用图对象来绘制图 + +Plotly 面向对象的 API 被称为 `graph_objects`,它有点类似于 [Matplotlib 的面向对象 API][7]。 + +要创建一个柱状图,你可以构造一个包含四个柱状图的对象: + +``` +# 导入 Plotly 和数据 +import plotly.graph_objects as go +from votes import wide as df + +# 得到 x 列表 +years = df['year'] +x = list(range(len(years))) + +# 定义绘图 +bar_plots = [ +  go.Bar(x=x, y=df['conservative'], name='Conservative', marker=go.bar.Marker(color='#0343df')), +  go.Bar(x=x, y=df['labour'], name='Labour', marker=go.bar.Marker(color='#e50000')), +  go.Bar(x=x, y=df['liberal'], name='Liberal', marker=go.bar.Marker(color='#ffff14')), +  go.Bar(x=x, y=df['others'], name='Others', marker=go.bar.Marker(color='#929591')), +] + +# 指定样式 +layout = go.Layout( +  title=go.layout.Title(text="Election results", x=0.5), +  yaxis_title="Seats", +  xaxis_tickmode="array", +  xaxis_tickvals=list(range(27)), +  xaxis_ticktext=tuple(df['year'].values), +) +    +# 绘制柱状图 +fig = go.Figure(data=bar_plots, layout=layout) + +# 告诉 Plotly 去渲染 +fig.show() +``` + +与 Matplotlib 不同的是,你无需手动计算柱状图的 `x` 轴位置,Plotly 会帮你适配。 + +最终结果图: + +![A multi-bar plot made using Graph Objects][8] + +*A multi-bar plot made using Graph Objects (© 2019 [Anvil][9])* + +### 使用 Python 数据结构来绘图 + +你还可以使用 Python 基本数据结构来定义绘图,它与面对对象 API 具有相同的结构。这直接对应于 Plotly 的 JavaScript 实现的 JSON API。 + +``` +# 定义绘图数据 +fig = { +    'data': [ +        {'type': 'bar', 'x': x, 'y': df['conservative'], 'name': 'Conservative', 'marker': {'color': '#0343df'}}, +        {'type': 'bar', 'x': x, 'y': df['labour'], 'name': 'Labour', 'marker': {'color': '#e50000'}}, +        {'type': 'bar', 'x': x, 'y': df['liberal'], 'name': 'Liberal', 'marker': {'color': '#ffff14'}}, +        {'type': 'bar', 'x': x, 'y': df['others'], 'name': 'Others', 'marker': {'color': '#929591'}}, +    ], +    'layout': { +        'title': {'text': 'Election results', 'x': 0.5}, +        'yaxis': {'title': 'Seats'}, +        'xaxis': { +            'tickmode': 'array', +            'tickvals': list(range(27)), +            'ticktext': tuple(df['year'].values), +        } +    } +} + +# 告诉 Plotly 去渲染它 +pio.show(fig) +``` + +最终结果与上次完全相同: + +![A multi-bar plot made using JSON-like data structures][10] + +*A multi-bar plot made using JSON-like data structures (© 2019 [Anvil][9])* + +#### 使用 Plotly Express 进行绘图 + +[Plotly Express][11] 是对图对象进行封装的高级 API。 + +你可以使用一行代码来绘制柱状图: + +``` +# 导入 Plotly 和数据 +import plotly.express as px +from votes import long as df + +# 定义颜色字典获得自定义栏颜色 +cmap = { +    'Conservative': '#0343df', +    'Labour': '#e50000', +    'Liberal': '#ffff14', +    'Others': '#929591', +} + +# 生成图 +fig = px.bar(df, x="year", y="seats", color="party", barmode="group", color_discrete_map=cmap) +``` + +这里使用了[长表][12]Long Form 数据,也称为“整洁数据”。这些列代表年份、政党和席位,而不是按政党划分。这与在 [Seaborn][13] 中制作柱状图非常相似。 + +``` +>> print(long) +     year         party  seats +0    1922  Conservative    344 +1    1923  Conservative    258 +2    1924  Conservative    412 +3    1929  Conservative    260 +4    1931  Conservative    470 +..    ...           ...    ... +103  2005        Others     30 +104  2010        Others     29 +105  2015        Others     80 +106  2017        Others     59 +107  2019        Others     72 + +[108 rows x 3 columns] +``` + +你可以访问底层的图对象 API 进行详细调整。如添加标题和 `y` 轴标签: + +``` +# 使用图对象 API 来调整绘图 +import plotly.graph_objects as go +fig.layout = go.Layout( +    title=go.layout.Title(text="Election results", x=0.5), +    yaxis_title="Seats", +) +``` + +最后,让 Plotly 渲染: + +``` +fig.show() +``` + +这将在未使用的端口上运行一个临时 Web 服务器,并打开默认的 Web 浏览器来查看图像(Web 服务器将会马上被关闭)。 + +不幸的是,结果并不完美。`x` 轴被视为整数,因此两组之间的距离很远且很小,这使得我们很难看到趋势。 + +![使用 Plotly Express 制作的柱状图][14] + +*A multi-bar plot made using Plotly Express (© 2019 [Anvil][9])* + +你可能会尝试通过将 `x` 值转换为字符串来使 Plotly Express 将其视为字符串,这样它就会以均匀的间隔和词法顺序来绘制。不幸的是,它们的间隔还是很大,像在 `graph_objects`中那样设置 `xaxis_tickvals` 也不行。 + +与 [Seaborn][13] 中的类似示例不同,在这种情况下,抽象似乎没有提供足够的[应急方案][15]来提供你想要的东西,但是也许你可以编写*自己*的 API? + +### 构建自己的 Plotly API + +对 Plotly 的操作方式不满意?那就构建自己的 Plotly API! + +Plotly 的核心是一个 JavaScript 库,它使用 [D3][16] 和 [stack.gl][17] 进行绘图。JavaScript 库的接口使用指定的 JSON 结构来绘图。因此,你只需要输出 JavaScript 库喜欢使用的 JSON 结构就好了。 + +Anvil 这样做是为了创建一个完全在浏览器中工作的 Python Plotly API。 + +![Ployly 使用 JavaScript 库创建图形,由其它语言库通过 JSON 使用][18] + +*Plotly uses a JavaScript library to create plots, driven by libraries in other languages via JSON (© 2019 [Anvil][9])* + +在 Anvil 版本中,你可以同时使用图对象 API 和上面介绍的 Python 数据结构方法。运行完全相同的命令,将数据和布局分配给 Anvil 应用程序中的 [Plot 组件][19]。 + +这是用 Anvil 的客户端 Python API 绘制的多列柱状图: + +``` +# 导入 Anvil 库 +from ._anvil_designer import EntrypointTemplate +from anvil import * +import anvil.server + +# 导入客户端 Plotly +import plotly.graph_objs as go + +# 这是一个 Anvil 表单 +class Entrypoint(EntrypointTemplate): +  def __init__(self, **properties): +    # Set Form properties and Data Bindings. +    self.init_components(**properties) + +    # 从服务器获取数据 +    data = anvil.server.call('get_election_data') +    +    # 获取一个方便的 x 值列表 +    years = data['year'] +    x = list(range(len(years))) + +    # 定义绘图 +    bar_plots = [ +      go.Bar(x=x, y=data['conservative'], name='Conservative', marker=go.Marker(color='#0343df')), +      go.Bar(x=x, y=data['labour'], name='Labour', marker=go.Marker(color='#e50000')), +      go.Bar(x=x, y=data['liberal'], name='Liberal', marker=go.Marker(color='#ffff14')), +      go.Bar(x=x, y=data['others'], name='Others', marker=go.Marker(color='#929591')), +    ] +    # 规定布局 +    layout = { +      'title': 'Election results', +      'yaxis': {'title': 'Seats'}, +      'xaxis': { +        'tickmode': 'array', +        'tickvals': list(range(27)), +        'ticktext': data['year'], +      }, +    } + +    # 生成多列柱状图 +    self.plot_1.data = bar_plots +    self.plot_1.layout = layout +``` + +绘图逻辑与上面相同,但是它完全在 Web 浏览器中运行,绘图是由用户计算机上的 Plotly JavaScript 库完成的!与本系列的所有其它 [Python 绘图库][3]相比,这是一个很大的优势。因为其它 Python 库都需要在服务器上运行。 + +这是在 Anvil 应用中运行的交互式 Plotly 图: + +![The election plot on the web using Anvil's client-side-Python Plotly library][20] + +*The election plot on the web using Anvil's [client-side-Python][21] Plotly library (© 2019 [Anvil][9])* + +你可以[复制此示例][22]作为一个 Anvil 应用程序(注意:Anvil 需要注册才能使用)。 + +在前端运行 Plotly 还有另一个优势:它为自定义交互行为提供了更多选项。 + +### 在 Plotly 中自定义交互 + +Plotly 绘图不仅是动态的,你可以自定义它们的互动行为。例如,你可以在每个柱状图中使用 `hovertemplate` 自定义工具提示的格式: + +``` + go.Bar( + x=x, + y=df['others'], + name='others', + marker=go.bar.Marker(color='#929591'), + hovertemplate='Seats: %{y}', + ), +``` + +当你把这个应用到每个柱状图时,你会看到以下结果: + +![A multi-bar plot with custom tool-tips][23] + +*A multi-bar plot with custom tool-tips (© 2019 [Anvil][9])* + +这很有用,当你想要在某些事件发生时执行任何你想要的代码就更好了(例如,当用户将鼠标悬停在栏上,你想要显示一个相关选举的信息框)。在 Anvil 的 Plotly 库中,你可以将事件处理程序绑定到诸如悬停之类的事件,这使得复杂的交互成为可能。 + +![A multi-bar plot with a hover event handler][24] + +*A multi-bar plot with a hover event handler (© 2019 [Anvil][9])* + +你可以通过将方法绑定到绘图的悬停事件来实现: + +``` + def plot_1_hover(self, points, **event_args): + """This method is called when a data point is hovered.""" + i = points[0]['point_number'] + self.label_year.text = self.data['year'][i] + self.label_con.text = self.data['conservative'][i] + self.label_lab.text = self.data['labour'][i] + self.label_lib.text = self.data['liberal'][i] + self.label_oth.text = self.data['others'][i] + url = f"https://en.wikipedia.org/wiki/{self.data['year'][i]}_United_Kingdom_general_election" + self.link_more_info.text = url + self.link_more_info.url = url +``` + +这是一种相当极端的交互性,从开发人员的角度来看,也是一种极端的可定制性。这都要归功于 Plotly 的架构 —— 它有一个简洁的接口,明确的设计是为了让你建立自己的API。如果到处都能看到这种伟大的设计,那将会很有帮助! + +### 使用 Bokeh 进行自定义交互 + +现在你已经了解了 Plotly 如何使用 JavaScript 来创建动态图,并且可以使用 Anvil 的客户端编写 Python 代码在浏览器中实时编辑它们。 + +Bokeh 是另一个 Python 绘图库,它可以输出可嵌入 Web 应用程序的 HTML 文档,并获得与 Plotly 提供的功能类似的动态功能(如果你想知道如何发音,那就是 “BOE-kay”)。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/plotly-python + +作者:[Shaun Taylor-Morgan][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://opensource.com/resources/python +[3]: https://linux.cn/article-12327-1.html +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: thttps://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/article/20/5/matplotlib-python +[8]: https://opensource.com/sites/default/files/uploads/plotly.png (A multi-bar plot made using Graph Objects) +[9]: https://anvil.works/blog/plotting-in-plotly +[10]: https://opensource.com/sites/default/files/uploads/plotly-pio.png (A multi-bar plot made using JSON-like data structures) +[11]: https://plot.ly/python/plotly-express/ +[12]: https://anvil.works/blog/tidy-data +[13]: https://opensource.com/article/20/5/seaborn-visualization-python +[14]: https://opensource.com/sites/default/files/uploads/plotly-express.png (A multi-bar plot made using Plotly Express) +[15]: https://anvil.works/blog/escape-hatches-and-ejector-seats +[16]: https://d3js.org/ +[17]: http://stack.gl/ +[18]: https://opensource.com/sites/default/files/uploads/plotly-arch.png (Plotly uses a JavaScript library to create plots, driven by libraries in other languages via JSON) +[19]: https://anvil.works/docs/client/components/plots +[20]: https://opensource.com/sites/default/files/uploads/plotting-in-anvil.gif (The election plot on the web using Anvil's client-side-Python Plotly library) +[21]: https://anvil.works/docs/client/python +[22]: https://anvil.works/login?app-name=Plotting%20in%20Plotly&app-author=shaun%40anvil.works +[23]: https://opensource.com/sites/default/files/uploads/plotly-tooltips.png (A multi-bar plot with custom tool-tips) +[24]: https://opensource.com/sites/default/files/uploads/plotly-event-handling.gif (A multi-bar plot with a hover event handler) diff --git a/published/202006/20200529 20 productivity tools for the Linux terminal.md b/published/202006/20200529 20 productivity tools for the Linux terminal.md new file mode 100644 index 0000000000..a373c3bb21 --- /dev/null +++ b/published/202006/20200529 20 productivity tools for the Linux terminal.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12274-1.html) +[#]: subject: (20 productivity tools for the Linux terminal) +[#]: via: (https://opensource.com/article/20/6/productivity-tools-linux-terminal) +[#]: author: (Alan Smithee https://opensource.com/users/alansmithee) + +20 个 Linux 终端下的生产力工具 +====== + +> 来试下这些开源工具。你的效率一定会提升。 + +![Computer screen with files or windows open][1] + +诚然,很多人使用计算机来娱乐。但是一些人会用来工作,他们的理论是计算机应当能帮我们更快、更好、更有条理地做事。实际应用中,如果没有根据每个人的工作风格来做一些小小的手动配置,计算机也不会提升我们的效率。 + +[Kevin Sonney][2] 喜欢设计系统,今年他在一个 20 篇文章的系列中介绍了 18 种不同的生产力工具,不仅涵盖了网络方面,也涉及了一些能提升他的工作效率的工具。Kevin 最喜欢的所有的工具都收集到了本文,下面概括介绍每种工具的用途。 + +### 文件同步 + +![][3] + +重要的文件应谨慎管理。 + + * [Syncthing][4] 能使不同设备上的文件彼此同步。*设备*可以是 Linux、Windows 或 Mac,也可以是服务器、Android 平板或手机,等等。文件可以是你期望在多台机器间同步的任意文件。Syncthing 是轻量级的点对点工具,因此你不需要支付服务费,你不需要第三方的服务器,而且它很快。 + * 同步是一件事,但有时你还需要帮忙处理你拥有的文件。假设你想要一个应用程序在作为一个图形化应用和作为控制台应用时表现不同行为,你可以通过修改符号链接指向的不同的配置文件来达成,如 `.foo-gui` 和 `.foo-term`。这完全可以手动修改,但也可以用脚本处理,或者你可以试试 [GNU Stow][5]。 + +### 邮件管理 + +![][6] + +我们都依赖于邮件和收件箱,但似乎很少有人对自己管理邮件的方式满意。如果你喜欢用终端工作,为什么不在终端里管理邮件呢?在终端里收发邮件是一件事,但是要能在终端里组织你的邮件就更棒了。如果你的职业是打字员或是天生写脚本的人,试试这类工具吧。 + + * 我每天用 [OfflineIMAP][7] 把工作邮件同步到笔记本,以便用 Mutt 看邮件。它是很特别的工具,只做一件事:保证本地的邮件副本与远程的收件箱完全同步。配置和用 [cron][8] 调度它都相当简单,然后你就可以忘了它的存在。它相当简单,你与 IMAP 打交道的每一刻时间都应该用它。 + * [Notmuch][9] 能为邮件消息建立索引、加标签以及搜索邮件。如果你的收件箱出了问题,它可以让你*不需要*花费很大精力去补救。 + * [Vim][10] 可以收发邮件和管理你的日历。 + * 当然,[Emacs][11] 可以收发邮件和管理你的日历。 + +### 日历和联系人 + +![][12] + +我用过的所有的 Linux 系统都预装了 `cal` 命令。这是一个在终端下用的便捷小日历,它也是个很好的速查工具。然而,它几乎不能被称为一个日历应用程序。[iCalendar][13] 规范(与 Apple 的旧桌面日历无关)中提供了丰富的共享日历功能,虽然 `.ics` 的约会和事件是纯文本的,但没有在终端中管理它们的工作流。至少,在 khal 和 vdirsyncer 出现之前不存在。 + + * [Khal][14] 是基于控制台的读写 `.ics` 文件的日历工具。 + * [Vdirsyncer][14] 是一个能把线上日历(和联系人)同步到本地的终端命令。Khal 在本地运行,vdirsyncer 在远程运行,这样远程的日历能与你管理的本地日历保持同步。 + * 管理联系人可能会很难,但是如果你用了 [Khard][15] 这个可以读写 vCard 格式文件的终端命令,就会变得简单。反过来,这些文件可以使用 vdirsyncer(你可能已经在使用 khal 日历)同步到远程服务器上。这使得日历和联系人管理变得简单,而且[搭建个人信息管理(PIM)服务器][16]也比以前容易得多。 + +### 待办清单 + +![][17] + + * 组织你每天的行程有很多种方式,但是最简单的一种是用 [todo.txt][18],一个简单、便携、易于理解的系统,即使设备上没有安装 todo.txt 也不会出现问题。todo.txt 能正常运行的原因是,它就是一个 Bash 脚本,能在几乎所有你能找到的的设备上运行。操作过程很简单:下载脚本,安装到家目录,用一个简单的命令开始调度任务。如果你的计算机上没有安装 `todo.sh` 命令,那么你的待办清单仍然可以作为纯文本文件来使用,你可以在需要时手动更新它。 + * [Jrnl][19] 是一个能追踪的你的日常议程和活动的数字笔记本。如果你要摘抄桌面上的报纸的片段或者把随意的想法写下来,那么这就是你要找的程序。 + +### 保持联络 + +![][20] + +沟通是关键,然而现在似乎比以往更多的是聊天平台的问题。这不仅仅是几个客户端,而是几个独立的网络。你怎么管理它们?这里有两个方案。 + + * 如果你有很多的联系人分布在太多的聊天网络中,那么你应该试试 [BitlBee][21],使用这个单一的聊天客户端就可以关联其他所有的聊天网络。 + * [Rainbow Stream][22] 是个推特客户端,能让你不被开放的网页浏览器分心,而又能紧跟时事。 + +### 消息通知 + +![][23] + +网页浏览器很好,但有时过犹不及。你希望能及时收到消息,但是你又不想全身心地陷入到互联网中。因为互联网是建立在开放的规范和大量的开源技术的基础上的,你不必在一个界面中做所有的事。对于不同的任务有不同的*客户端*,它们可以让你用自己喜欢的界面来获取你需要的信息。 + + * [Tuir][24] 是一个 Reddit 终端客户端。 + * [Newsboat][25] 是一个 RSS 阅读器。 + * [Wego][26] 是天气预报工具。 + * [Vim][27] 可以帮助你登录 Reddit 和 Twitter。 + * [Emacs][28] 能让你保持与 Reddit、Twitter 和聊天客户端的联系。 + +### 保持终端一直开启 + +![][29] + +如果你正在用终端工作,那么关闭它的意义是什么呢?摆脱 `exit` 和 `Ctrl+D` 的诱惑,让你的控制台一直开启着。 + + * [Tmux][30] 能分割你的终端,让一个终端窗口“分层"到另一个窗口之上,甚至从一台计算机离开到另一台计算机后,能保持相同的终端会话。 + * [DESQview][31] 是另一种方式:它本质上是一个终端窗口管理器。 + +### 未完待续 + +本文列出的工具只是 Linux 终端的神奇生产力工具中的一小部分。这个清单会结束,但你自己的清单可以继续。找到你喜欢的工具,学习它们,并将其发挥出最大的优势。当然,一个好的工具不一定要提高你的生产力:有时你最喜欢的命令也可以是能让你最快乐的命令。你的工作是找到自己喜欢的命令,用它们来改变世界。 + +玩得愉快! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/productivity-tools-linux-terminal + +作者:[Alan Smithee][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alansmithee +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open) +[2]: https://opensource.com/users/ksonney +[3]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png +[4]: https://linux.cn/article-11793-1.html +[5]: https://linux.cn/article-11796-1.html +[6]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png +[7]: https://linux.cn/article-11804-1.html +[8]: https://opensource.com/article/17/11/how-use-cron-linux +[9]: https://linux.cn/article-11807-1.html +[10]: https://linux.cn/article-11908-1.html +[11]: https://linux.cn/article-11932-1.html +[12]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png +[13]: https://tools.ietf.org/html/rfc5545 +[14]: https://linux.cn/article-11812-1.html +[15]: https://linux.cn/article-11834-1.html +[16]: https://opensource.com/alternatives/google-calendar +[17]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png +[18]: https://linux.cn/article-11835-1.html +[19]: https://linux.cn/article-11846-1.html +[20]: https://opensource.com/sites/default/files/uploads/productivity_9-1.png +[21]: https://linux.cn/article-11856-1.html +[22]: https://linux.cn/article-11858-1.html +[23]: https://opensource.com/sites/default/files/uploads/productivity_13-1.png +[24]: https://linux.cn/article-11869-1.html +[25]: https://linux.cn/article-11876-1.html +[26]: https://linux.cn/article-11879-1.html +[27]: https://linux.cn/article-11912-1.html +[28]: https://linux.cn/article-11956-1.html +[29]: https://opensource.com/sites/default/files/uploads/productivity_14-1.png +[30]: https://linux.cn/article-11900-1.html +[31]: https://linux.cn/article-11892-1.html diff --git a/published/202006/20200529 Add interactivity to your Python plots with Bokeh.md b/published/202006/20200529 Add interactivity to your Python plots with Bokeh.md new file mode 100644 index 0000000000..87a6640ddd --- /dev/null +++ b/published/202006/20200529 Add interactivity to your Python plots with Bokeh.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12329-1.html) +[#]: subject: (Add interactivity to your Python plots with Bokeh) +[#]: via: (https://opensource.com/article/20/5/bokeh-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Bokeh 为你的 Python 绘图添加交互性 +====== + +> 在 Bokeh 中绘图比其他一些绘图库要复杂一些,但付出额外的努力是有回报的。 + +![](https://img.linux.net.cn/data/attachment/album/202006/18/164708zz7tjxz7m7ax5lt3.jpg) + +在这一系列文章中,我通过在每个 Python 绘图库中制作相同的多条形绘图,来研究不同 Python 绘图库的特性。这次我重点介绍的是 [Bokeh][2](读作 “BOE-kay”)。 + +Bokeh 中的绘图比[其它一些绘图库][3]要复杂一些,但付出的额外努力是有回报的。Bokeh 的设计既允许你在 Web 上创建自己的交互式绘图,又能让你详细控制交互性如何工作。我将通过给我在这个系列中一直使用的多条形图添加工具提示来展示这一点。它绘制了 1966 年到 2020 年之间英国选举结果的数据。 + +![][4] + +*绘图的放大视图(©2019 年 [Anvil][5])* + +### 制作多条形图 + +在我们继续之前,请注意你可能需要调整你的 Python 环境来让这段代码运行,包括以下: + +- 运行最新版本的 Python (在 [Linux][11]、[Mac][12] 和 [Windows][13] 上的说明) +- 确认你运行的 Python 版本能与这些库一起工作。 + +数据可在线获得,可以用 Pandas 导入。 + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们可以继续进行了。 + +为了做出多条形图,你需要对你的数据进行一下调整。 + +原始数据是这样的: + +``` +>> print(long) + year party seats +0 1966 Conservative 253 +1 1970 Conservative 330 +2 Feb 1974 Conservative 297 +3 Oct 1974 Conservative 277 +4 1979 Conservative 339 +.. ... ... ... +103 2005 Others 30 +104 2010 Others 29 +105 2015 Others 80 +106 2017 Others 59 +107 2019 Others 72 + +[60 rows x 3 columns] +``` + +你可以把数据看成是每一个可能的 `(year, party)` 组合的一系列 `seats` 值。这正是 Bokeh 处理的方式。你需要做一个 `(year, party)` 元组的列表: + +``` +# 得到每种可能的 (year, party) 组合的元组 +x = [(str(r[1]['year']), r[1]['party']) for r in df.iterrows()] + +# This comes out as [('1922', 'Conservative'), ('1923', 'Conservative'), ... ('2019', 'Others')] +``` + +这些将是 `x` 值。`y` 值就是席位(`seats`)。 + +``` +y = df['seats'] +``` + +现在你的数据看起来应该像这样: + +``` +x                               y +('1966', 'Conservative')        253 +('1970', 'Conservative')        330 +('Feb 1974', 'Conservative')    297 +('Oct 1974', 'Conservative')    277 +('1979', 'Conservative')        339 + ...      ...                   ... +('2005', 'Others')              30 +('2010', 'Others')              29 +('2015', 'Others')              80 +('2017', 'Others')              59 +('2019', 'Others')              72 +``` + +Bokeh 需要你将数据封装在它提供的一些对象中,这样它就能给你提供交互功能。将你的 `x` 和 `y` 数据结构封装在一个 `ColumnDataSource` 对象中。 + +``` + from bokeh.models import ColumnDataSource + + source = ColumnDataSource(data={'x': x, 'y': y}) +``` + +然后构造一个 `Figure` 对象,并传入你用 `FactorRange` 对象封装的 `x` 数据。 + +``` +    from bokeh.plotting import figure +    from bokeh.models import FactorRange +    +    p = figure(x_range=FactorRange(*x), width=2000, title="Election results") +``` + +你需要让 Bokeh 创建一个颜色表,这是一个特殊的 `DataSpec` 字典,它根据你给它的颜色映射生成。在这种情况下,颜色表是一个简单的党派名称和一个十六进制值之间的映射。 + +``` +    from bokeh.transform import factor_cmap + +    cmap = { +        'Conservative': '#0343df', +        'Labour': '#e50000', +        'Liberal': '#ffff14', +        'Others': '#929591', +    } +    fill_color = factor_cmap('x', palette=list(cmap.values()), factors=list(cmap.keys()), start=1, end=2) +``` + +现在你可以创建条形图了: + +``` +    p.vbar(x='x', top='y', width=0.9, source=source, fill_color=fill_color, line_color=fill_color) +``` + +Bokeh 图表上数据的可视化形式被称为“字形glyphs”,因此你已经创建了一组条形字形。 + +调整图表的细节,让它看起来像你想要的样子。 + +``` +    p.y_range.start = 0 +    p.x_range.range_padding = 0.1 +    p.yaxis.axis_label = 'Seats' +    p.xaxis.major_label_orientation = 1 +    p.xgrid.grid_line_color = None +``` + +最后,告诉 Bokeh 你现在想看你的绘图: + +``` +   from bokeh.io import show + +   show(p) +``` + +这将绘图写入一个 HTML 文件,并在默认的 Web 浏览器中打开它。如下结果: + +![][6] + +*Bokeh 中的多条形绘图(©2019年[Anvil][5])* + +它已经有了一些互动功能,比如盒子缩放。 + +![][7] 。 + +*Bokeh 内置的盒子缩放(©2019[Anvil][5])* + +但 Bokeh 的厉害之处在于你可以添加自己的交互性。在下一节中,我们通过在条形图中添加工具提示来探索这个问题。 + +### 给条形图添加工具提示 + +要在条形图上添加工具提示,你只需要创建一个 `HoverTool` 对象并将其添加到你的绘图中。 + +``` +    h = HoverTool(tooltips=[ +        ('Seats', '@y'), +        ('(Year, Party)', '(@x)') +    ]) +    p.add_tools(h) +``` + +参数定义了哪些数据会显示在工具提示上。变量 `@y` 和 `@x` 是指你传入 `ColumnDataSource` 的变量。你还可以使用一些其他的值。例如,光标在图上的位置由 `$x` 和 `$y` 给出(与 `@x` 和 `@y` 没有关系)。 + +下面是结果: + +![][8] + +*选举图,现在带有工具提示(© 2019 [Anvil][5])* + +借助 Bokeh 的 HTML 输出,将绘图嵌入到 Web 应用中时,你可以获得完整的交互体验。你可以在[这里][9]把这个例子复制为 Anvil 应用(注:Anvil 需要注册才能使用)。 + +现在,你可以看到付出额外努力在 Bokeh 中将所有数据封装在 `ColumnDataSource` 等对象的原因了。作为回报,你可以相对轻松地添加交互性。 + +### 回归简单:Altair + +Bokeh 是四大最流行的绘图库之一,本系列将研究[它们各自的特别之处][3]。 + +我也在研究几个因其有趣的方法而脱颖而出的库。接下来,我将看看 [Altair][10],它的声明式 API 意味着它可以做出非常复杂的绘图,而不会让你头疼。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/bokeh-python + +作者:[Shaun Taylor-Morgan][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://bokeh.org/ +[3]: https://linux.cn/article-12327-1.html +[4]: https://opensource.com/sites/default/files/uploads/bokeh-closeup.png (A zoomed-in view on the plot) +[5]: https://anvil.works/blog/plotting-in-bokeh +[6]: https://opensource.com/sites/default/files/uploads/bokeh_0.png (A multi-bar plot in Bokeh) +[7]: https://opensource.com/sites/default/files/uploads/bokeh-box-zoom.gif (Bokeh's built-in box zoom) +[8]: https://opensource.com/sites/default/files/uploads/bokeh-tooltips.gif (The election graph, now with tooltips) +[9]: https://anvil.works/build#clone:CFRUWSM6PQ6JUUXH%3dSX4SACDSXBB4UOIVEVPWXH55%7cMYTOLCU2HM5WKJYM%3d6VJKGRSF74TCCVDG5CTVDOCS +[10]: https://altair-viz.github.io/ +[11]: https://opensource.com/article/20/4/install-python-linux +[12]: https://opensource.com/article/19/5/python-3-default-mac +[13]: https://opensource.com/article/19/8/how-install-python-windows \ No newline at end of file diff --git a/published/202006/20200529 How to find and remove broken symlinks on Linux.md b/published/202006/20200529 How to find and remove broken symlinks on Linux.md new file mode 100644 index 0000000000..0c67037b00 --- /dev/null +++ b/published/202006/20200529 How to find and remove broken symlinks on Linux.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12298-1.html) +[#]: subject: (How to find and remove broken symlinks on Linux) +[#]: via: (https://www.networkworld.com/article/3546252/how-to-find-and-remove-broken-symlinks-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 上查找和删除损坏的符号链接 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/09/095016y7ranx1tssxdsttd.jpg) + +> 符号链接是指向另一个文件的 Linux 文件。如果删除了被引用的文件,符号链接会保留,但不会显示有问题,除非你尝试使用它。以下是查找和删除指向文件已被删除的符号链接的简单方法。 + +符号链接symbolic link在 Linux 系统上扮演了非常有用的角色。它们可以帮助你记住重要文件在系统上的位置,使你更容易访问这些文件,并让你不必为了更方便访问大文件而复制它们,从而节省了大量的空间。 + +### 什么是符号链接? + +通常称它们为“符号链接”或“软链接”,符号链接是非常小的文件。实际上,符号链接真正包含的是它指向的文件的名称,通常包含路径(相对于当前位置或绝对路径)。如果有个名为 `ref1` 的文件指向名为 `/apps/refs/ref-2020` 的文件,那么 `ref1` 的长度将为 19 个字符,即使 `ref-202` 文件有 2TB。如果指向 `./ref-2020`,那么长度仅为 10 个字符。如果指向 `ref-2020`,那么只有 8 个字节。 + +如果你执行 `vi ref1` 之类的命令(其中 `ref1` 是符号链接的名称),你将编辑 `ref1` 指向的文件,而不是符号链接本身的内容。Linux 系统知道如何使用符号链接,并且可以做正确的事。同样,如果你使用诸如 `cat`、`more`、`head` 或 `tail` 之类的命令,那么将查看引用文件的内容。 + +另一方面,如果删除符号链接,你将删除该链接,而不是引用的文件。再说一次,Linux 知道怎么做。符号链接使得使用和共享文件更加容易,仅此而已。 + +#### 符号链接损坏时 + +当一个符号链接所指向的文件从系统中删除或重新命名时,符号链接将不再起作用。符号链接只不过是存储在某个特定目录中的引用而已,它不会随着指向它的文件发生变化而更新或删除。它一直指向被引用的文件,即使这个文件早已消失。 + +如果你尝试使用指向一个不存在的文件的符号链接,那么将出现如下错误: + +``` +$ tail whassup +tail: cannot open 'whassup' for reading: No such file or directory +``` + +如果你尝试访问指向自身的符号链接(是的,奇怪的事情发生了),你将看到类似以下的内容: + +``` +$ cat loopy +cat: loopy: Too many levels of symbolic links +$ ls -l loopy +lrwxrwxrwx 1 shs shs 5 May 28 18:07 loopy -> loopy +``` + +而且,如果(上面的)长列表的第一个字母没有引起你的注意,这表示该文件是符号链接。`rwxrwxrwx` 权限是标准权限,并不反映符号链接指向的文件的权限。 + +### 查找损坏的符号链接 + +`find` 命令有一个选项,能让你找到指向不再存在的文件的符号链接。此命令列出当前目录中的符号链接: + +``` +$ find . -type l +``` + +`l` (小写字母 `L`)告诉 `find` 命令查找符号链接。 + +另一方面,下面的命令在当前目录中查找指向*不存在*的文件的符号链接: + +``` +$ find . -xtype l +``` + +为了避免在该命令尝试查找你无权检查的文件或目录时发生错误,你可以将所有错误输出到 `/dev/null`,如下所示: + +``` +$ find . -xtype l 2>/dev/null +``` + +你也可以使用此命令找到损坏的符号链接。它比前面的更长,但做的是同样的事情: + +``` +$ find . -type l ! -exec test -e {} \; -print 2>/dev/null +``` + +### 如何处理损坏的符号链接 + +除非你知道符号链接引用的文件会被替换,否则最好的方法是直接删除损坏的链接。实际上,如果需要,你可以使用一条命令查找并删除损坏的符号链接,如: + +``` +$ find . -xtype l 2>/dev/null -exec rm {} \; +``` + +该命令的 `rm {}` 部分会变成“删除文件”的命令 + +如果你想将符号链接与不同的文件相关联,你必须先删除该符号链接,然后重新创建它,使其指向新文件。这是一个例子: + +``` +$ rm ref1 +$ ln -s /apps/data/newfile ref1 +``` + +### 总结 + +符号链接使引用的文件更易于查找和使用,但有时它会比那些宣传去年已经关闭的餐馆的路标还过分。`find` 命令可以帮助你摆脱损坏的符号链接,或者提醒你没有你可能仍然需要的文件。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3546252/how-to-find-and-remove-broken-symlinks-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world diff --git a/published/202006/20200529 What is the Difference Between Soft link vs Hard link in Linux.md b/published/202006/20200529 What is the Difference Between Soft link vs Hard link in Linux.md new file mode 100644 index 0000000000..da090386ec --- /dev/null +++ b/published/202006/20200529 What is the Difference Between Soft link vs Hard link in Linux.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12270-1.html) +[#]: subject: (What is the Difference Between Soft link vs Hard link in Linux?) +[#]: via: (https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + + +Linux 中软链接和硬链接的区别 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/01/082717bilg8nmx808oxzgn.jpg) + +链接Link是一种快捷访问机制,它通过一个文件指向原始文件或目录的方式实现快捷访问,同时还记录了原始文件或目录的一些信息。 + +链接允许多个不同文件对同一个文件进行引用。 + +### 什么是软链接 + +符号链接Symbolic Link(symlink),又称软链接Soft Link,是一种特殊的文件,它指向 Linux 系统上的另一个文件或目录。 + +这和 Windows 系统中的快捷方式有点类似,链接文件中记录的只是原始文件的路径,并不记录原始文件的内容。 + +符号链接通常用于对库文件进行链接,也常用于链接日志文件和网络文件系统Network File System(NFS)上共享的目录。 + +### 什么是硬链接 + +硬链接是原始文件的一个镜像副本。创建硬链接后,如果把原始文件删除,链接文件也不会受到影响,因为此时原始文件和链接文件互为镜像副本。 + +为什么要创建链接文件而不直接复制文件呢? + +当你需要将同一个文件保存在多个不同位置,而且还要保持持续更新的时候,硬链接的重要性就体现出来了。 + +如果你只是单纯把文件复制到另一个位置,那么另一个位置的文件只会保存着复制那一刻的文件内容,后续也不会跟随着原始文件持续更新。 + +而使用硬链接时,各个镜像副本的文件内容都会同时更新。 + +### 软链接和硬链接的区别 + +下表列出了软链接和硬链接之间的区别。 + +\# | 软链接 | 硬链接 +---|---|--- +1 | 软链接类似于 Windows 系统中的快捷方式 | 硬链接是原始文件的一个镜像副本 +2 | 软链接又称符号链接 | 硬链接没有别名 +3 | 链接中任何一个文件发生改变,都会同步到连接中的其它文件 | 和软链接一样 +4 | 软链接可以跨文件系统进行创建 | 硬链接不可以跨文件系统进行创建 +5 | 软链接可以指向文件或目录 | 硬链接只能指向文件 +6 | 链接文件和原始文件之间的 inode 和文件权限不完全一致 | 链接文件和原始文件的 inode 和文件权限完全一致 +7 | 链接文件只记录原始文件的路径,不记录原始文件的内容 | 链接文件记录了原始文件的内容 +8 | 如果原始文件被移除,软链接就会因为指向不存在的文件而失效。这被称为“挂起链接hanging link” | 即使原始文件被移除,链接文件也不受影响。 +9 | 通过 `ln -s <原始文件> <链接文件>` 命令创建软链接 | 通过 `ln <原始文件> <链接文件>` 命令创建硬链接 +10 | 软链接文件的文件权限中有一个特殊标记 `l` | 硬链接文件没有特殊标记 +11 | 通过 `find / -type l` 命令可以查找软链接文件 | 通过 `find / -samefile <原始文件>` 命令可以查找硬链接文件 +12 | 通过 `symlinks <目录>` 命令可以查找失效的软链接 | 硬链接不存在失效链接 + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 diff --git a/published/202006/20200531 Looking for Some Good Note Taking Apps on Linux- Here are the Best Notes Apps we Found for You.md b/published/202006/20200531 Looking for Some Good Note Taking Apps on Linux- Here are the Best Notes Apps we Found for You.md new file mode 100644 index 0000000000..f2fafaa32c --- /dev/null +++ b/published/202006/20200531 Looking for Some Good Note Taking Apps on Linux- Here are the Best Notes Apps we Found for You.md @@ -0,0 +1,290 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12307-1.html) +[#]: subject: (Looking for Some Good Note Taking Apps on Linux? Here are the Best Notes Apps we Found for You) +[#]: via: (https://itsfoss.com/note-taking-apps-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +9 款 Linux 上的最佳笔记应用 +====== + +无论你做什么,做笔记总是一个好习惯。是的,有很多笔记应用可以帮助你实现这个目标。但是,Linux 上的开源笔记应用怎么样呢? + +别担心,你不需要无休止地在互联网上搜索,就能找到 Linux 下最好的笔记应用。在这里,我挑选了一些最令人印象深刻的开源笔记应用。 + +![][1] + +请注意,此列表没有特定的排名顺序。 + +### 1、Joplin + +![][2] + +主要功能: + +* 支持 Markdown +* 支持附件 +* 支持加密 +* 跨平台,包括 Android 应用 + +[Joplin][9] 是一款令人印象深刻的自由开源笔记应用,支持加密。凭借其提供的出色的功能,它也是目前[最好的 Evernote 替代品][3]之一。事实上,我就是因为它提供的功能才从 Evernote 转移到 Joplin。 + +你可以选择添加待办事项列表、普通笔记,或者把它作为一个 Markdown 编辑器来写东西。它适用于 Linux、Windows、macOS、Android 和 iOS。你还可以选择使用 [Dropbox][4]、OneDrive、[NextCloud][5] 或 WebDAV 来同步你的笔记。 + +如果你好奇,可以阅读我们关于 [Joplin][6] 的详细文章来了解更多。 + +#### 如何安装? + +你可以用一个 AppImage 文件来安装 Joplin。我已经在 Ubuntu 20.04 LTS 上试过了,和预期的一样没有问题。要找到该文件,你可以前往其官方网站或探索他们的 [GitHub 页面][7]。 + +如果你不知道如何安装它,请按照我们的[使用 AppImage 文件][8]指南来开始。 + +另外,如果你想使用终端,你可以键入下面的命令,通过脚本来安装它(在这个过程中还会添加一个桌面图标)。 + +``` +wget -O - https://raw.githubusercontent.com/laurent22/joplin/master/Joplin_install_and_update.sh | bash +``` + +### 2、Simplenote + +![][10] + +主要功能: + +* 支持 Markdown +* 简约的用户界面 +* 通过你的 Simplenote 帐户轻松地进行同步 +* 有 32 位软件包 +* 跨平台,包括移动应用程序 + +顾名思义,它是一款简约的自由开源笔记应用。 + +由 [Automattic][11](WordPress 背后的公司)开发,[Simplenote][13] 可以让你在多个设备上无缝同步你的笔记。它支持 Android、iOS、Windows、Linux,以及 macOS。 + +与其它一些笔记应用不同的是,你会注意到它的界面非常简单,可能不会提供很多功能。但是,你可以为你的笔记添加标签。 + +#### 如何安装? + +它提供了 .deb / .rpm 软件包以及一个 AppImage 文件。你可以在它的 [GitHub 发布部分][12]中找到这些文件。 + +### 3、Laverna + +**注:** 它已经不再积极开发了,但它仍然可以正常工作。 + +![][14] + +主要功能: + +* 支持 Markdown +* 支持加密 +* 支持同步 + +[Laverna][15] 是一个有趣的开源笔记应用程序,还提供加密(这是可选的)。 + +你可以把它作为一个基于 Web 的笔记应用,也可以作为电脑上的应用使用。它适用于 Linux、Mac 和 Windows。 + +虽然它除了支持加密外,还具有记事本应用的所有基本功能,但并没有一个可以使用的移动应用。所以,这是一个只有当你是一个桌面用户,并且在 Web 浏览器上完成大部分事情时才能使用的东西。 + +#### 如何安装? + +它提供了一个压缩文件,可在其[官方网站][15]上获得。下载之后,你需要解压并启动可执行文件来开始。 + +### 4、Standard Notes + +![][16] + +主要功能: + +* 支持 Markdown +* 支持加密 +* 支持同步 +* 笔记的版本历史(付费计划) +* 跨平台,包括移动应用程序 +* 提供了 32 位包。 +* 提供付费选择 + +又一款开源笔记应用,为你的笔记和附件提供加密。 + +与 Laverna 不同,[Standard Notes][18] 正在积极开发中。虽然它提供了大量的功能,但其中一些功能以“扩展功能”或扩展插件仅提供给付费用户,这是偏昂贵的(每月订阅)。你也可以参考我们另外一篇关于 [Standard Notes][17] 的文章来了解更多信息。 + +总的来说,你会得到 Markdown 支持、加密附件和笔记的能力、版本历史、备份支持(OneDrive、Google Drive 等)以及更多这样有用的功能。 + +#### 如何安装? + +它提供了一个 AppImage 文件,可以在你的 Linux 发行版上安装它。你只需要前往它的[官方网站][18]下载即可。如果你不知道如何使用这个文件,可以参考我们的 [AppImage 指南][8]。 + +对于其他可用的软件包或源代码,你可以参考他们的 [GitHub 页面][19]。 + +### 5、Boost Note + +![][20] + +主要功能: + +* 支持 Markdown +* 适用于开发者 +* 跨平台 + +[Boost Note][21] 是一款对使用 Linux 的程序员有用的笔记应用。你可以用它写你的代码,也可以用来写笔记、文档等等。 + +它提供了一个简洁直观的用户界面,并提供了 Linux 上笔记应用的所有基本功能。 + +#### 如何安装? + +你可以选择其[官网][22]上为 Ubuntu 提供的 .deb 文件。如果你想在其他 Linux 发行版上尝试,你还可以找到一个 AppImage 文件来开始使用。 + +如果你好奇,也可以查看他们的 [GitHub 页面][23]来探索更多关于它的内容或复刻它。 + +### 6、Tomboy Notes(新一代) + +![][24] + +主要功能: + +* 轻量级笔记应用 +* 支持同步 +* 跨平台 + +一款轻量级且极其简单的记事应用怎么样? + +好吧,你可能知道旧版的 [Tomboy Notes][25] 已经不再开发了。幸运的是,有一个新一代的 [Tomboy Notes NG][27] 版本。你可以配置存储笔记的路径,并快速开始记笔记。 + +这款应用仅仅只有约 2MB 的下载量。所以,如果你正在寻找一个轻量级的解决方案 —— 那就是它。它可能无法用于智能手机,但你肯定可以在 Windows、Linux 和 MacOS 上使用它。 + +#### 如何安装? + +你可以在他们的 [GitHub 发布部分][26]中找到 .deb / .rpm 和其他包。对于其他的 Linux 发行版,你可以关注他们 GitHub 页面的文档来了解更多。 + +### 7、RedNoteBook + +![][28] + +主要功能 + +* 传统的日记式记事应用 +* 有模板 +* 离线使用 + +对于想要在 Linux 上使用离线笔记应用的用户来说,[RedNotebook][30] 应该是一个不错的选择。 + +是的,它不支持同步,如果你是一个不想要同步功能的人,RedNoteBook 应该是一款传统风格的记事应用,侧边栏为日历。 + +它主要是为喜欢离线日记的用户量身定做的。它还为你提供了几个模板,方便你创建某些笔记。 + +#### 如何安装? + +如果你使用的是 Ubuntu(或者其他基于 Ubuntu 的发行版),你可以通过 PPA 来安装它。下面是你在终端中输入的安装方法: + +``` +sudo add-apt-repository ppa:rednotebook/stable +sudo apt-get update +sudo apt-get install rednotebook +``` + +对于其他的 Linux 发行版,你可以得到 [Flatpak 软件包][29]。 + +### 8、TagSpaces + +![][31] + +主要特点: + +* 丰富的用户界面 +* 支持管理文件 +* 支持同步 +* 提供付费选择 + +[TagSpaces][34] 是一款适用于 Linux 的精美笔记应用。不仅仅局限于创建笔记,你还可以管理照片和其他文档。 + +与其他一些可用的笔记应用不同,它不提供加密功能。所以,你可以尝试像 [Syncthing][32] 这样支持 Dropbox 和 Nextcloud 的工具来安全地同步你的数据。 + +如果你想要特定的功能和支持,你也可以选择它的付费计划。 + +#### 如何安装? + +你可以在他们的 [GitHub 发布区][33]中找到 .deb 文件和一个 AppImage 文件来安装。无论哪种情况,你都可以把它也构建起来。 + +### 9、Trilium Notes + +![][35] + +主要功能: + +* 分层记事应用 +* 支持加密 +* 支持同步 + +[Trilium Notes][39] 并不只是又一款笔记应用,它是一款专注于建立个人知识库的分层笔记应用。 + +是的,你也可以将它用于普通用途 —— 但它是为特定用户量身定制的,他们希望能够以分层方式管理笔记。 + +我个人还没有使用过 —— 除了测试。欢迎试用,多多探讨。 + +#### 如何安装? + +只需前往其 [GitHub 发布区][36],并抓取 [.deb 文件在 Ubuntu 上安装][37]。如果你正在寻找其他 Linux 发行版上可用的软件包,你也可以从源代码构建它,或者下载并[解压缩文件][38]。 + +### 总结 + +我对 Linux 上的笔记应用的推荐到此结束。我已经用过很多个,目前决定用 Simplenote 来做快速笔记,用 Joplin 来收集章节中的笔记。 + +你是否知道一些应该包括在这个列表中的其它 Linux 笔记应用程序?为什么不在评论区告诉我们呢? + +你更喜欢哪个笔记应用程序?我很想知道你通常在 Linux 上寻找的最好的笔记应用程序是什么。 + +欢迎在下面的评论部分分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/note-taking-apps-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Note-Taking-Apps-linux.jpg?ssl=1 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/joplin_ubuntu.jpg?ssl=1 +[3]: https://itsfoss.com/5-evernote-alternatives-linux/ +[4]: https://www.dropbox.com/ +[5]: https://nextcloud.com/ +[6]: https://linux.cn/article-11896-1.html +[7]: https://github.com/laurent22/joplin +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://joplinapp.org/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/simplenote-new.jpg?ssl=1 +[11]: https://automattic.com/ +[12]: https://github.com/Automattic/simplenote-electron/releases/tag/v1.16.0 +[13]: https://simplenote.com +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/laverna.png?resize=800%2C623&ssl=1 +[15]: https://laverna.cc +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/standard-notes-shot.jpg?resize=800%2C578&ssl=1 +[17]: https://itsfoss.com/standard-notes/ +[18]: https://standardnotes.org +[19]: https://github.com/standardnotes +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/boostnote.png?resize=800%2C579&ssl=1 +[21]: https://itsfoss.com/boostnote-linux-review/ +[22]: https://boostnote.io/ +[23]: https://github.com/BoostIO/Boostnote +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/tomboy-notes-ng.jpg?ssl=1 +[25]: https://github.com/tomboy-notes/tomboy +[26]: https://github.com/tomboy-notes/tomboy-ng/releases +[27]: https://github.com/tomboy-notes/tomboy-ng +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/rednotebook.png?ssl=1 +[29]: https://flathub.org/apps/details/app.rednotebook.RedNotebook +[30]: https://rednotebook.sourceforge.io +[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/tagspaces.png?resize=800%2C523&ssl=1 +[32]: https://itsfoss.com/syncthing/ +[33]: https://github.com/tagspaces/tagspaces/releases/ +[34]: https://www.tagspaces.org/ +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/trilium-notes.png?ssl=1 +[36]: https://github.com/zadam/trilium/releases +[37]: https://itsfoss.com/install-deb-files-ubuntu/ +[38]: https://itsfoss.com/unzip-linux/ +[39]: https://github.com/zadam/trilium/ diff --git a/published/202006/20200601 How to write a VS Code extension.md b/published/202006/20200601 How to write a VS Code extension.md new file mode 100644 index 0000000000..366052a86a --- /dev/null +++ b/published/202006/20200601 How to write a VS Code extension.md @@ -0,0 +1,298 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12310-1.html) +[#]: subject: (How to write a VS Code extension) +[#]: via: (https://opensource.com/article/20/6/vs-code-extension) +[#]: author: (Ashique Hussain Ansari https://opensource.com/users/uidoyen) + +如何编写 VS Code 扩展 +====== + +> 通过为流行的代码编辑器编写自己的扩展来添加缺失的功能。 + +![](https://img.linux.net.cn/data/attachment/album/202006/13/105415w5u1d0z5bdoneb82.jpg) + +Visual Studio Code(VS Code)是微软为 Linux、Windows 和 macOS 创建的跨平台代码编辑器。遗憾的是,微软版本的 [VS Code][2] 是在 [Microsoft Software License][3] 下发布的,这不是一个开源的许可证。然而,它的源代码是开源的,在 MIT 许可证下由 [VSCodium][4] 项目发布。 + +VSCodium 和 VS Code一样,支持扩展、内嵌式 Git 控制、GitHub 集成、语法高亮、调试、智能代码补完、代码片段等。换句话说,对于大多数用户来说,使用 VS Code 和 VSCodium 没有什么区别,而且后者是完全开源的! + +### 什么是 VS Code 扩展? + +扩展extension可以让你为 VS Code 或 VSCodium 添加功能。你可以在 GUI 中或从终端安装扩展。 + +你也可以构建自己的扩展。有几个你可能想学习如何构建扩展的原因: + +1. **想要添加一些功能:** 如果缺失你想要的功能,你可以创建一个扩展来添加它。 +2. **为了乐趣和学习:** 扩展 API 允许你探索 VSCodium 是如何工作的,这是一件有趣的事情。 +3. **为了提高您的技能:** 创建扩展可以提高你的编程技能。 +4. **为了成名:** 创建一个对他人有用的扩展可以提高你的公众形象。 + +### 安装工具 + +在你开始之前,你必须已经安装了 [Node.js][5]、[npm][6] 和 VS Code 或 [VSCodium][4]。 + +要生成一个扩展,你还需要以下工具:[Yeoman][7],是一个开源的客户端脚手架工具,可以帮助你搭建新项目;以及 [vscode-generator-code][8],是 VS Code 团队创建的 Yeoman 生成器。 + +### 构建一个扩展 + +在本教程中,你将构建一个扩展,它可以为应用程序初始化一个 Docker 镜像。 + +#### 生成一个扩展骨架 + +要在全局范围内安装并运行 Yeoman 生成器,请在命令提示符或终端中输入以下内容: + +``` +npm install -g yo generator-code +``` + +导航到要生成扩展的文件夹,键入以下命令,然后按回车: + +``` +yo code +``` + +根据提示,你必须回答一些关于你的扩展的问题: + +* **你想创建什么类型的扩展?** 使用上下箭头选择其中一个选项。在本文中,我将只介绍第一个选项,`New Extension (TypeScript)`。 +* **你的扩展名称是什么?** 输入你的扩展名称。我的叫 `initdockerapp`。(我相信你会有一个更好的名字。) +* **你的扩展的标识符是什么?** 请保持原样。 +* **你的扩展的描述是什么?** 写一些关于你的扩展的内容(你可以现在填写或稍后编辑它)。 +* **初始化 Git 仓库?** 这将初始化一个 Git 仓库,你可以稍后添加 `set-remote`。 +* **使用哪个包管理器?** 你可以选择 `yarn` 或 `npm`;我使用 `npm`。 + +按回车键后,就会开始安装所需的依赖项。最后显示: + +> "Your extension **initdockerapp** has been created!" + +干的漂亮! + +### 检查项目的结构 + +检查你生成的东西和项目结构。导航到新的文件夹,并在终端中键入 `cd initdockerapp`。 + +一旦你进入该目录,键入 `.code`。它将在你的编辑器中打开,看起来像这样。 + +![Project file structure in VSCodium][9] + +(Hussain Ansari, [CC BY-SA 4.0][10]) + +最需要注意的两个文件是 `src` 文件夹内的 `package.json` 和 `extension.ts`。 + +#### package.json + +首先来看看 `package.json`,它应该是这样的。 + +``` +{ + "name": "initdockerapp", + "displayName": "initdockerapp", + "description": "", + "version": "0.0.1", + "engines": { + "vscode": "^1.44.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [ + "onCommand:initdockerapp.initialize" + ], + "main": "./out/extension.js", + "contributes": { + "commands": [ + { + "command": "initdockerapp.initialize", + "title": "Initialize A Docker Application" + } + ] + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "lint": "eslint src --ext ts", + "watch": "tsc -watch -p ./", + "pretest": "npm run compile && npm run lint", + "test": "node ./out/test/runTest.js" + }, + "devDependencies": { + "@types/vscode": "^1.44.0", + "@types/glob": "^7.1.1", + "@types/mocha": "^7.0.2", + "@types/node": "^13.11.0", + "eslint": "^6.8.0", + "@typescript-eslint/parser": "^2.26.0", + "@typescript-eslint/eslint-plugin": "^2.26.0", + "glob": "^7.1.6", + "mocha": "^7.1.1", + "typescript": "^3.8.3", + "vscode-test": "^1.3.0" + } +} +{ + "name": "initdockerapp", + "displayName": "initdockerapp", + "description": "", + "version": "0.0.1", + "engines": { + "vscode": "^1.44.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [ + "onCommand:initdockerapp.initialize" + ], + "main": "./out/extension.js", + "contributes": { + "commands": [ + { + "command": "initdockerapp.initialize", + "title": "Initialize A Docker Application" + } + ] + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "lint": "eslint src --ext ts", + "watch": "tsc -watch -p ./", + "pretest": "npm run compile && npm run lint", + "test": "node ./out/test/runTest.js" + }, + "devDependencies": { + "@types/vscode": "^1.44.0", + "@types/glob": "^7.1.1", + "@types/mocha": "^7.0.2", + "@types/node": "^13.11.0", + "eslint": "^6.8.0", + "@typescript-eslint/parser": "^2.26.0", + "@typescript-eslint/eslint-plugin": "^2.26.0", + "glob": "^7.1.6", + "mocha": "^7.1.1", + "typescript": "^3.8.3", + "vscode-test": "^1.3.0" + } +} +``` + +如果你是 Node.js 开发者,其中一些可能看起来很熟悉,因为 `name`、`description`、`version` 和 `scripts` 是 Node.js 项目的常见部分。 + +有几个部分是非常重要的: + +* `engines`:说明该扩展将支持哪个版本的 VS Code / VSCodium。 +* `categories`:设置扩展类型;你可以从 `Languages`、`Snippets`、`Linters`、`Themes`、`Debuggers`、`Formatters`、`Keymaps` 和 `Other` 中选择。 +* `contributes`:可用于与你的扩展一起运行的命令清单。 +* `main`:扩展的入口点。 +* `activationEvents`:指定激活事件发生的时间。具体来说,这决定了扩展何时会被加载到你的编辑器中。扩展是懒加载的,所以在激活事件触发之前,它们不会被激活。 + +#### src/extension.ts + +接下来看看 `src/extension.ts`,它应该是这样的: + +``` +// The module 'vscode' contains the VSCodium extensibility API +// Import the module and reference it with the alias vscode in your code below +import * as vscode from "vscode"; +const fs = require("fs"); +const path = require("path"); + +// this method is called when your extension is activated +// your extension is activated the very first time the command is executed +export function activate(context: vscode.ExtensionContext) { + + // Use the console to output diagnostic information (console.log) and errors (console.error) + // This line of code will only be executed once when your extension is activated + console.log('Congratulations, your extension "initdockerapp" is now active!'); + + // The command has been defined in the package.json file + // Now provide the implementation of the command with registerCommand + // The commandId parameter must match the command field in package.json + let disposable = vscode.commands.registerCommand('initdockerapp.initialize', () => { + // The code you place here will be executed every time your command is executed + + let fileContent =` + FROM node:alpine + WORKDIR /usr/src/app + + COPY package.json . + RUN npm install + + COPY . . + + EXPOSE 3000 + CMD ["npm", "start"] + `; + + fs.writeFile(path.join(vscode.workspace.rootPath, "Dockerfile"), fileContent, (err:any) => { + if (err) { + return vscode.window.showErrorMessage("Failed to initialize docker file!"); + } + vscode.window.showInformationMessage("Dockerfile has been created!"); + }); + }); + + context.subscriptions.push(disposable); +} + +// this method is called when your extension is deactivated +export function deactivate() {} +``` + +这是为你的扩展写代码的地方。已经有一些自动生成的代码了,我再来分析一下。 + +注意,`vscode.command.registerCommand` 里面的 `initdockerapp.initialize` 和 `package.json` 里面的命令是一样的。它需要两个参数。 + +1. 要注册的命令名称 +2. 执行命令的功能 + +另一个需要注意的函数是 `fs.writeFile`,这是你写在 `vscode.command.registerCommand` 函数里面的。这将在你的项目根目录下创建一个 Dockerfile,并在其中附加代码来创建一个 Docker 镜像。 + +### 调试扩展 + +现在你已经写好了扩展,是时候调试它了。点击“Run”菜单,选择“Start Debugging”(或者直接按 `F5`)打开调试窗口。 + +在调试窗口里面点击“Add Folder”或“Clone Repository”按钮,打开该项目。 + +接下来,用 `Ctrl+Shift+P`(在 macOS 上,用 `Command` 键代替 `Ctrl`)打开命令面板,运行 `Initialize A Docker Application`。 + +* 第一次运行此命令时,自 VSCodium 启动后,激活函数尚未执行。因此,调用激活函数,并由激活 函数注册该命令。 +* 如果命令已注册,那么它将被执行。 + +你会看到右下角有一条信息,上面写着:`Dockerfile has been created!`。这就创建了一个 Dockerfile,里面有一些预定义的代码,看起来是这样的: + +![Running the new extension command][11] + +(Hussain Ansari, [CC BY-SA 4.0][10]) + +### 总结 + +有许多有用的 API 可以帮助你创建你想要构建的扩展。VS Code 扩展 API 还有许多其他强大的方法可以使用。 + +你可以在 VS Code 扩展 API 文档中了解更多关于 VS Code API 的信息。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/vs-code-extension + +作者:[Ashique Hussain Ansari][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/uidoyen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://code.visualstudio.com/ +[3]: https://code.visualstudio.com/license +[4]: https://vscodium.com/ +[5]: https://nodejs.org/en/ +[6]: https://www.npmjs.com/ +[7]: https://yeoman.io/ +[8]: https://github.com/Microsoft/vscode-generator-code +[9]: https://opensource.com/sites/default/files/uploads/vscode-tree.png (Project file structure in VSCodium) +[10]: https://creativecommons.org/licenses/by-sa/4.0/ +[11]: https://opensource.com/sites/default/files/uploads/vscode-run-command.png (Running the new extension command) diff --git a/published/202006/20200601 Use FastAPI to build web services in Python.md b/published/202006/20200601 Use FastAPI to build web services in Python.md new file mode 100644 index 0000000000..00dcf9cd0d --- /dev/null +++ b/published/202006/20200601 Use FastAPI to build web services in Python.md @@ -0,0 +1,188 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12280-1.html) +[#]: subject: (Use FastAPI to build web services in Python) +[#]: via: (https://fedoramagazine.org/use-fastapi-to-build-web-services-in-python/) +[#]: author: (Clément Verna https://fedoramagazine.org/author/cverna/) + +使用 Python FastAPI 构建 Web 服务 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/04/105930wr333sx3erz3k2ur.jpg) + +[FastAPI][2] 是一个使用 Python 编写的 Web 框架,还应用了 Python asyncio 库中最新的优化。本文将会介绍如何搭建基于容器的开发环境,还会展示如何使用 FastAPI 实现一个小型 Web 服务。 + +### 起步 + +我们将使用 Fedora 作为基础镜像来搭建开发环境,并使用 Dockerfile 为镜像注入 FastAPI、[Uvicorn][3] 和 [aiofiles][4] 这几个包。 + +``` +FROM fedora:32 +RUN dnf install -y python-pip \ + && dnf clean all \ + && pip install fastapi uvicorn aiofiles +WORKDIR /srv +CMD ["uvicorn", "main:app", "--reload"] +``` + +在工作目录下保存 `Dockerfile` 之后,执行 `podman` 命令构建容器镜像。 + +``` +$ podman build -t fastapi . +$ podman images +REPOSITORY TAG IMAGE ID CREATED SIZE +localhost/fastapi latest 01e974cabe8b 18 seconds ago 326 MB +``` + +下面我们可以开始创建一个简单的 FastAPI 应用程序,并通过容器镜像运行。 + +``` +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +async def root(): + return {"message": "Hello Fedora Magazine!"} +``` + +将上面的代码保存到 `main.py` 文件中,然后执行以下命令开始运行: + +``` +$ podman run --rm -v $PWD:/srv:z -p 8000:8000 --name fastapi -d fastapi +$ curl http://127.0.0.1:8000 +{"message":"Hello Fedora Magazine!" +``` + +这样,一个基于 FastAPI 的 Web 服务就跑起来了。由于指定了 `--reload` 参数,一旦 `main.py` 文件发生了改变,整个应用都会自动重新加载。你可以尝试将返回信息 `"Hello Fedora Magazine!"` 修改为其它内容,然后观察效果。 + +可以使用以下命令停止应用程序: + +``` +$ podman stop fastapi +``` + +### 构建一个小型 Web 服务 + +接下来我们会构建一个需要 I/O 操作的应用程序,通过这个应用程序,我们可以看到 FastAPI 自身的特点,以及它在性能上有什么优势(可以在[这里][5]参考 FastAPI 和其它 Python Web 框架的对比)。为简单起见,我们直接使用 `dnf history` 命令的输出来作为这个应用程序使用的数据。 + +首先将 `dnf history` 命令的输出保存到文件。 + +``` +$ dnf history | tail --lines=+3 > history.txt +``` + +在上面的命令中,我们使用 `tail` 去除了 `dnf history` 输出内容中无用的表头信息。剩余的每一条 `dnf` 事务都包括了以下信息: + + * `id`:事务编号(每次运行一条新事务时该编号都会递增) + * `command`:事务中运行的 `dnf` 命令 + * `date`:执行事务的日期和时间 + +然后修改 `main.py` 文件将相关的数据结构添加进去。 + +``` +from fastapi import FastAPI +from pydantic import BaseModel + +app = FastAPI() + +class DnfTransaction(BaseModel): + id: int + command: str + date: str +``` + +FastAPI 自带的 [pydantic][6] 库让你可以轻松定义一个数据类,其中的类型注释对数据的验证也提供了方便。 + +再增加一个函数,用于从 `history.txt` 文件中读取数据。 + +``` +import aiofiles + +from fastapi import FastAPI +from pydantic import BaseModel + +app = FastAPI() + +class DnfTransaction(BaseModel): + id: int + command: str + date: str + + +async def read_history(): + transactions = [] + async with aiofiles.open("history.txt") as f: + async for line in f: + transactions.append(DnfTransaction( + id=line.split("|")[0].strip(" "), + command=line.split("|")[1].strip(" "), + date=line.split("|")[2].strip(" "))) + return transactions +``` + +这个函数中使用了 `aiofiles` 库,这个库提供了一个异步 API 来处理 Python 中的文件,因此打开文件或读取文件的时候不会阻塞其它对服务器的请求。 + +最后,修改 `root` 函数,让它返回事务列表中的数据。 + +``` +@app.get("/") +async def read_root(): + return await read_history() +``` + +执行以下命令就可以看到应用程序的输出内容了。 + +``` +$ curl http://127.0.0.1:8000 | python -m json.tool +[ +{ +"id": 103, +"command": "update", +"date": "2020-05-25 08:35" +}, +{ +"id": 102, +"command": "update", +"date": "2020-05-23 15:46" +}, +{ +"id": 101, +"command": "update", +"date": "2020-05-22 11:32" +}, +.... +] +``` + +### 总结 + +FastAPI 提供了一种使用 asyncio 构建 Web 服务的简单方法,因此它在 Python Web 框架的生态中日趋流行。要了解 FastAPI 的更多信息,欢迎查阅 [FastAPI 文档][2]。 + +本文中的代码可以在 [GitHub][7] 上找到。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-fastapi-to-build-web-services-in-python/ + +作者:[Clément Verna][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/cverna/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/fastapi-python-816x345.jpg +[2]: https://fastapi.tiangolo.com/ +[3]: https://www.uvicorn.org/ +[4]: https://github.com/Tinche/aiofiles +[5]: https://www.techempower.com/benchmarks/#section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e85911&hw=ph&test=composite&l=z8kflr-v&a=2&f=jz8cg-0-3s-0-3k-6bo-0-0-18y74-8s5c-0 +[6]: https://pydantic-docs.helpmanual.io/ +[7]: https://github.com/cverna/fastapi_app +[8]: https://unsplash.com/@jankubita?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[9]: https://unsplash.com/s/photos/fast-snake?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202006/20200601 When to choose C or Python for a command-line interface.md b/published/202006/20200601 When to choose C or Python for a command-line interface.md new file mode 100644 index 0000000000..868894f61f --- /dev/null +++ b/published/202006/20200601 When to choose C or Python for a command-line interface.md @@ -0,0 +1,247 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12286-1.html) +[#]: subject: (When to choose C or Python for a command-line interface) +[#]: via: (https://opensource.com/article/20/6/c-python-cli) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +用 Python 解析命令行参数 +====== + +> 借鉴 C 语言的历史,学习如何用 Python 编写有用的 CLI 程序。 + +![](https://img.linux.net.cn/data/attachment/album/202006/05/231539dyinqzceci4ci8vv.jpg) + +本文的目标很简单:帮助新的 Python 开发者了解一些关于[命令行接口][2](CLI)的历史和术语,并探讨如何在 Python 中编写这些有用的程序。 + +### 最初…… + +首先,从 [Unix][3] 的角度谈谈命令行界面设计。 + +Unix 是一种计算机操作系统,也是 Linux 和 macOS(以及许多其他操作系统)的祖先。在图形用户界面之前,用户通过命令行提示符与计算机进行交互(想想如今的 [Bash][4] 环境)。在 Unix 下开发这些程序的主要语言是 [C][5],它的[功能][6]非常强大。 + +因此,我们至少应该了解 [C 程序][7]的基础知识。 + +假设你没有读过上面那个链接的内容,C 程序的基本架构是一个叫做 `main` 的函数,它的签名是这样的。 + +``` +   int main(int argc, char **argv) +   { +   ... +   } +``` + +对于 Python 程序员来说,这应该不会显得太奇怪。C 函数首先有一个返回类型、一个函数名,然后是括号内的类型化参数。最后,函数的主体位于大括号之间。函数名 `main` 是[运行时链接器][8](构造和运行程序的程序)如何决定从哪里开始执行你的程序。如果你写了一个 C 程序,而它没有包含一个名为 `main` 的函数,它将什么也做不了。伤心。 + +函数参数变量 `argc` 和 `argv` 共同描述了程序被调用时用户在命令行输入的字符串列表。在典型的 Unix 命名传统中,`argc` 的意思是“参数计数argument count”,`argv` 的意思是“参数向量argument vector”。向量听起来比列表更酷,而 `argl` 听起来就像一个要勒死的求救声。我们是 Unix 系统的程序员,我们不求救。我们让*其他人*哭着求救。 + +#### 再进一步 + +``` +$ ./myprog foo bar -x baz +``` + +如果 `myprog` 是用 C 语言实现的,则 `argc` 的值是 5,而 `argv` 是一个有五个条目的字符指针数组。(不要担心,如果这听起来过于技术,那换句话说,这是一个由五个字符串组成的列表。)向量中的第一个条目 `argv[0]` 是程序的名称。`argv` 的其余部分包含参数。 + +``` +   argv[0] == "./myprog" +   argv[1] == "foo" +   argv[2] == "bar" +   argv[3] == "-x" +   argv[4] == "baz" +    +   /* 注:不是有效的 C 代码 */ +``` + +在 C 语言中,你有很多方法来处理 `argv` 中的字符串。你可以手动地循环处理数组 `argv`,并根据程序的需要解释每个字符串。这相对来说比较简单,但会导致程序的接口大相径庭,因为不同的程序员对什么是“好”有不同的想法。 + +``` +include + +/* 一个打印 argv 内容的简单 C 程序。 */ + +int main(int argc, char **argv) { + int i; + + for(i=0; i +#include + +#define OPTSTR "b:f:" + +extern char *optarg; + +int main(int argc, char **argv) { + int opt; + char *bar = NULL; + char *foo = NULL; + + while((opt=getopt(argc, argv, OPTSTR)) != EOF) + switch(opt) { + case 'b': + bar = optarg; + break; + case 'f': + foo = optarg; + break; + case 'h': + default': + fprintf(stderr, "Huh? try again."); + exit(-1); + /* NOTREACHED */ + } + printf("%s\n", foo ? foo : "Empty foo"); + printf("%s\n", bar ? bar : "Empty bar"); +} +``` + +就个人而言,我*希望* Python 有*开关*,但这[永远][12]、永远不会[发生][13]。 + +#### GNU 时代 + +[GNU][14] 项目出现了,并为他们实现的传统 Unix 命令行工具引入了更长的格式参数,比如`--file-format foo`。当然,我们这些 Unix 程序员很讨厌这样,因为打字太麻烦了,但是就像我们这些旧时代的恐龙一样,我们输了,因为用户*喜欢*更长的选项。我从来没有写过任何使用 GNU 风格选项解析的代码,所以这里没有代码示例。 + +GNU 风格的参数也接受像 `-f foo` 这样的短名,也必须支持。所有这些选择都给程序员带来了更多的工作量,因为他们只想知道用户要求的是什么,然后继续进行下去。但用户得到了更一致的用户体验:长格式选项、短格式选项和自动生成的帮助,使用户不必再试图阅读臭名昭著的难以解析的[手册][15]页面(参见 [ps][16] 这个特别糟糕的例子)。 + +### 但我们正在讨论 Python? + +你现在已经接触了足够多(太多?)的命令行的历史,对如何用我们最喜欢的语言来编写 CLI 有了一些背景知识。Python 在命令行解析方面给出了类似的几个选择:自己解析,自给自足batteries-included的方式,以及大量的第三方方式。你选择哪一种取决于你的特定情况和需求。 + +#### 首先,自己解析 + +你可以从 [sys][17] 模块中获取程序的参数。 + +``` +import sys + +if __name__ == '__main__': +   for value in sys.argv: +       print(value) +``` + +#### 自给自足 + +在 Python 标准库中已经有几个参数解析模块的实现:[getopt][18]、[optparse][19],以及最近的 [argparse][20]。`argparse` 允许程序员为用户提供一致的、有帮助的用户体验,但就像它的 GNU 前辈一样,它需要程序员做大量的工作和“[模板代码][21]”才能使它“奏效”。 + +``` +from argparse import ArgumentParser + +if __name__ == "__main__": + +   argparser = ArgumentParser(description='My Cool Program') +   argparser.add_argument("--foo", "-f", help="A user supplied foo") +   argparser.add_argument("--bar", "-b", help="A user supplied bar") +    +   results = argparser.parse_args() +   print(results.foo, results.bar) +``` + +好处是当用户调用 `--help` 时,有自动生成的帮助。但是[自给自足][22]batteries included的优势呢?有时,你的项目情况决定了你对第三方库的访问是有限的,或者说是没有,你不得不用 Python 标准库来“凑合”。 + +#### CLI 的现代方法 + +然后是 [Click][23]。`Click` 框架使用[装饰器][24]的方式来构建命令行解析。突然间,写一个丰富的命令行界面变得有趣而简单。在装饰器的酷炫和未来感的使用下,很多复杂的东西都消失了,用户惊叹于自动支持关键字补完以及上下文帮助。所有这些都比以前的解决方案写的代码更少。任何时候,只要你能写更少的代码,还能把事情做好,就是一种胜利。而我们都想要胜利。 + +``` +import click + +@click.command() +@click.option("-f", "--foo", default="foo", help="User supplied foo.") +@click.option("-b", "--bar", default="bar", help="User supplied bar.") +def echo(foo, bar): +    """My Cool Program +    +    It does stuff. Here is the documentation for it. +    """ +    print(foo, bar) +    +if __name__ == "__main__": +    echo() +``` + +你可以在 `@click.option` 装饰器中看到一些与 `argparse` 相同的模板代码。但是创建和管理参数分析器的“工作”已经被抽象化了。现在,命令行参数被解析,而值被赋给函数参数,从而函数 `echo` 被*魔法般地*调用。 + +在 `Click` 接口中添加参数就像在堆栈中添加另一个装饰符并将新的参数添加到函数定义中一样简单。 + +### 但是,等等,还有更多! + +[Typer][25] 建立在 `Click` 之上,是一个更新的 CLI 框架,它结合了 `Click` 的功能和现代 Python [类型提示][26]。使用 `Click` 的缺点之一是必须在函数中添加一堆装饰符。CLI 参数必须在两个地方指定:装饰符和函数参数列表。`Typer` [免去你造轮子][27] 去写 CLI 规范,让代码更容易阅读和维护。 + +``` +import typer + +cli = typer.Typer() + +@cli.command() +def echo(foo: str = "foo", bar: str = "bar"): +    """My Cool Program +    +    It does stuff. Here is the documentation for it. +    """ +    print(foo, bar) +    +if __name__ == "__main__": +    cli() +``` + +### 是时候开始写一些代码了 + +哪种方法是正确的?这取决于你的用例。你是在写一个只有你才会使用的快速而粗略的脚本吗?直接使用 `sys.argv` 然后继续编码。你需要更强大的命令行解析吗?也许 `argparse` 就够了。你是否有很多子命令和复杂的选项,你的团队是否会每天使用它?现在你一定要考虑一下 `Click` 或 `Typer`。作为一个程序员的乐趣之一就是魔改出替代实现,看看哪一个最适合你。 + +最后,在 Python 中有很多用于解析命令行参数的第三方软件包。我只介绍了我喜欢或使用过的那些。你喜欢和/或使用不同的包是完全可以的,也是我们所期望的。我的建议是先从这些包开始,然后看看你最终的结果。 + +去写一些很酷的东西吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/c-python-cli + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://en.wikipedia.org/wiki/Command-line_interface +[3]: https://en.wikipedia.org/wiki/Unix +[4]: https://www.gnu.org/software/bash/ +[5]: https://en.wikipedia.org/wiki/C_(programming_language) +[6]: https://www.toptal.com/c/after-all-these-years-the-world-is-still-powered-by-c-programming +[7]: https://opensource.com/article/19/5/how-write-good-c-main-function +[8]: https://en.wikipedia.org/wiki/Dynamic_linker +[9]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[10]: https://en.wikipedia.org/wiki/C_standard_library +[11]: http://man7.org/linux/man-pages/man3/getopt.3.html +[12]: https://www.python.org/dev/peps/pep-0275/ +[13]: https://www.python.org/dev/peps/pep-3103/ +[14]: https://www.gnu.org +[15]: https://en.wikipedia.org/wiki/Man_page +[16]: http://man7.org/linux/man-pages/man1/ps.1.html +[17]: https://docs.python.org/3/library/sys.html +[18]: https://docs.python.org/2/library/getopt.html +[19]: https://docs.python.org/2/library/optparse.html +[20]: https://docs.python.org/3/library/argparse.html +[21]: https://en.wikipedia.org/wiki/Boilerplate_code +[22]: https://www.python.org/dev/peps/pep-0206/ +[23]: https://click.palletsprojects.com/en/7.x/ +[24]: https://wiki.python.org/moin/PythonDecorators +[25]: https://typer.tiangolo.com +[26]: https://docs.python.org/3/library/typing.html +[27]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself +[28]: https://pybit.es/guest-exploring-python-clis.html diff --git a/published/202006/20200602 Linux Lite 5.0 Released With UEFI Support - Other Major Improvements.md b/published/202006/20200602 Linux Lite 5.0 Released With UEFI Support - Other Major Improvements.md new file mode 100644 index 0000000000..f17baf1796 --- /dev/null +++ b/published/202006/20200602 Linux Lite 5.0 Released With UEFI Support - Other Major Improvements.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12287-1.html) +[#]: subject: (Linux Lite 5.0 Released With UEFI Support & Other Major Improvements) +[#]: via: (https://itsfoss.com/linux-lite-5-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Lite 5.0 发布,带有 UEFI 支持和其他重大改进 +====== + +Linux Lite 是[适合 Windows 用户的最佳 Linux 发行版][1]之一。 不仅限于此,它还是最受欢迎的[轻量级 Linux 发行版][2]之一。 + +基于 Ubuntu 18.04 的 Linux Lite 4.x 系列虽然不错,但没有 [UEFI 支持][3]。 但是现在基于 [Ubuntu 20.04][4] 的 Linux Lite 5.0 终于来了,我很高兴看到这些变化! + +在本文中,我们将介绍 Linux Lite 5.0 的新增功能。 + +### Linux Lite 5.0:关键变更 + +![][5] + +即使 Linux Lite 从 2.x 就开始支持 UEFI,但他们总是默认发布非 UEFI 的。 + +但是,在 Linux Lite 5.0 中,他们终于增加了开箱即用的 [UEFI][3] 默认支持以及许多重大改进。让我们看看发生了什么变化: + +#### UEFI 支持 + +Linux Lite 5.0 支持开箱即用的 UEFI。但是,他们建议禁用[安全启动][6],即使该功能可以工作。 + +![][7] + +你可以看看他们的[论坛文章][8],以了解更多信息。此外,你还可以在新的内置**帮助手册**中找到有关此的更多信息。 + +#### 基于 Ubuntu 的发行版,没有隐藏的遥测 + +如果你正在寻找基于 Ubuntu 的 Linux 发行版,且没有任何隐藏的遥测功能,那么 Linux Lite 5.0 似乎是理想的选择。 + +在[发布公告][9]中,他们在变更日志中提到了它,并提供了截图: + +![][10] + +#### GUFW 防火墙替换为 firewalld + +你可能已经读过[在 Linux 上使用 GUFW 设置防火墙][11],但从 Linux Lite 5.0 开始,它已由 [firewalld][12] 取代。 + +![][13] + +似乎 [GUFW][14] 不能像 firewalld 那样配置。因此,他们决定替换它。 + +默认情况下,它是禁用的。但是,你可以按照**帮助手册**中的教程选择启用它。 + +#### 新的 Whisker 菜单 + +![][15] + +[Whisker 菜单][16]已更新至最新可用的软件包(v2.4.4)。 除了更新之外,你还可以注意到**安装更新**现在被固定在收藏夹。 + +#### HiDPI 设置 + +![][17] + +如果需要,你会发现从**设置菜单**中设置 HiDPI 非常容易。 + +#### 已添加 XFCE 屏幕保护程序 + +在 Linux Lite 5.0 中,你还将注意到添加了 [XFCE 屏幕保护程序][18],默认情况下它处于禁用状态。 + +![][19] + +这是一个简单的补充,对于一直想要屏幕保护程序并能够对其进行调整的用户而言,这将很有用。 + +### 其他重要改进 + +除了上面提到的关键要点外,还有其他一些改进对于 Linux Lite 5.0 用户而言应该是很方便的。我在这里列出其中一些: + + * [Mousepad][20] 替换 [Leafpad][21] + * 新的更新通知 + * 在即时启动时进行完整性检查 + * 对**帮助手册**的重大改进 + * Lite 软件中用 Chrome 取代了 Chromium + * 新的布局选项 + * Lite 欢迎页面和 Lite 用户管理器现在更新到 GTK3 和 Python3。 + * 欢迎页面添加了新的选择:**选择深色或浅色主题、UEFI 和安全启动、反馈** + * 改进的 Lite 小部件 + +如果你想进一步了解更改,可以在其[官方公告][9]中找到详细的更改列表。 + +### 总结 + +我认为 Linux Lite 5.0 比以往任何时候要好,并且随着最近新增的功能,对于许多新 Linux 用户来说,它也是一个绝佳的选择。 + +你如何看待 Linux Lite 5.0?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-lite-5-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/windows-like-linux-distributions/ +[2]: https://itsfoss.com/lightweight-linux-beginners/ +[3]: https://help.ubuntu.com/community/UEFI +[4]: https://itsfoss.com/ubuntu-20-04-release-features/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5.jpg?ssl=1 +[6]: https://en.wikipedia.org/wiki/Hardware_restriction#Secure_boot +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-uefi.png?ssl=1 +[8]: https://www.linuxliteos.com/forums/uefi-secure-boot/ +[9]: https://www.linuxliteos.com/forums/release-announcements/linux-lite-5-0-final-released/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-telemetry.png?ssl=1 +[11]: https://itsfoss.com/set-up-firewall-gufw/ +[12]: https://firewalld.org/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-firewall.jpg?ssl=1 +[14]: http://gufw.org/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/whisker-menu-linux-lite.jpg?ssl=1 +[16]: https://gottcode.org/xfce4-whiskermenu-plugin/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-hidpi.png?ssl=1 +[18]: https://docs.xfce.org/apps/screensaver/start +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-screensaver.jpg?ssl=1 +[20]: https://salsa.debian.org/xfce-team/apps/mousepad +[21]: https://tarot.freeshell.org/leafpad/ diff --git a/published/202006/20200602 Using pandas to plot data in Python.md b/published/202006/20200602 Using pandas to plot data in Python.md new file mode 100644 index 0000000000..f51dd2f1e1 --- /dev/null +++ b/published/202006/20200602 Using pandas to plot data in Python.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12333-1.html) +[#]: subject: (Using pandas to plot data in Python) +[#]: via: (https://opensource.com/article/20/6/pandas-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Pandas 在 Python 中绘制数据 +====== + +> Pandas 是一个非常流行的 Python 数据操作库。学习怎样使用它的 API 绘制数据。 + +![](https://img.linux.net.cn/data/attachment/album/202006/19/231720ed0jd9s99h9cute7.jpg) + +在有关基于 Python 的绘图库的系列文章中,我们将对使用 Pandas 这个非常流行的 Python 数据操作库进行绘图进行概念性的研究。Pandas 是 Python 中的标准工具,用于对进行数据可扩展的转换,它也已成为[从 CSV 和 Excel 格式导入和导出数据][2]的流行方法。 + +除此之外,它还包含一个非常好的绘图 API。这非常方便,你已将数据存储在 Pandas DataFrame 中,那么为什么不使用相同的库进行绘制呢? + +在本系列中,我们将在每个库中制作相同的多条形柱状图,以便我们可以比较它们的工作方式。我们使用的数据是 1966 年至 2020 年的英国大选结果: + +![Matplotlib UK election results][3] + +### 自行绘制的数据 + +在继续之前,请注意你可能需要调整 Python 环境来运行此代码,包括: + +* 运行最新版本的 Python(用于 [Linux][4]、[Mac][5] 和 [Windows][6] 的说明) +* 确认你运行的是与这些库兼容的 Python 版本 + +数据可在线获得,并可使用 Pandas 导入: + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们已经准备好了。在本系列文章中,我们已经看到了一些令人印象深刻的简单 API,但是 Pandas 一定能夺冠。 + +要在 x 轴上绘制按年份和每个党派分组的柱状图,我只需要这样做: + +``` +import matplotlib.pyplot as plt +ax = df.plot.bar(x='year') +plt.show() +``` + +只有四行,这绝对是我们在本系列中创建的最棒的多条形柱状图。 + +我以[宽格式][7]使用数据,这意味着每个党派都有一列: + +``` + year conservative labour liberal others +0 1966 253 364 12 1 +1 1970 330 287 6 7 +2 Feb 1974 297 301 14 18 +.. ... ... ... ... ... +12 2015 330 232 8 80 +13 2017 317 262 12 59 +14 2019 365 202 11 72 +``` + +这意味着 Pandas 会自动知道我希望如何分组,如果我希望进行不同的分组,Pandas 可以很容易地[重组 DataFrame][8]。 + +与 [Seaborn][9] 一样,Pandas 的绘图功能是 Matplotlib 之上的抽象,这就是为什么要调用 Matplotlib 的 `plt.show()` 函数来实际生成绘图的原因。 + +看起来是这样的: + +![pandas unstyled data plot][10] + +看起来很棒,特别是它又这么简单!让我们对它进行样式设置,使其看起来像 [Matplotlib][11] 的例子。 + +#### 调整样式 + +我们可以通过访问底层的 Matplotlib 方法轻松地调整样式。 + +首先,我们可以通过将 Matplotlib 颜色表传递到绘图函数来为柱状图着色: + +``` +from matplotlib.colors import ListedColormap +cmap = ListedColormap(['#0343df', '#e50000', '#ffff14', '#929591']) +ax = df.plot.bar(x='year', colormap=cmap) +``` + +我们可以使用绘图函数的返回值设置坐标轴标签和标题,它只是一个 [Matplotlib 的 Axis 对象][12]。 + +``` +ax.set_xlabel(None) +ax.set_ylabel('Seats') +ax.set_title('UK election results') +``` + +这是现在的样子: + +![pandas styled plot][13] + +这与上面的 Matplotlib 版本几乎相同,但是只用了 8 行代码而不是 16 行!我内心的[代码高手][14]非常高兴。 + +### 抽象必须是可转义的 + +与 Seaborn 一样,向下访问 Matplotlib API 进行细节调整的能力确实很有帮助。这是给出抽象[紧急出口][15]使其既强大又简单的一个很好的例子。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/pandas-python + +作者:[Shaun Taylor-Morgan][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/panda.png?itok=0lJlct7O (Two pandas sitting in bamboo) +[2]: https://anvil.works/docs/data-tables/csv-and-excel +[3]: https://opensource.com/sites/default/files/uploads/matplotlib_2.png (Matplotlib UK election results) +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: https://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://anvil.works/blog/tidy-data +[8]: https://anvil.works/blog/tidy-data#converting-between-long-and-wide-data-in-pandas +[9]: https://anvil.works/blog/plotting-in-seaborn +[10]: https://opensource.com/sites/default/files/uploads/pandas-unstyled.png (pandas unstyled data plot) +[11]: https://opensource.com/article/20/5/matplotlib-python +[12]: https://matplotlib.org/api/axis_api.html#axis-objects +[13]: https://opensource.com/sites/default/files/uploads/pandas_3.png (pandas styled plot) +[14]: https://en.wikipedia.org/wiki/Code_golf +[15]: https://anvil.works/blog/escape-hatches-and-ejector-seats +[16]: https://anvil.works/blog/plotting-in-pandas \ No newline at end of file diff --git a/published/202006/20200602 Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions.md b/published/202006/20200602 Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions.md new file mode 100644 index 0000000000..3a33690599 --- /dev/null +++ b/published/202006/20200602 Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12353-1.html) +[#]: subject: (Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions) +[#]: via: (https://itsfoss.com/synaptic-package-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 中使用轻量的 Apt 软件包管理器 Synaptic +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/26/220622uh75qnmmzgh58lpv.jpg) + +这周推荐的开源软件是 Synaptic。学习这个经过时光积淀的软件包管理器能做哪些现代软件管理器做不到的事情。 + +### Synaptic 软件包管理器是什么? + +[Synaptic][1] 是一个轻量级的 [apt 软件包管理器系统][2]的 GUI 前端,使用在 Debian、Ubuntu、Linux Mint 以及其它很多基于 Debian/Ubuntu 发行版中。 + +总的来说,所有你可以 [在终端中使用 apt-get 命令][3] 来做的事,都可以通过 Synaptic 来实现。 + +![][4] + +曾几何时,Synaptic 几乎是所有基于 Debian Linux 发行版的默认图形化软件包管理器。它被认为是一种用户友好的、易于使用的管理应用程序的方法。 + +随着像 [GNOME “软件”][5] 和 [KDE “发现”][6] 等现代软件包管理器工具带来更现代和直观的图形用户界面,事情发生了变化。这些软件包管理器有更好的界面,以一种更友好的方式显示软件包信息,带有缩略图、评分和评论。 + +最后,Synaptic [的使用被局限于在大多数的轻量级 Linux 发行版][7] 中。 + +#### 为什么你要使用像 Synaptic 软件包管理器这样的 “古老的” 软件? + +当然,在多大数的情况下,你没有必要这样做。 + +但是,Synaptic 仍然比 GNOME “软件” 的功能要很多。记住,它基本上是 `apt` 的 GUI 前端,这意味着它(几乎)可以做任何你能够 [在终端中使用 apt 命令][8] 所做的事。 + +例如,如果你想 [在 Ubuntu 中阻止特定的软件包更新][9],你可以在 Synaptic 中做到这一点,但是你却不能 GNOME/Ubuntu 的软件中心中实现。 + +![][10] + +另外,我注意到 Ubuntu 20.04 的软件中心存在一些问题。它加载速度缓慢,它搜索软件包时缓慢,并且它充满了 snap 应用程序(不是每个人都喜欢)。 + +Synaptic 也是 [Ubuntu 中一个轻量级应用程序][7],使用可以可以让你感觉你的系统快一点。 + +#### Synaptic 软件包管理器的功能 + +下面是对 Synaptic 的概况: + + * 更新软件包缓存 + * 升级整个系统 + * 管理软件包包存储库 + * 通过名称、描述、维护者、版本、依赖项等搜索软件包 + * 通过组、状态(安装与否)、源或更多信息列出软件包 + * 通过名称、状态、大小或版本排序软件包 + * 获取与软件包相关的信息 + * 锁定软件包版本 + * 安装指定版本的软件包 + +还有很多功能,大家可以自己去探索。 + +### 如何在 Ubuntu 上安装 Synaptic 软件包管理器 + +Synaptic 软件包管理器可在 Ubuntu 的 Universe 存储库中获得。如果 Universe 存储库未启用,你可以在软件中心中找到Synaptic: + +![Synaptic 在 Ubuntu 软件中心][11] + +你也可以通过命令行来安装 Synaptic 。先确保启用 universe 存储库: + +``` +sudo add-apt-repository univers +``` + +然后更新缓存(在 Ubuntu 18.04 及更高版本中不需要): + +``` +sudo apt update +``` + +现在,使用下面的命令来安装 synaptic 软件包管理器: + +``` +sudo apt install synaptic +``` + +这就是所有的安装过程。 + +### 如何使用 Synaptic 软件包管理器 + +在安装后,你可以在菜单中开始搜索 Synaptic 并启动它: + +![][12] + +可以看到,这个界面不是最好看的界面之一。注意复选框的颜色。白色意味着软件包未安装,绿色意味软件包已安装。 + +![][4] + +你可以搜索一个应用程序并单击复选框将标记其为安装。它也将(以绿色的形式)高亮将被作为依赖关系项目的软件包。单击应用来安装选择的软件包: + +![][13] + +你可以使用 Synaptic [查看在 Ubuntu 中安装的所有软件包][14] 。你也可以从这个视图中选择移除软件包。 + +![][15] + +你可以根据源显示各个存储库中可用的软件包。这是查看 [哪个 PPA 提供什么软件包][16]的好方法。你可以通过如上所述的方法来安装或移除软件包。 + +![][17] + +通常,当你更新 Ubuntu 时,所有的软件包都会同时更新。使用 Synaptic,你可以轻松地选择你需要更新/升级到较新版本的软件包。 + +![][18] + +你也可以锁定软件包的版本,以便它们就不会随着系统更新而被更新。 + +![][10] + +你也可以使用 Synaptic 搜索软件包。这类似于 [使用 apt-cache search 命令搜索软件包][19]。 + +![][20] + +如果你认为你做了错误的选择,你可以从“编辑”菜单中单击撤销。 + +你可以使用 Synaptic 做很多事,我无法涵盖所有可能的用法。我在这里已经涵盖了最常见的一些方法,如果你将要去使用 Synaptic 的话,我留给你去探索。 + +### Synaptic 并不适合所有的人 + +如果你不喜欢 Synaptic,你可以在软件中心中移除它,或在终端中使用这个命令: + +``` +sudo apt remove synaptic +``` + +Ubuntu 还有另一个被称为 [AppGrid][21] 的轻量级软件包管理器。据我所知,它已经有一段时间没有更新了。 + +Synaptic 当然并不适合所有的人。它列出了你在常规软件中心中看不到的库和包。如果你移除了一个你不知道的库,那么它可能会引起问题。 + +我认为 Synaptic 更适合于中高级用户,他们既想更好地控制软件包管理器又不想使用命令行方法。 + +你有什么要说的吗?你使用过 Synaptic 软件包管理器吗?你是使用软件中心还是你只在终端中探索?请在评论区中分享你的喜好。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/synaptic-package-manager/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.comrobsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.nongnu.org/synaptic/ +[2]: https://en.wikipedia.org/wiki/APT_(software) +[3]: https://itsfoss.com/apt-get-linux-guide/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/synaptic-interface.png?ssl=1 +[5]: https://wiki.gnome.org/Apps/Software +[6]: https://userbase.kde.org/Discover +[7]: https://itsfoss.com/lightweight-alternative-applications-ubuntu/ +[8]: https://itsfoss.com/apt-command-guide/ +[9]: https://itsfoss.com/prevent-package-update-ubuntu/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/lock-version-synaptic.png?ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/synaptic-ubuntu-software-center.png?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/synaptic-package-manager-ubuntu.jpg?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/install-packages-in-synaptic.png?ssl=1 +[14]: https://itsfoss.com/list-installed-packages-ubuntu/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/remove-packages-using-synaptic.png?ssl=1 +[16]: https://itsfoss.com/ppa-guide/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/upgrade-packages-synaptic.png?ssl=1 +[19]: https://itsfoss.com/apt-search-command/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/search-results-synaptic.png?ssl=1 +[21]: https://itsfoss.com/app-grid-lighter-alternative-ubuntu-software-center/ diff --git a/published/202006/20200604 Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster (and Free From systemd).md b/published/202006/20200604 Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster (and Free From systemd).md new file mode 100644 index 0000000000..14d4670ffe --- /dev/null +++ b/published/202006/20200604 Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster (and Free From systemd).md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12308-1.html) +[#]: subject: (Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster) +[#]: via: (https://itsfoss.com/devuan-3-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +没有 systemd 的 Devuan Beowulf 3.0 发布 +====== + +[Devuan GNU+Linux][1] 是 [Debian][2] 的分支,它不含有 [systemd][3]。如果你想知道 systemd 有什么问题,我们可以改天再讨论这个话题。 + +不过,如果你想要一个没有 systemd 的 Linux 发行版,那么 Devuan Beowulf 3.0 的发布对你来说应该是个好消息。 + +### Devuan Beowulf 3.0 有什么新增功能? + +![](https://img.linux.net.cn/data/attachment/album/202006/12/112455y003411l1k8yykp0.jpg) + +Devuan 通常因其提供了替代性的[初始化][5]系统(如 [SysV][6])而受到喜爱。 + +在本文中,我们将介绍 Devuan Beowulf 3.0 中的主要亮点。 + +#### 基于 Debian 10.4 Buster + +[Debian 10 Buster][7] 无疑是一款令人印象深刻的发行版系列,它的最新版本是 Debian 10.4。 + +而 Devuan Beowulf 3.0,是基于最新的 Debian 10.4 Buster 更新版本的。如果你不了解,可以查看 [Debian 10.4 Buster 的官方公告][8],以了解更多信息。 + +#### Linux Kernel 4.19 + +在它的最新版本中装有 [Linux Kernel 4.19 LTS][9] 也是一个很好的加分项。 + +当然,这不是最新的内核,因为我们身处 “Debian 领域”,这里的事物并非总是最新的,但更加稳定。这个新内核应该可以解决以前版本中可能遇到的几个问题。 + +#### 支持 ppc64el 架构 + +对 [ppc64el][10] 的支持在大多数时候都不是大事,但支持 PowerPC 和 Power ISA 处理器是一个优势。 + +顺便提一句,Devuan GNU+Linux 已经支持 i386、amd64、armel、armhf 和 arm64 架构。 + +#### 添加 runit 和 OpenRC 作为可选项 + +想要更多替代的的初始化系统吗?现在最新版本中可选 [runit][11] 和 [openrc][12]。 + +#### 其他变化 + +除了上面的这样亮点外,你还可以发现它添加了独立守护进程 [eudev][13] 和 [elogind][14]。 + +启动页面、显示管理器和桌面主题也有了细微的变化。例如,启动菜单显示的是 “Debian” 而不是 “Devuan”。 + +如果你想了解有关 Devuan Beowulf 3.0.0 变更的更多技术详细信息,那么可以查看[官方发行说明][15]。 + +> 花絮 +> +> Devuan 的发布版本以小行星命名。Beowulf 是一个[编号为 38086 的小行星][16]。 + +### 总结 + +最新稳定版本的 Devuan Beowulf 3.0 是提供无 systemd 的发行版的很好的进展。 + +如果你想支持 Devuan 项目,请[在财务上为他们的项目捐款][17]或[通过其他方式][18]。 + +你觉得这个版本怎么样?请在下面评论让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/devuan-3-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://devuan.org +[2]: https://www.debian.org +[3]: https://en.wikipedia.org/wiki/Systemd +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/devuan-beowulf.jpg?ssl=1 +[5]: https://en.wikipedia.org/wiki/Init +[6]: https://wiki.archlinux.org/index.php/SysVinit +[7]: https://itsfoss.com/debian-10-buster/ +[8]: https://www.debian.org/News/2020/20200509 +[9]: https://itsfoss.com/linux-kernel-4-19-lts-release/ +[10]: https://en.wikipedia.org/wiki/Ppc64 +[11]: https://en.wikipedia.org/wiki/Runit +[12]: https://en.wikipedia.org/wiki/OpenRC +[13]: https://wiki.gentoo.org/wiki/Eudev +[14]: https://wiki.gentoo.org/wiki/Elogind +[15]: https://files.devuan.org/devuan_beowulf/Release_notes.txt +[16]: https://en.wikipedia.org/wiki/Meanings_of_minor_planet_names:_38001%E2%80%9339000#086 +[17]: https://devuan.org/os/donate +[18]: https://dev1galaxy.org/viewtopic.php?pid=1380#p1380 diff --git a/published/202006/20200604 How to Install Nvidia Drivers on Fedora Linux.md b/published/202006/20200604 How to Install Nvidia Drivers on Fedora Linux.md new file mode 100644 index 0000000000..724a854583 --- /dev/null +++ b/published/202006/20200604 How to Install Nvidia Drivers on Fedora Linux.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12301-1.html) +[#]: subject: (How to Install Nvidia Drivers on Fedora Linux) +[#]: via: (https://itsfoss.com/install-nvidia-drivers-fedora/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +如何在 Fedora Linux 中安装 Nvidia 驱动 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/10/094702c7of7scjyucmc5f1.jpg) + +与大多数 Linux 发行版一样,[Fedora][1] 并未默认安装专有的 [Nvidia][2] 驱动。 + +默认的开源 [Nouveau 驱动][3]在大多数情况下都可以使用,但是你可能会遇到屏幕撕裂等问题。 + +![Display issue in Fedora with Nouveau graphics driver][4] + +如果遇到此类图形/视频问题,那么可能需要在 Fedora 中安装官方专有的 Nvidia 驱动。让我告诉你如何安装。 + +### 在 Fedora 中安装 Nvidia 驱动 + +我在本教程中使用 [Fedora 32][5],但它应适用于其他 Fedora 版本。 + +#### 步骤 1 + +在做其他任何操作之前,请先确保你的系统是最新的。你可以使用软件中心,也可以在终端中使用以下命令: + +``` +sudo dnf update +``` + +#### 步骤 2 + +由于 Fedora 没有提供 Nvidia 驱动,因此你需要在系统中添加 [RPMFusion 仓库][6]。你可以在终端中使用以下命令: + +``` +sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm +``` + +> 不喜欢终端么?那使用 GUI 的方法添加 RPMFusion 仓库。 +> +> 如果你使用 Firefox,那么还可以从浏览器添加 RPMFusion 仓库。进入这个[配置页面][7],然后向下滚动到 “Graphical Setup via Firefox web browser”。单击自由和非自由仓库的链接。这将下载 .rpm 文件,并安装仓库。 +> +> ![RPMFusion Browser Installation][8] +> +> 你可以双击下载的 RPM 文件进行安装。 +> +> ![RPMFusion in the Software Center][9] + +#### 步骤 3 + +现在,你需要确定 [Linux 系统中有哪些显卡(或芯片)][10]。打开终端并输入以下命令: + +``` +lspci -vnn | grep VGA +``` + +![Video Card Lookup in Fedora][11] + +接下来,你需要查找与该芯片对应的驱动。你可以在[此处][12]找到 Nvidia 芯片的列表。你也可以使用[此工具][13]搜索设备。 + +**注意**:请记住,即使 Nvidia 列表显示了更多驱动,但也只有三个驱动可以安装。Nvidia 驱动支持最新的显卡。nvidia-390 和 nvidia-340 驱动支持旧设备。 + +#### 步骤 4 + +要安装所需的驱动,请在终端中输入以下一个命令。下面的命令是用于我的显卡的命令。根据你的系统相应调整。 + +``` +sudo dnf install akmod-nvidia sudo dnf install xorg-x11-drv-nvidia-390xx akmod-nvidia-390xx sudo dnf install xorg-x11-drv-nvidia-340xx akmod-nvidia-340xx +``` + +![Nvidia terminal installation][14] + +#### 步骤 5 + +要使更改生效,请重启系统。你的系统重启可能需要比较长的时间,因为它将 Nvidia 驱动注入到 Linux 内核中。 + +重启并登录系统后,你会看到更好的视觉效果,并且不会出现屏幕撕裂的情况。 + +![Fedora with Nvidia drivers][15] + +### 额外的提示 + +这是可选步骤,但建议这样做。添加 RPMFusion 仓库时,你可以访问常规仓库中不可用的多媒体包。 + +此命令将为使用 [gstreamer][16] 的应用安装软件包: + +``` +sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin +``` + +此命令将安装声音和视频软件包所需的包: + +``` +sudo dnf groupupdate sound-and-video +``` + +希望本教程对在 Fedora 上安装 Nvidia 驱动很有用。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-nvidia-drivers-fedora/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://getfedora.org/ +[2]: https://www.nvidia.com/en-us/ +[3]: https://en.wikipedia.org/wiki/Nouveau_(software) +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/fedora-nouveau.jpg?resize=800%2C500&ssl=1 +[5]: https://itsfoss.com/fedora-32/ +[6]: https://rpmfusion.org/RPM%20Fusion +[7]: https://rpmfusion.org/Configuration +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/rpmfusion-gui-install.png?resize=800%2C500&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/rpmfusion-gui-install2.png?resize=800%2C500&ssl=1 +[10]: https://itsfoss.com/check-graphics-card-linux/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/video-card-lookup-fedora.png?ssl=1 +[12]: https://us.download.nvidia.com/XFree86/Linux-x86/367.57/README/supportedchips.html +[13]: https://www.nvidia.com/Download/index.aspx?lang=en-us +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/nvidia-cli-install.png?resize=800%2C500&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/fedora-nvidia.jpg?resize=800%2C500&ssl=1 +[16]: https://en.wikipedia.org/wiki/GStreamer diff --git a/published/202006/20200604 How to generate an EPUB file on Fedora.md b/published/202006/20200604 How to generate an EPUB file on Fedora.md new file mode 100644 index 0000000000..021271376f --- /dev/null +++ b/published/202006/20200604 How to generate an EPUB file on Fedora.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12313-1.html) +[#]: subject: (How to generate an EPUB file on Fedora) +[#]: via: (https://fedoramagazine.org/how-to-generate-an-epub-file-on-fedora/) +[#]: author: (John Paul Wohlscheid https://fedoramagazine.org/author/johnblood/) + +如何在 Fedora 上生成 EPUB 电子书 +====== + +![][1] + +在智能手机上阅读内容正在变得越来越流行。每一部手机都有它自己的电子书阅读器。可能你不知道,在 Fedora 创建你自己的电子书文件是非常容易的。 + +这篇文章展示了使用两种不同的方法来创建一个 [EPUB][2] 文件。EPUB 格式是最流行的格式之一,并且被很多开源软件所支持。 + +绝大数的人们将会询问 “在很容易创建 PDF 文件的情况下,为什么要花费时间和精力来创建 EPUB 文件?” 答案是: “你曾经尝试看过每次只能看到一张纸的一小部分的吗?”为阅读一个 PDF 文件,你不得不经常缩放和移动文档,或者将其缩放到一个小尺寸来适合屏幕大小。在另一方面,EPUB 文件则被设计成可以适合很多不同的屏幕类型。 + +### 方法 1: ghostwriter 和 pandoc + +第一种方法创建一个速成版的电子书文件。它使用一个名为 [ghostwriter][3] 的 Markdown 编辑器,和一个名为 [pandoc][4] 的命令行文档转换工具。 + +你可以从软件中心搜查和安装它们,也可以从终端中安装它们。如果你使用终端来安装它们,运行这个命令: + +``` +sudo dnf install pandoc ghostwriter +``` + +对于那些不知道 [Markdown][5] 是什么的人们来说,在这里有一个简要的解释:它是一个大约在 15 年前创建的简单的标记语言。它使用简单的语法来格式化纯文本。Markdown 文件可以随后转换成很多其它文档格式的文件。 + +![ghostwriter][6] + +对于工具,ghostwriter 是一个跨平台的易于使用的 Markdown 编辑器。pandoc 是一个非常易于使用的文档转换工具,可以处理数百种不同的格式。 + +要创建你的电子书,打开 ghostwriter,开始编写你的文档。如果你以前使用过 Markdown,你可能习惯于在文档的“标题 1”的前面放置一个 `#` 符号来作为标题。像这样: `# My Man Jeeves`。然而,pandoc 将不会识别其为标题,并将在你的电子书的顶部放置一个一个大的 “UNTITLED” 。相反地在你的标题前放置一个 `%` 来作为标题。例如,`% My Man Jeeves` 。章节应该被格式为“标题 2”,例如,`## Leave It to Jeeves`。如果你有子章节,使用“标题 3”(`###`)。 + +![][7] + +在你的文档完成后,单击“文件 -> 导出”(或按 `Ctrl+E` 键)。在对话框中,在几个 Markdown 转换器中进行选择。如果这是你第一次使用 ghostwriter ,默认选择的是 Sundown 转换器。从对话框中,选择 pandoc 。接下来单击“导出”。现在你的 EPUB 文件已经创建好了。 + +![ghostwriter 导出对话框][8] + +注意: 如果你得到一个与 pandoc 有关的错误,关闭“智能排版”,并再试一次。 + +### 方法 2: calibre + +如果你想要一个更完美的电子书,那这就是你正在寻找的方法。它需要更多的步骤,但是是值得的。 + +![][9] + +首先,安装一个名为 [calibre][10] 的应用程序。calibre 不仅仅是一个电子书阅读器,它也是一个电子书管理器系统。你可以从软件中心安装它,也可以从终端安装它: + +``` +sudo dnf install calibre +``` + +在这个方法中,你可以在 LibreOffice、ghostwriter,或者其它你选择的编辑器中编写你的文档。确保书籍的标题被格式为“标题 1”,章节被格式为“标题 2”,子章节被格式为“标题 3”。 + +接下来,导出你的文档为一个 HTML 文件。 + +现在添加该文件到 calibre 。打开 calibre ,并单击 “添加书籍”。calibre 会用几秒钟来添加文件。 + +![][11] + +在文件导入后,通过单击 “编辑元数据” 按钮来编辑文件的元数据。在这里你可以填写书的标题和作者的姓名。你也可以上传一个封面图片(如果你有的话),或者 calibre 将为你生成一个封面。 + +![][12] + +接下来,单击 “转换书籍” 按钮。在新的对话框中,选择 “界面与外观” 部分的 “布局” 标签页。勾选 “删除段间空行” 选项。这将更加严格地缩进每一段的内容。 + +![][13] + +现在,设置目录。选择 “内容目录” 部分。这里有三个需要注意的选项: “一级目录”、“二级目录” 和 “三级目录”。对于每一个选项点击其末尾处的魔法棒按钮。在新的对话框中,选择应用于目录表项的 HTML 标记。例如,为“一级目录”选择 “h1”。 + +![][14] + +接下来,告诉 calibre 包含内容目录。选择 “输出 EPUB” 部分并勾选 “插入内联目录”。单击“确定“ 创建 epub 文件。 + +![][15] + +现在,你有了一个看起来很专业的电子书文件。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-generate-an-epub-file-on-fedora/ + +作者:[John Paul Wohlscheid][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/johnblood/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/epub-how_to-816x345.png +[2]: https://en.wikipedia.org/wiki/EPUB +[3]: https://github.com/wereturtle/ghostwriter +[4]: https://pandoc.org/ +[5]: https://fedoramagazine.org/applications-for-writing-markdown/ +[6]: https://fedoramagazine.org/wp-content/uploads/2020/05/ghostwriter-1024x640.jpg +[7]: https://fedoramagazine.org/wp-content/uploads/2020/05/ghostwriter-menu-1024x640.jpg +[8]: https://fedoramagazine.org/wp-content/uploads/2020/05/ghostwriter-export-1024x640.jpg +[9]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-pre-1024x640.jpg +[10]: https://calibre-ebook.com/ +[11]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-metadata-1024x640.jpg +[12]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-lookandfeel-1024x640.jpg +[13]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-toc2-1024x640.jpg +[14]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-epub-output-1024x640.jpg +[15]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-post-1024x640.jpg diff --git a/published/202006/20200604 Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience).md b/published/202006/20200604 Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience).md new file mode 100644 index 0000000000..7fed915dff --- /dev/null +++ b/published/202006/20200604 Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience).md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12283-1.html) +[#]: subject: (Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience)) +[#]: via: (https://itsfoss.com/lenovo-linux-certified/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +现在你可以购买通过 Linux 认证的联想 ThinkPad 和 ThinkStation +====== + +曾经有一段时间,[ThinkPad][1] 是 Linux 用户的首选系统。但那是在 ThinkPad 还是 [IBM][2] 的产品的时候。当[联想在 2005 年收购了 IBM 的个人电脑业务][3]之后,(我觉得)事情开始发生了变化。 + +ThinkPad 曾经是一个令人惊叹的系列笔记本电脑,稳定可靠、值得信赖、坚如磐石,你只要问问 2010 年代以前用过它的人就知道了。 + +但在 2010 年前后,联想 ThinkPad 开始失去了它的魅力。它充满了一个又一个的问题,消费者们抱怨性能不佳。 + +而对于 Linux 用户来说,情况就更糟糕了。它的安全启动与 UEFI [给 Linux 用户带来了问题][4]。[与 Linux 的争论][5]就这样没完没了。 + +我为什么要回忆起这些?因为联想似乎正在努力提高 Linux 的兼容性。对于 Linux 爱好者来说,联想的最新公告是一个极好的消息。 + +### 联想 ThinkPad 和 ThinkStation 全系产品将通过 Linux 认证 + +![][6] + +联想[宣布][7],将对**全部工作站产品进行 Ubuntu 和红帽等顶级 Linux 发行版的认证**,这包括所有机型和配置。 + +作为 Linux 用户,这对你来说意味着什么?它意味着,如果你购买了联想电脑,你将获得**最好的开箱即用的 Linux 体验**。 + +等一下?不是可以随便在任何电脑上安装 Linux 吗,不管是联想还是幻想?当然,你可以。但是,当你把现有的(Windows)操作系统清除掉,自己安装 Linux 时,你可能会遇到硬件兼容性的问题,如没有声音、Wi-Fi 无法工作等。 + +开箱即用的体验很重要,因为并不是每个人都愿意花时间去修复声音、显卡、Wi-Fi 和蓝牙等问题,而不是专注于自己的实际工作,因为他们买电脑的目的就是为了这个。 + +来自 [Ubuntu][8] 和 Red Hat 的开发人员会对联想系统的每一个硬件组件进行测试和验证,以确保联想系统的每一个硬件组件都能正常工作。 + +### Ubuntu、Red Hat 以及更多 + +![][9] + +为此,联想选择了两款顶级 Linux 发行版。Red Hat 是企业级 Linux 桌面和服务器的热门选择。而 Ubuntu 当然是普遍流行的。 + +这意味着,联想的计算机在使用 Ubuntu LTS 版本和 Red Hat Linux 时,会以最佳状态工作。联想甚至会在其中预装 Ubuntu 和 Red Hat 两种版本的系统。 + +但是,这还没有结束。Fedora 是 Red Hat 的一个社区项目,联想也会在 ThinkPad P53 和 P1 Gen 2 系统上预装 Fedora。 + +有很多基于 Ubuntu LTS 版本的 Linux 发行版。大多数情况下,这些发行版在外观、应用和其他图形化的东西上都不一样,但它们使用的是与 Ubuntu 相同的基础。 + +这应该意味着,基于 Ubuntu 的发行版,如 Linux Mint、Elementary OS 等也会与联想的设备有更好的硬件兼容性。 + +联想还将这些设备驱动直接发送给上游的 Linux 内核中,帮助它们的系统在整个生命周期内都保持稳定性和兼容性。这一点是非常棒的。 + +### 它能帮助增加 Linux 用户群吗? + +开箱即用的体验很重要。它可以让你专注于系统上应该做的重要任务,而不是故障排除。 + +我有一台[预装了 Ubuntu 的戴尔 XPS 笔记本][10]。这是唯一一台几乎不需要从我这一端进行硬件故障排除的设备,即使我手动安装了其它基于 Ubuntu 的发行版,也不需要进行硬件故障排除。 + +我很高兴看到联想为提高 Linux 的兼容性做出了更多努力。现在在[预装 Linux 的电脑列表][11]中有了更多的选择。 + +我不知道联想在其计算机产品中提供 Linux 是否有助于增加 Linux 用户群。大多数时候人们都会要 Windows,Linux 不会成为首要关注点。 + +但联想在设备上让自己的计算机产品更多的使用 Linux,这一点还是值得称赞的。我希望其他厂商也能这样做。希望没有什么坏处:) + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lenovo-linux-certified/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/ThinkPad +[2]: https://www.ibm.com/ +[3]: https://in.pcmag.com/laptops/38093/10-years-later-looking-back-at-the-ibm-lenovo-pc-deal +[4]: https://www.phoronix.com/scan.php?page=news_item&px=mtiyotg +[5]: https://www.engadget.com/2016-09-21-lenovo-pc-linux-trouble.html +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/lenevo-linux-certified-systems.jpg?ssl=1 +[7]: https://news.lenovo.com/pressroom/press-releases/lenovo-brings-linux-certification-to-thinkpad-and-thinkstation-workstation-portfolio-easing-deployment-for-developers-data-scientists/ +[8]: https://ubuntu.com/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/thinkpad-ubuntu.jpg?resize=800%2C582&ssl=1 +[10]: https://itsfoss.com/dell-xps-13-ubuntu-review/ +[11]: https://itsfoss.com/get-linux-laptops/ diff --git a/published/202006/20200604 Using AppImage for Linux package management.md b/published/202006/20200604 Using AppImage for Linux package management.md new file mode 100644 index 0000000000..ea7908af31 --- /dev/null +++ b/published/202006/20200604 Using AppImage for Linux package management.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12317-1.html) +[#]: subject: (Using AppImage for Linux package management) +[#]: via: (https://opensource.com/article/20/6/appimages) +[#]: author: (David Clinton https://opensource.com/users/dbclinton) + +使用 AppImage 进行 Linux 软件包管理 +====== + +> AppImage 在自足的环境中分发应用, 它适用于任何 Linux 发行版。 + +![](https://img.linux.net.cn/data/attachment/album/202006/15/140050aazux37axew7e0xk.jpg) + +管理 Linux 机器(尤其是远程机器)的一个重要分就是管理和安装软件。当本地应用程序出现问题时,或者文件系统上的某些文件损坏需要修复时,你通常会希望推送更新,而不必走很多路坐在物理屏幕前。正如我在 Pluralsight 课程《[Linux 系统维护和故障排除][2]》中所解释的那样,许多问题当然可以通过 Bash 脚本解决,但是仍有很多情况下,除了老式的二进制文件外,没有其他选择。 + +想象一下,你的某些远程系统需要安装新的应用程序,这样使用这些计算机的团队成员就能够执行某些业务。能够利用 Debian 或 RPM 之类的主要 Linux 仓库系统的集成和自动化,可以使你的管理任务变得更加容易。 + +正如 Linus Torvalds 永不厌倦地提醒我们的那样,太多的 Linux 软件管理系统的问题是 [Linux 软件管理系统太多了][3]。多年来,应用开发甚至是 Linux 的采用都变得愈加复杂起来,因为你为了提供你的软件(比如,放到 Debian 仓库)而投入的所有时间和工作,对于你想让它们进入 RPM 系统并没有什么帮助,对于 SUSE 的 Zypper 管理器也一样,没有什么帮助。 + +解决软件孤岛问题的一种有前途的方案是分发具有自足环境的应用,它们可以在任何 Linux 发行版上运行。在这个年轻且不断发展的领域中,选择之一是 [AppImage][4]。 + +### 使用 AppImage + +我全面投入到了 AppImage。就像我提到的其他软件包管理系统一样,如果你需要的话,有很多复杂的功能可以使用。但是,从本质上讲,AppImage 非常简单。AppImage 不像大多数其他包管理器一样通过仓库工作,它使用单个、独立的文件,可以直接发送或通过网站共享。 + +下面是个展示它的美妙之处的例子。当我在用 AppImage 时,我在一个技术论坛上看到了一个很老的讨论,它让我找到了一个同样久远且废弃的 GitHub 项目以及相关的 YAML 和配方文件。它们旨在自动构建准备生成 AppImage 包所需的相当复杂的基础架构。尽管该基础架构全部是在 5 年前的 Ubuntu 版本上构建的,但是当我将它们放在一起并运行 `appimagetool` 命令时,它创建了一个 AppImage 文件,它可在我当前的桌面上无缝运行。我不认为有很多有五年历史的 GitHub 复杂项目可以使用其他技术运行,而无需认真重做。 + +但是这里我我不会介绍这个案例。相反,我将用一个简单的 Hello World 程序向你展示它是如何工作的。首先,请确保本地已安装 AppStream 包。 + +对于基于 Debian 的系统,运行: + +``` +$ sudo apt install appstream +``` + +对于 RPM 系统,请使用: + +``` +$ sudo dnf install appstream +``` + +克隆[这篇文章][5]中提及的 Git 仓库,我会基于它示例: + +``` +$ git clone +$ cd appimage-resources +$ ls hello-world-appimage +``` + +接下来,使用 `cd` 进入 Git 新创建的目录。这里有两个目录。请使用 `hello-world-appimage`。另一个是更复杂的项目,你也应该考虑尝试一下。 + +Linux GUI 系统会读取 `helloworld.desktop` 文件来知道如何呈现桌面图标。事实证明,当前的这个文件会在以后给你带来点麻烦,因此请进行一些小修改:添加 `Categories=` 这行并为其赋予值 `GNOME`。不要忘记最后的分号: + + +``` +$ nano hello-world-appimage/helloworld.desktop +        add Categories=GNOME; +``` + +从 [AppImage GitHub 项目][6]下载 `appimagetool` 预编译的二进制文件。访问 GitHub 的原因之一:那里有很多出色的文档和资源。下载二进制文件后,使文件可执行,并将 `hello-world-appimage` 目录传给它。但是首先,你需要告诉它你想要的架构。由于某些原因,一个名字以 x86\_64 结尾的工具都不能自行确定是否该使用 x86\_64 来构建应用程序(我不知道这是怎么回事)。 + +``` +$ wget +$ chmod +x appimagetool-x86_64.AppImage +$ ARCH=x86_64 ./appimagetool-x86_64.AppImage hello-world-appimage +``` + +如果你没有看到任何错误消息,那么表示完成了,请运行: + +``` +$ ls +$ ./hello-world-appimage-x86_64.AppImage +``` + +### 总结 + +AppImage 是软件包管理的非常有效的选择。当你探索它时,我想你会发现它是 Linux 发行版默认软件包系统的很好的替代品。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/appimages + +作者:[David Clinton][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dbclinton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://pluralsight.pxf.io/VMKQj +[3]: https://itsfoss.com/desktop-linux-torvalds/ +[4]: https://appimage.org/ +[5]: https://www.booleanworld.com/creating-linux-apps-run-anywhere-appimage/ +[6]: https://github.com/AppImage/AppImageKit/releases diff --git a/published/202006/20200607 5 ways to boost your Kubernetes knowledge.md b/published/202006/20200607 5 ways to boost your Kubernetes knowledge.md new file mode 100644 index 0000000000..8912c4aa92 --- /dev/null +++ b/published/202006/20200607 5 ways to boost your Kubernetes knowledge.md @@ -0,0 +1,89 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12320-1.html" +[#]: subject: "5 ways to boost your Kubernetes knowledge" +[#]: via: "https://opensource.com/article/20/6/kubernetes-anniversary" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +提升你 Kubernetes 技能的 5 种方式 +====== + +> 值此周年纪念之际,来通过这些深度文章和实践项目了解下 Kubernetes。 + +![](https://img.linux.net.cn/data/attachment/album/202006/16/191023lqq0d5zv5vggr2vg.png) + +在云原生的成长期,开发者们发现在一个小型的、原子化的、精简的 Linux 镜像里编写应用程序很方便,这些镜像与它们所运行的服务器共享资源。从技术上讲,这些基于内核命名空间的小环境定义被称为[容器][2]。随着容器的激增,系统管理员们很快意识到,开发一个不仅能帮助他们管理容器,还能帮助他们管理下面的虚拟化基础设施的工具变得至关重要。于是,[Kubernetes][3] 应运而生。 + +Kubernetes 是一个可扩展开源平台,用于管理容器。它可以帮助管理员和开发者们围绕容器管理工作负载、服务和进程。它促进了声明式配置,更容易实现自动化。在它相对较短的生命周期中,它已经催生了一个迅速成长的生态系统,其中包括来自大量公司和项目的服务、支持和工具。 + +如果你想对这项重要的云技术有更多的了解,这里有一些能帮忙你更深入学习的文章。还有 5 个项目可以帮你把学到的东西付诸实践。 + +### 遏制容器乱象 + +2016 年,我们发布了《[使用 Kubernetes 遏制容器乱象][4]》,这是一篇由 Terry Ryan 写的关于 Kubernetes 的介绍性文章,讲述了 Kubernetes 如何帮助管理员和架构师们努力应对容器。如果你想找一篇从底层介绍容器是做什么的以及 Kubernetes 是如何实现容器管理的,那么你应该先读下本文。本文适合零基础的读者,解释了所有重要的概念,因此你能迅速了解相关技术。 + +如果想进阶了解内核层面发生的一些神奇的事情,请阅读 Jessica Cherry 对 [Kubernetes 命名空间][5]的解释。 + +延伸阅读: + +- [一文了解 Kubernetes 是什么?](https://linux.cn/article-8800-1.html) +- [Kubernetes 是什么?](https://linux.cn/article-8858-1.html) + +### Kubernetes:为什么它很重要? + +Kubernetes 提供了基础设施即服务Infrastructure-as-a-Service(IaaS)解决方案(类似 OpenStack)的便利和一个完整的平台即服务Platform as a Service(PaaS)。它为你提供了管理基础设施的抽象能力,以及在裸金属基础层面进行故障排除所需的工具。如果你执着于使用单一的裸金属服务器,你可能需要阅读下 Tim Potter 写的《[你为什么需要 Kubernetes][6]》。他的文章对比了 IaaS 和 PaaS,解释了为什么 Kubernetes 如此广泛地被使用。你可能并不是一定需要 Kubernetes 或容器,但是重要的是知道什么情况下需要。 + +延伸阅读: + +- [使用 Kubernetes 的 5 个理由](https://linux.cn/article-10973-1.html) +- [你(多半)不需要 Kubernetes](https://linux.cn/article-10469-1.html) + +### 在树莓派上运行 Kubernetes + +熟悉 Kubernetes 的最好方法莫过于自己运行它。不幸的是,不是每个人都有一个云服务基层设施(或者有足够的钱来租用一个)可供其支配。而幸运的是,Chris Collins 提供了《[在树莓派上运行 Kubernetes][7]》的教程。结合他的另外几篇关于《[Cloud-init][8]》和《[Cloud-init 服务][9]》的教程(也是在树莓派上运行),你可以搭建任何你想要的家庭实验室,这样你就可以学习如何管理属于自己的开放混合云。 + +### Kubernetes 命令 + +一旦你运行起 Kubernetes 后,可以看看 Jessica Cherry 的文章和附带的备忘清单,这个清单列出了所有的[基本的 Kubernetes 命令][10]。在她的文章中,她解释了 `kubectl` 命令的语法,简单讲述了每个命令和子命令是用来做什么的。 + +### 有趣的 Kubernetes 项目 + +没有什么比拥有技术却不知道该怎么用它更令人沮丧的了。例如,在你的办公桌上有一个树莓派是一回事,但是决定它的 CPU 应该用来做什么工作却完全是另一回事。我们发布了很多教程,来指导你完成你的 Kubernetes 之路的探索: + + * [Helm][11] 是一个 Kubernetes 的包管理器。你可以在它的帮助下,很快熟悉 Kubernetes 环境。 + * 学习下 [Operator SDK][12] 的所有内容,来熟悉 Kubernetes 的对象和操作器。 + * [在 Kubernetes 之上搭建网络文件系统(NFS)][13] + * 学习如何使用 [Skipper][14] 或 [Traefik][15] 进行流量调度。 + +最重要的,花点时间来熟悉容器和 Kubernetes。不论你先把容器化的应用放到服务器、云上还是桌面,它们都是能帮助你理解的重要的范例,因为它们是一个强大的构造,可以让 Linux 的应用变得更好、更健壮、鲁棒性更好、更简单。一定要投入精力去学习它们,你不会后悔的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/kubernetes-anniversary + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek "Ship captain sailing the Kubernetes seas" +[2]: https://opensource.com/article/18/11/behind-scenes-linux-containers +[3]: https://opensource.com/resources/what-is-kubernetes +[4]: https://opensource.com/life/16/9/containing-container-chaos-kubernetes +[5]: https://linux.cn/article-11749-1.html +[6]: https://linux.cn/article-8902-1.html +[7]: https://linux.cn/article-8499-1.html +[8]: https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab +[9]: https://opensource.com/article/20/5/create-simple-cloud-init-service-your-homelab +[10]: https://opensource.com/article/20/5/kubectl-cheat-sheet +[11]: https://linux.cn/article-12007-1.html +[12]: https://opensource.com/article/20/3/kubernetes-operator-sdk +[13]: https://opensource.com/article/20/6/kubernetes-nfs-client-provisioning +[14]: https://opensource.com/article/20/4/http-kubernetes-skipper +[15]: https://opensource.com/article/20/3/kubernetes-traefik diff --git a/published/202006/20200609 Style your data plots in Python with Pygal.md b/published/202006/20200609 Style your data plots in Python with Pygal.md new file mode 100644 index 0000000000..89fc30a3a1 --- /dev/null +++ b/published/202006/20200609 Style your data plots in Python with Pygal.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12364-1.html) +[#]: subject: (Style your data plots in Python with Pygal) +[#]: via: (https://opensource.com/article/20/6/pygal-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Pygal 在 Python 中设置数据图的样式 +====== + +> 介绍一种更时尚的 Python 绘图库。 + +![](https://img.linux.net.cn/data/attachment/album/202006/30/120650hlf8lm0em3l1m8zd.jpg) + +[Python][2] 有很多可以将数据可视化的库。其中一个互动性较强的库是 Pygal,我认为这个库适合喜欢漂亮事物的人。它可以生成用户可以与之交互的漂亮的 SVG(可缩放矢量图形)文件。SVG 是交互式图形的标准格式,仅使用几行 Python 就可以带来丰富的用户体验。 + +### 使用 Pygal 进行时尚的 Python 绘图 + +在本文中,我们要重新创建多柱状图,用来表示 1966 年至 2020 年英国大选的结果: + +![Pygal plot][3] + +在继续之前,请注意你可能需要调整 Python 环境以使此代码运行,包括: + + * 运行最新版本的 Python([Linux][4]、[Mac][5] 和 [Windows][6] 的说明) + * 确认你运行的是与这些库兼容的 Python 版本 + +数据可在线获得,并可使用 pandas 导入: + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们可以继续进行了。。数据如下所示: + +``` +        year  conservative  labour  liberal  others +0       1966           253     364       12       1 +1       1970           330     287        6       7 +2   Feb 1974           297     301       14      18 +..       ...           ...     ...      ...     ... +12      2015           330     232        8      80 +13      2017           317     262       12      59 +14      2019           365     202       11      72 +``` + +在 Pygal 中进行绘制会以一种易于阅读的方式显示。首先,我们以一种简化柱状图定义的方式定义样式对象。然后我们将自定义样式以及其他元数据传递给 `Bar` 对象: + +``` +import pygal +from pygal.style import Style + +custom_style = Style( + colors=('#0343df', '#e50000', '#ffff14', '#929591'), + font_family='Roboto,Helvetica,Arial,sans-serif', + background='transparent', + label_font_size=14, +) + +c = pygal.Bar( + title="UK Election Results", + style=custom_style, + y_title='Seats', + width=1200, + x_label_rotation=270, +) +``` + +然后,我们将数据添加到 `Bar` 对象中: + +``` +c.add('Conservative', df['conservative']) +c.add('Labour', df['labour']) +c.add('Liberal', df['liberal']) +c.add('Others', df['others']) + +c.x_labels = df['year'] +``` + +最后,我们将图另存为 SVG 文件: + +``` +c.render_to_file('pygal.svg') +``` + +结果是一个交互式 SVG 图,你可以在此 gif 中看到: + +![The Python pygal library can generate rich SVG files as seen here][7] + +精美简单,并且效果漂亮。 + +### 总结 + +Python 中的某些绘图工具需要非常详细地构建每个对象,而 Pygal 从一开始就为你提供这些。如果你手边有数据并且想做一个干净、漂亮、简单的交互式图表,请尝试一下 Pygal。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/pygal-python + +作者:[Shaun Taylor-Morgan][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) +[2]: https://opensource.com/article/20/4/plot-data-python +[3]: https://opensource.com/sites/default/files/uploads/pygal_1.png (Pygal plot) +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: https://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/sites/default/files/uploads/pygal-interactive_3.gif (The Python pygal library can generate rich SVG files as seen here) +[8]: https://anvil.works/blog/plotting-in-pygal diff --git a/published/202006/20200610 5 ways to examine the content of files on Linux.md b/published/202006/20200610 5 ways to examine the content of files on Linux.md new file mode 100644 index 0000000000..90f1db340d --- /dev/null +++ b/published/202006/20200610 5 ways to examine the content of files on Linux.md @@ -0,0 +1,241 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12340-1.html) +[#]: subject: (5 ways to examine the content of files on Linux) +[#]: via: (https://www.networkworld.com/article/3561490/5-ways-to-examine-the-content-of-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上查看文件内容的 5 种方法 +====== + +> 如何使用 cat、more、head 和 tail 命令查看 Linux 文件的内容,而不仅仅是文本文件。 + +![](https://img.linux.net.cn/data/attachment/album/202006/23/121047zz9gwx9dwz155m2w.jpg) + +Linux 提供了许多命令来查看文件的内容,包 括 `cat`、`more`、`head` 和 `tail`,但这只是一个开始。 + +一方面,即使是最显而易见的命令也有很多许多用户不会去使用的选项。还有一些普普通通的命令提供了一些独特的功能。在本文中,我们将介绍查看文件内容的命令,以及如何定制这些视图以更好地满足你的需求的选项。 + +### cat + +`cat` 命令将文本文件的全部内容发送到终端窗口以供查看。实际上,如果你输入 `cat`,然后输入包含数千行内容的文件名,那么这些行将以极快的速度在你的窗口中滚动,你将无法看到除了最后一屏外的其他文本。对于 Linux 用户来说 `cat` 命令很熟悉,但即使是这个基本命令也提供了许多有用的选项,例如对输出中的行进行编号,这是我们许多人可能从未使用过的。更进一步,你不仅可以对行进行编号,还可以选择如何编号。 + +对每行进行编号就像这样: + +``` +$ cat -n msg + 1 Hello -- + 2 + 3 I hope you are having a wonderful day! + 4 + 5 + 6 That's it for ... now + 7 + 8 bye! + 9 + 10 s. +``` + +你也可以只对有内容的行编号。请注意,对于此命令,仅包含空格的行不被视为“空”,而是会被编号。 + +``` +$ cat -b msg + 1 Hello -- + + 2 I hope you are having a wonderful day! + + + 3 That's it for ... now + + 4 bye! + + 5 s. +``` + +`cat` 命令允许你使用 `-s` 选项忽略重复的空白行,但是要完全忽略空白行你必须添加另一个命令。 + +``` +$ cat -s msg +Hello -- + +I hope you are having a wonderful day! + +That's it for ... now + +bye! + +s. +``` + +要忽略所有空白行,只需如下将 `cat` 的输出通过管道传递给 `grep` 命令。 点(`.`)匹配包含任意字符的文本,因此它将显示任意非空的行,用于结束一行的回车换行做匹配(LCTT 译注:此处原文有误,径改)。 + +``` +$ cat msg | grep . +Hello -- +I hope you are having a wonderful day! +That's it for ... now +bye! +s. +``` + +`-E` 选项通过在每行末尾加 `$` 符提供视觉提示,来显示行尾是否还有多余的空格。 + +``` +$ cat -E msg +Hello --$ +$ +I hope you are having a wonderful day! $ +$ +$ +That's it for ... now$ +$ +bye!$ +$ +s.$ +``` + +使用 `-A` 时,既可以在每行的末尾显示 `$` 字符,并且制表符会显示为 `^I` 而不是空白。 + +``` +$ cat -A msg +Hello --$ +$ +I hope you are having a wonderful day!$ +$ +$ +That’s it for ...^Inow$ +$ +bye!$ +$ +s.$ +``` + +### 使用 head 和 tail 显示文件部分内容 + +`head` 和 `tail` 显示文件的头部或尾部,默认为十行。 你可以使用 `-3`(显示 3 行)或 `-11`(显示 11 行)之类的字符串来指定要查看的其它行数。`tail` 命令与 `head` 的工作方式相同,但是显示文件的尾部而不是头部。 + +``` +$ head -3 msg +Hello -- +I hope you are having a wonderful day! +$ tail -3 msg +bye! + +s. +``` + +你还可以结合使用 `head` 和 `tail` 命令来查看文件中间的文本。你只需要选择起点和想要查看行数即可。在此例中,命令将在文件中显示第二个一百行,并在 `cat` 的帮助下为这些行编号。 + +``` +$ cat -b mybigfile | head -200 | tail -100 + 101 Invoice #2020-06-07a sent to vendor + ... +``` + +### 使用 more 或者 less 浏览一屏文本 + +`more` 命令是一次浏览一屏内容的自然之选,而 `less` 通过使用上下键盘箭头增加了在文件中上下移动的能力,这样你就可以遍历内容,然后在文件中回退。 + +### 使用 od 查看文本的两种方法 + +`od`(八进制转储)命令能够以常规文本和一系列 ASCII 值(即该文本在文件中的实际编码方式)的形式查看文件。在下面的例子中可以看到,带编号的行显示了 ASCII 数字值,而其他行则显示了文本和不可打印的字符。 + +``` +$ od -bc msg +0000000 110 145 154 154 157 040 055 055 012 012 111 040 150 157 160 145 + H e l l o - - \n \n I h o p e +0000020 040 171 157 165 040 141 162 145 040 150 141 166 151 156 147 040 + y o u a r e h a v i n g +0000040 141 040 167 157 156 144 145 162 146 165 154 040 144 141 171 041 + a w o n d e r f u l d a y ! +0000060 012 012 012 124 150 141 164 047 163 040 151 164 040 146 157 162 + \n \n \n T h a t ' s i t f o r +0000100 040 056 056 056 011 156 157 167 012 012 142 171 145 041 012 012 + . . . \t n o w \n \n b y e ! \n \n +0000120 163 056 012 + s . \n +``` + +请注意,换行符显示为 `\n`(八进制 `012`),而制表符显示为 `\t`(八进制 `011`)。 + +`od` 命令特别有用的用途之一是查看非文本文件以获取可以标识文件类型的信息。在这里,我们看到 `JFIF`(JPEG 文件交换格式)标签,该标签让 `file` 之类报告文件类型的命令将它标示为 jpg 文件。这里还有很多其他有用的信息,特别是如果你对这些文件的格式感到好奇的话。 + +在接下来的命令中,我们查看 jpg 文件的开始部分。 + +``` +$ od -bc arrow.jpg | head -12 +0000000 377 330 377 340 000 020 112 106 111 106 000 001 001 000 000 001 + 377 330 377 340 \0 020 J F I F \0 001 001 \0 \0 001 +0000020 000 001 000 000 377 333 000 103 000 003 002 002 002 002 002 003 + \0 001 \0 \0 377 333 \0 C \0 003 002 002 002 002 002 003 +0000040 002 002 002 003 003 003 003 004 006 004 004 004 004 004 010 006 + 002 002 002 003 003 003 003 004 006 004 004 004 004 004 \b 006 +0000060 006 005 006 011 010 012 012 011 010 011 011 012 014 017 014 012 + 006 005 006 \t \b \n \n \t \b \t \t \n \f 017 \f \n +0000100 013 016 013 011 011 015 021 015 016 017 020 020 021 020 012 014 + \v 016 \v \t \t \r 021 \r 016 017 020 020 021 020 \n \f +0000120 022 023 022 020 023 017 020 020 020 377 333 000 103 001 003 003 + 022 023 022 020 023 017 020 020 020 377 333 \0 C 001 003 003 +``` + +如果我们要 `file` 命令提供有关此图像的信息,我们可能会看到类似下面这样的信息。`file` 命令从文件开头的数据中提取了所有这些描述性信息: + +``` +$ file arrow.jpg +arrow.png: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 500x375, components 3 +``` + +### 使用 jp2a 将文件视为基于文本的图像 + +如果你只能在命令行工作,并且想了解特定图像包含的内容,那么可以使用 `jp2a`(jpeg to ascii)之类的工具提供字符渲染。图像在这种格式下的识别程度取决于文件。不要有太多期待,因为你将看到的图像版本是“低分辨率”下的测试!这是一只分辨率很低的帝王企鹅。(请离远点看) + +``` +$ jp2a Emperor_Penguin.jpg +MMMMMMMMWOdkNMMMMMMMMMMMMMMMMMMM +MMMXK0kc.... ,OKMMMMMMMMMMMMMMMM +MMNK0Ol... :Xx'dNMMMMMMMMMMMMM +MMMMMMMd;lx00Oo. ..xMMMMMMMMMMMM +MMMMMMK.OXMMMMMN,...lMMMMMMMMMMM +MMMMMMx'KXNNMMMMK....0MMMMMMMMMM +MMMMMMx:kkKNWWMMMl.. 'NMMMMMMMMM +MMMMMMddx0NNNWMMMK'...;NMMMMMMMM +MMMMMMck0NNWWWWWMMd ..lMMMMMMMM +MMMMMM.d0KXNWWWWMMo ...WMMMMMMM +MMMMMM.xOXNNWNMMMW. ....KMMMMMMM +MMMMMM'kKNKWXWMMMK ..'.0MMMMMMM +MMMMMMxckXNNNNMMMX .:..XMMMMMMM +MMMMMMW;xKNWWWMMMM. .;. NMMMMMMM +MMMMMMMok0NNWNWMMMx .l..MMMMMMMM +MMMMMMMkxOKXWXNMMMMl.:'dMMMMMMMM +MMMMMMM0dKOdKXXNMMMMNx,WMMMMMMMM +MMMMMMMWoKxldXKNNMMMMM;MMMMMMMMM +MMMMMMMMxxxxdNWNXNMMMM;MMMMMMMMM +MMMMMMMMxOcoo0XOOOOWMW,kMMMMMMMM +MMMMMMM0xK;.cO0dNX:0XXd;NMMMMMMM +MMMNkdd:,'ldXXO0xl;x0kx:;lKMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +``` + +### 总结 + +Linux 上有很多命令可以通过各种方式查看文件的内容。其中一些选项在你需要处理文件内容时可能会非常有用。其它的只是……有趣。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3561490/5-ways-to-examine-the-content-of-files-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/q65bNe9fW-w +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202006/20200610 How to Change Folder Color in Ubuntu 20.04.md b/published/202006/20200610 How to Change Folder Color in Ubuntu 20.04.md new file mode 100644 index 0000000000..42f0043ab2 --- /dev/null +++ b/published/202006/20200610 How to Change Folder Color in Ubuntu 20.04.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12311-1.html) +[#]: subject: (How to Change Folder Color in Ubuntu 20.04) +[#]: via: (https://itsfoss.com/folder-color-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 20.04 中更改文件夹颜色 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/13/133146y1bjzb73jj141143.jpg) + +[Ubuntu 20.04][1] 中默认的 Yaru 主题赋予它优美、现代的外观。默认 Yaru 主题中的文件夹是紫色的外观,以与 Ubuntu 的品牌保持一致。 + +如果你不喜欢紫色,可以在 Ubuntu 中自由更改颜色主题。你可以更改 Ubuntu 的主题以使其有不同的颜色,但这将意味着放弃 Yaru 主题。 + +如果你只想在 Ubuntu 20.04 中更改文件夹的颜色,可以有两种方法: + +* 为选定的文件夹赋予不同的颜色和标志(以便更好地组织文件和文件夹) +* 通过更改 Yaru 颜色主题来更改所有文件夹的颜色 + +让我向你展示两种方法。 + +### 更改所选文件和文件夹的颜色和标志 + +![][2] + +我知道有些人将他们的文件夹使用不同的颜色或放在不同的位置,来表示工作正在进行中还是待处理或已完成。 + +如果你也是这样的,那么可以使用 [Folder Color 工具][3]更改文件夹的颜色。你还可以在文件夹中添加标志(绿色的勾号表示完成,加号表示新的,感叹号表示重要等)。你可以在上一张图片中看到一些例子。 + +你还可以在文件上使用 “Folder Color” 工具。你不能更改文件图标的颜色,但可以添加标志。 + +如果你在 Ubuntu 20.04 中[使用 Yaru 主题][4],你可以使用[官方 PPA][5]: + +``` +sudo add-apt-repository ppa:costales/yaru-colors-folder-color +``` + +现在,使用 Yaru 兼容包安装 Folder Color。 + +``` +sudo apt install folder-color yaru-colors-folder-color +``` + +安装后,你必须使用 `nautilus -q` 命令重启 Nautilus 文件管理器。之后,你可以进入文件管理器,右键单击文件夹或文件。你会在上下文菜单中看到 Folder Color 的选项。你将在此处看到颜色和标志选项。 + +![][6] + +你还可以通过在菜单**通过选择“默认”恢复原始文件夹颜色**。 + +对于 Ubuntu 18.04 或更早版本,可以从软件中心安装 Folder Color。它还可用于 Linux Mint/Cinnamon 桌面的 Nemo 文件管理器和 MATE 桌面的 [Caja 文件管理器][7]。 + +#### 如何删除 Folder Color? + +如果你不想使用 Folder Color,你可以删除应用并删除 PPA。首先删除该应用: + +``` +sudo apt remove folder-color yaru-colors-folder-color +``` + +现在[删除 PPA][8]: + +``` +sudo add-apt-repository -r ppa:costales/yaru-colors-folder-color +``` + +### Yaru Colors 主题包更改 Yaru 主题颜色 + +![Yaru Colors Blue Theme Variant][9] + +如果你想继续使用 Yaru 主题但使用不同的颜色,那么需要[Yaru Colors 主题包][10]。 + +Yaru Colors 由 12 种 Yaru 颜色变体组成。它们浅绿色、蓝色、棕色、深蓝色、绿色、灰色、MATE 绿、橙色、粉红色、紫色、红色和黄色。 + +主题包括 GTK 主题、图标、光标和 GNOME Shell 主题。 + + * 图标:更改文件夹的强调色 + * GTK 主题:更改应用窗口的强调色 + * 光标主题:向光标添加几乎可以忽略的色彩轮廓 + * GNOME Shell 主题:更改消息托盘和系统托盘中的强调色 + +你可以从它的 GitHub 仓库下载 Yaru Colors 主题包: + +#### 下载 Yaru Colors 主题包 + +在提取内容时,你会发现图标、主题文件夹,这两个文件夹都包含上述十二种颜色。你可以分别在 `~/.local/share/.icons` 和 `~/.local/share/themes` 文件夹中复制图标和主题文件夹。 + +如果你不想亲自复制,那么你可以在解压文件夹中找到 `install.sh` 脚本。你可以运行它来通过交互式终端会话安装全部或选定的几个主题。 + +![][11] + +要更改 GNOME Shell 主题,你必须[使用 GNOME Tweak 工具][12]。你也可以使用 GNOME Tweak 将图标和主题更改回默认。 + +![][13] + +享受为你的 Ubuntu 生活增色 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/folder-color-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/download-ubuntu-20-04/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/folder-colors-yaru-ubuntu.png?ssl=1 +[3]: https://foldercolor.tuxfamily.org/ +[4]: https://itsfoss.com/ubuntu-community-theme/ +[5]: https://launchpad.net/folder-color +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/change-folder-color-ubuntu.png?ssl=1 +[7]: https://github.com/mate-desktop/caja +[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/yaru-colors-blue-theme-variant.jpg?ssl=1 +[10]: https://github.com/Jannomag/Yaru-Colors +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/yaru-colors-theme-install.png?resize=800%2C513&ssl=1 +[12]: https://itsfoss.com/gnome-tweak-tool/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/restore-yaru-gnome-tweak.png?resize=800%2C557&ssl=1 diff --git a/published/202006/20200610 How to write functions in Bash.md b/published/202006/20200610 How to write functions in Bash.md new file mode 100644 index 0000000000..1df7f0efc2 --- /dev/null +++ b/published/202006/20200610 How to write functions in Bash.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12323-1.html) +[#]: subject: (How to write functions in Bash) +[#]: via: (https://opensource.com/article/20/6/bash-functions) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Bash 中编写函数 +====== + +> 通过编写函数来减少代码的冗余和维护。 + +![](https://img.linux.net.cn/data/attachment/album/202006/17/125913hf1efce5c48cebrc.jpg) + +在编程时,实际上是在定义要由计算机执行的过程procedure例程routine。一个简单的类比是将计算机编程与烤面包进行比较:你一次列出了要组建工作环境的配料,然后列出了烤面包所必须采取的步骤。在编程和烘烤中,必须以不同的间隔重复执行某些步骤。例如,在烤面包中,这可能是酵母培养的过程: + +``` +STIR=100 +SNOOZE=86400 + +function feed_culture { +  remove_from(pantry) +  add(flour, water) +  stir($STIR) +  sleep($SNOOZE) +} +``` + +然后,揉面和醒发面团: + +``` +KNEAD=600 +SNOOZE=7200 + +function process_dough { +  remove_from(proofing_drawer) +  knead($KNEAD) +  return_to_drawer($SNOOZE) +} +``` + +在编程中,这些子例程subroutines可以表示为函数function。函数对程序员很重要,因为它们有助于减少代码中的冗余,从而减少了所需的维护量。例如,在以编程方式烤制面包的假想场景中,如果你需要更改面团醒发的用时,只要你之前使用函数,那么你只需更改一次用时,或使用变量(在示例代码中为 `SNOOZE`)或直接在处理面团的子程序中更改用时。这样可以节省你很多时间,因为你不必通过你的代码库遍历每个可能正在醒发的面团,更不用说担心错过一个。许多 bug 是由未更改的缺失的值或执行不正确的 `sed` 命令引起的,它们希望捕获所有可能而不必手动寻找。 + +在 [Bash][2] 中,无论是在编写的脚本或在独立的文件中,定义函数和使用它们一样简单。如果将函数保存到独立的文件中。那么可以将它 `source` 到脚本中,就像 `include` C 语言或 C++ 中的库或将模块 `import` 到 Python 中一样。要创建一个 Bash 函数,请使用关键字 `function`: + +``` +function foo { +# code here +} +``` + +这是一个如何在函数中使用参数的例子(有些人为设计,因此可能会更简单): + +``` +#!/usr/bin/env bash +ARG=$1 + +function mimic { +  if [[ -z $ARG ]]; then +    ARG='world' +  fi +  echo "hello $ARG" +} + +mimic $ARG +``` + +结果如下: + +``` +$ ./mimic +hello world +$ ./mimic everybody +hello everybody +``` + +请注意脚本的最后一行,它会执行该函数。对于编写脚本的新手来说,这是一个普遍的困惑点:函数不会自动执行。它们作为*潜在的*例程存在,直到被调用。 + +如果没有调用该函数,那么函数只是被定义,并且永远不会运行。 + +如果你刚接触 Bash,请尝试在包含最后一行的情况下执行示例脚本一次,然后在注释掉最后一行的情况下再次执行示例脚本。 + +### 使用函数 + +即使对于简单的脚本,函数也是很重要的编程概念。你越适应函数,在面对一个不仅需要声明性的命令行,还需要更多动态的复杂问题时,你就会越容易。将通用函数保存在单独的文件中还可以节省一些工作,因为它将帮助你建立常用的程序,以便你可以在项目间重用它们。看看你的脚本习惯,看是否适合使用函数。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-functions + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/resources/what-bash diff --git a/published/202006/20200611 How I stream video with OBS and WebSockets.md b/published/202006/20200611 How I stream video with OBS and WebSockets.md new file mode 100644 index 0000000000..56e391979e --- /dev/null +++ b/published/202006/20200611 How I stream video with OBS and WebSockets.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12347-1.html) +[#]: subject: (How I stream video with OBS and WebSockets) +[#]: via: (https://opensource.com/article/20/6/obs-websockets-streaming) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +如何用 OBS 和 WebSockets 播放视频流 +====== + +> 用这些简化了 WebSockets 的开源支持工具来控制你的流媒体。 + +![](https://img.linux.net.cn/data/attachment/album/202006/25/105128sdod30qqu4z5oooo.jpg) + +[OBS][2] 是现在视频直播的主流之一。它是直播流媒体到 Twitch 的首选软件,Twitch 是近来最受欢迎的视频直播网站之一。有一些非常好的附加组件,可以让流媒体人从他们的手机或另一个屏幕上进行控制,而不影响正在运行的视频。事实证明,使用 [Node-RED][3] 和 [obs-websockets][4] 插件来构建自己的控制面板真的很容易。 + +![My OBS Control Dashboard][5] + +*我的 OBS 控制仪表盘* + +我知道你们很多人在想什么 —— “他在同一句话中提到了 WebSockets 和简单?”很多人在设置和使用 WebSockets 时遇到了困难,WebSockets 允许通过 Web 服务器的单一连接进行双向通信。Node-RED 内置了对 WebSockets 的支持,是让这一切变得简单的原因之一,至少与编写自己的客户端/服务器相比是如此。 + +在开始之前,请确保你已经安装和配置了 OBS。首先下载并安装[最新稳定版的 obs-websockets][6]插件。对于本文来说,默认的设置就可以了,但我强烈建议你之后按照说明来保护 obs-websockets 的安全。 + +接下来,[下载并安装 Node-RED][7],可以在同一个系统上,也可以在不同的系统上(比如树莓派)。同样,默认的安装对我们这篇文章来说是够了,但最好按照他们网站上的指示进行安全安装。 + +现在是有趣的部分。启动 Node-RED,打开网页界面(默认在 ),你有了一个空白的画布。打开右边的“汉堡”菜单,选择“管理口味Manage Palate”。然后点击“安装”标签,搜索 `node-red-contrib-dashboard` 和 `node-red-contrib-rbe` 模块。 + +安装好这些模块后,点击右侧列表,将以下模块拖拽到画布上。 + + * 1 Websocket Out + * 1 Websocket In + * 1 Debug + * 1 Inject + * 1 Switch + * 1 Change + * 2 JSON + * 1 Catch + +以下列顺序连接它们: + +``` +Inject->Button->Change->JSON->Websocket Out + +Websocket In->JSON->Switch->RBE->Debug + +Catch->Debug +``` + +![The basic flows][8] + +*基本流程* + +当 “Button” 被按下时(或 “Inject” 节点发送一个时间戳),有效载荷通过 “change” 节点发送,从 JSON 对象转换为字符串,然后发送到 “WebSocket Out” 节点。当 “WebSocket In” 节点收到消息后,会将其转换为 JSON 对象,如果不是重复的,则发送到 “Debug” 节点进行输出。而 “Catch” 节点会捕捉到任何错误,并将其放入 “Debug” 面板中。 + +那有效载荷里有什么呢?让我们设置好一切,一探究竟。 + +首先,双击 “Button” 打开设置对话框。先使用下拉菜单将有效载荷改为 “JSON”。在该字段中,添加以下内容: + +``` +{"request-type":"GetVersion"} +``` + +启用 “If msg arrives on input, emulate a button click” 复选框,然后点击 “Done” 关闭 “Button” 配置。当消息从 “Inject” 节点传来时,或者 UI 中的 “Button” 被按下,它将把 JSON 有效载荷发送到下一个节点。 + +![Setting up the button][9] + +*设置 “Button”* + +现在打开 “Change” 节点。我们要将 `msg.payload.message-id` 设置为 `msg._msgid`,方法是将第一个字段从 `payload` 改为 `payload.message-id`,然后使用第二个字段的下拉菜单将类型从 `String` 改为 `msg.`,然后我们将 `_msgid` 放入该字段。这样就会把唯一的消息 ID 复制到 JSON 对象的有效载荷中,这样每个请求就有一个唯一的 ID 进行跟踪。 + +然后将其发送到 “JSON” 节点,以便将 JSON 对象转换为字符串,然后传递给 “Websocket Out” 节点。打开 “Websocket Out” 节点,配置到 OBS 的连接。首先,将 `Type` 更改为 `Connect to`,然后单击铅笔图标以创建新的连接 URL。将其设置为 `ws://OBSMachine:4444/`,然后关闭对话框进行保存。`OBSMachine` 是 OBS 和 obs-websocket 运行的机器名称。例如,如果 Node-RED 运行在同一台机器上,则为 `ws://localhost:4444`,如果是在名为 `luxuria.local` 的机器上,则为 `ws://luxuria.local:4444`。关闭并更新 “Websocket Out” 节点。这将向 OBS 中的 WebSocket 发送有效载荷文本字符串。 + +![Websocket Out Node configuration][10] + +*“Websocket Out” 节点配置* + +进入 “WebSocket In” 流程!打开 “WebSocket In” 节点,并对其设置 `Type` 为 `Connect to` 和我们之前定义的连接的 URL(应自动填充)。接下来是第二个 “JSON” 节点,我们可以不用管它。它接受 OBS 的输出,并将其转换为有效载荷对象。 + +接下来,我们将从中过滤出常规的心跳和状态更新。打开 “Switch”,将 `Property` 值设置为 `payload["update-type"]`。现在从它下面的下拉菜单中选择 `Is Not Null`。点击 `+` 添加第二个选项,并从下拉菜单中选择 `otherwise`。 + +![Switch Node configuration][11] + +*“Switch” 节点配置* + +将 “Switch” 上的新输出直接连接到 “Debug” 节点的输入。 + +RBE 节点将过滤掉重复的内容,需要告诉它要观察什么字段。由于它应该连接到 “Switch” 的输出,而它只发送状态更新,所以这一点很重要,因为 obs-websocket 每隔几秒钟就会发送更新。默认情况下,RBE 会比较整个有效载荷对象,它将不断变化。打开 RBE 节点,将 `Property` 从 `payload` 改为 `payload.streaming`。如果 `payload` 的 `streaming` 值发生了变化,那么就把消息传递过去,否则就丢弃。 + +最后一步是将 “Debug” 节点的输出从 `msg.payload` 改为完整的 `msg` 对象。这使我们能够看到整个对象,有时在 `payload` 之外还有有用的信息。 + +现在,单击 “Deploy” 以激活更改。希望 WebSocket 节点下面会有绿色的 `Connected` 消息。如果它们是红色或黄色的,则连接 URL 可能不正确,需要更新,或者连接被阻止。请确保远程机器上的 4444 端口是开放的、可用的,并且 OBS 正在运行! + +如果没有 RBE 节点对 `streaming` 值的过滤,调试面板(点击画布右侧的“虫子”图标)大约现在就会被心跳消息填满。点击 “Inject” 节点左边的按钮,发送一个模拟按钮点击的信号。如果一切顺利,你应该会看到一个对象到达,它有一个 `obs-websocket` 可以做的所有事情的列表。 + +![The response to "GetVersion"][12] + +*对 “GetVersion” 的回应* + +现在在另一个标签或窗口中打开 `http://localhost:1880/ui`。它应该显示一个单一的按钮。按下它! 调试面板应该会显示和之前一样的信息。 + +恭喜你!你已经发送了你的第一个(希望不是最后一个)WebSocket 消息! + +这只是使用 obs-websockets 和 Node-RED 可以做的事情的起步。支持的完整文档记录在 obs-websockets 的 GitHub 仓库的 `protocol.md` 文件中。通过一点点的实验,你可以创建一个功能齐全的控制面板来启动和停止流媒体、改变场景,以及更多。如果你和我一样,在意识到之前,你就可以设置好各种控件了。 + +![OBS Websocket][13] + +*如此多的能力让我有点疯* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/obs-websockets-streaming + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_film.png?itok=aElrLLrw (An old-fashioned video camera) +[2]: https://obsproject.com/ +[3]: https://nodered.org/ +[4]: https://github.com/Palakis/obs-websocket +[5]: https://opensource.com/sites/default/files/uploads/obscontrol-img1.png.jpg (My OBS Control Dashboard) +[6]: https://github.com/palakis/obs-websocket/releases +[7]: https://nodered.org/docs/getting-started/ +[8]: https://opensource.com/sites/default/files/uploads/obscontrol-img2.png.jpg (The basic flows) +[9]: https://opensource.com/sites/default/files/uploads/obscontrol-img3.png.jpg (Setting up the button) +[10]: https://opensource.com/sites/default/files/uploads/obscontrol-img4.png.jpg (Websocket Out Node configuration) +[11]: https://opensource.com/sites/default/files/uploads/obscontrol-img5.png.jpg (Switch Node configuration) +[12]: https://opensource.com/sites/default/files/uploads/obscontrol-img6.png.jpg (The response to "GetVersion") +[13]: https://opensource.com/sites/default/files/uploads/obscontrol-img7.png.jpg (OBS Websocket) diff --git a/published/202006/20200612 Import functions and variables into Bash with the source command.md b/published/202006/20200612 Import functions and variables into Bash with the source command.md new file mode 100644 index 0000000000..f8dc02f78e --- /dev/null +++ b/published/202006/20200612 Import functions and variables into Bash with the source command.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12346-1.html) +[#]: subject: (Import functions and variables into Bash with the source command) +[#]: via: (https://opensource.com/article/20/6/bash-source-command) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 source 命令将函数和变量导入 Bash +====== + +> source 就像 Python 的 import 或者 Java 的 include。学习它来扩展你的 Bash 能力。 + +![](https://img.linux.net.cn/data/attachment/album/202006/24/235417tbzjpdbpbzkbjeul.jpg) + +登录 Linux shell 时,你将继承特定的工作环境。对于 shell 而言,“环境environment”意味着已经为你设置了某些变量,以确保你的命令可以按预期工作。例如,[PATH][2] 环境变量定义 shell 从哪里查找命令。没有它,几乎在 Bash 中尝试执行的所有操作都会因“命令未发现” 错误而失败。在执行日常任务时,环境对你几乎是不可见的,但它很重要。 + +有多种方法可以影响你的 shell 环境。你可以在配置文件中进行修改,例如 `~/.bashrc` 和 `~/.profile`,你可以在启动时运行服务,还可以创建自己的自定义命令或编写自己的 [Bash 函数][3] 。 + +### 通过 source 添加到你的环境 + +Bash(以及其他一些 shell)有一个称为 `source` 的内置命令。这就是令人困惑的地方:`source` 执行与命令 `.` 相同的功能(是的,那只是一个点),而与 `Tcl` 命令的 `source` 不是同一个(如果你输入 `man source`,也许在屏幕上显示的是它)。实际上,内置的 `source` 命令根本不在你的 `PATH` 中。这是 Bash 附带的命令,要获取有关它的更多信息,可以输入 `help source`。 + +`.` 命令兼容 [POSIX][4]。 但 `source` 命令不是 POSIX 定义的,但可以与 `.` 命令互换使用。 + +根据 Bash `help`,`source` 命令在你当前的 shell 中执行一个文件。 “在你当前的 shell 中” 这句很重要,因为它表示它不会启动子 shell。因此,用 `source` 执行的任何操作都发生在内部并影响*当前*环境。 + +在探讨 `source` 对环境的影响之前,请用 `source` 命令导入一个测试文件,以确保其按预期执行代码。首先,创建一个简单的 Bash 脚本并将其保存为 `hello.sh`: + +``` +#!/usr/bin/env bash +echo "hello world" +``` + +使用 `source`,即使该脚本不设置可执行也可以运行: + +``` +$ source hello.sh +hello world +``` + +你也可以使用内置的 `.` 命令获得相同的结果: + +``` +$ . hello.sh +hello world +``` + +`source` 和 `.` 命令成功地执行了测试文件的内容。 + +### 设置变量和导入函数 + + 你可以使用 `source` 将文件 “导入” 到 shell 环境中,就像你可以在 C 或 C++ 中使用 `include` 关键字引用一个库,或者在 Python 中使用 `import` 关键字引入一个模块一样。这是 `source` 的最常见用法之一,它也是 `.bashrc` 中的一个默认包含方式,通过 `source` 导入 `.bash_aliases`,以便将任何你自定义的别名在登录时导入到你的环境。 + +这是导入 Bash 函数的示例。首先,在名为 `myfunctions` 的文件中创建一个函数。它将打印你的公共 IP 地址和本地 IP 地址: + +``` +function myip() { +        curl       + +        ip addr | grep inet$IP | \ +        cut -d"/" -f 1 | \ +        grep -v 127\\.0 | \ +        grep -v \:\:1 | \ +        awk '{$1=$1};1' +} +``` + +将该函数导入你的 shell: + +``` +$ source myfunctions +``` + +测试新函数: + +``` +$ myip +93.184.216.34 +inet 192.168.0.23 +inet6 fbd4:e85f:49c:2121:ce12:ef79:0e77:59d1 +inet 10.8.42.38 +``` + +### source 的搜索 + +当你在 Bash 中使用 `source` 时,它将在当前目录中搜索你引用的文件。但并非所有 shell 都这样,因此,如果你不使用 Bash,请查看文档。 + +如果 Bash 找不到要执行的文件,它将搜索你的 `PATH`。同样,这并不是所有 shell 的默认设置,因此,如果你不使用 Bash,请查看文档。 + +这些都是 Bash 中不错的便利功能。这种出奇地强大,因为它允许你将常用函数保存在磁盘上的一个集中的位置,然后将你的环境视为集成开发环境 (IDE)。你不必担心函数的存储位置,因为你知道它们在你的本地位置等同于在 `/usr/include` 下,因此无论你在哪,当你导入它们时,Bash 都可以找到它们。 + +例如,你可以创建一个名为 `~/.local/include` 的目录作为常见函数存储区,然后将此代码块放入 `.bashrc` 文件中: + +``` +for i in $HOME/.local/include/*; +  do source $i +done +``` + +这会将 `~/.local/include` 中所有包含自定义函数的文件“导入”到 shell 环境中。 + +当你使用 `source` 或 `.` 命令时,Bash 是唯一搜索当前目录和 `PATH` 的 shell。 + +### 将 source 用于开源 + +使用 `source` 或 `.` 来执行文件是影响环境同时保持变更模块化的一种便捷方法。在下次考虑将大量代码复制并粘贴到 `.bashrc` 文件中时,请考虑将相关函数或别名组放入专用文件中,然后使用 `source` 导入它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-source-command + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/17/6/set-path-linux +[3]: https://opensource.com/article/20/6/how-write-functions-bash +[4]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains diff --git a/published/202006/20200615 How to use Bash history commands.md b/published/202006/20200615 How to use Bash history commands.md new file mode 100644 index 0000000000..f410a9ff13 --- /dev/null +++ b/published/202006/20200615 How to use Bash history commands.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12344-1.html) +[#]: subject: (How to use Bash history commands) +[#]: via: (https://opensource.com/article/20/6/bash-history-commands) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何使用 Bash history 命令 +====== + +> Bash 的 history 命令在它提供的功能数量上超过了所有其他 Linux Shell 历史接口。 + +![](https://img.linux.net.cn/data/attachment/album/202006/24/101620c0uj0dgg0buo9nib.jpg) + +Bash 有丰富的历史。也就是说,它是一个古老的的 shell,还有一个更古老的 Shell (Bourne shell)的前辈,但是它还有一个很棒的 `history` 命令,它提供的功能数量超过了所有其他 shell 的历史接口。 [Bash][2] 版本的 `history` 可进行反向搜索、快速调用、重写历史记录等。 + +`history` 命令与许多其他命令不同。你可能习惯于将命令作为可执行文件放在常见的系统级位置,例如 `/usr/bin`、`/usr/local/bin` 或者 `~/bin`。 内置的 `history` 命令不在你的 `PATH` 中并且没有物理位置: + + +``` +$ which history + +which: no history in [PATH] +``` + +相反,`history` 是 shell 本身的内置函数: + +``` +$ type history +history is a shell builtin +$ help history +history: history [-c] [-d offset] [n] or +history -anrw [filename] or +history -ps arg [arg...] + +Display or manipulate the history list. +[...] +``` + +出于这个原因,每个 shell 中的历史功能都是独特的,因此你在 Bash 中使用的功能可能无法在 Tcsh 或 Fish 或 Dash 中使用,而在这些 shell 中使用的功能可能也无法在 Bash 中使用。在某些情况下,了解 Bash 可以做什么可能会激发其他 shell 的用户创建有趣的改造来复制 Bash 行为,并且可能会解锁你从未知道的 Bash 功能。 + +### 查看你的 Bash 历史 + +`history` 命令最基本、最频繁的用法是查看 shell 会话的历史记录: + + +``` +$ echo "hello" +hello +$ echo "world" +world +$ history +  1  echo "hello" +  2  echo "world" +  3  history +``` + +### 事件指示器 + +事件指示器Event designator按事件搜索你的历史记录。在这里,“事件”是指记录在历史中的命令,以换行符划定。换句话说,一行一个事件,以索引号来标记。 + +事件指示器大多以感叹号开头,有时也称为 “bang”(`!`)。 + +要从你的历史记录中重新运行命令,请使用感叹号,之后紧跟(之间没有空格)所需命令的索引号。例如,假设第 1 行包含命令 `echo "hello"`,你想要想再次运行它: + + +``` +$ !1 +echo "hello" +hello +``` + +你可以使用相对定位,提供基于你历史中当前位置向后的负数行号。例如,返回到历史中倒数第三个条目: + +``` +$ echo "foo" +foo +$ echo "bar" +bar +$ echo "baz" +baz +$ !-3 +echo "foo" +foo +``` + +如果只想回去一行,那么可以使用速记 `!!` 代替 `!-1`。这节省了按键时间! + +``` +$ echo "foo" +$ !! +echo "foo" +foo +``` + +### 字符串搜索 + +你也可以对条目搜索特定的字符串,反过来搜索要运行命令。要搜索以指定字符串*开始*的命令,请使用感叹号,之后紧跟(没有空格)要搜索的字符串: + +``` +$ echo "foo" +$ true +$ false +$ !echo +echo "foo" +foo +``` + +你还可以在任意位置(不仅是开头)搜索包含该字符串的命令。为此,请像之前一样使用 `!` 加上要搜索的字符串,但在字符串的两端都用问号(`?`)围绕起来。如果你知道该字符串后紧跟一个换行符,那么可以省略最后的问号(就是在按*回车*之前输入的最后字符): + +``` +$ echo "foo" +$ true +$ false +$ !?foo? +echo "foo" +foo +``` + +### 字符串替换 + +类似于在行首搜索字符串,你可以搜索字符串并用新字符串替换它,以更改命令: + +``` +$ echo "hello" +hello +$ echo "world" +world +$ ^hello^foo +echo "foo" +foo +``` + +### 让 history 有用 + +在 Bash 中,`history` 命令的功能远远超过此处介绍的内容,但这是一个很好的开始, 可以让你习惯使用你的历史记录, 而不是仅仅把它当作一个参考。经常使用 `history` 命令,并试试无需输入命令即可执行的操作。你可能会感到惊讶! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-history-commands + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://opensource.com/resources/what-bash diff --git a/published/202006/20200615 Introduction to Homebrew- the painless way to install anything on a Mac.md b/published/202006/20200615 Introduction to Homebrew- the painless way to install anything on a Mac.md new file mode 100644 index 0000000000..7253cba52c --- /dev/null +++ b/published/202006/20200615 Introduction to Homebrew- the painless way to install anything on a Mac.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12338-1.html) +[#]: subject: (Introduction to Homebrew: the painless way to install anything on a Mac) +[#]: via: (https://opensource.com/article/20/6/homebrew-mac) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + + +Homebrew :在 Mac 上无痛安装软件 +====== + +> Homebrew 软件包管理器可以让你轻松地在 Mac 上安装和更新应用程序和实用程序。 + +![](https://img.linux.net.cn/data/attachment/album/202006/22/102739xum6zqmoh6sso0n6.jpg) + +在我追求“万物自动化”的过程中,我一直坚持走在用代码来管理我的 Mac 笔记本电脑的路上。与其用鼠标或触控板手动管理我的应用程序和实用程序,我更喜欢使用软件包管理软件来安装、更新和删除不需要的软件。 + +这对 Mac 用户来说是个挑战。Mac 的操作系统 macOS 始终落后于 Linux 的一个地方就是在包管理方面。Mac 用户没有默认的软件包管理器,而 Linux 用户则有很多选择 —— 从熟悉的 `yum` 和 `apt` 到现代的 [Flatpak][2]。但 Mac 呢? + +这就是 [Homebrew][3] 的作用。Homebrew(自酿)填补了 MacOS 事实上的软件包管理器的空白(它也是 Linux 上的又一个可选的包管理器)。它为任何熟悉命令行的人提供了令人难以置信的流畅而直接的体验,如果你是新手,它是学习命令行的好方法。 + +(LCTT 译注:Homebrew 系统中采用了大量针对自酿啤酒相关的比喻,大家在使用过程中会发现这些有趣的形容。) + +如果你在 Mac 上还没有 Homebrew,你可以这样来安装: + +``` +$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +``` + +该命令将执行 Homebrew 团队提供的安装程序脚本。如果你喜欢谨慎一点,可以 `curl` 下来这个文件,审核后再手动运行。 + +``` +$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh --output homebrew_installer.sh +$ more homebrew_installer.sh # 审核该脚本,直到你觉得没问题了 +$ bash homebrew_installer.sh +``` + +### 使用“酿造”来管理你的命令行实用程序 + +Homebrew 号称它“可以安装苹果(或你的 Linux 系统)默认没有安装的必需之物”。安装是通过 `brew`(酿造)命令进行的,它使我们能够访问成千上万的命令行实用程序,但不是更复杂的应用程序。 + +对于我们这些搞技术的人来说,符合“必需之物”类别的实用工具包括显示目录结构的方便的 `tree` 命令和我用来 [管理多个 Python 版本][4] 的 `pyenv`。 + +你可以用 `search` 子命令看到 Homebrew 中所有的“秘方formula”,我用 `wc` 命令显示有多少个“秘方”。 + +``` +# -l 统计行数 +$ brew search | wc -l +    5013 +``` + +有 5000 多个“秘方”,这是一个不可思议的软件数量。所以,在搜索那个庞大的清单之前,最好先对自己想要的东西有个概念。值得庆幸的是,浏览起来很方便。“秘方”被编入并集中存储到核心库中,核心库按操作系统划分(Mac 在 [Homebrew Core][5],Linux 在 [Linux Core][6])。它们也可以通过 Homebrew API 和[网站][7]列出。 + +口碑是另一个寻找实用工具的好方法。考虑到这一点,如果你正在寻找灵感,这里有一些我的最爱: + +* `pyenv`、`rbenv` 和 `nodenv` 分别用于管理 Python、Ruby 和 Node.js 的版本 +* `imagemagick` 用于可脚本化的图像编辑 +* `pandoc` 用于可脚本化的文件转换(我经常从 .docx 切换到 .md 或 .html) +* `hub` 为 GitHub 用户提供了[更好的 Git 体验][8]。 +* `tldr` 提供了解如何使用命令行工具的例子 + +举个例子,看看 [tldr 页面][9],这是一个用户友好的替代方式,可以滚动浏览应用程序的手册页。你可以通过再次运行 `search` 来确认它是否可用: + +``` +$ brew search tldr +==> Formulae +tldr ✔ +``` + +成功了!这个对勾让你知道它是可用的。现在你可以安装它了: + +``` +$ brew install tldr +==> Downloading https://homebrew.bintray.com/bottles/tldr-1.3.0_2.catalina.bottle.tar.gz +Already downloaded: /Users/mbbroberg/Library/Caches/Homebrew/downloads/901bc14594a9283e9ab20aec942dc5a9a2befb7e96e1b0fcccb4e3257918813c--tldr-1.3.0_2.catalina.bottle.tar.gz +==> Installing tldr +==> Pouring tldr-1.3.0_2.catalina.bottle.tar.gz +🍺 /usr/local/Cellar/tldr/1.3.0_2: 6 files, 35.5KB +``` + +值得庆幸的是,Homebrew 预先构建了二进制文件,所以你不必在本地机器上从源代码构建。这样就节省了很多时间,并免除了 CPU 风扇的噪音。我对 Homebrew 赞赏的另一件事是,你可以在不完全了解其含义的情况下欣赏此功能。 + +但如果你喜欢,看看复杂的东西也是很有趣的。对 `tldr` 运行 `info` 子命令,你可以看到所有的依赖管理、源代码,甚至公共分析。 + +``` +$ brew info tldr +tldr: stable 1.3.0 (bottled), HEAD +Simplified and community-driven man pages +https://tldr.sh/ +Conflicts with: + tealdeer (because both install `tldr` binaries) +/usr/local/Cellar/tldr/1.3.0_2 (6 files, 35.5KB) * + Poured from bottle on 2020-05-20 at 15:12:12 +From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/tldr.rb +==> Dependencies +Build: pkg-config ✔ +Required: libzip ✔ +==> Options +--HEAD + Install HEAD version +==> Analytics +install: 2,811 (30 days), 7,875 (90 days), 27,105 (365 days) +install-on-request: 2,806 (30 days), 7,860 (90 days), 27,080 (365 days) +build-error: 0 (30 days) +``` + +最后,和其他优秀的软件包管理器一样,Homebrew 的 `brew uninstall` 子命令可用于快速清理和删除未使用的实用程序。 + +### 用“酒桶”管理你的应用程序 + +命令行实用程序是一匹孤狼,但完整的应用程序呢?Homebrew 保持了其标准命令的简单性,只通过其默认的 `brew` 命令行界面安装单文件应用。而应用程序不符合这种结构。它们的目录层次比较复杂,比单一的二进制要复杂得多。 + +幸运的是,Mac 上的 Homebrew 包含了一个名为 `cask`(酒桶)的子命令,用于处理更复杂的多目录结构。特别好的是,`cask` 使用了与标准 `brew` 命令类似的命令结构,所以你可以使用类似的 `search`、`install` 和 `info` 子命令: + +``` +brew search --cask | wc -l +    4772 +``` + +哇,有近 5000 个应用程序,在 [Homebrew 的网站][10]上浏览更方便。 + +我将用我新喜欢的一款应用来引导你完成 `cask`。[Meld][11](我[在 Opensource.com 上读到的][12])。这是一个功能丰富的编辑器,可以帮助管理合并冲突。在它的网站上有下载的链接,我可以运行安装程序,并将其拖放到我的应用程序文件夹中。但我不想再这样做了,我用的是 Homebrew。 + +首先,我可以通过稍微不同的语法确认它可以使用: + +``` +$ brew search --casks meld +==> Casks +meld +``` + +然后我使用 `cask` 子命令来安装它: + +``` +$ brew cask install meld +==> Downloading https://github.com/yousseb/meld/releases/download/osx-19/meldmerge.dmg +==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/28624006/66cb25 +######################################################################## 100.0% +==> Verifying SHA-256 checksum for Cask 'meld'. +==> Installing Cask meld +==> Moving App 'Meld.app' to '/Applications/Meld.app'. +==> Linking Binary 'meld.wrapper.sh' to '/usr/local/bin/meld'. +🍺 meld was successfully installed! +``` + +Homebrew 不仅安装了应用程序,而且还在我当前的路径 `/usr/local/bin/` 下提供了它。现在,我可以从命令行运行 `meld` 或从应用程序文件夹中启动应用程序。 + +### 更新一切的“酿造升级” + +我一直使用软件包管理器的主要原因是,我可以不断升级我的软件,以避免已知的安全漏洞,并确保我总是有最新的功能。如果我手工安装所有的东西,我必须关注每一个工具和应用程序,以了解它是否有自动更新程序,如果没有,就得自己拉回最新的版本。 + +升级功能是优秀的软件包管理的闪光点。由于我没有什么特殊的版本要求,所以我只需要运行一个命令就可以顺利更新一切: + +``` +$ brew upgrade +==> Upgrading 6 outdated packages: +helm 3.2.1 -> 3.2.2 +python@3.8 3.8.2_4 -> 3.8.3 +ipython 7.14.0 -> 7.15.0 +go 1.14.2_1 -> 1.14.3 +libzip 1.6.1 -> 1.6.1_1 +sqlite 3.31.1 -> 3.32.1 +``` + +如果你有更复杂的需求,或者想在安装升级前关注一下升级情况,有很多功能标志可供选择。例如,`-n` 提供了一个 “模拟运行”,列出了可用的升级,而不会进行安装。你也可以 “[钉][13]” 住应用程序版本来防止它升级。 + +### 备份你的安装 + +当该工具允许你像其它[点文件的版本控制方案][14]一样备份你的安装环境时,命令行实用程序和应用程序的管理就跳到了一个全新的水平。Homebrew 就有这样的功能,可以在 `dump` 子命令下使用。它会生成一个 `Brewfile`,这是一个可重复使用的当前所有安装的工具的列表。要从你的安装的环境中生成一个,进入你的合适的文件夹并运行: + +``` +$ cd ~/Development/dotfiles # 这是我的点文件的文件夹 +$ brew bundle dump +``` + +当我换了机器,想用 Homebrew 安装相同的应用程序时,我就会进入装有 `Brewfile` 的文件夹并运行。 + +``` +$ brew bundle +``` + +它将在我的新机器上安装所有列出的“秘方”和“酒桶”。 + +### 用 Homebrew 进行软件包管理 + +Homebrew 是我常用的命令行工具和应用程序的管理器。它可以让我保持有条理和及时更新,它的设计在易用性和功能深度之间取得了美丽的平衡。Homebrew 将软件包管理的细节最小化到只需要你知道的程度,大多数用户都会从中受益。 + +如果你对 Linux 软件包管理器已经驾轻就熟,你可能会认为 Homebrew 太简单了,但不要误以为 Homebrew 的易用性是功能的缺乏。稍微深入一点看,就会发现很多高级选项,远远超出了我在这里向你展示的范围。将 `-h` 添加到任何 `brew` 子命令中,会显示可用来升级、删除、故障排除,甚至使用模板贡献新 “秘方” 的丰富功能。 + +总的来说,Homebrew 可以让一个重度命令行的 Mac 用户变得很开心。此外,它是开源的,所以如果你愿意,你可以[贡献代码][15]。尝试一下它,让我知道你的想法,在下面留下评论。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/homebrew-mac + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/article/19/10/how-build-flatpak-packaging +[3]: https://brew.sh +[4]: https://opensource.com/article/20/4/pyenv +[5]: https://github.com/Homebrew/homebrew-core +[6]: https://github.com/Homebrew/linuxbrew-core +[7]: https://formulae.brew.sh/formula/ +[8]: https://opensource.com/article/20/3/github-hub +[9]: https://github.com/tldr-pages/tldr +[10]: https://formulae.brew.sh/cask/ +[11]: https://meldmerge.org/ +[12]: https://opensource.com/article/20/3/meld +[13]: https://docs.brew.sh/FAQ#how-do-i-stop-certain-formulae-from-being-updated +[14]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[15]: https://github.com/Homebrew/brew diff --git a/published/202006/20200619 How to dump the GOSSAFUNC graph for a method.md b/published/202006/20200619 How to dump the GOSSAFUNC graph for a method.md new file mode 100644 index 0000000000..36c75fc7af --- /dev/null +++ b/published/202006/20200619 How to dump the GOSSAFUNC graph for a method.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12350-1.html) +[#]: subject: (How to dump the GOSSAFUNC graph for a method) +[#]: via: (https://dave.cheney.net/2020/06/19/how-to-dump-the-gossafunc-graph-for-a-method) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +在 Go 中如何转储一个方法的 GOSSAFUNC 图 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/26/083943vymvmc67p7s3oman.jpg) + +Go 编译器的 SSA 后端包含一种工具,可以生成编译阶段的 HTML 调试输出。这篇文章介绍了如何为函数*和*方法打印 SSA 输出。 + +让我们从一个包含函数、值方法和指针方法的示例程序开始: + +``` +package main + +import ( + "fmt" +) + +type Numbers struct { + vals []int +} + +func (n *Numbers) Add(v int) { + n.vals = append(n.vals, v) +} + +func (n Numbers) Average() float64 { + sum := 0.0 + for _, num := range n.vals { + sum += float64(num) + } + return sum / float64(len(n.vals)) +} + + +func main() { + var numbers Numbers + numbers.Add(200) + numbers.Add(43) + numbers.Add(-6) + fmt.Println(numbers.Average()) +} +``` + +通过 `GOSSAFUNC` 环境变量控制 SSA 调试输出。此变量含有要转储的函数的名称。这*不是*函数的完全限定名。对于上面的 `func main`,函数名称为 `main` *而不是* `main.main`。 + +``` +% env GOSSAFUNC=main go build +runtime +dumped SSA to ../../go/src/runtime/ssa.html +t +dumped SSA to ./ssa.html +``` + +在这个例子中,`GOSSAFUNC=main` 同时匹配了 `main.main` 和一个名为 `runtime.main` 的函数。[^1]这有点不走运,但是实际上可能没什么大不了的,因为如果你要对代码进行性能调整,它就不会出现在 `func main` 中的巨大的意大利面块中。 + +你的代码更有可能在*方法*中,你可能已经看到这篇文章,并寻找能够转储方法的 SSA 输出。 + +要为指针方法 `func (n *Numbers) Add` 打印 SSA 调试,等效函数名为 `(*Numbers).Add`:[^2] + +``` +% env "GOSSAFUNC=(*Numbers).Add" go build +t +dumped SSA to ./ssa.html +``` + +要为值方法 `func (n Numbers) Average` 打印 SSA 调试,等效函数名为 `(*Numbers).Average`,*即使这是一个值方法*: + +``` +% env "GOSSAFUNC=(*Numbers).Average" go build +t +dumped SSA to ./ssa.html +``` + +[^1]: 如果你没有从源码构建 Go,那么 `runtime` 软件包的路径可能是只读的,并且可能会收到错误消息。请不要使用 `sudo` 来解决此问题。 +[^2]: 请注意 shell 引用 + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/06/19/how-to-dump-the-gossafunc-graph-for-a-method + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 + diff --git a/published/202006/20200621 How to Make Ubuntu Look Like macOS in 5 Easy Steps.md b/published/202006/20200621 How to Make Ubuntu Look Like macOS in 5 Easy Steps.md new file mode 100644 index 0000000000..9d5d5f7cf6 --- /dev/null +++ b/published/202006/20200621 How to Make Ubuntu Look Like macOS in 5 Easy Steps.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12361-1.html) +[#]: subject: (How to Make Ubuntu Look Like macOS in 5 Easy Steps) +[#]: via: (https://itsfoss.com/make-ubuntu-look-like-macos/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +5 个简单步骤使你的 Ubuntu 看起来像 macOS +====== + +定制是 [我为什么使用 Linux][1] 的一个主要原因。定制桌面 Linux 的道路是永无止境的。你可以更改图标、主题、字体、终端、添加屏幕小工具、[指示器小程序][2]、扩展等诸如此类的东西。 + +我们已经介绍了很多桌面环境定制的建议和技巧。在这篇文章中,我将向你展示如何使 Ubuntu 看起来像 macOS。 + +很多人使用 macOS,是因为它的简单和优雅的外观。你可能不同意这一点,但这仍然是一个流行的观点。甚至有的 Linux 发行版也有类似 macOS 外观和感觉。 + +一位读者要求我们展示如何使 Ubuntu 看起来像 macOS,因此我们写了这篇教程。事实上,这是一个用来展示桌面 Linux 定制能力的很好的示例。 + +不过,你没有必要为定制外观而安装一个新的发行版。你可以在你自己的系统上做一些调整来给予你一个类似 macOS 的外观。 + +### 如何给你的 Ubuntu Linux 进行 macOS 改造 + +![][3] + +尽管这篇文章是对 Ubuntu 的建议,但是你也可以在其它使用 GNOME 桌面环境的发行版中使用这些建议,几乎可以不做任何改动。请确保[检查一下你的桌面环境][4]。 + +说实话,即使你使用的是其它的桌面环境,你仍然可以得到一些关于要做哪些更改的提示。但是你必须确保使用你的桌面环境的工具按照步骤进行。 + +#### 必要条件: GNOME Tweaks 和 GNOME 扩展 + +请确保 [安装 GNOME Tweaks 工具][5]。你需要它来更改主题和图标。 + +你也需要 [启用 GNOME 扩展][6] 来更改 GNOME Shell 和添加重要的要点。 + +在你启用 GNOME 扩展后,你需要从 [GNOME 扩展][7] 网站安装“用户主题” 扩展,或者只需要转到 [这个超链接][8] ,并单击开关来将其打开。 + +我也希望你对 [在 Ubuntu 上安装主题][9] 有一定的了解。不过,我还是简单的谈了一下这个主题。 + +让我们依次看看每个步骤。 + +#### 步骤 1: 安装一个 macOS 风格的 GTK 主题 + +因为重点是使 GNOME 看起来像 macOS,所以你应该选择一个像 macOS 一样的主题。有很多主题都是像 macOS 一样的。 + +##### 下载一个你选择的主题 + +你可以转到 [Gnome-look][10] 站点,并搜索关于 GTK3 的主题。如果你在 Gnome-look 网站上看到 “Pling” 字样,不用担心,它们都是来自同一个供应商。 + +你可以选择任何你想要的主题。下面是一些我认为你应该看看的macOS主题: + +- [mcOS 11][11] +- [McHigh Sierra][12] +- [Catalina][13] +- [McMojave][14] + +在这篇文章中,我将使用 “[McMojave][14]”。你可以选择任何你想要的主题。你将在网站的右侧找到下拉式的下载按钮,单击它。 + +![McMojave 暗黑主题][15] + +在这里你可以找到各种 “.tar.xz” 文件。这些不同的文件包含了相同的主题,但有一些小的差异。像在 “McMojave” 中,我们有像暗黑主题和明亮主题的变体。你可以尝试所有的主题,或者从之间随意选择一个你喜欢的。 + +##### 设置下载的主题 + +提取下载的主题,并复制这些提取的主题文件夹到 `.local/share/themes` 文件夹下。 + +打开 GNOME Tweak 工具,并更改应用程序和 Shell 的主题。在你更改主题的同时,你可以看到黄色、绿色和红色三个按钮,以及左上角的苹果标志。你也可以看到在面板项上的一些更改。 + +![McMojave GTK 和 Shell 主题][16] + +#### 步骤 2: 安装像 macOS 一样的图标 + +macOS 外观改造的下一步骤是使用像 macOS 一样的图标。 + +##### 下载图标集合 + +这里有一些我建议使用的图标集合,你可以从 Gnome-look 网站下载: + +- [McMojave-circle][17] +- [Mojave CT-icons][18] +- [Cupertino icons][19] + +在这篇文章中,我将使用 “[McMojave-circle][17]” ,你可以随意使用任何你喜欢的图标。 + +就像主题一样,你可以从右侧的下拉式的 “下载” 按钮下载图标集合。在这里你也可以找到同一种图标的不同版本。 + +![Mcmojave Circle][20] + +##### 设置图标 + +现在设置下载的图标。为此,提取下载文件中的文件夹并复制它到你的家目录下的 `.icons` 文件夹。 查看这篇关于 [在 Ubuntu 中安装图标主题][9] 的文章。 + +这是这种图标看起来的样子: + +![McMojave Circle 图标外观][21] + +#### 步骤 3: 添加类似 macOS 样子的坞站 + +没有类似 macOS 样子的坞站dock,你的 Ubuntu 就看起来不像 macOS。在 Linux 上有很多可用的坞站。我喜欢 “[Dash to Dock][22]”,我会在这里使用它。 + +“Dash to Dock” 是一个 GNOME 扩展。到现在为止,你已经熟悉 GNOME 扩展。只需要转到 [这个超链接][23] ,并单击切换按钮来安装它。你的原本的坞站将自动被 “Dash to Dock” 所替换。 + +你可以通过右键单击 “show applications” 按钮(最右边的菜单按钮)并选择 “Dash to dock settings” 来更改设置。 + +![Dash To Dock][24] + +#### 步骤 4: 使用 macOS 壁纸 + +大多数复杂的东西已经完成。现在是时候设置 macOS 壁纸了。你可以从下面的超链接下载 macOS 默认壁纸: + +- [下载 macOS 壁纸][25] + +##### 更改桌面背景 + +我将使用 “Mojave Day” 壁纸。右键单击已下载的的图像,并选择 “设置为壁纸” 选项来更改壁纸。 + +在设置这个壁纸后,这是我系统外观的样子: + +![][26] + +##### 更改锁屏壁纸 + +锁屏壁纸选项已经从 [Ubuntu 20.04][27] 的设置中移除。现在它使用一个模糊的桌面壁纸作为锁屏壁纸。 + +要设置一个自定义锁屏壁纸,你可以使用 “[Lock screen background][28]” 扩展。 + +打开 “Lock screen background” 扩展设置,并设置锁屏壁纸。 + +![锁屏背景设置][29] + +这是锁屏现在的样子。如果你感到好奇话,这里是 [如何在 Ubuntu 中截图锁屏][30]。 + +![锁屏][31] + +![登录屏幕][32] + +#### 步骤 5: 更改系统字体 + +这几年,macOS 的主要系统字体是 “San Francisco” 。但是,这个字体并不是公共领域的,而是像苹果生态系统中的许多其他东西一样,是专有字体。基于这个原因,你不能使用这种字体。 + +你能做的就是使用一种看起来像 San Francisc 字体一样的开源字体。我建议使用 Google 的 [Roboto][33] 字体,或 Adobe 的 [Source Sans Pro][34] 。 + +[在 Ubuntu 中安装字体是很简单的][35] 。下载 字体的 zip 文件,只需要在提取出来的文件夹中双击 ttf 文件。它会给你一个选项来逐一安装字体。 + +如果你想节省时间并一次安装所有的字体,提取其中所有的字体到你的家目录(`~/.fonts`)下的 `.fonts` 目录中。 + +![安装字体][36] + +在你安装字体后,你可以使用 GNOME Tweaks 工具来更改系统字体。 + +![设置字体][37] + +#### 额外提示:Spotlight 式的应用程序启动器(如果你像更进一步的话) + +如果你是 macOS Spotlight 启动器的粉丝,那么你在 Linux 上也能找到类似的东西。我最喜欢的这类启动器的软件包是 “[Albert][38]”。 + +你可以 [在 Albert 网站上找到它的安装说明][39] 。 + +安装完成后,打开 Albert 并设置快捷键(你想打开该启动器的组合键)就可以了。我想,在 macOS 中 `Command + Space` 键是来启动 Spotlight;在 Ubuntu 中,你可以设置 `Super+Space` [快捷键][40]。 + +你会会得到很多内置的主题,在下面的图片中,我使用 “Spotlight dark” 主题。 + +Albert 不能直接启动应用程序,你必须授予它在哪里可以进行搜索的权限。 + +![Albert 设置][41] + +在设置后,这是它看起来的样子: + +![Albert 暗黑主题][42] + +这是我的 Ubuntu 20.04 在完成所有定制后的样子。它看起来像 macOS 吗? 仁者见仁,智者见智。 + +![macOS 主题][43] + +![Ubuntu 使用 macOS 外观改造][44] + +如此,这就是你如何使你的 GNOME 桌面看起来像 macOS 一样的步骤。正如我在开始时所说的,这是一个很好的 Linux 桌面定制功能的示例。 + +如果你有新的注意或有任何疑问;评论区全是你的地盘。 + +本文由 Sumeet 编写,并由 Abhishek Prakash 提供补充输入信息。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/make-ubuntu-look-like-macos/ + +作者:[Sumeet][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-use-linux/ +[2]: https://itsfoss.com/best-indicator-applets-ubuntu/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Make-Ubuntu-Look-like-MacOS.png?ssl=1 +[4]: https://linux.cn/article-12124-1.html +[5]: https://itsfoss.com/gnome-tweak-tool/ +[6]: https://linux.cn/article-9447-1.html +[7]: https://extensions.gnome.org/ +[8]: https://extensions.gnome.org/extension/19/user-themes/ +[9]: https://itsfoss.com/install-themes-ubuntu/ +[10]: https://www.gnome-look.org/ +[11]: https://www.pling.com/p/1220826 +[12]: https://www.pling.com/p/1013714 +[13]: https://www.pling.com/p/1226871 +[14]: https://www.pling.com/p/1275087 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-dark-theme.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-Desktop.png?ssl=1 +[17]: https://www.gnome-look.org/p/1305429/ +[18]: https://www.gnome-look.org/p/1210856/ +[19]: https://www.gnome-look.org/p/1102582/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-.png?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-icons-look.png?fit=800%2C494&ssl=1 +[22]: https://github.com/micheleg/dash-to-dock +[23]: https://extensions.gnome.org/extension/307/dash-to-dock/ +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Dash-to-dock-1.png?ssl=1 +[25]: https://oswallpapers.com/category/mac-os/ +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Wallpaper.png?fit=800%2C450&ssl=1 +[27]: https://itsfoss.com/ubuntu-20-04-release-features/ +[28]: https://extensions.gnome.org/extension/1476/unlock-dialog-background/ +[29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-background-setting.png?ssl=1 +[30]: https://itsfoss.com/screenshot-login-screen-ubuntu-linux/ +[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-1.png?ssl=1 +[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?ssl=1 +[33]: https://fonts.google.com/specimen/Roboto?query=robot +[34]: https://adobe-fonts.github.io/source-sans-pro/ +[35]: https://itsfoss.com/install-fonts-ubuntu/ +[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Fonts.png?ssl=1 +[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Set-fonts.png?ssl=1 +[38]: https://albertlauncher.github.io/ +[39]: https://albertlauncher.github.io/docs/installing/ +[40]: https://itsfoss.com/ubuntu-shortcuts/ +[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-settings.png?ssl=1 +[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-look.png?ssl=1 +[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme.png?fit=800%2C450&ssl=1 +[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme-2.png?fit=800%2C450&ssl=1 diff --git a/published/202006/20200623 Make the switch from Mac to Linux easier with Homebrew.md b/published/202006/20200623 Make the switch from Mac to Linux easier with Homebrew.md new file mode 100644 index 0000000000..f28c5fbf98 --- /dev/null +++ b/published/202006/20200623 Make the switch from Mac to Linux easier with Homebrew.md @@ -0,0 +1,263 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12358-1.html) +[#]: subject: (Make the switch from Mac to Linux easier with Homebrew) +[#]: via: (https://opensource.com/article/20/6/homebrew-linux) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Homebrew 让你从 Mac 切换到 Linux 更轻松 +====== + +> 不管你是想要更舒服地从 Mac 搬到 Linux,还是不满意常规的 Linux 包管理器,都可以试试 Homebrew。 + +![](https://img.linux.net.cn/data/attachment/album/202006/28/091127an02f8oae0pln3as.jpg) + +[Homebrew][2] 项目最初是为了给 Mac 用户提供一个非官方的 Linux 式的包管理器。用户很快就爱上了它友好的界面以及帮助性的提示,而且,它已经被移植到 Linux 系统 —— 这看起来像是一个奇怪的命运转折。 + +一开始,有两个分开的项目分别针对 macOS 和 Linux (Homebrew 与 Linuxbrew),但是现在是由 Homebrew 核心管理着这两个操作系统。由于我正 [从 Mac 切换到 Linux][3],所以一直在研究我在 macOS 最常用的开源软件在 Linux 表现如何,最终,我很高兴地发现 Homebrew 对 Linux 的支持太赞了! + +### 为什么要在 Linux 使用 Homebrew 呢? + +长期使用 Linux 的用户对 Homebrew 的第一反应是:“为什么不直接使用……呢”,省略号代表他们喜欢的某个 Linux 包管理器。基于 Debian 的系统早就有了 `apt`,基于 Fedora 的系统则有 `dnf` 和 `yum`,并且像 Flatpak 跟 AppImage 这样的项目,在两种系统上都能流畅运行。我花了不少时间尝试这些技术,不得不说,它们都有其强大之处。 + +那我为什么还要 [坚持使用 Homebrew][4] 呢?首先,我对它非常熟悉。在为我过去使用的专有软件寻找开源替代品的过程中,我已经学会了许多使用方法,而保持一些熟悉的东西,比如 Homebrew,可以让我专注于一次学习一件事情,而不是被不同系统间的差异搞垮。 + +此外,我没有看到哪一个包管理器像 Homebrew 一样,对用户如此友好。正如默认的帮助命令一样,命令井然有序: + +``` +$ brew -h +Example usage: +  brew search [TEXT|/REGEX/] +  brew info [FORMULA...] +  brew install FORMULA... +  brew update +  brew upgrade [FORMULA...] +  brew uninstall FORMULA... +  brew list [FORMULA...] + +Troubleshooting: +  brew config +  brew doctor +  brew install --verbose --debug FORMULA + +Contributing: +  brew create [URL [--no-fetch]] +  brew edit [FORMULA...] + +Further help: +  brew commands +  brew help [COMMAND] +  man brew +  +``` + +过于简短的输出可能会被误解为它功能局限,但是你简单看看每一个子命令,都有很丰富的功能。虽然上面的列表只有短短 23 行,但对高级用户来说,光是子命令 `install` 就包含整整 79 行的帮助信息: + +``` +$ brew --help | wc -l +23 +$ brew install --help | wc -l +79 +``` + +它可以选择忽略或者安装依赖关系,也可以选择用源代码编译以及用什么编译器来编译某个确切的上游 Git 提交,或者选择应用的官方 “灌装” 版。总而言之,Homebrew 即适合新手,也同样能满足老鸟。 + +### 开始在 Linux 使用 Homebrew + +如果你想要试着使用 Homebrew,可以用这个单行脚本在 Mac 或者 Linux 上进行安装: + +``` +$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +``` + +这条命令会立即开始安装 Homebrew。如果你比较谨慎,可以使用 `curl` 将该文件下载到本地,检查完毕之后再运行。 + +``` +$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh --output homebrew_installer.sh +$ more homebrew_installer.sh # 审核该脚本,直到你觉得没问题了 +$ bash homebrew_installer.sh +``` + +对 Linux 的安装步骤还包括如何配置点文件,对于 Debian 系统来说是 `~/.profile`,对于 Fedora 系统是 `~/.bash_profile`。 + +``` +$ test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) +$ test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile +$ echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile +``` + +为了确认已经安装好,Homebrew 团队提供一个空的 `hello` “秘方” 供测试: + +``` +$ brew install hello +==> Downloading https://linuxbrew.bintray.com/bottles/hello-2.10.x86_64_linux.bottle.tar.gz +######################################################################## 100.0% +==> Pouring hello-2.10.x86_64_linux.bottle.tar.gz +🍺 /home/linuxbrew/.linuxbrew/Cellar/hello/2.10: 52 files, 595.6KB +``` + +看起来安装毫无问题,让我来试试更多操作。 + +### 命令行工具 Brew + +Homebrew 宣称自己是一款默认只 “安装你需要而 [Linux] 没有的东西”的应用程序。 + +你可以用 `brew` 命令安装任何打包在 Homebrew 中的命令行软件。这些包的定义文件叫做 “秘方formula”,而且它们通过“瓶子bottle”来编译并分享。在 Homebrew 的世界里,还有许多 “啤酒方面” 的术语,但这个包管理器主要目的是让软件便于使用。 + +都有些什么样的软件呢?对我这样的技术玩家(既然你已经在读这篇文章,估计你也是)来说最方便的东西。例如,便利的 `tree` 命令,可以展示目录结构,或者 `pyenv`,我用它来 [在 Mac 管理不同版本 Python][5]。 + +你可以用 `search` 命令查看所有可以安装的“秘方”,在后面加上 `wc` 命令看看一共有多少: + +``` +# -l 选项统计行数 +$ brew search | wc -l +    5087 +``` + +迄今为止,一共有 5000 多个 “秘方”,这囊括了很多软件。需要注意的是:并非所有 “秘方” 都能在 Linux 运行。在 `brew search --help` 输出中有一节提到可以按软件运行的操作系统来筛选软件。它会在浏览器打开用于每个操作系统的软件仓库。我运行的是 Fedora,所以我会用它来试一试: + +``` +$ brew search --fedora tree +``` + +浏览器打开了网址 `https://apps.fedoraproject.org/packages/s/tree`,向我展示了所有 Fedora 的可用选项。你也可以通过其它方法进行浏览。“秘方” 被集中整理到由操作系统划分的核心仓库当中(Mac 在 [Homebrew Core][6],Linux 在 [Linux Core][7])。同样也可以通过 Homebrew API [在网页显示][8]。 + +即使有这些选择,我还是通过其它用户的推荐找到很多新工具。我列出一些我最喜欢的工具,你可以在里面找点灵感: + + * `pyenv`、`rbenv` 和 `nodenv` 用来管理(相应的) Python、Ruby 和 Node.js 版本 + * `imagemagick` 用于脚本化编辑图片 + * `pandoc` 用于脚本化转换文档格式(我通常将 .docx 文件转成 .md 或者 .html) + * `hub` 为 GitHub 用户提供 [更好的 Git 体验][9] + * `tldr` 展示了命令工具的使用范例 + +想要深入了解 Homebrew,可以去 [trldr 页面][10] 看看,比起应用的 man 页面,它要友好得多。使用 `search` 命令确认你可以安装: + +``` +$ brew search tldr +==> Formulae +tldr ✔ +``` + +太好了!对勾说明你可以安装。那么继续吧: + +``` +$ brew install tldr +==> Downloading https://linuxbrew.bintray.com/bottles/tldr-1.3.0_2.x86_64_linux.bottle.1.tar.gz +######################################################################## 100.0% +==> Pouring tldr-1.3.0_2.x86_64_linux.bottle.1.tar.gz +🍺 /home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2: 6 files, 63.2KB +``` + +Homebrew 提供了编译好的二进制文件,所以你不必在本地机器上从源码编译。这能节省很多时间,也不用听 CPU 风扇的噪声。我很欣赏 Homebrew 的另外一点是,你不完全理解每一个选项的含义也不会影响正常使用。若你想自己编译,可以在 `brew install` 命令后面加上 `-s` 或者 `--build-from-source` 标识,这样就能从源码编译 “秘方”(即便已经有一个 “瓶子” 存在)。 + +同样,软件底层的复杂性也很有意思。使用 `info` 可以查看 `tldr` 软件的依赖管理,“秘方” 的源代码存放在磁盘上的何处,甚至还能查看公开分析。 + +``` +$ brew info tldr +tldr: stable 1.3.0 (bottled), HEAD +Simplified and community-driven man pages +https://tldr.sh/ +Conflicts with: + tealdeer (because both install `tldr` binaries) +/home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2 (6 files, 63.2KB) * + Poured from bottle on 2020-06-08 at 15:56:15 +From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/tldr.rb +==> Dependencies +Build: pkg-config ✔ +Required: libzip ✔, curl ✔ +==> Options +--HEAD + Install HEAD version +==> Analytics +install: 197 (30 days), 647 (90 days), 1,546 (365 days) +install-on-request: 197 (30 days), 646 (90 days), 1,546 (365 days) +build-error: 0 (30 days) +``` + +### 从 Mac 到 Linux 的一点不足 + +在 macOS,Homebrew 的 `cask`(“酒桶”)子命令可以让用户使用命令行安装、管理整个应用软件。不幸的是,`cask` 还不能在任何 Linux 发行版上使用。我在安装一个开源工具时发现了这点: + +``` +$ brew cask install tusk +Error: Installing casks is supported only on macOS +``` + +我在 [论坛上][11] 问了一下,很快得到其他用户的反馈。总结一下,方案如下: + +* 复刻 Homebrew 项目,构建这个特性,然后像别人展示其价值 +* 给该软件写一个 “秘方”,然后从源代码编译 +* 为该软件创建一个第三方仓库 + +最后一个是我最感兴趣的。Homebrew 通过 [创建并维护 “水龙头tap”][12] (另一个受啤酒影响的术语)管理第三方仓库。随着你对系统越来越熟悉,并想加入生态系统, “水龙头” 是值得研究的。 + +### 备份 Homebrew 的安装记录 + +我最中意的 Homebrew 特性之一就是你可以像其它任何 [用版本控制工具来备份点文件][13] 一样备份你的安装记录。为了实现这个目的,Homebrew 提供 `bundle`(“捆扎”)子命令,它可以控制一个叫 `dump`(“倾倒”)的子命令生成一个 `Brewfile`。这个文件包含你目前所有安装的工具列表,可以重复使用。进入你想使用的目录然后运行命令,它会根据你所安装的软件生成 `Brewfile`: + +``` +$ cd ~/Development/dotfiles # This is my dotfile folder +$ brew bundle dump +$ ls Brewfile +Brewfile +``` + +当我换了一台机器,想要安装一样的软件时,进入含有 `Brewfile` 的文件夹,然后重新安装: + +``` +$ ls Brewfile +Brewfile +$ brew bundle +``` + +它会在我的新机器上安装所有列出的 “秘方”。 + +#### 在 Mac 和 Linux 同时管理 Brewfile + +`Brewfile` 非常适合备份你目前的安装记录,但是如果某些在 Mac 上运行的软件无法运行在 Linux 呢?或者刚好相反?我发现不管是 Mac 还是 Linux,如果软件无法在当前操作系统运行,Homebrew 会优雅地忽略那一行。如果它遇到不兼容的请求(比如使用 `brew` 在 Linux 安装 “酒桶cask” 时),它会选择跳过,继续安装过程: + +``` +$ brew bundle --file=Brewfile.example + +Skipping cask licecap (on Linux) +Skipping cask macdown (on Linux) +Installing fish +Homebrew Bundle complete! 1 Brewfile dependency now installed. +``` + +为了保持配置文件的简洁,我在两个操作系统上使用同一份 `Brewfile`,因为它只安装与操作系统相关的版本,所以我一直没有遇到任何问题。 + +### 使用 Homebrew 管理软件包 + +Homebrew 已经成了我必备的命令行工具,由于我很熟悉它,所以在 Linux 上的体验也充满乐趣。Homebrew 让我的工具井然有序,并且时刻保持更新,我愈发欣赏它在实用性与功能上找到的平衡点。我更喜欢将软件包管理的细节保持在用户需要了解的最小程度,大多数人都会从中受益。如果你已经很熟悉 Linux 包管理器了,Homebrew 可能会让你觉得很基础,但稍微深入一点看,就会发现它的高级选项远远超过本文的内容。 + +对 Linux 用户来说,他们有很多包管理器可以选择。如果你来自 MacOS,Homebrew 会让你宾至如归。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/homebrew-linux + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://brew.sh/ +[3]: https://opensource.com/article/19/10/why-switch-mac-linux +[4]: https://opensource.com/article/20/6/homebrew-mac +[5]: https://opensource.com/article/20/4/pyenv +[6]: https://github.com/Homebrew/homebrew-core +[7]: https://github.com/Homebrew/linuxbrew-core +[8]: https://formulae.brew.sh/formula/ +[9]: https://opensource.com/article/20/3/github-hub +[10]: https://github.com/tldr-pages/tldr +[11]: https://discourse.brew.sh/t/add-linux-support-to-existing-cask/5766 +[12]: https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap +[13]: https://opensource.com/article/19/3/move-your-dotfiles-version-control diff --git a/published/202006/20200624 Customize your Raspberry Pi operating system for everyday use.md b/published/202006/20200624 Customize your Raspberry Pi operating system for everyday use.md new file mode 100644 index 0000000000..52fc766db8 --- /dev/null +++ b/published/202006/20200624 Customize your Raspberry Pi operating system for everyday use.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12365-1.html) +[#]: subject: (Customize your Raspberry Pi operating system for everyday use) +[#]: via: (https://opensource.com/article/20/6/custom-raspberry-pi) +[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) + +定制用于日常使用的树莓派系统 +====== + +> 安装精简版树莓派系统,让你的树莓派更加轻盈。 + +![](https://img.linux.net.cn/data/attachment/album/202006/30/133836pfm4u3sq073ffmbf.jpg) + +你有一个运行[树莓派系统][2]Raspberry Pi OS(以前称为 Raspbian)操作系统的树莓派Raspberry Pi,你肯定知道,它是一个非常棒的小型电脑,有一个很好的操作系统,对于初学者来说,它包括了你可能想要的一切。然而,一旦你熟悉了它,并且想用它干一些别的事情的时候,你可能不想要那个默认囊括了一切组件的操作系统。 + +在这种情况下,你两个选择:要么你可以绞尽脑汁地把所有你不需要的东西都删干净,要么你还可以用精简版树莓派系统Raspberry Pi OS Lite来构建专门为你的需求而定制的轻量级操作系统。我的建议是,用第二种方法,既简便又节省时间。 + +### Raspberry Pi OS Lite + +“精简版Lite”的树莓派系统Raspberry Pi OS其实没什么特别的,就是一个基于最新版本的 [Debian][3] 的最小化镜像。这个镜像仅包含了操作系统核心和启动到命令行的部分,而不会进入图形桌面。可以将这个作为你的定制树莓派系统的基础。这之后的所有东西都是建立在这个核心之上的。 + +前往树莓派基金会的网站上[下载][2]这个轻量级镜像。下载完成后,查看详细的[安装指南][4],这里面介绍了在 Linux、Windows 或者 macOS 下如何烧制树莓派操作系统的 SD 卡。 + +如果你计划用树莓派作为一个极简系统来运行一些脚本和服务的话,差不多这么多就够了。如果你还想干更多事,那继续往下读。 + +### X Window + +首先,如果偶尔需要通过图形用户界面(GUI)连接到你的树莓派,安装一个窗口系统还是不错的。 + +[X Window 系统][5],有时候称为 X11,是 Unix 操作系统上一个常见的基本窗口系统。X11 提供了一套 GUI 桌面环境的基本框架。它可以让你通过窗口、鼠标和键盘与计算机交互。 + +#### 安装 X Window + +下面这一行安装了能让 X11 运行的最少的包。 + +``` +sudo apt install -y --no-install-recommends xserver-xorg-core xserver-xorg xfonts-base xinit +``` + +如果使用 `--no-install-recommends`,则只安装了主要的一些依赖(`Depends` 字段中的包)。这样可以节省很多空间,因为没有安装那些建议却不一定需要的包。 + +### 进阶:使用 Xfce 桌面环境 + +如果你愿意,可以就此停下了,然后开始使用 X Window 作为你的桌面。不过,我并不建议这么做。X Window 自带的这种最小化的窗口管理工具走的是极简主义风格,某种程度上让人感觉过时了。相反,我建议安装现代化的桌面环境,比如说像 Xfce、GNOME 或者 KDE。当用在微型计算机上时,我更倾向于 [Xfce][6] 而不是其他的,因为它就是为资源有限的系统设计的,而且你可以通过主题、图标或者其他东西对它进行定制。 + +#### 安装 Xfce + +安装 Xfce 桌面环境相当简单。只需要: + +``` +sudo apt install -y --no-install-recommends xfce4 desktop-base lightdm +``` + +这就够了。你现在安装了 X Window(X11)和 Xfce 了。现在是时候来定制一下环境并且安装一些核心应用了。 + +### 核心应用 + +目前为止,你已经安装了 X Window(X11)、Xfce 桌面环境和 LightDM(一个 Xfce 自带的显示管理器)。现在,你已经有了一个可以启动并且正常使用的轻量级的完整系统。不过,在彻底完成之前,我还是喜欢装一些核心应用。 + +下面这条命令安装了一个终端程序、[Audacious][7] 音频播放器、[Ristretto][8] 图像浏览器、[Mousepad][9] 文本编辑器、[File Roller][10] 存档管理器和 [Thunar][11] 容量管理器。 + +``` +sudo apt install -y --no-install-recommends xfce4-terminal audacious ristretto +sudo apt install -y --no-install-recommends mousepad file-roller thunar-volman +``` + +#### 其他可选项 + +其他一些你可能想安装的东西,包括一个好的网络管理器、任务管理器、PDF 阅读器和通知工具,以及桌面背景管理器、截图工具、一些新的图标和光标主题。简单来说,如果树莓派是你的首选系统,这些都算是日常工作的一些补充。 + +``` +sudo apt install -y --no-install-recommends network-manager xfce4-taskmanager xfce4-notifyd +sudo apt install -y --no-install-recommends  xpdf gnome-icon-theme dmz-cursor-theme +``` + +### 下一步该做什么? + +如果一切都正常工作的话,你现在就有一个基于 Xfce 和 Debian Lite 超轻量级操作系统的树莓派了。我建议现在你去 Xfce 网站上查看其它很酷的好东西,这些你都可以安装并使用。下一步做什么完全由你决定! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/custom-raspberry-pi + +作者:[Patrick H. Mullins][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pmullins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_cartoon.png?itok=m3TcBONJ (Cartoon graphic of Raspberry Pi board) +[2]: https://www.raspberrypi.org/downloads/raspberry-pi-os/ +[3]: https://www.debian.org/ +[4]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[5]: https://en.wikipedia.org/wiki/X_Window_System +[6]: http://xfce.org +[7]: https://audacious-media-player.org/ +[8]: https://docs.xfce.org/apps/ristretto/start +[9]: https://github.com/codebrainz/mousepad +[10]: https://gitlab.gnome.org/GNOME/file-roller +[11]: https://docs.xfce.org/xfce/thunar/thunar-volman +[12]: https://goodies.xfce.org/ diff --git a/published/20200603 Code your hardware using this open source RTOS.md b/published/20200603 Code your hardware using this open source RTOS.md new file mode 100644 index 0000000000..067f5d0213 --- /dev/null +++ b/published/20200603 Code your hardware using this open source RTOS.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12518-1.html) +[#]: subject: (Code your hardware using this open source RTOS) +[#]: via: (https://opensource.com/article/20/6/open-source-rtos) +[#]: author: (Zhu Tianlong https://opensource.com/users/zhu-tianlong) + +使用 RT-Thread 实时操作系统驱动你的硬件 +====== + +> 编程驱动一个微处理器芯片是相当有难度的,但在嵌入式系统开发上,实时操作系统可以为你解决很多此类的困难。 + +![](https://img.linux.net.cn/data/attachment/album/202008/15/065451hu3784opp7p74qtp.jpg) + +从通用计算的角度,操作系统是提供计算机基本功能的一组软件。操作系统保证了计算机硬件可以探测并响应外围器件(如键盘、屏幕、移动设备、打印机等),并管理内存空间和外部存储空间。 + +虽然一个 CPU 核心同一时间只能运行单个线程,但现代操作系统可以使多个程序表现的像是在同时运行。每一个任务执行的如此之短,一系列任务切换的如此之快,以至于看起来多个任务像是在并行进行。这一切都是由一个叫做 *调度器* 的子进程来控制的。 + +操作系统通常是为计算机准备的,安装在硬盘上,管理计算机所要执行的任务。 + +### 为什么实时操作系统对嵌入式系统而言不可或缺 + +我曾经在 2008 年接触过嵌入式软件,那时候我还是一名学生,正在学习 [MCS-51][2] 微处理器编程。因为我的主修专业是计算机科学,我在其它课程中的所有程序都是在 PC 上执行的。为微处理器芯片编程是完全不同的体验。人生中第一次,我看到我的程序在裸板上运行,即使到现在我仍然记得,在我看到自己人生中第一个走马灯程序成功运行时的那种兴奋和激动。 + +但那种兴奋转瞬即逝。随着为裸板写出越来越多的程序,我遇到了越来越多的问题。这种沮丧并不是我独有的。直接为芯片写程序很困难,这也是 PC 要运行操作系统的很重要的原因。不幸的是,微处理器芯片(或嵌入式系统)通常是没有操作系统的,它们只能采用“硬编码”的方式编程,没有操作系统帮助你管理代码的运行。 + +在以“硬编码”的方式为处理芯片编写代码的时候,可能会遇到下列问题: + +#### 并发 + +在裸板上是没有管理程序运行的现成守护进程的。嵌入式系统软件中,无可避免的要把所有的逻辑功能放在一个巨大的 `while (1)` 循环中。每个功能可能包含一个或多个延时函数。CPU 在运行延时函数的时候是顺序执行的,没有任何办法跨越一个不必要的延时。正因如此,运行事务的复位操作只能是等待。最终结果就是很多的 CPU 处理时间浪费在空循环上,这对任务的并发非常不利。 + +#### 模块化 + +从软件工程的角度,高內聚低耦合原则在软件开发过程中被不厌其烦的频频强调,但是嵌入式软件的不同模块之间常常是重度耦合的,很多功能都集中在一个巨大的 `while (1)` 循环中,很难切分为模块。设计低耦合软件在编程上只是繁琐一些,但在嵌入式系统上,要低耦合就难以编写比较大型的软件。 + +与此同时,如果使用了看门狗定时器,程序员还得在调用延时函数时倍加小心。如果延时时间太长,主程序没有得到及时“喂狗”的时机,那么看门狗将在程序运行过程中被触发。嵌入式系统软件开发过程中,需要考虑的东西太多了,即便是个简单的延时函数,都不能掉以轻心。软件越复杂,就越需要细心。想象一下,试图将这一系列具有精细时间关系的交互功能拆分为模块会怎么样。 + +#### 软件生态 + +很多高级的软件组件依赖于其所基于的底层操作系统的实现。举个自身的例子,我曾开发过一个基于 [FreeModbus][3] 的开源项目,原计划将它移植到多种平台上,包括裸板。但与适应不同操作系统的便利性相比,有些功能过于复杂,无法在所有裸机板上实现。更糟糕的是,很多硬件平台因为缺乏一致性,只能各自从头做起。 + +直至现在,我的 Modbus 栈仍然不支持在裸板上运行。 + +很多像 Realtek、TI 和 MediaTek 的大厂,所提供的 WiFi 软件开发工具只能在操作系统上运行,且他们不公开固件源码,所以在裸板上根本没法使用这些工具。 + +#### 实时性 + +有些应用领域对实时性有要求,比如有些场景中,必须在特定的时间触发特定的软件操作。在工业控制场景,机器实体控制过程中,机械部件必须以确定的时间和确定的顺序执行动作。如果不能保证控制系统的实时性,整个机器可能出现功能异常,甚至危及工人生命。在裸板平台,所有的功能都塞在一个巨大的 `while (1)` 循环中,实时性无从保证。 + +#### 重用性 + +重用性依赖于模块化。没谁愿意翻来覆去做一成不变的事,对程序员而言更是如此。这不单单是浪费时间,更要命的是这使得代码的维护异常复杂。尤其是,因为功能的实现依赖于底层的硬件,使用了不同芯片的不同硬件平台上,同样的功能必须适配不同的硬件平台。这种情况下,重新发明轮子是无法避免的。 + +### 实时操作系统的优势 + +幸运的是,现在有针对各种微处理器芯片的操作系统,它们被称为实时操作系统(RTOS),和大多数操作系统一样,它们拥有调度器,保证代码以可预见的顺序运行。 + +我是在 2010 年初次在裸板上使用实时操作系统。那时候,[STM32][4] 系列微处理器(MCU)开始流行,因为这种微处理器性能强大、功能丰富,很多人在上面跑操作系统。我使用的是 [RT-Thread][5] 操作系统,有很多基于它的现成组件可用。它使用的是 Apache 2.0 许可,和其它操作系统相比,我觉得这个很舒心。我已经基于它作为平台从事开发工作 10 年了。 + +使用实时操作系统为裸板编程,操作系统为我们解决了需要处理的大部分问题。 + +#### 模块化 + +在操作系统支持下,整个软件可以分割为多个任务(即线程)。每个线程拥有自己独立的运行空间。线程之间互相独立,这促进了软件的模块化。 + +#### 并发 + +如果一个线程有延时函数,它将自动让出 CPU 资源给需要 CPU 的线程,这提高了 CPU 的整体利用率,也提升了系统的并发性能。 + +#### 实时性 + +实时操作系统从设计上就具备实时性。每个线程都被指定了特定的优先级,比较重要的线程设置为更高的优先级,不重要的线程优先级也低。正是以这种方式,软件整体的实时性得到了保证。 + +#### 开发效率 + +操作系统提供了统一的抽象接口,这使得可重用组件得以不断积累,同时提升了开发效率。 + +操作系统是软件极客集体智慧的结晶。很多通用的软件功能,如信号量、事件提醒、邮箱、环形缓冲、单向链表、双向链表等,被抽象出来并实现了封装,可随时调用。 + +Linux、RT-Thread 等操作系统为五花八门的硬件实现了一致的硬件接口,也就是常说的设备驱动框架。正因如此,软件工程师可以专注于软件开发,而不用关心底层的硬件,也不用重复造轮子。 + +#### 软件生态 + +RT-Thread 丰富的软件生态为大量的从业者带来了巨大的改变。操作系统带来的模块化和重用性,使得程序员可以基于 RT-Thread 封装出方便嵌入式系统开发使用的可重用组件。这些组件可以在其它项目中重用,也可以分享给其他的嵌入式应用开发者,以最大化软件的价值。 + +比如,LkdGui 是个开源的单色显示图形库,你可能在工业控制面板上简单而美观的设置界面上见过它。LkdGui 提供了像描点、画线、绘矩形及显示文本、按钮组件、进度条等绘图功能。 + +![LkdGui][6] + +使用像 LkdGui 这样兼具扩展性和健壮性的功能库,程序员们可以在同行已有工作成果的基础上充分施展自己的才能。而这一切,没有实时操作系统这样一个统一的基础,是根本不可能的。 + +### 试用 RT-Thread + +作为开源极客,我已经在 GitHub 上开源了一些嵌入式软件。在发布开源软件之前,我很少对他人谈及自己曾经的项目,因为不同的人在使用各种不同的微处理器芯片和硬件平台,我的代码极可能无法在他人的板子上运行。类似于 RT-Thread 这样的实时操作系统极大的提升了软件的可重用性,所以全世界的不同领域的专家得以就同一个项目展开探讨。这鼓励着越来越多的人分享和交流各自的项目。如果你在做裸板的软件开发,下次可以试试 TR-Thread。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/open-source-rtos + +作者:[Zhu Tianlong][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/zhu-tianlong +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://en.wikipedia.org/wiki/Intel_MCS-51 +[3]: https://www.embedded-solutions.at/files/freemodbus-v1.6-apidoc/ +[4]: https://en.wikipedia.org/wiki/STM32 +[5]: https://github.com/RT-Thread/rt-thread +[6]: https://opensource.com/sites/default/files/uploads/lkdgui.jpg (LkdGui) diff --git a/published/20200610 Concise data plotting in Python with Altair.md b/published/20200610 Concise data plotting in Python with Altair.md new file mode 100644 index 0000000000..9f68890aa5 --- /dev/null +++ b/published/20200610 Concise data plotting in Python with Altair.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12493-1.html) +[#]: subject: (Concise data plotting in Python with Altair) +[#]: via: (https://opensource.com/article/20/6/altair-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +Python 下使用 Altair 数据制图 +====== + +> Altair 作为一个 Python 数据制图库,提供了优雅的接口及自有的绘图语言。 + +![](https://img.linux.net.cn/data/attachment/album/202008/06/110441imrz9ajtpshtfq1i.jpg) + +Python 中的 [绘图库][2] 提供了呈现数据的多种方式,可以满足你不同的偏好,如灵活性、布局、易用性,或者特殊的风格。 + +和其它方式相比,我发现,Altair 提供的是一种不同的解决方案,且总体而言使用起来更为简单。得益于声明式的绘图语言 [Vega][3],Altair 拥有一套优雅的接口,可以直接定义要绘的图应该是什么样子,而不是通过写一大堆循环和条件判断去一步步构建。 + +### 绘图流程 + +我通过绘制同一个多柱状图比较了多个 Python 绘图库的差异。正式开始之前,你需要将你的 Python 环境调整到能运行下面代码的状态。具体就是: + +* 安装最新版的 Python( [Linux][4]、[Mac][5] 和 [Windows][6] 系统下的安装方法) +* 确认该版本 Python 可以运行本教程所使用的库 + +演示用数据可从网络下载,并且可以用 pandas 直接导入: + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +准备开始吧。为了做个比较,先看下面这个用 [Matplotlib][7] 做的图: + +![Matplotlib UK election results][8] + +使用 Matplotlib 需要 16 行代码,图柱的位置需要自己计算。 + +使用 Altair 绘制相似的图,代码如下: + +``` +    import altair as alt + +    chart = alt.Chart(df).mark_bar().encode( +        x='party', +        y='seats', +        column='year', +        color='party', +    ) + +    chart.save('altair-elections.html') +``` + +真是简洁多了!与 [Seaborn][9] 类似,Altair 所用数据的组织形式是每个变量一列(即 [数据列][10] )。这种方式下可以将每个变量映射到图的一个属性上 —— Altair 称之为“通道”。在上例中,我们期望每个 “党派” 在 `x` 轴上显示为一组图柱, 其 “席位” 显示在 `y` 轴,且将图柱按照 “年份” 分开为 “列”。我们还想根据 “党派” 给图柱使用不同的 “颜色”。用语言表述需求的话就是上面这个样子,而这也正是代码所要表述的! + +现在把图画出来: + +![Altair plot with default styling][11] + +### 调整样式 + +这和我们期待的效果有点接近了。与 Matplotlib 方案相比,主要区别在于 Altair 方案中,每个 `year` 组显示的时候,内部之间都有个小空白 —— 这不是问题,这只是 Altair 多柱状图显示的一个特性。 + +所以说呢,还需要对显示样式再做一些改进。 + +#### 非整形数据 + +两个不是整数的年份名称(`Feb 1974` 和 `Oct 1974`)显示为 `NaN` 了。这可以通过将年份数值 `year` 转换为字符串来解决: + + +``` +    df['year'] = df['year'].astype(str) +``` + +#### 指定数据排序方法 + +还需要让 Altair 知道如何对数据进行排序。Altair 允许通过传给它一个 `Column` 对象,来设定 `Column` 通道的更多细节。现在让 Altair 按照数据在数据集中出现的顺序排列: + +``` +    chart = alt.Chart(df).mark_bar().encode( +        # ... +        column=alt.Column('year', sort=list(df['year']), title=None), +        # ... +    ) +``` + +#### 移除坐标轴标签 + +我们通过设置 `title=None` 移除了图顶的 "year" 标签。下面再一处每列数据的 "party" 标签: + + +``` +    chart = alt.Chart(df).mark_bar().encode( +        x=alt.X('party', title=None), +        # ... +    ) +``` + +#### 指定颜色图 + +最后,我们还想自己指定图柱的颜色。Altair 允许建立 `domain` 中数值与 `range` 中颜色的映射来实现所需功能,太贴心了: + +``` +    cmap = { +        'Conservative': '#0343df', +        'Labour': '#e50000', +        'Liberal': '#ffff14', +        'Others': '#929591', +    } + +    chart = alt.Chart(df).mark_bar().encode( +        # ... +        color=alt.Color('party', scale=alt.Scale(domain=list(cmap.keys()), range=list(cmap.values()))) +    ) +``` + +#### 样式调整后的最终代码 + +应用上述样式调整之后,代码看起来不那么悦目了,但我们仍然是用声明的方式实现的,这正是 Altair 如此有弹性的原因所在。实现过程中,仍然是使用的异于显示数据的独立变量来分离图中不同属性的,而不是像在 Matplotlib 中那样直接对显示数据做复杂的操作。唯一的不同是,我们的变量名字封装在类似 `alt.X()` 的对象中,从而实现对显示效果的控制: + +``` +    import altair as alt +    from votes import long as df + +    cmap = { +        'Conservative': '#0343df', +        'Labour': '#e50000', +        'Liberal': '#ffff14', +        'Others': '#929591', +    } + +    df['year'] = df['year'].astype(str) + +    # We're still assigning, e.g. 'party' to x, but now we've wrapped it +    # in alt.X in order to specify its styling +    chart = alt.Chart(df).mark_bar().encode( +        x=alt.X('party', title=None), +        y='seats', +        column=alt.Column('year', sort=list(df['year']), title=None), +        color=alt.Color('party', scale=alt.Scale(domain=list(cmap.keys()), range=list(cmap.values()))) +    ) + +    chart.save('altair-elections.html') +``` + +现在与 Matplotlib 方案扯平了,代码数量达到了 16 行! + +下图是使用我们的样式调整方案之后的 Altair 效果图: + +![The Altair plot with our custom styling][12] + +### 结论 + +尽管在代码数量上,使用 Altair 绘图没有表现出优势,但它的声明式绘图语言使得对图层的操控更为精密,这是我比较欣赏的。Altair 还提供了清晰而独立的方式来调校显示样式,这使得 相关代码与绘图的代码块分离开来。Altair 确实是使用 Python 绘图时又一个很棒的工具库。 + +本文首次发布于 [这里][13],蒙允编辑后再次发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/altair-python + +作者:[Shaun Taylor-Morgan][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://linux.cn/article-12327-1.html +[3]: https://vega.github.io/vega/ +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: https://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/article/20/5/matplotlib-python +[8]: https://opensource.com/sites/default/files/uploads/matplotlib_1_1.png (Matplotlib UK election results) +[9]: https://anvil.works/blog/plotting-in-seaborn +[10]: https://anvil.works/blog/tidy-data +[11]: https://opensource.com/sites/default/files/uploads/altair-first-try.png (Altair plot with default styling) +[12]: https://opensource.com/sites/default/files/uploads/altair_3.png (The Altair plot with our custom styling.) +[13]: https://anvil.works/blog/plotting-in-altair diff --git a/published/20200611 Never forget your password with this Python encryption algorithm.md b/published/20200611 Never forget your password with this Python encryption algorithm.md new file mode 100644 index 0000000000..5d236b50d9 --- /dev/null +++ b/published/20200611 Never forget your password with this Python encryption algorithm.md @@ -0,0 +1,254 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12474-1.html) +[#]: subject: (Never forget your password with this Python encryption algorithm) +[#]: via: (https://opensource.com/article/20/6/python-passwords) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +国王的秘密:如何保护你的主密码 +====== + +> 这种使用 Python 和 Shamir 秘密共享的独特算法可以保护你的主密码,可以有效避免黑客窃取和自己不经意忘记引发的风险和不便。 + +![](https://img.linux.net.cn/data/attachment/album/202008/01/105831kzxididbld8kdhdb.jpg) + +很多人使用密码管理器来保密存储自己在用的各种密码。密码管理器的关键环节之一是主密码,主密码保护着所有其它密码。这种情况下,主密码本身就是风险所在。任何知道你的主密码的人,都可以视你的密码保护若无物,畅行无阻。自然而然,为了保证主密码的安全性,你会选用很难想到的密码,把它牢记在脑子里,并做[所有其他][2]你应该做的事情。 + +但是万一主密码泄露了或者忘记了,后果是什么?也许你去了个心仪的岛上旅行上个把月,没有现代技术覆盖,在开心戏水之后享用美味菠萝的时刻,突然记不清自己的密码是什么了。是“山巅一寺一壶酒”?还是“一去二三里,烟村四五家”?反正当时选密码的时候感觉浑身都是机灵,现在则后悔当初何必作茧自缚。 + +![XKCD comic on password strength][3] + +*([XKCD][4], [CC BY-NC 2.5][5])* + +当然,你不会把自己的主密码告诉其它任何人,因为这是密码管理的首要原则。有没有其它变通的办法,免除这种难以承受的密码之重? + +试试 [Shamir 秘密共享算法][6]Shamir's Secret Sharing,这是一种可以将保密内容进行分块保存,且只能将片段拼合才能恢复保密内容的算法。 + +先分别通过一个古代的和一个现代的故事,看看 Shamir 秘密共享算法究竟是怎么回事吧。 + +这些故事的隐含前提是你对密码学有起码的了解,必要的话,你可以先温习一下 [密码学与公钥基础设施引论][7]. + +### 一个古代关于加解密的故事 + +古代某国,国王有个大秘密,很大很大的秘密: + +``` +def int_from_bytes(s): +    acc = 0 +    for b in s: +        acc = acc * 256 +        acc += b +    return acc + +secret = int_from_bytes("terrible secret".encode("utf-8")) +``` + +大到连他自己的孩子都不能轻易信任。他有五个子女,但他知道前路危机重重。他的孩子需要在他百年之后用这个秘密来保卫国家,而国王又不能忍受自己的孩子在他们还记得自己的时候就知道这些秘密,尤其是这种状态可能要持续几十年。 + +所以,国王动用大力魔术,将这个秘密分为了五个部分。他知道,可能有一两个孩子不会遵从他的遗嘱,但绝对不会同时有三个或三个以上会这样: + +``` +from mod import Mod +from os import urandom +``` + +国王精通 [有限域][8] 和 *随机* 魔法,当然,对他来说,使用巨蟒分割这个秘密也是小菜一碟。 + +第一步是选择一个大质数——第 13 个 [梅森质数][9](`2**521 - 1`),他让人把这个数铸造在巨鼎上,摆放在大殿上: + +``` +P = 2**521 - 1 +``` + +但这不是要保密的秘密:这只是 *公开数据*。 + +国王知道,如果 `P` 是一个质数,用 `P` 对数字取模,就形成了一个数学 [场][10]:在场中可以自由进行加、减、乘、除运算。当然,做除法运算时,除数不能为 0。 + +国王日理万机,方便起见,他在做模运算时使用了 PyPI 中的 [mod][11] 模块,这个模块实现了各种模数运算算法。 + +他确认过,自己的秘密比 `P` 要短: + +``` +secret < P +``` +``` +TRUE +``` + +将秘密转换为 `P` 的模,`mod P`: + +``` +secret = mod.Mod(secret, P) +``` + +为了使任意三个孩子掌握的片段就可以重建这个秘密,他还得生成另外两个部分,并混杂到一起: + +``` +polynomial = [secret] +for i in range(2): + polynomial.append(Mod(int_from_bytes(urandom(16)), P)) +len(polynomial) +``` +``` +3 +``` + +下一步就是在随机选择的点上计算某 [多项式][12] 的值,即计算 `polynomial[0] + polynomial[1]*x + polynomial[2]*x**2 ...`。 + +虽然有第三方模块可以计算多项式的值,但那并不是针对有限域内的运算的,所以,国王还得亲自操刀,写出计算多项式的代码: + +``` +def evaluate(coefficients, x): +    acc = 0 +    power = 1 +    for c in coefficients: +        acc += c * power +        power *= x +    return acc +``` + +再下一步,国王选择五个不同的点,计算多项式的值,并分别交给五个孩子,让他们各自保存一份: + +``` +shards = {} +for i in range(5): +    x = Mod(int_from_bytes(urandom(16)), P) +    y = evaluate(polynomial, x) +    shards[i] = (x, y) +``` + +正如国王所虑,不是每个孩子都正直守信。其中有两个孩子,在他尸骨未寒的时候,就想从自己掌握的秘密片段中窥出些什么,但穷极所能,终无所获。另外三个孩子听说了这个事,合力将这两人永远驱逐: + +``` +del shards[2] +del shards[3] +``` + +二十年弹指一挥间,奉先王遗命,三个孩子将合力恢复出先王的大秘密。他们将各自的秘密片段拼合在一起: + +``` +retrieved = list(shards.values()) +``` + +然后是 40 天没日没夜的苦干。这是个大工程,他们虽然都懂些 Python,但都不如前国王精通。 + +最终,揭示秘密的时刻到了。 + +用于反算秘密的代码基于 [拉格朗日差值][13],它利用多项式在 `n` 个非 0 位置的值,来计算其在 `0` 处的值。前面的 `n` 指的是多项式的阶数。这个过程的原理是,可以为一个多项式找到一个显示方程,使其满足:其在 `t[0]` 处的值是 `1`,在 `i` 不为 `0` 的时候,其在 `t[i]` 处的值是 `0`。因多项式值的计算属于线性运算,需要计算 *这些* 多项式各自的值,并使用多项式的值进行插值: + +``` +from functools import reduce +from operator import mul + +def retrieve_original(secrets): +    x_s = [s[0] for s in secrets] +    acc = Mod(0, P) +    for i in range(len(secrets)): +        others = list(x_s) +        cur = others.pop(i) +        factor = Mod(1, P) +        for el in others: +            factor *= el * (el - cur).inverse() +        acc += factor * secrets[i][1] +    return acc +``` + +这代码是在太复杂了,40 天能算出结果已经够快了。雪上加霜的是,他们只能利用五个秘密片段中的三个来完成这个运算,这让他们万分紧张: + +``` +retrieved_secret = retrieve_original(retrieved) +``` + +后事如何? + +``` +retrieved_secret == secret +``` +``` +TRUE +``` + +数学这个魔术的优美之处就在于它每一次都是那么靠谱,无一例外。国王的孩子们,曾经的孩童,而今已是壮年,足以理解先王的初衷,并以先王的锦囊妙计保卫了国家,并继之以繁荣昌盛! + +### 关于 Shamir 秘密共享算法的现代故事 + +现代,很多人都对类似的大秘密苦不堪言:密码管理器的主密码!几乎没有谁能有足够信任的人去完全托付自己最深的秘密,好消息是,找到至少有三个不会串通起来搞鬼的五人组不是个太困难的事。 + +同样是在现代,比较幸运的是,我们不必再像国王那样自己动手分割要守护的秘密。拜现代 *开源* 技术所赐,这都可以使用现成的软件完成。 + +假设你有五个不敢完全信任,但还可以有点信任的人:张三、李四、王五、赵六和钱大麻子。 + +安装并运行 `ssss` 分割密钥: + +``` +$ echo 'long legs travel fast' | ssss-split -t 3 -n 5 +Generating shares using a (3,5) scheme with dynamic security level. +Enter the secret, at most 128 ASCII characters: Using a 168 bit security level. +1-797842b76d80771f04972feb31c66f3927e7183609 +2-947925f2fbc23dc9bca950ef613da7a4e42dc1c296 +3-14647bdfc4e6596e0dbb0aa6ab839b195c9d15906d +4-97c77a805cd3d3a30bff7841f3158ea841cd41a611 +5-17da24ad63f7b704baed220839abb215f97d95f4f8 +``` + +这确实是个非常牛的主密码:`long legs travel fast`,绝不能把它完整的托付给任何人!那就把五个片段分别交给还比较可靠的伙伴,张三、李四、王五、赵六和钱大麻子。 + + * 把 `1` 给张三。 + * 把 `2` 给李四。 + * 把 `3` 给王五。 + * 把 `4` 给赵六。 + * 把 `5` 给钱大麻子。 + +然后,你开启你的惬意之旅,整整一个月,流连于海边温暖的沙滩,整整一个月,没碰过任何电子设备。没用多久,把自己的主密码忘到了九霄云外。 + +李四和王五也在和你一起旅行,你托付给他们保管的密钥片段保存的好好的,在他们各自的密码管理器中,但不幸的是,他们和你一样,也忘了自己的 *主密码*。 + +没关系。 + +联系张三,他保管的密钥片段是 `1-797842b76d80771f04972feb31c66f3927e7183609`;赵六,一直替你的班,很高兴你能尽快重返岗位,把自己掌握的片段给了你,`4-97c77a805cd3d3a30bff7841f3158ea841cd41a611`;钱大麻子,收到你给的跑腿费才将自己保管的片段翻出来发给你,`5-17da24ad63f7b704baed220839abb215f97d95f4f8`。 + +有了这三个密钥片段,运行: + +``` +$ ssss-combine -t 3 +Enter 3 shares separated by newlines: +Share [1/3]: 1-797842b76d80771f04972feb31c66f3927e7183609 +Share [2/3]: 4-97c77a805cd3d3a30bff7841f3158ea841cd41a611 +Share [3/3]: 5-17da24ad63f7b704baed220839abb215f97d95f4f8 +Resulting secret: long legs travel fast +``` + +就这么简单,有了 *开源* 技术加持,你也可以活的像国王一样滋润! + +### 自己的安全不是自己一个人的事 + +密码管理是当今网络生活必备技能,当然要选择复杂的密码,来保证安全性,但这不是全部。来用 Shamir 秘密共享算法,和他人共同安全的存储你的密码吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/python-passwords + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://monitor.firefox.com/security-tips +[3]: https://opensource.com/sites/default/files/uploads/password_strength-xkcd.png (XKCD comic on password strength) +[4]: https://imgs.xkcd.com/comics/password_strength.png +[5]: https://creativecommons.org/licenses/by-nc/2.5/ +[6]: https://en.wikipedia.org/wiki/Secret_sharing#Shamir's_scheme +[7]: https://opensource.com/article/18/5/cryptography-pki +[8]: https://en.wikipedia.org/wiki/Finite_field +[9]: https://en.wikipedia.org/wiki/Mersenne_prime +[10]: https://en.wikipedia.org/wiki/Field_(mathematics) +[11]: https://pypi.org/project/mod/ +[12]: https://en.wikipedia.org/wiki/Polynomial +[13]: https://www.math.usm.edu/lambers/mat772/fall10/lecture5.pdf diff --git a/published/20200612 3 reasons to contribute to open source now.md b/published/20200612 3 reasons to contribute to open source now.md new file mode 100644 index 0000000000..02ec8fa726 --- /dev/null +++ b/published/20200612 3 reasons to contribute to open source now.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12505-1.html) +[#]: subject: (3 reasons to contribute to open source now) +[#]: via: (https://opensource.com/article/20/6/why-contribute-open-source) +[#]: author: (Jason Blais https://opensource.com/users/jasonblais) + +现在贡献开源的 3 个理由 +====== + +> 现在比以往任何时候都更是为开源做出贡献的理想时机。下面是为什么。 + +![](https://img.linux.net.cn/data/attachment/album/202008/11/101413or3y9jsjsu0999s4.jpg) + +开源软件已经[遍及世界][2]。从 Linux 和 MySQL 的早期开始,开源就以前所未有的方式推动创新,仅 GitHub 上就有 [180,000 个公共仓库][3]。 + +对于尚未进入开源世界的那些人,下面是如今天开始的三个原因。 + +### 建立你作为开发人员的信心 + +如果你还很年轻,在职业生涯初期,甚至只是在学习一种新的编程语言,那么开源是入门的最佳方法。 + +通过参与一个开源项目,你会立即收到有关你的开发和编程技能的反馈。你可能会获得有关如何选择函数名称、条件逻辑的使用方式或如何使用不了解的 goroutine 来加快程序执行速度的建议。这是你在学习新东西时获得的宝贵反馈。 + +此外,随着你创建更多的拉取请求并应用从先前提交的内容中学到的知识,你将开始学习如何编写良好的代码并[提交优秀的拉取请求进行代码审查][4]。最后,许多开源项目提供指导计划,以帮助指导你完成前几个贡献。这是一个非常友好、安全的环境,可树立你作为开发人员的信心。 + +有关例子故事,请阅读 [Allan Guwatudde 作为一名自学开发者在开源方面的经验][5]这篇文章。 + +### 丰富你的简历 + +即使你是一位经验丰富的开发人员,你也可能希望丰富自己的简历,以帮助职业发展和未来的寻找工作。也许你有兴趣探索新的前沿框架或新的编程模块,而你却没有机会在工作中用到。 + +你可以通过报名一个课程或在日常工作中找到一个方式引入这些概念来获得经验。但是,当这些选项不可用(或不希望使用)时,开源将提供绝佳的机会!除了建立技能和提高信心之外,所有开源贡献都是公开的,它们可以证明你已掌握的技能和已完成的项目。实际上,你的开源方面的个人资料本身可以为你提供强大的作品集,从而使你与其他应聘者脱颖而出。 + +此外,许多开源项目,例如 [Mattermost][6],允许你在 LinkedIn 上添加自己为贡献者,以直接提升自己的专业形象。 + +[阅读 Siyuan Liu 的旅程][7]这篇文章,了解如何从第一次开源贡献到两次成为 Mattermost 项目 MVP。 + +### 建立你的专业网络 + +建立强大的专业网络可以帮助你实现职业目标,了解有关你自己或相邻领域的更多信息,并有助于寻找工作。为开源做贡献是建立该网络的绝佳方法。你加入了一个由成百上千的贡献者组成的温馨社区,在开源空间中与志趣相投的开发人员进行互动,并一路建立联系。你甚至可能会被介绍给行业中的关键人物,例如知名的开源工具的维护者。这样的关系可以变成改变职业生涯的关系。 + +最后,为开源项目做贡献甚至可以让你找到工作!例如,[Mattermost][8] 已经从它的开源社区聘请了一些贡献者,全职在工程团队中工作。 + +### 从今天开始为开源做贡献 + +开源让你能够树立开发者的信心,建立简历和建立专业网络。而且,无论你的贡献大小,它都会对开源项目的未来产生直接影响。因此,许多项目都会向贡献者发放礼物以表示感谢(例如,[为所有首次贡献者送上一个定制的杯子][9])。 + +准备开始进入开源了吗?查看[这些开源项目][10]来进行首次开源贡献,或了解[如何为 Mattermost 做贡献][11]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/why-contribute-open-source + +作者:[Jason Blais][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jasonblais +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://techcrunch.com/2019/01/12/how-open-source-software-took-over-the-world/ +[3]: https://github.com/search?q=stars%3A%3E100&s=stars&type=Repositories +[4]: https://mattermost.com/blog/submitting-great-prs/ +[5]: https://mattermost.com/blog/building-confidence-and-gaining-experience-with-good-open-source-projects/ +[6]: https://docs.mattermost.com/overview/faq.html#can-contributors-add-themselves-to-the-mattermost-company-page-on-linkedin +[7]: https://mattermost.com/blog/open-source-contributor-journey-with-mattermost/ +[8]: https://mattermost.com/careers/ +[9]: https://forum.mattermost.org/t/limited-edition-mattermost-mugs/143 +[10]: https://firstcontributions.github.io/ +[11]: http://mattermost.com/contribute diff --git a/published/20200616 Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool.md b/published/20200616 Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool.md new file mode 100644 index 0000000000..1da4367b17 --- /dev/null +++ b/published/20200616 Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12523-1.html) +[#]: subject: (Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool) +[#]: via: (https://itsfoss.com/pdf-mix-tool/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +使用 PDF Mix Tool 执行常见的 PDF 编辑任务 +====== + +> PDF Mix Tool 是一个简单、轻巧的开源 PDF 编辑应用,可让你从 PDF 中提取页面、合并两个 PDF、从 PDF 中删除页面等。 + +![](https://img.linux.net.cn/data/attachment/album/202008/16/203411puozfr91f1pmzg9z.jpg) + +### PDF Mix Tool:一个简单的开源 PDF 编辑工具 + +![][1] + +有[几个可以在 Linux 中使用的 PDF 编辑器][2],我通常将它们分为两类: + + * 可让你编辑内容(注释、高亮、更改文本、添加/删除图像等)的 PDF 编辑器, + * 可让你通过合并、分割、提取页面等来修改文件的 PDF 编辑器。 + +[PDF Mix Tool][3] 属于第二类。它是用 C++ 和 Qt5 编写的开源软件。它可让你合并两个或更多 PDF 文件,并为每个文件指定页面,还有旋转页面、添加空白页、删除页面以及从 PDF 文件提取页面。 + +在本周的开源软件亮点中,让我们看一下使用 PDF Mix Tool。 + +### 使用 PDF Mix Tool 在 Linux 中编辑 PDF + +![][4] + +PDF Mix Tool 并没有很多功能,但是有一些非常重要的功能。 + +#### 合并 PDF 文件 + +![][5] + +你可以轻松合并多个 PDF 文件,同时指定确切的页面。它让你能够调整页面数、旋转,还能使用 “交替混合Alternate mix” 反转页面顺序合并。 + +![][6] + +你只需要单击 “添加 PDF 文件Add PDF File” 添加文件,然后使用可用的选项对其进行编辑(如上图所示),最后生成编辑的 PDF。 + +#### 旋转页面 + +你可以在合并多个文件或仅对单个 PDF 文件进行操作时旋转 PDF 文件的页面。 + +对于合并文件,你可以参考上面的截图。但是当你选择一个文件时,它看上去像这样: + +![][7] + +你有多种选择,但是要旋转页面,需要选择 “编辑页面布局Edit page layout” 选项,如上截图所示。 + +#### 添加或删除页面 + +要从其他 PDF 文件添加新页面,最好利用此选项。 + +但是,如果要添加空白页,你可以选择一个文件进行添加。不只是添加空白页面,还可以删除特定页面。下面的截图圈出了高亮选项: + +![][8] + +#### 从 PDF 文件提取页面 + +![][9] + +除了所有其他选项之外,你还可以从给定的 PDF 文件中提取特定页面(或全部)。你还可以为所有提取的页面生成一个新的 PDF 文件,或者为提取的每个页面制作单独的 PDF 文件。在许多场景中,它应该派上用场。 + +#### 其他功能 + +利用上面所有功能,你可以生成自己选择的全新 PDF,颠倒顺序、提取页面、制作单独的 PDF 文件等等。 + +它不会减小 PDF 文件的大小。你必须使用其他工具[在 Linux 中压缩 PDF 文件][10]。 + +因此,当你组合使用可用选项时,它是功能丰富的工具。 + +### 在 Linux 上安装 PDF Mix Tool + +![PDF Mix Tool in Ubuntu Software Center][11] + +PDF Mix Tool 存在于 Snap 和 [Flatpak 软件包][12]中。这意味着如果发行版支持这任意一种,你都可以在软件管理器中找到它。 + +或者,如果你[启用了 Snap 软件包支持][13],那么可以使用以下命令进行安装: + +``` +sudo snap install pdfmixtool +``` + +如果你想[使用 Flatpak][14],那么使用: + +``` +flatpak install flathub eu.scarpetta.PDFMixTool +``` + +如果你使用的是 Arch Linux,那么可以从[社区仓库][15]中获取。 + +``` +sudo pacman -S pdfmixtool +``` + +你也可以选择查看它的 [GitLab 页面][16]获取源码。 + +- [下载 PDF Mix Tool 源码][17] + +### 总结 + +它可能不是功能最丰富的 PDF 编辑工具,但考虑到它是轻量级的开源工具,因此它是已安装的应用中非常有用的。过去我们也介绍过类似的工具 [PDF Arranger][18]。你可能会想了解一下。 + +你如何看待它?你有尝试过么?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pdf-mix-tool/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool.png?ssl=1 +[2]: https://itsfoss.com/pdf-editors-linux/ +[3]: https://scarpetta.eu/pdfmixtool/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge.png?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-edit.png?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge-edit.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-layout.png?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-add-delete.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-extract.png?ssl=1 +[10]: https://itsfoss.com/compress-pdf-linux/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-ubuntu.png?ssl=1 +[12]: https://flathub.org/apps/details/eu.scarpetta.PDFMixTool +[13]: https://itsfoss.com/install-snap-linux/ +[14]: https://itsfoss.com/flatpak-guide/ +[15]: https://www.archlinux.org/packages/community/x86_64/pdfmixtool/ +[16]: https://gitlab.com/scarpetta/pdfmixtool +[17]: https://www.scarpetta.eu/pdfmixtool/ +[18]: https://itsfoss.com/pdfarranger-app/ diff --git a/published/20200623 Jitsi Meet- A Free - Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up.md b/published/20200623 Jitsi Meet- A Free - Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up.md new file mode 100644 index 0000000000..48a344eca5 --- /dev/null +++ b/published/20200623 Jitsi Meet- A Free - Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12484-1.html) +[#]: subject: (Jitsi Meet: A Free & Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up) +[#]: via: (https://itsfoss.com/jitsi-meet/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Jitsi Meet:自由开源的视频会议解决方案,无需设置即可免费使用 +====== + +> Jitsi Meet 是一个开源视频会议服务,你可以免费使用它来组织在线课程、会议和聚会。你也可以在自己的服务器上托管 Jitsi。 + +在 COVID-19 大流行期间,远程工作趋势显著增长。无论你是否喜欢,视频会议对于个人和企业都是一个很好的解决方案。 + +在过去的几个月中,非常流行的视频会议服务之一就是 Zoom。但是,[关于 Zoom 视频通话][1]存在很多安全和隐私问题。 + +因此,选择一个安全且易于使用的视频会议应用来完成工作是很重要的。我敢肯定有很多选择,但是在这里,让我们看一下开源选项 [Jitsi Meet][2]。 + +### Jitsi Meet:免费使用的开源视频会议服务 + +![][3] + +Jitsi Meet 是开源语音、视频会议和即时消息服务 [Jitsi][4] 集合的一部分。 + +通过 Jitsi Meet,你可以即刻主持群组视频通话(即视频会议),你甚至都不需要建立帐户。 + +对于桌面端,它是基于浏览器的,但它以 AppImage 的形式为 Linux 提供了一个基于 Electron 的桌面应用。它也可以用在 Windows 和 macOS 上。 + +对于智能手机,它提供了 iOS 和 Android 应用,你可以分别从 App Store 和 Play Store 进行安装。除了这些,你还可以在开源 Android 应用商店 [F-Droid][5] 中找到它。 + +如果你想更进一步,你可以在你的服务器上部署 Jitsi Meet。对于那些不想使用第三方服务器的企业来说,这是理想的选择,即使该服务器来自软件开发商。 + +### Jitsi Meet 的功能 + +![][6] + +Jitsi Meet 简单但功能丰富。这是你将获得的功能: + + * 不需要用户注册 + * 使用 Etherpad 共同编辑文档 + * 能够自己部署 + * 支持集成 Slack 和 Rocket.chat + * 如果需要,提供密码保护 + * 端到端加密(beta 版) + * 背景模糊(beta 版) + * 录音选项 + * 直播流支持 + * YouTube 视频分享 + * 查看用户的网络状态 + * 集成 Google 和 Microsoft 日历 + * 聊天功能 + * 屏幕共享 + * 支持国际连接拨入 + * 你可以稍后继续视频通话,而无需会议代码 + * 低带宽模式选项 + * Jitsi 可选的桌面版本 + +![][7] + +出于显而易见的原因,你在移动应用上只能找到较少的功能。 + +请注意,[端到端加密仍处于 beta 阶段][8]。但是,即使没有它,Jitsi Meet 也应该是一个隐私友好且安全的视频会议解决方案。 + +在移动设备上,我只希望它有屏幕共享功能。除此之外,其他所有功能都很好。 + +### 如何使用 Jitsi Meet? + +![][9] + +要使它在 Linux 上运行,你不需要做任何其他事情。你只需要前往它的[官方 Jitsi Meet 实例][2],然后输入会议名称即可创建或加入。 + +如果您使用的是基于 Electron的应用程序,则完全一样。 使用桌面应用程序时的外观如下: + +![](https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-electron.png?w=800&ssl=1) + +如你在上面的截图中所见,你还可以找到你最近使用的会议室的列表,这样就不必再次输入或创建会议室。 + +![][10] + +如果你要创建它,那么最好使用唯一的名称,并且如果你不需要其他任何人意外加入,那么还应为其添加密码保护。 + +![][11] + +如果你要参加其他人的会议,只需询问会议名称或会议链接即可使用台式机或智能手机轻松加入。 + +除了少一些功能,它与桌面端的工作方式相同。我已经使用了一段时间,并且还鼓励和培训了我父亲的单位(我们的附近学校)使用 Jitsi Meet 主持在线课程。 + +即使有最多 75 名参与者的限制,它的表现也很好,而且工作良好。 + +[Jitsi Meet][12] + +### 总结 + +如果你希望托管自己的 Jitsi 实例,建议你遵循它的[官方自托管指南][13]来启动并运行它。你还可以在[它的 GitHub 页面中找到实例列表][14]。 + +Jitsi Meet 是个了不起的开源视频会议应用。它是 Zoom 和其他此类视频通话服务的一种隐私保护替代方案。 + +我还建议查看 [NextCloud,它是 MS Office 365 的开源替代方案][15]。 + +你如何看待 Jitsi Meet?你尝试过了吗?你最喜欢的视频会议工具是什么? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/jitsi-meet/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.tomsguide.com/news/zoom-security-privacy-woes +[2]: https://meet.jit.si/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-screenshot.png?ssl=1 +[4]: https://jitsi.org/ +[5]: https://f-droid.org/en/packages/org.jitsi.meet/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-smartphones.jpg?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-options-desktop.png?ssl=1 +[8]: https://jitsi.org/blog/e2ee/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-use.resized.png?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-browser-screenshot.png?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-password.png?ssl=1 +[12]: https://meet.jit.si +[13]: https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart +[14]: https://github.com/jitsi/jitsi-meet/wiki/Jitsi-Meet-Instances +[15]: https://itsfoss.com/nextcloud/ diff --git a/published/202007/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md b/published/202007/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md new file mode 100644 index 0000000000..3c9039e20f --- /dev/null +++ b/published/202007/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md @@ -0,0 +1,501 @@ +50 个绝佳的必备 Ubuntu 应用 +====== + +> 摘要:这是一份详尽清单,给所有用户的优秀的 Ubuntu 应用。这些应用将帮助你获得更好的 Linux 桌面使用体验。 + +过去,我已经多次写过关于 [安装 Ubuntu 之后该做什么][1]。每次我都建议在 Ubuntu 上安装某些关键的应用程序。 + +那么问题来了,什么是关键的 Ubuntu 应用程序?没有绝对的答案。这取决于你的需要和你在 Ubuntu 上要做的工作。 + +然而还是有很多读者请我推荐一些优秀的 Ubuntu 应用。这就是为什么我创建了这个全面的Ubuntu应用程序列表,你可以经常使用。 + +为了方便阅读和理解,清单划分为不同应用种类。 + +### 提供更好使用体验的优秀 Ubuntu 应用 + +![优秀 Ubuntu 应用][2] + +当然,你不必使用以下全部应用。只须浏览这份 Ubuntu 关键应用清单,阅读描述并安装你需要或想要的应用。将这篇文章保存在你的浏览器收藏夹以备将来参考或者通过搜索引擎搜索即可。 + +这份 Ubuntu 优秀应用清单是准备给普通 Ubuntu 用户的,因此这些应用不全是开源的。我也标记了某些可能不适合新手的稍微复杂的应用。清单适用于 Ubuntu 16.04、18.04 和其他版本。 + +除非特别声明,所有列出的软件都可以在 Ubuntu 软件中心获得。 + +如果你没有在软件中心找到应用或者缺失安装说明,请告知我,我会补充安装步骤。 + +话不多说!让我们看看有哪些优秀 Ubuntu 应用。 + +#### 浏览器 + +Ubuntu 以 Firefox 为默认浏览器。自从 Quantum 版本发布以来,Firefox 已有显著提升。就个人而言,我经常使用多个浏览器来应对不同的工作。 + +##### Google Chrome + +![Google Chrome Logo][3] + +由于某种原因,Google Chrome 是最为广泛使用的浏览器。使用 Google 账号,你可以在不同设备无缝同步。大量拓展和应用进一步增强 Chrome 的能力。你可以 [点击此处在 Ubuntu 上安装 Chrome][4]。 + +##### Brave + +![brave browser][5] + +Google Chrome 可能是最广泛使用的浏览器,但也是隐私窥探者。一个 [替代浏览器][6] 是 [Brave][7],它可以默认拦截广告和追踪脚本。它为你提供了更快、更安全的浏览体验。 + +#### 音乐应用 + +![Ubuntu 优秀音乐应用][8] + +Ubuntu 将 Rhythmbox 作为默认音乐播放器,这是个相当不坏的选择。不过,你当然可以安装更好的音乐播放器。 + +##### Sayonara + +[Sayonara][9] 是一个小型、轻量并具备漂亮的深色用户界面的音乐播放器。它拥有所有你期望的标准音乐播放器应有的关键功能。它与 Ubuntu 桌面环境整合良好并且不会大量消耗你的内存。 + +##### Audacity + +[Audacity][10] 与其说是音频播放器,不如说是音频编辑器。你可以使用这款自由且开源的工具录制和编辑音频。它支持 Linux、Windows 和 macOS。你可以从软件中心安装它。 + +##### MusicBrainz Picard + +[Picard][11] 不是一个音乐播放器,而是个音乐标签软件。如果你有大量本地音乐文件,Picard 可以帮助你自动更新音乐文件的正确的曲目、专辑、艺人资料和专辑封面。 + +#### 流媒体音乐应用 + +![Streaming Music app Ubuntu][12] + +在这个时代的互联网,听音乐的方式显然发生了改变。现在的人更依赖于流媒体音乐播放器而不是收藏上百首本地音乐文件。让我们看看你可以用于收听流媒体音乐的一些应用吧。 + +##### Spotify + +[Spotify][13] 是流媒体音乐之王。好消息是它具有官方 Linux 版本。[Ubuntu 上的 Spotify 应用][14] 与媒体键和声音菜单以及桌面通知中心整合良好。请注意,Spotify 服务可能在你的国家有,也可能没有。 + +##### Nuvola 音乐播放器 + +[Nuvola][15] 不是像 Spotify 那样的流媒体音乐服务。它是一款在单一应用内支持多个流媒体音乐服务的桌面音乐播放器。你可以使用 Spotify、Deezer、Google Play Music、Amazon Cloud Player 和更多类似服务。 + +#### 视频播放器 + +![Linux 视频播放器][16] + +Ubuntu 有默认的 GNOME 视频播放器(从前名为 Totem),表现尚可,但不支持多种视频编码。当然有很多播放器比 GNOME 视频播放器更优秀。 + +##### VLC + +自由开源的 [VLC][17] 摘得视频播放器桂冠。它几乎支持全部的视频编码。它还允许你将音量增至最高的 200%。它也支持从最后一个已知位置继续播放。有很多 [VLC 使用技巧][18] 供你参考以尽兴使用。 + +##### MPV + +[MPV][19] 是款值得更多关注的视频播放器。别致轻量的界面和丰富的功能,MPV 拥有你对一个好的视频播放器的一切期望。你甚至可以在命令行使用它。如果你对 VLC 不够满意,你完全可以尝试 MPV。 + +#### 云端存储服务 + +本地备份很好,但云端存储给你更多维度的自由。使用云存储,你再也不必总是随身携带 U 盘或担心硬盘故障。 + +##### Dropbox + +![Dropbox logo][20] + +[Dropbox][21] 是最流行的云存储提供商之一。你会获得 2GB 免费存储空间,并通过推介给他人得到更多存储空间。Dropbox 提供了一个原生的 Linux 客户端,你可以从官网下载获得。它会在你的系统创建一个本地文件夹,以和云端服务器同步。 + +##### pCloud + +![pCloud icon][22] + +[pCloud][23] 是另一个优秀的 Linux 云存储提供商。它也拥有原生的 Linux 客户端,你可以从官网下载。你可以获得高达 20GB 的免费存储空间,如果你需要更多,价格也比 Dropbox 实惠。pCloud 总部位于瑞士,这个国家以严格的数据隐私法而闻名。 + +#### 图片编辑器 + +我相信你一定会在某个时间点上需要一个照片编辑器。这里有些优秀的 Ubuntu 图片编辑应用。 + +##### GIMP + +![gimp icon][24] + +[GIMP][25] 是一个自由开源的图片编辑器,它支持 Linux、Windows 和 macOS。它是 Adobe Photoshop 在 Linux 上最优秀的替代软件。你可以使用它执行任何图片编辑。网上有许多资源帮助你使用 GIMP。 + +##### Inkscape + +![inkscape icon][26] + +[Inkscape][27] 也是一个自由开源的图片编辑器,专用于矢量图形编辑。你可以在 Inkscape 上设计矢量图形和徽标。你可以把它比做 Adobe Illustrator。与 GIMP 一样,网上也有诸多 Inkscape 教程。 + +#### 绘图应用 + +![Painting apps for Ubuntu Linux][28] + +绘图应用和图片编辑器不完全等同,尽管它们有时功能重叠。以下是你能在 Ubuntu 使用的一些绘图应用。 + +##### Krita + +[Krita][29] 是一款自由开源的数字绘图应用。你可以用它创建数字绘画、漫画和动画。这是款专业软件,甚至被美术学校作为主要软件使用。 + +##### Pinta + +[Pinta][30] 虽然不像 Krita 功能强大,但也可圈可点。你可以把它视为 Linux 端的微软画图软件。你可以绘制、画图、添加文字和执行绘图应用可行的其他诸如此类的小任务。 + +#### 摄影应用 + +摄影爱好者还是专家?你将随手获得大量 [摄影工具][31],以下是一些推荐应用。 + +##### digiKam + +![digikam][32] + +使用开源软件 [digKam][33],你可以专业地处理你的高品质摄影作品。digKam 提供用于查看、管理、编辑、增强、组织、标记和分享照片所需的所有工具。 + +##### Darktable + +![Darktable icon][34] + +[darktable][35] 是一款开源的摄影工作流应用程序,特别是专注于 raw 图像的开发。这会是你取代 Adobe Lightroom 的最佳替代品。它同样支持 Windows 和 macOS。 + +#### 视频编辑器 + +![Video editors Ubuntu][36] + +[Linux 上的视频编辑器][37] 并不匮乏,毋庸赘述。看看 Ubuntu 中一些功能丰富但相对简单的视频编辑器。 + +##### Kdenlive + +[Kdenlive][38] 是 Linux 端最好的全能型视频编辑器。它与 iMovie 或 Movie Maker 相比功能毫不逊色。 + +##### Shotcut + +[Shotcut][39] 是视频编辑的另一个好选择。它是一款开源软件,拥有标准视频编辑器的所有功能。 + +#### 图片和视频格式转换器 + +如果你需要为你的图片和视频 [转换文件格式][40],这些是我的推荐。 + +##### Xnconvert + +![xnconvert logo][41] + +[Xnconvert][42] 是一款优秀的批量图像转换工具。你可以批量调整图片尺寸、转换文件类型并重命名。 + +##### Handbrake + +![Handbrake Logo][43] + +[HandBrake][44] 是一款易用的开源工具,用于将多种格式的视频转换为一些现代流行的格式。 + +#### 截图和录屏工具 + +![Screenshot and recorders Ubuntu][45] + +以下是截图和录屏的优秀 Ubuntu 应用。 + +##### Shutter + +[Shutter][46] 是我截图的常用工具。你也可以对这些截图进行一些快速编辑,比如添加箭头、文字或调整图片尺寸。你在我们网站看到的截图都是用 Shutter 编辑的。绝对是 Ubuntu 上最好的应用程序之一。 + +##### Kazam + +[Kazam][47] 是我最喜欢的 [Linux 上的录屏工具][48]。这个是小巧的工具,可以让你录制全屏、某个应用程序窗口或选定区域。你也可以使用快捷键暂停或恢复录屏。[我们的 YouTube 频道][49] 上的教程都是用 Kazam 录制的。 + +#### 办公套件 + +我无法想象你在使用计算机时没有文档编辑器。又何必把自己局限在一个文档编辑器上呢?去寻找一个完整的办公套件吧。 + +##### LibreOffice + +![LibreOffice logo][50] + +Ubuntu 预装了 [LibreOffice][51],它无疑是 [最佳的开源办公软件][52]。它是个组件完整的办公软件,包括文档编辑器、电子表格工具、演示软件、数学工具和作图工具。你甚至可以用它编辑部分 PDF 文件。 + +##### WPS Office + +![WPS Office logo][53] + +[WPS Office][54] 因酷似微软 Office 而广受欢迎。它的界面与微软 Office 几乎一样并且号称与微软 Office 更加兼容。如果你正在寻找类似微软 Office 的办公软件,WPS Office 是个好选择。 + +#### 下载工具 + +![Downloading software Ubuntu][55] + +如果你经常从网上下载视频或其他大型文件,这些工具会帮助你。 + +##### youtube-dl + +这是本清单少有的基于命令行的 Ubuntu 应用之一。如果你想从 YouTube、DailyMotion 或其他视频网站下载视频,youtube-dl 是个绝好的选择。它提供了大量 [视频下载高级选项][56]。 + +##### uGet + +[uGet][57] 是一款功能丰富的 [Linux 下载管理器][58]。它允许你暂停和恢复下载、定时下载、监控剪贴板上的可下载内容。如果你的网络速度很慢、不稳定,或者每天的流量有限,这是一个完美的应对工具。 + +#### 代码编辑器 + +![Coding apps for Ubuntu][59] + +如果你喜欢编程,默认的 Gedit 文本编辑器可能无法满足你的编程需求。下面就为你介绍一些比较好用的代码编辑器。 + +##### Atom + +[Atom][60] 是一款由 GitHub 推出的 [自由开源的代码编辑器][61]。早在它推出第一个稳定版之前,它就因其用户界面、功能和海量插件而成为程序员的至宠。 + +##### Visual Studio Code + +[VS Code][62] 是一款微软出品的开源代码编辑器。别忌惮微软之名,VS Code 是款很棒的 Web 开发编辑器,它还支持许多其他编程语言。 + +#### PDF 和电子书相关应用 + +![eBook Management tools in Ubuntu][63] + +在这个数字时代,你不能只依靠真正的纸质书籍,特别是当有大量的免费电子书唾手可得。这里有一些 Ubuntu 应用以供管理 PDF 和电子书。 + +##### Calibre + +如果你是个书虫,并收集电子书,你应该使用 [Calibre][64]。它是一个电子书管理器,拥有 [创建电子书][65]、转换电子书格式和管理电子书库的所有必要组件。 + +##### Okular + +Okular 主要是一个 PDF 查看器,有编辑 PDF 文件的选项。你可以用 Okular 在 Linux 上做一些基本的 [PDF 编辑][66],如添加弹出式备注、内联式备注、手绘、荧光笔、印章等。 + +#### 通讯应用 + +![Messaging apps for Ubuntu][67] + +我相信你在 Linux 上使用至少一款 [通讯应用][68]。以下是我的推荐。 + +##### Skype + +[Skype][69] 是最流行的视频通讯应用。它也被许多公司和企业用于面试和会议。这使得 Skype 成为 Ubuntu 必备的应用程序之一。 + +##### Rambox + +[Rambox][70] 本身不是一个通讯应用,但它允许你从单一窗口中使用 Skype、Viber、Facebook Messanger、WhatsApp、Slack 和其他一些通讯应用。 + +#### 笔记和待办事项应用 + +需要一个待办事项应用或简单的应用来做笔记吗?看看这些吧。 + +##### Simplenote + +![Simplenote logo][71] + +[Simplenote][72] 是 WordPress 创建者 [Automattic][73] 推出的一款自由开源的笔记应用。它适用于 Windows、Linux、macOS、iOS 和 Android。你的笔记会同步到云服务器上,你可以在任何设备上访问它们。你可以从官网下载 DEB 文件。 + +##### Remember The Milk + +![Remember The Milk logo][74] + +[Remember The Milk][75] 是一款流行的待办事项应用。它适用于 Windows、Linux、macOS、iOS 和 Android。你可以在拥有的所有设备上访问你的待办事项。你也可以从浏览器访问它。它还有一个官方的 Linux 原生版本,你可以从官网下载。 + +#### 密码保护和加密 + +![Encryption software Ubuntu][76] + +如果有其他人经常使用你的电脑,也许你会考虑通过密码保护文件和文件夹来增加额外的安全。 + +##### EncryptPad + +[EncryptPad][77] 是一个开源文本编辑器,它允许你用密码锁定你的文件。你可以选择加密的类型。这个工具也有一个命令行版本。 + +##### Gnome Encfs Manager + +Gnome Encfs Manager 允许你 [在 Linux 中用密码锁定文件夹][78]。你可以将任何你想要的文件保存在一个加密文件夹中,然后用密码锁定它。 + +#### 游戏 + +![Gaming on Ubuntu][79] + +[Linux 上的游戏][80] 体验比几年前改进很多。你可以在 Linux 上畅玩大量游戏,而不用回到 Windows 了。 + +##### Steam + +[Steam][81] 是一个数字发行平台,允许你购买游戏(如果需要的话)。Steam 拥有超过 1500 款 [Linux 游戏][82]。你可以从软件中心下载 Steam 客户端。 + +##### PlayOnLinux + +[PlayOnLinux][83] 允许你在 Linux 上通过 WINE 兼容层运行 Windows 游戏。不要对它抱有太高的期望,因为并不是每个游戏都能在 PlayOnLinux 下完美运行。 + +#### 软件包管理工具 [中高级用户] + +![Package Management tools Ubuntu][84] + +Ubuntu 软件中心满足普通 Ubuntu 用户的软件需求,但你可以使用以下应用程序对其进行更多的深入操作。 + +##### Gdebi + +Gedbi 是一款小巧的软件包管理器,你可以用它来安装 DEB 文件。它比软件中心更快,而且还能处理依赖问题。 + +##### Synaptic + +十年前,Synaptic 是大多数 Linux 发行版的默认 GUI 软件包管理器。在一些 Linux 发行版中,它仍然是默认的软件包管理器。这个强大的软件包管理器在 [查找已安装的应用程序并删除它们][85] 方面特别有用。 + +#### 备份和恢复工具 + +![Backup and data recovery tools for Ubuntu][86] + +任何操作系统都应该有备份和恢复工具。让我们来看看 Ubuntu 上有哪些软件是你必须拥有的。 + +##### Timeshift + +Timeshift 是一个帮助你 [对系统进行快照][87] 的工具。这可以让你在系统配置混乱的情况下,在发生不幸的事时将系统恢复到以前的状态。不过要注意的是,它并不是你个人数据备份的最佳工具。对此,你可以使用U buntu 默认的 Deja Dup(也叫做“备份”)。 + +##### TestDisk [中级用户] + +这是本清单里另一个命令行工具。[TestDisk][88] 可以让你 [恢复 Linux 上的数据][89]。如果你不小心删除了文件,使用 TestDisk 还有机会找回来。 + +#### 系统调整和管理工具 + +![System Maintenance apps Ubuntu][90] + +##### GNOME/Unity Tweak Tool + +这些调整工具是每个 Ubuntu 用户必备的。它们允许你访问一些高级系统设置。最重要的是,你可以使用这些调整工具 [改变 Ubuntu 的主题][91]。 + +##### UFW Firewall + +[UFW][92] 意指“不复杂的防火墙”,这一点是贴切的。UFW 为家庭、工作和公共网络预先定义了防火墙设置。 + +##### Stacer + +如果你想释放 Ubuntu 的存储空间,可以试试 Stacer。这个图形化工具可以让你通过删除不必要的文件和完全卸载软件来 [优化你的 Ubuntu 系统][93]。可以从 [官网][94] 下载 Stacer。 + +#### 其他工具 + +![Utilities Ubuntu][95] + +最后,我会列一些其他我很喜欢但无法归类的 Ubuntu 应用。 + +##### Neofetch + +又多了一个命令行工具!Neofetch 可以显示你的系统信息,如 [Ubuntu 版本][96]、桌面环境、主题、图标、内存和其他信息,并附有 [发行版的 ASCII 徽标][97]。使用以下命令安装 Neofetch。 + +``` +sudo apt install neofetch +``` + +##### Etcher + +Ubuntu 已经带有一个即用 USB 创建工具,但 Etcher 能更好地完成这项任务。它同样支持 Windows 和 macOS。你可以 [点击这里][98] 下载 Etcher。 + +##### gscan2pdf + +我使用这个小工具的唯一目的是 [将图片转换为 PDF][99]。你也可以用它将多张图片合并成一个 PDF 文件。 + +##### 音频记录器 + +另一个小巧而又必不可少的 Ubuntu 应用,用于 [在 Ubuntu 上录制音频][100]。你可以用它来录制来自系统麦克风、音乐播放器或任何其他来源的声音。 + +### 你对 Ubuntu 关键应用的建议? + +我想在这里结束我的优秀 Ubuntu 应用清单。我知道你可能不需要或使用所有的应用,但我确信你会喜欢这里列出的大部分应用。 + +你是否找到几款以前从未知道的应用呢?如果要你推荐最爱的 Ubuntu 应用,你会选择哪个呢? + +最后,如果你觉得这篇文章有用,请把它分享到社交媒体或其他你常访问的社区或论坛。这样,你也帮助了我们的成长 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-ubuntu-apps/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[LikChung](https://github.com/LikChung) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/abhishek/ +[1]:https://linux.cn/article-12183-1.html +[2]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/best-ubuntu-apps-featured.jpeg +[3]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/google-chrome.jpeg +[4]:https://www.google.com/chrome/ +[5]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/brave-browser-icon.jpeg +[6]:https://itsfoss.com/open-source-browsers-linux/ +[7]:https://brave.com/ +[8]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/music-apps-ubuntu.jpeg +[9]:https://itsfoss.com/sayonara-music-player/ +[10]:https://www.audacityteam.org/ +[11]:https://itsfoss.com/musicbrainz-picard/ +[12]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/streaming-music-apps-ubuntu.jpeg +[13]:https://www.spotify.com// +[14]:https://linux.cn/article-9415-1.html +[15]:https://tiliado.eu/nuvolaplayer/ +[16]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/Video-Players-linux.jpg +[17]:https://www.videolan.org/index.html +[18]:https://linux.cn/article-11776-1.html +[19]:https://mpv.io/ +[20]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/dropbox-icon.jpeg +[21]:https://www.dropbox.com/ +[22]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/pcloud-icon.jpeg +[23]:https://itsfoss.com/recommends/pcloud/ +[24]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/gimp-icon.jpeg +[25]:https://www.gimp.org/ +[26]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/inkscape-icon.jpeg +[27]:https://inkscape.org/en/ +[28]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/paint-apps-ubuntu.jpeg +[29]:https://krita.org/en/ +[30]:https://pinta-project.com/pintaproject/pinta/ +[31]:https://itsfoss.com/image-applications-ubuntu-linux/ +[32]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/digikam-icon.jpeg +[33]:https://www.digikam.org/ +[34]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/darktable-icon.jpeg +[35]:https://www.darktable.org/ +[36]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/video-editing-apps-ubuntu.jpeg +[37]:https://linux.cn/article-10185-1.html +[38]:https://kdenlive.org/en/ +[39]:https://shotcut.org/ +[40]:https://itsfoss.com/format-factory-alternative-linux/ +[41]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/xnconvert-logo.jpeg +[42]:https://www.xnview.com/en/xnconvert/ +[43]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/handbrake-logo.jpeg +[44]:https://handbrake.fr/ +[45]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/screen-recording-ubuntu-apps.jpeg +[46]:http://shutter-project.org/ +[47]:https://launchpad.net/kazam +[48]:https://itsfoss.com/best-linux-screen-recorders/ +[49]:https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[50]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/libre-office-logo.jpeg +[51]:https://www.libreoffice.org/download/download/ +[52]:https://linux.cn/article-9379-1.html +[53]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/wps-office-logo.jpeg +[54]:http://wps-community.org/ +[55]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/download-apps-ubuntu.jpeg +[56]:https://linux.cn/article-9244-1.html +[57]:http://ugetdm.com/ +[58]:https://itsfoss.com/4-best-download-managers-for-linux/ +[59]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/coding-apps-ubuntu.jpeg +[60]:https://atom.io/ +[61]:https://linux.cn/article-7468-1.html +[62]:https://itsfoss.com/install-visual-studio-code-ubuntu/ +[63]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/pdf-management-apps-ubuntu.jpeg +[64]:https://calibre-ebook.com/ +[65]:https://linux.cn/article-7977-1.html +[66]:https://itsfoss.com/pdf-editors-linux/ +[67]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/messaging-apps-ubuntu.jpeg +[68]:https://itsfoss.com/best-messaging-apps-linux/ +[69]:https://www.skype.com/en/ +[70]:https://rambox.pro/ +[71]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/simplenote-logo.jpeg +[72]:http://simplenote.com/ +[73]:https://automattic.com/ +[74]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/remember-the-milk-logo.jpeg +[75]:https://itsfoss.com/remember-the-milk-linux/ +[76]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/encryption-apps-ubuntu.jpeg +[77]:https://linux.cn/article-9377-1.html +[78]:https://itsfoss.com/password-protect-folder-linux/ +[79]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/gaming-ubuntu.jpeg +[80]:https://linux.cn/article-7316-1.html +[81]:https://store.steampowered.com/ +[82]:https://itsfoss.com/free-linux-games/ +[83]:https://www.playonlinux.com/en/ +[84]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/package-management-apps-ubuntu.jpeg +[85]:https://itsfoss.com/how-to-add-remove-programs-in-ubuntu/ +[86]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/backup-recovery-tools-ubuntu.jpeg +[87]:https://linux.cn/article-11619-1.html +[88]:https://www.cgsecurity.org/wiki/TestDisk +[89]:https://linux.cn/article-7974-1.html +[90]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/system-maintenance-apps-ubuntu.jpeg +[91]:https://itsfoss.com/install-themes-ubuntu/ +[92]:https://wiki.ubuntu.com/UncomplicatedFirewall +[93]:https://itsfoss.com/optimize-ubuntu-stacer/ +[94]:https://github.com/oguzhaninan/Stacer +[95]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/utilities-apps-ubuntu.jpeg +[96]:https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[97]:https://itsfoss.com/display-linux-logo-in-ascii/ +[98]:https://etcher.io/ +[99]:https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/ +[100]:https://itsfoss.com/record-streaming-audio/ diff --git a/published/202007/20190213 How to build a WiFi picture frame with a Raspberry Pi.md b/published/202007/20190213 How to build a WiFi picture frame with a Raspberry Pi.md new file mode 100644 index 0000000000..6e66448709 --- /dev/null +++ b/published/202007/20190213 How to build a WiFi picture frame with a Raspberry Pi.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (this-is-name-right) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12448-1.html) +[#]: subject: (How to build a WiFi picture frame with a Raspberry Pi) +[#]: via: (https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi) +[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) + +如何用树莓派制作 WiFi 相框 +====== + +> DIY一个数码相框,图片流来自云端。 + +![](https://img.linux.net.cn/data/attachment/album/202007/24/212836agkae2776gude1cb.jpg) + +数码相框真的很好,因为它可以让你查看你自己的相片而不必打印出来。更棒的是,当你想要展示一张新的相片的时候,增加和删除数字图片要比打开传统的相框然后替换里面的相框更简单。不过,这还是需要一点手动的操作,比如从数字相框取出 SD 卡、U 盘或者其他的存储介质,然后把存储介质接入电脑,接着再复制图片进入存储介质。 + +一个更简单的选项是数字相框通过 WiFi 获得图片,例如从云端服务器获得。下面就是如何制作这样的一个数字相框。 + +### 需要使用的材料 + + * 老式 [TFT][1] 的 LCD 显示屏 + * HDMI 到 DVI 的转接线(因为 TFT 屏幕支持 DVI) + * 树莓派 3 + * Micro SD 卡 + * 树莓派的电源 + * 键盘 + * 鼠标(可选) + +使用线缆连接树莓派到显示器,并连接电源。 + +### 安装 Raspbian + +按照以下[指示][2]下载并将 Raspbian 烧录到 Micro SD 卡中。将 Micro SD 卡插入树莓派,启动它,并配置你的 WiFi。在安装完 Raspbian 后,我的第一个操作通常是运行 `sudo raspi-config`。在那里,我在网络选项中更改主机名(例如,改为 `picframe`),并在接口选项中启用 SSH 以远程连接到树莓派。使用(例如)`ssh pi@picframe` 连接到树莓派。 + +### 建立并安装云客户端 + +我使用 [Nextcloud][3] 来同步我的图片,但是你可以使用 NFS、[Dropbox][4],或者其他的适合你的需求的方式上传图片到相框。 + +如果你使用 Nextcloud,请按照[以下说明][5]在 Raspbian 上安装客户端。这可以很方便的放图片到你的相框,并且你可能很熟悉安装在台式机的这个客户端应用。当连接客户端到 Nextcloud 服务器上的时候,请确保只选择存储你要在相框上显示的图片的文件夹。 + +### 设置幻灯片放映 + +我发现设置幻灯片放映最简单的方式是使用一个专门为这个目的建立的[轻量级的幻灯片项目][6]。还有一些备用方案,像是配置屏保,这个应用似乎是最最简单设置幻灯片放映的方式了。 + +在你的树莓派上下载最新的二进制程序,解包并移动到一个可执行的文件夹里: + +``` +wget https://github.com/NautiluX/slide/releases/download/v0.9.0/slide_pi_stretch_0.9.0.tar.gz +tar xf slide_pi_stretch_0.9.0.tar.gz +mv slide_0.9.0/slide /usr/local/bin/ +``` + +安装依赖关系: + +``` +sudo apt install libexif12 qt5-default +``` + +通过执行下面的命令播放幻灯片(不要忘记修改图片的路径)。如果你通过 SSH 访问你树莓派,设置 `DISPLAY` 变量来在连接到树莓派显示屏上开始播放幻灯片。 + +``` +DISPLAY=:0.0 slide -p /home/pi/nextcloud/picframe +``` + +### 自动播放幻灯片 + +为了在 Raspbian Stretch 上自动播放幻灯片,建立如下的文件夹并且添加一个 `autostart` 文件到里面: + +``` +mkdir -p /home/pi/.config/lxsession/LXDE/ +vi /home/pi/.config/lxsession/LXDE/autostart +``` + +在文件中输入如下的命令来自动开启幻灯片。`slide` 命令可以调整到你需要的地方: + +``` +@xset s noblank +@xset s off +@xset -dpms +@slide -p -t 60 -o 200 -p /home/pi/nextcloud/picframe +``` + +禁止屏幕空白,树莓派通常会在 10 分钟后这样做,通过编辑下面的文件修改: + +``` +vi /etc/lightdm/lightdm.conf +``` + +添加这两行到文件末尾: + +``` +[SeatDefaults] +xserver-command=X -s 0 -dpms +``` + +### 配置上电时间 + +你可以安排你的相框什么时候打开和关闭通过使用两个简单的定时任务。例如,你想在上午 7 点自动打开,在晚上 11 点自动关闭。运行 `crontab -e` 并且输入下面的两行: + +``` +0 23 * * * /opt/vc/bin/tvservice -o +0 7 * * * /opt/vc/bin/tvservice -p && sudo systemctl restart display-manager +``` + +注意这不会打开或关闭树莓派的电源;这只会关闭 HDMI,它会关闭屏幕。第一行命令将在晚上 11 点关闭 HDMI。第二行将在早上 7 点打开显示屏并重启显示器管理器。 + +### 附言 + +通过这些简单的步骤,你创建了你自己 WiFi 相框。如果你想要让它更好看,为显示屏做一个木质相框吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi + +作者:[Manuel Dewald][a] +选题:[lujun9972][b] +译者:[this-is-name-right](https://github.com/this-is-name-right) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ntlx +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Thin-film-transistor_liquid-crystal_display +[2]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[3]: https://nextcloud.com/ +[4]: http://dropbox.com/ +[5]: https://github.com/nextcloud/client_theming#building-on-debian +[6]: https://github.com/NautiluX/slide/releases/tag/v0.9.0 diff --git a/published/202007/20190624 Book Review- A Byte of Vim.md b/published/202007/20190624 Book Review- A Byte of Vim.md new file mode 100644 index 0000000000..d0cbb158b6 --- /dev/null +++ b/published/202007/20190624 Book Review- A Byte of Vim.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12441-1.html) +[#]: subject: (Book Review: A Byte of Vim) +[#]: via: (https://itsfoss.com/book-review-a-byte-of-vim/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +《A Byte of Vim》书评 +====== + +[Vim][1] 是一个简单而又强大的文本编辑工具。大多数新用户都会被它吓倒,因为它不像常规的图形化文本编辑器那样“工作”。Vim “不寻常”的键盘快捷键让人不知道[如何保存并退出 Vim][2]。但一旦你掌握了 Vim,就没有什么能比得上它了。 + +网上有大量的 [Vim 资源][3]。我们也在介绍了一些 Vim 技巧。除了线上资源,也有很多书致力于介绍这个编辑器。今天,我们要介绍的是一本旨在使大多数用户轻松理解 Vim 的书。我们将讨论的书是 [Swaroop C H][5] 撰写的《[A Byte of Vim][4]》。 + +本书作者 [Swaroop C H][5] 已经在计算机领域工作了十余年,他曾在 Yahoo 和 Adobe 工作过。大学毕业后,他卖过 Linux CD,也曾多次创业,也是一个创建了一个名为 ion 的 iPod 充电器的团队的联合创始人。他目前是 [Helpshift][7] AI 团队的工程经理。 + +### 《A Byte of Vim》 + +![][8] + +像所有好书一样,《A Byte of Vim》一开始就谈到了什么是 Vim:“一个用于写各类文本的计算机程序。”他接着说:“Vim 之所以与众不同,是因为它是为数不多的既简单又强大的软件之一。” + +在深入讲解如何使用 Vim 之前,Swaroop 先告诉读者如何在 Windows、Mac、Linux 和 BSD 上安装 Vim。安装完成后,他进而指导读者完成如何启动 Vim,以及如何创建第一个文件。 + +接着,Swaroop 讨论了 Vim 的不同模式,以及如何通过 Vim 的键盘快捷键来浏览文档。接着是使用 Vim 编辑文档的基础知识,包括如何在 Vim 中剪切/复制/粘帖以及撤销/重做。 + +在介绍了编辑基础知识后,Swaroop 介绍了如何使用 Vim 来编辑单个文档的多个部分。你也可以使用多个标签和窗口来同时编辑多个文档。 + +本书还涵盖了通过编写脚本和安装插件来扩展 Vim 的功能。在 Vim 中使用脚本有两种方法,一种是使用 Vim 的内置脚本语言,另一种是使用 Python 或 Perl 等编程语言来访问 Vim 的内核。可以编写或下载五种类型的 Vim 插件:vimrc、全局插件、文件类型插件、语法高亮插件和编译器插件。 + +在一个单独的章节中,Swaroop C H 介绍了使 Vim 更适合编程的特点。这些功能包括语法高亮、智能缩进、对 Shell 命令的支持、全局补全以及可用作 IDE 使用的功能。 + +#### 获取《A Byte of Vim》一书并为之贡献 + +《A Byte of Vim》按照 [共创协议 4.0][10]授权。读者可以在[作者的主页][4]上免费阅读其在线版本。你也可以免费下载其 [PDF][11]、[Epub][12] 或者 [Mobi][13] 版本。 + +- [免费获取《A Byte of Vim》][4] + +如果你更喜欢阅读[纸质版本][14],你也可以选择该方式。 + +请注意,**《A Byte of Vim》的初始版本写于 2008**,并转换为 PDf。不幸的是,Swaroop CH丢失了原始源文件。他正在努力将该书转换为 [Markdown][15]。如果你想提供帮助,请访问[该书的 GitHub 页面][16]。 + +#### 结语 + +当我初次对着 Vim 生气时,我不知道该怎么办。我希望那时候我就知道《A Byte of Vim》这本书。对于任何学习 Linux 的人来说,这本书都是不错的资源,特别是当你开始学习命令行的时候。 + +你读过 Swaroop C H 的《[A Byte of Vim][4]》吗?如果读过,你是如何找到它的?如果不是,那么你最喜欢关于开源主题的是哪本书?请在下方评论区告诉我们。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/book-review-a-byte-of-vim/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://www.vim.org/ +[2]: https://itsfoss.com/how-to-exit-vim/ +[3]: https://linuxhandbook.com/basic-vim-commands/ +[4]: https://vim.swaroopch.com/ +[5]: https://swaroopch.com/ +[6]: https://swaroopch.com/about/ +[7]: https://www.helpshift.com/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/Byte-of-vim-book.png?resize=800%2C450&ssl=1 +[9]: https://itsfoss.com/4mlinux-review/ +[10]: https://creativecommons.org/licenses/by/4.0/ +[11]: https://www.gitbook.com/download/pdf/book/swaroopch/byte-of-vim +[12]: https://www.gitbook.com/download/epub/book/swaroopch/byte-of-vim +[13]: https://www.gitbook.com/download/mobi/book/swaroopch/byte-of-vim +[14]: https://swaroopch.com/buybook/ +[15]: https://itsfoss.com/best-markdown-editors-linux/ +[16]: https://github.com/swaroopch/byte-of-vim#status-incomplete +[17]: https://i2.wp.com/images-na.ssl-images-amazon.com/images/I/41itW8furUL._SL160_.jpg?ssl=1 +[18]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Mastering Vim Quickly: From WTF to OMG in no time) +[19]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[20]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Buy on Amazon) +[21]: https://itsfoss.com/iridium-browser-review/ +[22]: http://reddit.com/r/linuxusersgroup diff --git a/published/202007/20190702 One CI-CD pipeline per product to rule them all.md b/published/202007/20190702 One CI-CD pipeline per product to rule them all.md new file mode 100644 index 0000000000..b093c265ef --- /dev/null +++ b/published/202007/20190702 One CI-CD pipeline per product to rule them all.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: (chunibyo-wly) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12392-1.html) +[#]: subject: (One CI/CD pipeline per product to rule them all) +[#]: via: (https://opensource.com/article/19/7/cicd-pipeline-rule-them-all) +[#]: author: (Willy-Peter Schaub https://opensource.com/users/wpschaub/users/bclaster/users/matt-micene/users/barkerd427) + +使用一条 CI/CD 流水线管理所有的产品 +====== + +> 统一的持续集成与持续交付的流水线的构想是一种梦想吗? + +![](https://img.linux.net.cn/data/attachment/album/202007/07/224752iib7xgh7icr8478f.jpg) + +当我加入 WorkSafeBC 负责云端运维和工程流程优化的云端运维团队时,我和大家分享了我的梦想,那就是一个工具化的流水线,每一个产品都可以持续集成和持续交付。 + +根据 Lukas Klose 的说法,[流程][2]flow(在软件工程的语境内)是“软件系统以稳定和可预测的速度创造价值的状态”。我认为这是最大的挑战和机遇之一,特别是在复杂的新兴解决方案领域。我力求通过一种持续、高效和优质的解决方案,提供一种持续交付模式,并且能够构建正确的事物让我们的用户感到满意。想办法把我们的系统分解成更小的碎片,这些碎片本身是有价值的,使团队能够渐进式地交付价值。这需要业务和工程部门改变思维方式。 + +### 持续集成和持续交付的(CI/CD)流水线 + +CI/CD 流水线是一种 DevOps 实践,用于更频繁、一致、可靠的地交付代码变更。它可以帮助敏捷开发团队提高**部署频率**,减少**变更准备时间**、**变更失败率**和关键绩效指标(KPI)的**平均恢复时间**,从而提高质量并且实现更快的交付。唯一的先决条件就是坚实的开发流程、对质量的心态和对需求从构想到废弃的责任心,以及一个全面的流水线(如下图所示)。 + +![Prerequisites for a solid development process][3] + +它简化了工程流程和产品,以稳定基础架构环境;优化工作流程;并创建一致的、可重复的、自动化的任务。正如 Dave Snowden 的 [Cynefin Sensemaking][4] 模型所说的那样,这样就允许我们将复杂不可解决的任务变成了复杂可解决的任务,降低了维护成本,提高了质量和可靠性。 + +精简流程的一部分是将 [浪费实践类型][5]wasteful practice types Muri(过载)、Mura(变异)和 Muda(浪费)的浪费降低最低。 + + * **Muri(过载)**:避免过度工程化,避免与商业价值不相关的功能以及过多的文档。 + * **Mura(变异)**:改善审批和验证流程(比如,安全签批);推动 [左移提前][6]shift-left 策略以推行单元测试、安全漏洞扫描与代码质量检查;并改进风险评定。 + * **Muda(浪费)**:避免技术债、错误或前期的详细文档等浪费。 + +看起来 80% 的重点都集中在提供一种可以集成和协作的工程产品上,这些系统可以采用一个创意和计划、开发、测试和监控你的解决方案。然而,一个成功的转型和工程系统是由 5% 的产品、15% 的过程和 80% 的开发人员组成的。 + +我们可以使用的产品有很多。比如,Azure DevOps 为持续集成(CI)、持续交付(CD)和可扩展性提供了丰富支持,并与 Stryker、SonarQube、WhiteSource、Jenkins 和 Octopus 等开源集成和商用成品(COTS)软件即服务(SaaS)进行集成。对于工程师来说,关注产品总是一种诱惑,但请记住,它们只是我们旅程的 5%。 + +![5% about products, 15% about process, 80% about people][7] + +最大的挑战是打破数十年的规则、规定和已经步入舒适区的流程:“*我们一直都是这样做的;为什么需要改变呢?*” + +开发和运维人员之间的摩擦导致了各种支离破碎的、重复的、不间断的集成和交付流水线。开发人员希望能访问所有东西,以便持续迭代,让用户使用起来和持续地快速发布。运维人员希望将所有东西锁起来,保护业务、用户和品质。这些矛盾在不经意间导致了很难做到一种自动化的流程,进而导致发布周期晚于预期。 + +让我们使用最近的一次白板讨论中的片段来探索流水线。 + +想要支持流水线的变化是一项困难并且花费巨大的工作;版本和可追溯性的不一致使得这个问题变得更加复杂,因此不断精简开发流程和流水线是一项挑战。 + +![Improving quality and visibility of pipelines][8] + +我主张一些原则使得每个产品都能使用通用流水线: + + * 使一切可自动化的东西都自动化 + * 一次构建 + * 保持持续集成和持续交付 + * 保持持续精简和改进 + * 保持一个构建的定义 + * 保持一个发布流水线的定义 + * 尽早、频繁地扫描漏洞,并且*尽快失败* + * 尽早、频繁地进行测试,并且*尽快失败* + * 保持已发布版本的可追踪和监控 + +但是,如果我要打破这些,最重要的原则就是*保持简单*。如果你不能说明流水线化的原因(是什么、为什么)和过程(如何),你或许是不了解自己的软件过程的。我们大多数人想要的不是最好的、超现代的和具有革命意义的流水线 —— 我们仅仅是需要一个功能强大的、有价值的和能促进工程的流水线。首先需要解决的是那 80% —— 文化、人员和他们的心态。请你的 CI/CD 骑士们穿上闪亮的盔甲,在他们的盾牌上贴上 TLA(两个/三个字母的缩写two/three-lettered acronym)符号,加入到实践和经验工程的力量中来。 + +### 统一流水线 + +让我们逐步完成我们的白板会议实践。 + +![CI build/CD release pipeline][9] + +每个应用使用一套构建定义来定义一个 CI/CD 流水线,用来触发*拉取请求的预合并验证*与*持续集成*的构建。生成一个带有调试信息的*发布*的构建,并且将其上传到 [符号服务器][10]。这使开发人员可以在本地和远程生产环境进行调试,而在不用考虑需要加载哪个构建和符号,符号服务器为我们施展了这样的魔法。 + +![Breaking down the CI build pipeline][11] + +在构建过程中进行尽可能多的验证(*左移提前*),这允许开发新特性的团队可以尽快失败,不断的提高整体的产品质量,并在拉取请求中为代码审核人员提供宝贵证据。你喜欢有大量提交的拉取请求吗?还是一个带有少数提交和提供了漏洞检查、测试覆盖率、代码质量检查和 [Stryker][12] 突变残余等支持的拉取请求?就我个人而言,我投后者的票。 + +![Breaking down the CD release pipeline][13] + +不要使用构建转换来生成多个特定环境的构建。通过一个构建实现*发布时转换*、*标记化*和 XML/JSON 的*值替换*。换句话说,*右移滞后*具体环境的配置。 + +![Shift-right the environment-specific configuration][14] + +安全存储发布配置数据,并且根据数据的*信任度*和*敏感度*,让开发和运维都能使用。使用开源的密钥管理工具、Azure 密钥保险库、AWS 密钥管理服务或者其他产品,记住你的工具箱中有很多方便的工具。 + +![Dev-QA-production pipeline][15] + +使用*用户组*而不是*用户*,将审批人管理从跨多个流水线的多个阶段移动到简单的组成员。 + +![Move approver management to simple group membership][16] + +创建一条流水线并且对赋予特定的交付阶段的权限,而不是重复流水线让团队进入他们感兴趣的地方。 + +![Pipeline with access to specific delivery stages][17] + +最后,但并非最不重要的是,拥抱拉取请求,以帮助提高对代码仓库的洞察力和透明度,增进整体质量、协作,并将预验证构建发布到选定的环境,比如,开发环境。 + +这是整个白板更正式的视图。 + +![The full pipeline][18] + +所以,你对 CI/CD 流水线有什么想法和经验?我的通过*一条流水线来管理它们*的这个梦想是空想吗? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all + +作者:[Willy-Peter Schaub][a] +选题:[lujun9972][b] +译者:[chunibyo-wly](https://github.com/chunibyo-wly) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/wpschaub/users/bclaster/users/matt-micene/users/barkerd427 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) +[2]: https://continuingstudies.sauder.ubc.ca/courses/agile-delivery-methods/ii861 +[3]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-2.png (Prerequisites for a solid development process) +[4]: https://en.wikipedia.org/wiki/Cynefin_framework +[5]: https://www.lean.org/lexicon/muda-mura-muri +[6]: https://en.wikipedia.org/wiki/Shift_left_testing +[7]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-3.png (5% about products, 15% about process, 80% about people) +[8]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-4_0.png (Improving quality and visibility of pipelines) +[9]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-5_0.png (CI build/CD release pipeline) +[10]: https://en.wikipedia.org/wiki/Microsoft_Symbol_Server +[11]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-6.png (Breaking down the CI build pipeline) +[12]: https://stryker-mutator.io/ +[13]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-7.png (Breaking down the CD release pipeline) +[14]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-8.png (Shift-right the environment-specific configuration) +[15]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-9.png (Dev-QA-production pipeline) +[16]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-10.png (Move approver management to simple group membership) +[17]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-11.png (Pipeline with access to specific delivery stages) +[18]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-12.png (The full pipeline) diff --git a/published/202007/20190808 Sending custom emails with Python.md b/published/202007/20190808 Sending custom emails with Python.md new file mode 100644 index 0000000000..d27fc38226 --- /dev/null +++ b/published/202007/20190808 Sending custom emails with Python.md @@ -0,0 +1,268 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12452-1.html) +[#]: subject: (Sending custom emails with Python) +[#]: via: (https://opensource.com/article/19/8/sending-custom-emails-python) +[#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbie) + +使用 Mailmerge 发送定制邮件 +====== + +> Mailmerge 是一个可以定制群发邮件的命令行程序,它可以处理简单和复杂的邮件。 + +![](https://img.linux.net.cn/data/attachment/album/202007/25/233710lqkvko0jdbh1jzul.jpg) + +电子邮件还是生活的一部分,尽管有种种不足,它仍然是大多数人发送信息的最佳方式,尤其是在按队列将邮件发送给收件人的自动化方式中。 + +作为 [Fedora 社区行动和影响协调员][2],我的工作之一就是给人们发送资助旅行相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用 [Mailmerge][3] 向一群人发送定制邮件的,Mailmerge 是一个可以处理简单和复杂的邮件的命令行程序。 + +### 安装 Mailmerge + +在 Fedora 中,Mailmerge 已经打包可用,你可以通过在命令行中运行 `sudo dnf install python3-mailmerge` 来安装它。你还可以使用 `pip` 命令从 PyPi 中安装,具体可以参阅该项目的 [README][4]。 + +### 配置 Mailmerge + +三个配置文件控制着 Mailmerge 的工作模式。运行 `mailmerge --sample`,将生成配置文件模板。这些文件包括: + + * `mailmerge_server.conf:` 这里保存着 SMTP 服务端邮件发送相关详细配置,但你的密码 *不* 在这里保存。 + * `mailmerge_database.csv:` 这里保存每封邮件的定制数据,包括收件人的电子邮件地址。 + * `mailmerge_template.txt:` 这里保存电子邮件的文本,文本中包含占位符,这些占位符会使用 `mailmerge_database.csv` 中的数据替换。 + +#### Server.conf + +配置模板文件 `mailmerge_server.conf` 包含几个大家应该很熟悉的例子。如果你曾经往手机上添加过电子邮件或者设置过桌面电子邮件客户端,那你就应该看到过这些数据。需要提醒的是要记得把你的用户名更新到这个文件中,尤其是在你使用模板所提供的配置时。 + +#### Database.csv + +`mailmerge_database.csv` 这个配置文件稍微有点复杂。最起码要将邮件接收者的电子邮件地址保存在这里,其它在电子邮件中任何需要替换的定制信息也要保存在这里。推荐在创建本文件的占位符列表时,同步编辑 `mailmerge_template.txt` 文件。我发现一个有效的做法是,使用电子表格软件录入这些数据,完成后导出为 CSV 文件。使用下面的示例文件: + +``` +email,name,number +myself@mydomain.com,"Myself",17 +bob@bobdomain.com,"Bob",42 +``` + +可以你向这两个人发送电子邮件,使用他们的名字并告诉他们一个数字。这个示例文件虽然不是特别有趣,但应用了一个重要的原则,那就是:始终让自己处于邮件接收列表的首位。这样你可以在向列表全员发送邮件之前,先给自己发送一个测试邮件,以验证邮件的效果是否如你预期。 + +任何包含半角逗号的值,都 **必须** 以半角双引号(`"`)封闭。如果恰好在半角双引号封闭的区域需要有一个半角双引号,那就在同一行中连续使用两个半角双引号。引号的规则比较有趣,去 [Python 3 中关于 CSV 的内容中][7] 一探究竟吧。 + +#### Template.txt + +我的工作之一,就是为我们 Fedora 贡献者会议 [Flock][8] 发送与旅行基金有关的信息。通过简单的邮件告诉有关的人,他被选中为旅行基金支持的幸运者,以及相应基金支持的详细信息。与接收者相关的具体信息之一就是我们可以为他的旅行提供多少资助。下面是一份我的节略后的模板文件(为了简洁,已经移除大量的文本): + +``` +$ cat mailmerge_template.txt +TO: {{Email}} +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd + + +Hi {{Name}}, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: {{Travel_Budget}} + + +<> +``` + +模板的起头定义了邮件的接收者、发送者和主题。在空行之后,是邮件的内容。该邮件需要从 `database.csv` 文件中获取接收者的 `Email` 、`Name` 和 `Travel_Budget` 。注意,上述这些占位符是由双大括弧( `{{`、`}}` )封闭的。相应的 `mailmerge_database.csv` 如下: + +``` +$ cat mailmerge_database.csv +Name,Email,Travel_Budget +Brian,bexelbie@redhat.com,1000 +PersonA,persona@fedoraproject.org,1500 +PèrsonB,personb@fedoraproject.org,500 +``` + +注意,我把自己的信息放在了首条,这是为了测试方便。除了我,还有另外两个人的信息在文档中。列表中的第二个人 PèrsonB,他的名字中有一个包含变音符号的字母,Mailmerge 会对这类字母自动编码。 + +以上包含了模板的全部知识点:写上你自己的电子邮件信息,并编写好以双大括弧封闭的占位符。接下来创建用来提供前述占位符具体值的数据文件。现在测试一下电子邮件的效果。 + +### 测试并发送简单邮件 + +#### 试运行 + +测试从邮件的试运行开始,试运行就是讲邮件内容显示出来,所有的占位符都会被具体值取代。默认情况下,如果你运行不带参数的命令 `mailmerge`,它将对收件列表中的第一个人进行试运行: + +``` +$ mailmerge +>>> encoding ascii +>>> message 0 +TO: bexelbie@redhat.com +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Date: Sat, 20 Jul 2019 18:17:15 -0000 + + +Hi Brian, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: 1000 + + +<> + + +>>> sent message 0 DRY RUN +>>> No attachments were sent with the emails. +>>> Limit was 1 messages. To remove the limit, use the --no-limit option. +>>> This was a dry run. To send messages, use the --no-dry-run option. +``` + +从试运行生成的邮件中(列表中的 `message 0` ,和计算机中很多计数场景一样,计数从 0 开始),可以看到我的名字及旅行预算是正确的。如果你想检视所有的邮件,运行 `mailmerge --no-limit`,告诉 Mailmerge 不要仅仅处理第一个收件人的信息。下面是第三个收件人邮件的试运行结果,用来测试特殊字符的编码: + +``` +>>> message 2 +TO: personb@fedoraproject.org +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +MIME-Version: 1.0 +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Date: Sat, 20 Jul 2019 18:22:48 -0000 + + +Hi P=E8rsonB, +``` + +没有问题,`P=E8rsonB` 是 `PèrsonB` 的编码形式。 + +#### 发送测试信息 + +现在,运行 `mailmerge --no-dry-run`,Mailmerge 将向收件人列表中的第一个人发送电子邮件: + +``` +$ mailmerge --no-dry-run +>>> encoding ascii +>>> message 0 +TO: bexelbie@redhat.com +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Date: Sat, 20 Jul 2019 18:25:45 -0000 + + +Hi Brian, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: 1000 + + +<> + + +>>> Read SMTP server configuration from mailmerge_server.conf +>>> host = smtp.gmail.com +>>> port = 587 +>>> username = bexelbie@redhat.com +>>> security = STARTTLS +>>> password for bexelbie@redhat.com on smtp.gmail.com: +>>> sent message 0 +>>> No attachments were sent with the emails. +>>> Limit was 1 messages. To remove the limit, use the --no-limit option. +``` + +在倒数第 4 行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是 Gmail 或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。上述这些操作不会影响邮件系统的安全性,但是仍然有必要采用复杂的安全性好的密码。 + +我在我的邮件收件箱中,看到了这封格式美观的测试邮件。如果测试邮件看起来没有问题,那就可以运行 `mailmerge --no-dry-run --no-limit` 发送所有的邮件了。 + +### 发送复杂邮件 + +只有充分了解了 [Jinja2 模板][12] ,你才可能充分领略 Mailmerge 真正的威力。在邮件模板中使用条件语句及附带附件,是很有用的。下面就是一个复杂邮件的模板及对应的数据文件: + +``` +$ cat mailmerge_template.txt +TO: {{Email}} +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +ATTACHMENT: attachments/{{File}} + + +Hi {{Name}}, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: {{Travel_Budget}} +{% if Hotel == "Yes" -%} +Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) +{%- endif %} + + +<> + + +$ cat mailmerge_database.csv +Name,Email,Travel_Budget,Hotel,File +Brian,bexelbie@redhat.com,1000,Yes,visa_bex.pdf +PersonA,persona@fedoraproject.org,1500,No,visa_person_a.pdf +PèrsonB,personb@fedoraproject.org,500,Yes,visa_person_b.pdf +``` + +在这个邮件中有两项新内容。首先是附件,我需要向参加国际旅行的人发送签证邀请信,帮助他们来 Flock,文件头的 `ATTACHMENT` 部分说明了要包含什么文件;为了保持我的文档目录清晰,我将所有需要作为附件的文档保存于附件子目录下。其次是包含了关于宾馆的条件信息,因为有些人的旅行资金包含了住宿费用,我需要对涉及住宿的人员诉及相关信息,而这是通过 `if` 判断实现的: + +``` +{% if Hotel == "Yes" -%} +Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) +{%- endif %} +``` + +这和大多数编程语言中的 `if` 判断是一样的。Jinja2 实力非凡,可以实现多级判断。通过包含数据元素控制邮件内容,能大大简化相关的日常工作。空格的正确使用对邮件的易读性很重要。`if` 和 `endif` 语句中的短线( `-` )是 Jinja2 控制 [空白字符][13] 的一部分。这里面选项很多,所以还是要通过试验找到最适合自己的方式。 + +在上面的例子中,我在数据文件扩充了 `Hotel` 和 `File` 两个字段,这些字段的值控制着宾馆信息和附件文件名。另外,在上例中,我和 PèrsonB 有住宿资助,但 PersonA 没有。 + +对于简单邮件和复杂邮件而言,试运行及正式发送邮件的操作都是相同的。快去试试吧! + +你还可以尝试在邮件头中使用条件判断( `if` … `endif` ),比如你可以使发送给在数据库中的某人的邮件包含附件,或者改变对部分人改变发送人的信息。 + +### Mailmerge 的优点 + +Mailmerge 是用来批量发送定制邮件的简洁而高效的工具。每个人只接受到他需要的信息,其它额外的操作和细节都是透明的。 + +我还发现,即使是在发送简单的集团邮件时,相对于使用 CC 或者 BCC 向一组受众发送一封邮件,采用 Mailmerge 也是非常高效的。很多人使用了邮件过滤,那些不是直接发给他们的邮件,他们一律不会立刻处理。使用 Mailmerge 保证了每名接收者收到的就是自己的邮件。所有的信息会对接收者进行正确过滤,再也不会有人无意间回复到整个邮件组。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/sending-custom-emails-python + +作者:[Brian "bex" Exelbierd][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bexelbie +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://docs.fedoraproject.org/en-US/council/fcaic/ +[3]: https://github.com/awdeorio/mailmerge +[4]: https://github.com/awdeorio/mailmerge#install +[5]: mailto:myself@mydomain.com +[6]: mailto:bob@bobdomain.com +[7]: https://docs.python.org/3/library/csv.html +[8]: https://flocktofedora.org/ +[9]: mailto:bexelbie@redhat.com +[10]: mailto:persona@fedoraproject.org +[11]: mailto:personb@fedoraproject.org +[12]: http://jinja.pocoo.org/docs/latest/templates/ +[13]: http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control diff --git a/published/202007/20191031 4 Python tools for getting started with astronomy.md b/published/202007/20191031 4 Python tools for getting started with astronomy.md new file mode 100644 index 0000000000..e197bd3721 --- /dev/null +++ b/published/202007/20191031 4 Python tools for getting started with astronomy.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12459-1.html) +[#]: subject: (4 Python tools for getting started with astronomy) +[#]: via: (https://opensource.com/article/19/10/python-astronomy-open-data) +[#]: author: (Gina Helfrich, Ph.D. https://opensource.com/users/ginahelfrich) + +开启天文之路的 4 个 Python 工具 +====== + +> 使用 NumPy、SciPy、Scikit-Image 和 Astropy 探索宇宙 + +![](https://img.linux.net.cn/data/attachment/album/202007/27/223146sjfgbj9jfu9m1z2c.jpg) + +### 天文学与 Python + +对科学界而言,尤其是对天文学界来说,Python 是一种伟大的语言工具。各种软件包,如 [NumPy][5]、[SciPy][6]、[Scikit-Image][7] 和 [Astropy][8],(仅举几例) ,都充分证明了 Python 对天文学的适用性,而且有很多用例。(NumPy、Astropy 和 SciPy 是 NumFOCUS 提供资金支持的项目;Scikit-Image 是个隶属项目)。我在十几年前脱离天文研究领域,成为了软件开发者之后,对这些工具包的演进一直很感兴趣。我的很多前天文界同事在他们的研究中,使用着前面提到的大部分甚至是全部工具包。以我为例,我也曾为位于智利的超大口径望远镜(VLT)上的仪器编写过专业天文软件工具包。 + +最近令我吃惊的是,Python 工具包竟然演进到如此好用,任何人都可以轻松编写 [数据还原][9]data reduction 脚本,产生出高质量的数据产品。天文数据易于获取,而且大部分是可以公开使用的,你要做的只是去寻找相关数据。 + +比如,负责 VLT 运行的 ESO,直接在他们的网站上提供数据下载服务,只要访问 [www.eso.org/UserPortal][10] 并在首页创建用户就可以享有数据下载服务。如果你需要 SPHERE 数据,可以下载附近任何一个包含系外行星exoplanet或者原恒星盘proto-stellar discs的恒星的全部数据集。对任何 Python 高手而言,通过还原数据发现深藏于噪声中的行星或者原恒星盘,实在是件令人兴奋的事。 + +我鼓励你下载 ESO 或其它天文影像数据,开启你的探索历程。这里提供几条建议: + +1. 首先要有一个高质量的数据集。看一些有关包含系外行星或者原恒星盘的较近恒星的论文,然后在 之类的网站检索数据。需要注意的是,前述网站上的数据有的标注为红色,有的标注为绿色,标注为红色的数据是尚未公开的,在相应的“发布日期”处会注明数据将来公开的时间。 +2. 了解一些用于获取你所用数据的仪器的信息。尽量对数据的获取有一个基本的理解,对标准的数据还原之后应该是什么样子做到心中有数。所有的望远镜和仪器都有这方面的文档供公开获取。 +3. 必须考虑天文数据的标准问题,并予以校正: + + 1. 数据以 FITS 格式文件保存。需要使用 `pyfits` 或者 `astropy` (包含 `pyfits` )将其读入到 `NumPy` 数组。有些情况下,数据是三维的,需要沿 z 轴使用 `numpy.median` 将数据转换为二维数组。有些 SPHERE 数据在同一幅影像中包含了同一片天空的两份拷贝(各自使用了不同的滤波器),这时候需要使用 **索引** 和 **切片** 将它们分离出来。 + 2. 全黑图master dark坏点图bad pixel map。所有仪器都有快门全关(完全无光)状态拍摄的特殊图片,使用 **NumPy 掩膜数组** 从中分离出坏点图。坏点图非常重要,你在合成最终的清晰图像过程中,需要持续跟踪坏点。有些情况下,这还有助于你从原始科学数据中扣除暗背景的操作。 + 3. 一般情况下,天文仪器还要拍标准响应图master flat frame。这是对均匀的单色标准光源拍摄的一张或者一组图片。你需要将所有的原始数据除以标准响应之后再做后续处理(同样,使用 Numpy 掩膜数组实现的话,这仅仅是一个简单的除法运算)。 + 4. 对行星影像,为了使行星在明亮恒星背景下变得可见,需要仰仗日冕仪coronagraph角差分成像angular differential imaging技术。这一步需要识别影像的光学中心,这是比较棘手的环节之一,过程中要使用 `skimage.feature.blob_dog` 从原始影像中寻找一些人工辅助影像作为帮助。 +4. 要有耐心。理解数据格式并弄清如何操作需要一些时间,绘出像素数据曲线图或者统计图有助于你的理解。贵在坚持,必有收获!你会从中学到很多关于图像数据及其处理的知识。 + +综合应用 NumPy、SciPy、Astropy、scikit-image 及其它工具,结合耐心和恒心,通过分析大量可用的天文数据分析实现重大的发现是非常有可能的。说不定,你会成为某个之前被忽略的系外行星的第一发现者呢。祝你好运! + +--- + +NumFOCUS 是个非盈利组织,维护着一套科学计算与数据科学方面的杰出开源工具集。如果想了解我们的任务及代码,可以访问 [numfocus.org][3]。如果你有兴趣以个人身份加入 NumFOCUS 社区,可以关注你所在地区的 [PyData 活动][4]。 + +本文基于 Pivigo CTO [Ole Moeller-Nilsson][12] 的一次 [谈话][11],最初发布于 NumFOCUS 的博客,蒙允再次发布。如果你有意支持 NumFOCUS,可以 [捐赠][13],也可以参与遍布全球的 [PyData 活动][4] 中你身边的那些。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/python-astronomy-open-data + +作者:[Gina Helfrich, Ph.D.][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ginahelfrich +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars) +[2]: https://numfocus.org/blog +[3]: https://numfocus.org +[4]: https://pydata.org/ +[5]: http://numpy.scipy.org/ +[6]: http://www.scipy.org/ +[7]: http://scikit-image.org/ +[8]: http://www.astropy.org/ +[9]: https://en.wikipedia.org/wiki/Data_reduction +[10]: http://www.eso.org/UserPortal +[11]: https://www.slideshare.net/OleMoellerNilsson/pydata-lonon-finding-planets-with-python +[12]: https://twitter.com/olly_mn +[13]: https://numfocus.org/donate diff --git a/published/202007/20200103 What you need to know about Rust in 2020.md b/published/202007/20200103 What you need to know about Rust in 2020.md new file mode 100644 index 0000000000..50a2b02f43 --- /dev/null +++ b/published/202007/20200103 What you need to know about Rust in 2020.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12469-1.html) +[#]: subject: (What you need to know about Rust in 2020) +[#]: via: (https://opensource.com/article/20/1/rust-resources) +[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) + +2020 年关于 Rust 你所需要知道的 +====== + +> 尽管许多程序员长期以来一直将 Rust 用于业余爱好项目,但正如许多有关 Rust 的热门文章所解释的那样,该语言在 2019 年吸引了主要技术公司的支持。 + +![](https://img.linux.net.cn/data/attachment/album/202007/31/001101fkh88966ktvvee99.jpg) + +一段时间以来, [Rust][2] 在诸如 Hacker News 之类的网站上引起了程序员大量的关注。尽管许多人一直喜欢在业余爱好项目中[使用该语言][3],但直到 2019 年它才开始在业界流行,直到那会儿情况才真正开始有所转变。 + +在过去的一年中,包括[微软][4]、 [Facebook][5] 和 [Intel][6] 在内的许多大公司都出来支持 Rust,许多[较小的公司][7]也注意到了这一点。2016 年,作为欧洲最大的 Rust 大会 [RustFest][8] 的第一任主持人,除了 Mozilla,我没见到任何一个人在工作中使用 Rust。三年后,似乎我在 RustFest 2019 所交流的每个人都在不同的公司的日常工作中使用 Rust,无论是作为游戏开发人员、银行的后端工程师、开发者工具的创造者或是其他的一些岗位。 + +在 2019 年, Opensource.com 也通过报道 Rust 日益增长的受欢迎程度而发挥了作用。万一你错过了它们,这里是过去一年里 Opensource.com 上关于 Rust 的热门文章。 + +### 《使用 rust-vmm 构建未来的虚拟化堆栈》 + +Amazon 的 [Firecracker][9] 是支持 AWS Lambda 和 Fargate 的虚拟化技术,它是完全使用 Rust 编写的。这项技术的作者之一 Andreea Florescu 在 《[使用 rust-vmm 构建未来的虚拟化堆栈][10]》中对 Firecracker 及其相关技术进行了深入探讨。 + +Firecracker 最初是 Google [CrosVM][11] 的一个分支,但是很快由于两个项目的不同需求而分化。尽管如此,在这个项目与其他用 Rust 所编写的虚拟机管理器(VMM)之间仍有许多得到了很好共享的通用片段。考虑到这一点,[rust-vmm][12] 项目起初是以一种让 Amazon 和 Google、Intel 和 Red Hat 以及其余开源社区去相互共享通用 Rust “crates” (即程序包)的方式开始的。其中包括 KVM 接口(Linux 虚拟化 API)、Virtio 设备支持以及内核加载程序。 + +看到软件行业的一些巨头围绕用 Rust 编写的通用技术栈协同工作,实在是很神奇。鉴于这种和其他[使用 Rust 编写的技术堆栈][13]之间的伙伴关系,到了 2020 年,看到更多这样的情况我不会感到惊讶。 + +### 《为何选择 Rust 作为你的下一门编程语言》 + +采用一门新语言,尤其是在有着建立已久技术栈的大公司,并非易事。我很高兴写了《[为何选择 Rust 作为你的下一门编程语言][14]》,书中讲述了微软是如何在许多其他有趣的编程语言没有被考虑的情况下考虑采用 Rust 的。 + +选择编程语言涉及许多不同的标准——从技术上到组织上,甚至是情感上。其中一些标准比其他的更容易衡量。比方说,了解技术变更的成本(例如适应构建系统和构建新工具链)要比理解组织或情感问题(例如高效或快乐的开发人员将如何使用这种新语言)容易得多。此外,易于衡量的标准通常与成本相关,而难以衡量的标准通常以收益为导向。这通常会导致成本在决策过程中变得越来越重要,即使这不一定就是说成本要比收益更重要——只是成本更容易衡量。这使得公司不太可能采用新的语言。 + +然而,Rust 最大的好处之一是很容易衡量其编写安全且高性能系统软件的能力。鉴于微软 70% 的安全漏洞是由于内存安全问题导致的,而 Rust 正是旨在防止这些问题的,而且这些问题每年都使公司付出了几十亿美元的代价,所以很容易衡量并理解采用这门语言的好处。 + +是否会在微软全面采用 Rust 尚待观察,但是仅凭着相对于现有技术具有明显且可衡量的好处这一事实,Rust 的未来一片光明。 + +### 2020 年的 Rust + +尽管要达到 C++ 等语言的流行度还有很长的路要走。Rust 实际上已经开始在业界引起关注。我希望更多公司在 2020 年开始采用 Rust。Rust 社区现在必须着眼于欢迎开发人员和公司加入社区,同时确保将推动该语言发展到现在的一切都保留下来。 + +Rust 不仅仅是一个编译器和一组库,而是一群想要使系统编程变得容易、安全而且有趣的人。即将到来的这一年,对于 Rust 从业余爱好语言到软件行业所使用的主要语言之一的转型至关重要。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/rust-resources + +作者:[Ryan Levick][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ryanlevick +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: http://rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://youtu.be/o01QmYVluSw +[5]: https://youtu.be/kylqq8pEgRs +[6]: https://youtu.be/l9hM0h6IQDo +[7]: https://oxide.computer/blog/introducing-the-oxide-computer-company/ +[8]: https://rustfest.eu +[9]: https://firecracker-microvm.github.io/ +[10]: https://opensource.com/article/19/3/rust-virtual-machine +[11]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ +[12]: https://github.com/rust-vmm +[13]: https://bytecodealliance.org/ +[14]: https://opensource.com/article/19/10/choose-rust-programming-language diff --git a/published/202007/20200428 Open source has room for everyone.md b/published/202007/20200428 Open source has room for everyone.md new file mode 100644 index 0000000000..38fe8f56fd --- /dev/null +++ b/published/202007/20200428 Open source has room for everyone.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12399-1.html) +[#]: subject: (Open source has room for everyone) +[#]: via: (https://opensource.com/article/20/4/interview-Megan-Byrd-Sanicki) +[#]: author: (Jay Barber https://opensource.com/users/jaybarber) + +开源代码广阔天地造福人类 +====== + +> 了解 2020 年开源社区女性奖获得者 Megan Byrd-Sanicki 如何将人们聚集在一起。 + +![蒲公英般浮于水面][1] + +“在成长的过程中,我曾经有点像陆军元帅,” 2020 年[开源社区女性奖获得者][2] Megan Byrd-Sanicki 笑着说。“我总是那个把同学们拉到一起的人。‘大家来吧,我们告诉你们规则。’我也会注意旁听,尝试找出没有被接纳进来的人,并把他们拉进圈子。” + +![Megan Sanicki 的照片, 已经许可使用][3] + +这种将人们聚集在一起,并为他们建立一个组织,让他们表现出色的动力贯穿了她的大部分职业生涯和社区工作。“我回想起二年级体育课上的我,不得不承认,今天的我依然是这样的人。” + +作为第一任 [Drupal 协会][4]执行主任,Megan 十年来活跃于开源社区,现在是谷歌开源项目办公室的研发和运营主管。“我很幸运能担任这个职位,因为它可以让我看到谷歌 2000 多个不同目标、不同治理结构、不同策略的开源项目。这个也是难得的学习机会。” Megan 最近被推选为 [开源代码促进会][5]的董事会成员,她努力加强该组织为全球项目和企业提供的开源领导力。 + +### 从地下室台阶上学到的知识 + +Megan 原以为她会从商,远离循规的技术。坐在地下室台阶上,耳濡目染父亲的销售电话,到 16 岁时候就知道父亲的所有产品系列,也熟悉了其他知识。 + +“我从父亲学到了做生意就是解决问题和帮助别人” Megan 说。“在我的职业生涯这个信念我始终放在第一位。在某些角度看选择这条路我并不觉得奇怪;这是我个人选择的自然延伸,但它也把我带到了我从未梦想过的地方。” + +开源事业对 Megan 不仅仅是一个职业;她在她的社区活动中也使用同样的理念。“现在,我正在与 [Covid Act Now][6] 的一大群优秀的工程师、数据科学家以及流行病科学家合作。团队成员是义务提供他们的专业知识,公开合作,为政府公共人员提供数据建模,以便他们快速的做出有效的决策。” + +她也活跃于 [FOSS Responders][7],这是一个为受 COVID-19 事件影响的开源项目和社区成员点亮温暖的组织。“在疫情期间,项目很难得到他们需要的帮助。我们可以帮忙需要帮忙的组织和个人扩散他们的请求。”这个组织的一个重要的事务是管理 [FOSS Responders 基金][7],这是一个寻求开源项目基金的融资需求的机制,避免社区衰亡。 + +### 在这不断变化的世界中一群可爱的人 + +影响 Megan 参与到社区的两个宗旨分别是对开源的明确承诺和把大家团结在一起的动力。“人们有梦想的时候,他们就积极的去实现它,这就造就了共同的信念和强烈的 ‘为什么’。人们很容易围绕着‘为什么’参与其中。我知道我是这样做的。” Megan 在被问到她这么努力时说到。 + +“不管是帮助 Drupal 基金会筹集资金的任务还是赋能开源项目可持续发展,都会对人类产生真正的影响。帮助人们达到他们的目标,实现他们的梦想和愿景,而我也实实在在感受到收获这种蝴蝶效应般的热情。” + +开源技术在技术领域占的比重越来越大,Megan 对未来抱有很大希望。“令人兴奋的是故事还没有结束。作为一个社区,我们还在摸索,”她说:“关于开源,我们需要学习的东西太多了,我们的外部环境不断发生变化,它可以以多种方式发展,同时我们周围的环境也在变化。我们需要正确的对话,并找出如何共同发展的方法。确保每个人都有一席之地。” + +用她的话说,这些都是经常从她的父亲生意电话里听到的感悟,做生意就是解决问题并帮助别人。“帮助更多的人学习如何使用和贡献开源来解决问题,的确是一件有益的事情。不管是推动创新,提升效率,还是实现业务目标,有很多方法可以从开源中获得价值。” + +### 属于你的荣耀 + +当被问到对其他想参与到开源社区的女性有哪些建议时,Megan 兴奋的说:“请记住,在开源社区,所有人都有一席之地。这可能会让人望而生畏,但是从我的经验来看,人们都想帮忙。当你需要帮助的时候,就寻求帮助,但也要清楚你能在哪里做出贡献,如何做出贡献,以及你的需求是什么。” + +她也认识到,在开源领域的所有声音中,有时会感觉到缺乏集中的领导力,但她提醒不要把它看成是一种只留给少数人的特权角色。“做你期望的领导者。当社区领导角色空缺时,每个个体可以自己填补空缺。每一个开源的贡献者都是领导者,不管是领导他人,领导社区,甚至领导自己。不要等待被动赋予属于你的权力和精彩。” + +对 Megan 来说,开源之旅就如:一个前途不明朗的心路之旅。尽管如此,对风险和未来的不确定性她从不逃避。“我把生命看作一张你正在编织的美丽挂毯,日复一日,你仅仅看到后面的线头。如果你可以看到全貌,你将意识到,你只要每天尽自己最大的努力,就会以无数的方式为这个美好的作品做出贡献。” + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/interview-Megan-Byrd-Sanicki + +作者:[Jay Barber][a] +选题:[lujun9972][b] +译者:[guevaraya](https://github.com/guevaraya) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jaybarber +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dandelion_blue_water_hand.jpg?itok=QggW8Wnw (Dandelion held out over water) +[2]: https://www.redhat.com/en/about/women-in-open-source +[3]: https://opensource.com/sites/default/files/uploads/megan_sanicki_headshot_small_0.png (Photo by Megan Sanicki, Used with permission) +[4]: https://www.drupal.org/association +[5]: https://opensource.org/ +[6]: https://www.covidactnow.org/ +[7]: https://fossresponders.com/ +[8]: https://opensource.com/article/20/4/interview-Netha-Hussain diff --git a/published/202007/20200514 What is IoT- The internet of things explained.md b/published/202007/20200514 What is IoT- The internet of things explained.md new file mode 100644 index 0000000000..00ed2a05ef --- /dev/null +++ b/published/202007/20200514 What is IoT- The internet of things explained.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12411-1.html) +[#]: subject: (What is IoT? The internet of things explained) +[#]: via: (https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html) +[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) + +物联网(IoT)简介 +====== + +> 物联网(IoT)是一个由智能设备连接起来的网络,并提供了丰富的数据,但是它也有可能是一场安全领域的噩梦。 + +![](https://img.linux.net.cn/data/attachment/album/202007/13/144427tnrjnnh686n5kgtn.jpg) + +物联网Internet of Things(IoT)是一个统称,指的是越来越多不属于传统计算设备,但却连接到互联网接收或发送数据,或既接收也发送的电子设备组成的网络。 + +现在有数不胜数的东西可以归为这一类:可以联网的“智能”版传统设备,比如说电冰箱和灯泡;那些只能运行于有互联网环境的小设备,比如像 Alexa 之类的电子助手;与互联网连接的传感器,它们正在改变着工厂、医疗、运输、物流中心和农场。 + +### 什么是物联网? + +物联网将互联网、数据处理和分析的能力带给了现实的实物世界。对于消费者来说,这就意味着不需要键盘和显示器这些东西,就能和这个全球信息网络进行互动;他们的日常用品当中,很多都可以通过该网络接受操作指令,而只需很少的人工干预。 + +互联网长期以来为知识工作提供了便利,在企业环境当中,物联网也能为制造和分销带来同样的效率。全球数以百万计甚至数十亿计的嵌入式具有互联网功能的传感器正在提供令人难以置信丰富的数据集,企业可以利用这些数据来保证他们运营的安全、跟踪资产和减少人工流程。研究人员也可以使用物联网来获取人们的喜好和行为数据,尽管这些行为可能会严重影响隐私和安全。 + +### 它有多大? + +一句话:非常庞大。[Priceonomics 对此进行了分析][2]:在 2020 年的时候,有超过 50 亿的物联网设备,这些设备可以生成 4.4 泽字节zettabyte(LCTT 译注:1 zettabyte = 109 terabyte = 1012 gigabyte)的数据。相比较,物联网设备在 2013 年仅仅产生了 1000 亿千兆字节gigabyte的数据。在物联网市场上可能挣到的钱也同样让人瞠目;到 2025 年,这块市场的价值可以达到 1.6 万亿美元到 14.4 万亿美元不等。 + +### 物联网的历史 + +一个联网设备和传感器无处不在的世界,是科幻小说中最经典的景象之一。物联网传说中将 1970 年 [卡耐基•梅隆大学的一台连接到 APRANET 的自动贩卖机][3] 称之为世界上第一个物联网设备,而且许多技术都被吹捧为可以实现 “智能” 的物联网式特征,使其颇具有未来主义的光彩。但是“物联网”这个词是由英国的技术专家 [Kevin Ashton][4] 于 1999 年提出来的。 + +一开始,技术是滞后于当时对未来的憧憬的。每个与互联网相连的设备都需要一个处理器和一种能和其他东西通信的方式,无线的最好,这些因素都增加了物联网大规模实际应用的成本和性能要求,这种情况至少一直持续到 21 世纪头十年中期,直到摩尔定律赶上来。 + +一个重要的里程碑是 [RFID 标签的大规模使用][5],这种价格低廉的极简转发器可以被贴在任何物品上,然后这些物品就可以连接到更大的互联网上了。对于设计者来说,无处不在的 Wi-Fi 和 4G 让任何地方的无线连接都变得非常简单。而且,IPv6 的出现再也不用让人们担心把数十亿小设备连接到互联网上会将 IP 地址耗尽。(相关报道:[物联网网络可以促进 IPv6 的使用吗?][6]) + +### 物联网是如何工作的? + +物联网的基本元素是收集数据的设备。广义地说,它们是和互联网相连的设备,所以每一个设备都有 IP 地址。它们的复杂程度不一,这些设备涵盖了从工厂运输货物的自动驾驶车辆到监控建筑温度的简单传感器。这其中也包括每天统计步数的个人手环。为了让这些数据变得有意义,就需要对其收集、处理、过滤和分析,每一种数据都可以通过多种方式进行处理。 + +采集数据的方式是将数据从设备上传输到采集点。可以通过各种无线或者有线网络进行数据的转移。数据可以通过互联网发送到具有存储空间或者计算能力的数据中心或者云端,或者这些数据也可以分段进行传输,由中间设备汇总数据后再沿路径发送。 + +处理数据可以在数据中心或者云端进行,但是有时候这不太可行。对于一些非常重要的设备,比如说工业领域的关停设备,从设备上将数据发送到远程数据中心的延迟太大了。发送、处理、分析数据和返回指令(在管道爆炸之前关闭阀门)这些操作,来回一趟的时间可能要花费非常多的时间。在这种情况下,边缘计算edge-computing就可以大显身手了,智能边缘设备可以汇总数据、分析数据,在需要的时候进行回应,所有这些都在相对较近的物理距离内进行,从而减少延迟。边缘设备可以有上游连接,这样数据就可以进一步被处理和储存。 + +![][7] + +*物联网是如何工作的。* + +### 物联网设备的一些例子 + +本质上,任何可以搜集来自于真实世界数据,并且可以发送回去的设备都可以参与到物联网生态系统中。典型的例子包括智能家居设备、射频识别标签(RFID)和工业传感器。这些传感器可以监控一系列的因素,包括工业系统中的温度和压力、机器中关键设备的状态、患者身上与生命体征相关的信号、水电的使用情况,以及其它许许多多可能的东西。 + +整个工厂的机器人可以被认为是物联网设备,在工业环境和仓库中移动产品的自主车辆也是如此。 + +其他的例子包括可穿戴设备和家庭安防系统。还有一些其它更基础的设备,比如说[树莓派][8]和[Arduino][9],这些设备可以让你构建你自己的物联网终端节点。尽管你可能会认为你的智能手机是一台袖珍电脑,但它很可能也会以非常类似物联网的方式将你的位置和行为数据传送到后端服务。 + +#### 设备管理 + +为了能让这些设备一起工作,所有这些设备都需要进行验证、分配、配置和监控,并且在必要时进行修复和更新。很多时候,这些操作都会在一个单一的设备供应商的专有系统中进行;要么就完全不会进行这些操作,而这样也是最有风险的。但是整个业界正在向[标准化的设备管理模式][10]过渡,这使得物联网设备之间可以相互操作,并保证设备不会被孤立。 + +#### 物联网通信标准和协议 + +当物联网上的小设备和其他设备通信的时候,它们可以使用各种通信标准和协议,这其中许多都是为这些处理能力有限和电源功率不大的设备专门定制的。你一定听说过其中的一些,尽管有一些设备使用的是 Wi-Fi 或者蓝牙,但是更多的设备是使用了专门为物联网世界定制的标准。比如,ZigBee 就是一个低功耗、远距离传输的无线通信协议,而 MQTT(消息队列遥测传输Message Queuing Telemetry Transport)是为连接在不可靠或者易发生延迟的网络上的设备定制的一个发布/订阅信息协议。(参考 Network World 的词汇表:[物联网标准和协议](11)。) + +物联网也会受益于 5G 为蜂窝网络带来的高速度和高带宽,尽管这种使用场景会[滞后于普通的手机][12]。 + +### 物联网、边缘计算和云 + +![][13] + +*边缘计算如何使物联网成为可能。* + +对于许多物联网系统来说,大量的数据会以极快的速度涌来,这种情况催生了一个新的科技领域,[边缘计算][14]edge computing,它由放置在物联网设备附近的设备组成,处理来自那些设备的数据。这些机器对这些数据进行处理,只将相关的素材数据发送到一个更集中的系统系统进行分析。比如,想象一个由几十个物联网安防摄像头组成的网络,边缘计算会直接分析传入的视频,而且只有当其中一个摄像头检测到有物体移动的时候才向安全操作中心(SoC)发出警报,而不会是一下子将所有的在线数据流全部发送到建筑物的 SoC。 + +一旦这些数据已经被处理过了,它们又去哪里了呢?好吧,它也许会被送到你的数据中心,但是更多情况下,它最终会进入云。 + +对于物联网这种间歇或者不同步的数据来往场景来说,具有弹性的云计算是再适合不过的了。许多云计算巨头,包括[谷歌][15]、[微软][16]和[亚马逊][17],都有物联网产品。 + +### 物联网平台 + +云计算巨头们正在尝试出售的,不仅仅是存放传感器搜集的数据的地方。他们正在提供一个可以协调物联网系统中各种元素的完整平台,平台会将很多功能捆绑在一起。本质上,物联网平台作为中间件,将物联网设备和边缘网关与你用来处理物联网数据的应用程序连接起来。也就是说,每一个平台的厂商看上去都会对物联网平台应该是什么这个问题有一些稍微不同的解释,以更好地[与其他竞争者拉开差距][18]。 + +### 物联网和数据 + +正如前面所提到的,所有这些物联网设备收集了 ZB 级的数据,这些数据通过边缘网关被发送到平台上进行处理。在很多情况下,这些数据就是要部署物联网的首要原因。通过从现实世界中的传感器搜集来的数据,企业就可以实时的作出灵活的决定。 + +例如,Oracle 公司[假想了一个这样的场景][19],当人们在主题公园的时候,会被鼓励下载一个可以提供公园信息的应用。同时,这个程序会将 GPS 信号发回到公园的管理部门来帮助他们预测排队时间。有了这些信息,公园就可以在短期内(比如通过增加员工数量来提升景点的一些容量)和长期内(通过了解哪些设施最受欢迎,那些最不受欢迎)采取行动。 + +这些决定可以在没有人工干预的情况作出。比如,从化工厂管道中的压力传感器收集的数据可以通过边缘设备的软件进行分析,从而发现管道破裂的威胁,这样的信息可以触发关闭阀门的信号,从而避免泄漏。 + +### 物联网和大数据分析 + +主题公园的例子可以让你很容易理解,但是和许多现实世界中物联网收集数据的操作相比,就显得小菜一碟了。许多大数据业务都会使用到来自物联网设备收集的信息,然后与其他数据关联,这样就可以分析预测到人类的行为。Software Advice 给出了[一些例子][20],其中包括由 Birst 提供的一项服务,该服务将从联网的咖啡机中收集的咖啡冲泡的信息与社交媒体上发布的帖子进行匹配,看看顾客是否在网上谈论咖啡品牌。 + +另一个最近才发生的戏剧性的例子,X-Mode 发布了一张基于位置追踪数据的地图,地图上显示了在 2020 年 3 月春假的时候,正当新冠病毒在美国加速传播的时候,人们在劳德代尔堡Ft. Lauderdale聚会完[最终都去了哪里][21]。这张地图令人震撼,不仅仅是因为它显示出病毒可能的扩散方向,更是因为它说明了物联网设备是可以多么密切地追踪我们。(更多关于物联网和分析的信息,请点击[此处][22]。) + +### 物联网数据和 AI + +物联网设备能够收集的数据量远远大于任何人类能够以有效的方式处理的数据量,而且这肯定也不是能实时处理的。我们已经看到,仅仅为了理解从物联网终端传来的原始数据,就需要边缘计算设备。此外,还需要检测和处理可能就是[完全错误的数据][23]。 + +许多物联网供应商也同时提供机器学习和人工智能的功能,可以用来理解收集来的数据。比如,IBM 的 Jeopardy!-winning Watson 平台就可以在[物联网数据集上进行训练][24],这样就可以在预测性维护领域产生有用的结果 —— 比如说,分析来自无人机的数据,可以区分桥梁上轻微的损坏和需要重视的裂缝。同时,ARM 也在研发[低功耗芯片][25],它可以在物联网终端上提供 AI 的能力。 + +### 物联网和商业 + +物联网的商业用途包括跟踪客户、库存和重要部件的状态。[IoT for All][26] 列举了四个已经被物联网改变的行业: + +* **石油和天然气**:与人工干预相比,物联网传感器可以更好的检测孤立的钻井现场。 +* **农业**:通过物联网传感器获得的田间作物的数据,可以用来提高产量。 +* **采暖通风**:制造商可以监控全国各地的气候控制系统。 +* **实体零售**:当顾客在商店的某些地方停留的时候,可以通过手机进行微目标定位,提供优惠信息。 + +更普遍的情况是,企业正在寻找能够在[四个领域][27]上获得帮助的物联网解决方案:能源使用、资产跟踪、安全领域和客户体验。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html + +作者:[Josh Fruhlinger][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/category/internet-of-things/ +[2]: https://priceonomics.com/the-iot-data-explosion-how-big-is-the-iot-data/ +[3]: https://www.machinedesign.com/automation-iiot/article/21836968/iot-started-with-a-vending-machine +[4]: https://www.visioncritical.com/blog/kevin-ashton-internet-of-things +[5]: https://www.networkworld.com/article/2319384/rfid-readers-route-tag-traffic.html +[6]: https://www.networkworld.com/article/3338106/can-iot-networking-drive-adoption-of-ipv6.html +[7]: https://images.idgesg.net/images/article/2020/05/nw_how_iot_works_diagram-100840757-orig.jpg +[8]: https://www.networkworld.com/article/3176091/10-killer-raspberry-pi-projects-collection-1.html +[9]: https://www.networkworld.com/article/3075360/arduino-targets-the-internet-of-things-with-primo-board.html +[10]: https://www.networkworld.com/article/3258812/the-future-of-iot-device-management.html +[11]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html +[12]: https://www.networkworld.com/article/3291778/what-s-so-special-about-5g-and-iot.html +[13]: https://images.idgesg.net/images/article/2017/09/nw_how_edge_computing_works_diagram_1400x1717-100736111-orig.jpg +[14]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[15]: https://cloud.google.com/solutions/iot +[16]: https://azure.microsoft.com/en-us/overview/iot/ +[17]: https://aws.amazon.com/iot/ +[18]: https://www.networkworld.com/article/3336166/why-are-iot-platforms-so-darn-confusing.html +[19]: https://blogs.oracle.com/bigdata/how-big-data-powers-the-internet-of-things +[20]: https://www.softwareadvice.com/resources/iot-data-analytics-use-cases/ +[21]: https://www.cnn.com/2020/04/04/tech/location-tracking-florida-coronavirus/index.html +[22]: https://www.networkworld.com/article/3311919/iot-analytics-guide-what-to-expect-from-internet-of-things-data.html +[23]: https://www.networkworld.com/article/3396230/when-iot-systems-fail-the-risk-of-having-bad-iot-data.html +[24]: https://www.networkworld.com/article/3449243/watson-iot-chief-ai-can-broaden-iot-services.html +[25]: https://www.networkworld.com/article/3532094/ai-everywhere-iot-chips-coming-from-arm.html +[26]: https://www.iotforall.com/4-unlikely-industries-iot-changing/ +[27]: https://www.networkworld.com/article/3396128/the-state-of-enterprise-iot-companies-want-solutions-for-these-4-areas.html diff --git a/published/202007/20200522 Turn your Raspberry Pi homelab into a network filesystem.md b/published/202007/20200522 Turn your Raspberry Pi homelab into a network filesystem.md new file mode 100644 index 0000000000..cff0ca4ee7 --- /dev/null +++ b/published/202007/20200522 Turn your Raspberry Pi homelab into a network filesystem.md @@ -0,0 +1,286 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12413-1.html) +[#]: subject: (Turn your Raspberry Pi homelab into a network filesystem) +[#]: via: (https://opensource.com/article/20/5/nfs-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +把你的树莓派家庭实验室变成一个网络文件系统 +====== + +> 使用 NFS 服务器将共享文件系统添加到你的家庭实验室。 + +![](https://img.linux.net.cn/data/attachment/album/202007/14/154349bgrgrwzexluuvzev.jpg) + +共享文件系统是为家庭实验室增加通用性和功能性的好方法。在实验室中为客户端共享一个集中的文件系统,使得组织数据、进行备份和共享数据变得相当容易。这对于在多个服务器上进行负载均衡的 Web 应用和 [Kubernetes][2] 使用的持久化卷来说,尤其有用,因为它允许在任何数量的节点上用持久化数据来轮转 Pod。 + +无论你的家庭实验室是由普通计算机、多余的企业服务器,还是树莓派或其他单板计算机(SBC)组成,共享文件系统都是一种有用的资产,而网络文件系统(NFS)服务器是创建共享文件系统的好方法。 + +我之前写过关于[建立“家庭私有云”][3]的文章,这是一个由树莓派或其他 SBC 组成的家庭实验室,也许还有其他一些消费类硬件或台式 PC。NFS 服务器是这些组件之间共享数据的理想方式。由于大多数 SBC 的操作系统是通过 SD 卡运行的,所以存在一些挑战。尤其是在用作计算机的操作系统磁盘时,SD 卡的故障率会增加,它们并不是用来不断地读写的。你实际需要的是一个真正的硬盘:它们通常比 SD 卡的每 GB 价格便宜,特别是对于较大的磁盘,而且它们不太可能持续发生故障。树莓派 4 现在带有 USB 3.0 接口,而 USB 3.0 硬盘无处不在,价格也很实惠。这是一个完美的搭配。在这个项目中,我将使用一个 2TB 的 USB 3.0 外置硬盘插入到运行 NFS 服务器的树莓派 4 中。 + +![Raspberry Pi with a USB hard disk][4] + +### 安装 NFS 服务器软件 + +我在树莓派上运行 Fedora 服务器,但这个项目也可以在其他发行版上运行。要在 Fedora 上运行 NFS 服务器,你需要 `nfs-utils` 包,幸运的是它已经安装好了(至少在 Fedora 31 中是这样)。如果你打算运行 NFSv3 服务,你还需要 `rpcbind` 包,但它不是 NFSv4 的严格要求。 + +如果你的系统中还没有这些软件包,请使用 `dnf` 命令安装它们。 + +``` +# 安装 nfs-utils 和 rpcbind +$ sudo dnf install nfs-utils rpcbind +``` + +Raspbian 是另一个与树莓派一起使用的流行操作系统,设置几乎完全相同。软件包名称不同而已,但这是唯一的主要区别。要在运行 Raspbian 的系统上安装 NFS 服务器,你需要以下软件包。 + + * `nfs-common`:这些文件是 NFS 服务器和客户端的通用文件。 + * `nfs-kernel-server`:主要的 NFS 服务器软件包。 + +Raspbian 使用 `apt-get` 来管理软件包(而不是像 Fedora 那样使用 `dnf`),所以用它来安装软件包。 + +``` +# 对于 Raspbian 系统,使用 apt-get 来安装 NFS 软件包 +$ sudo apt-get install nfs-common nfs-kernel-server +``` + +### 准备一个 USB 硬盘作为存储设备 + +正如我上面提到的,USB 硬盘是为树莓派或其他 SBC 提供存储的好选择,尤其是用于操作系统磁盘镜像的 SD 卡并不适合这个用途。对于家庭私有云,你可以使用廉价的 USB 3.0 硬盘进行大规模存储。插入磁盘,使用 `fdisk` 找出分配给它的设备 ID,就可以使用它工作了。 + +``` +# 使用 fdisk 找到你的硬盘 +# 无关的硬盘信息已经省略 +$ sudo fdisk -l + +Disk /dev/sda: 1.84 TiB, 2000398933504 bytes, 3907029167 sectors +Disk model: BUP Slim BK +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xe3345ae9 + +Device     Boot Start        End    Sectors  Size Id Type +/dev/sda1        2048 3907028991 3907026944  1.8T 83 Linux +``` + +为了清楚起见,在上面的例子输出中,除了我感兴趣的那个磁盘,我省略了所有其它磁盘的信息。你可以看到我想使用的 USB 磁盘被分配了设备 `/dev/sda`,你可以看到一些关于型号的信息(`Disk model: BUP Slim BK`),这有助于我识别正确的磁盘。该磁盘已经有了一个分区,它的大小也证实了它就是我要找的磁盘。 + +注意:请确保正确识别你的设备的磁盘和分区。它可能与上面的例子不同。 + +在驱动器上创建的每个分区都有一个特殊的通用唯一标识符(UUID)。计算机使用 UUID 来确保它使用 `/etc/fstab` 配置文件将正确的分区挂载到正确的位置。你可以使用 `blkid` 命令检索分区的 UUID。 + +``` +# 获取该分区的块设备属性 +# 确保你使用了合适的分区,它应该有所不同。 +$ sudo blkid /dev/sda1 + +/dev/sda1: LABEL="backup" UUID="bd44867c-447c-4f85-8dbf-dc6b9bc65c91" TYPE="xfs" PARTUUID="e3345ae9-01" +``` + +在这里,`/dev/sda1` 的 UUID 是 `bd44867c-447c-4f85-8dbf-dc6b9bc65c91`。你的 UUID 会有所不同,所以要记下来。 + +### 配置树莓派在启动时挂载这个磁盘,然后挂载它 + +现在你已经确定了要使用的磁盘和分区,你需要告诉计算机如何挂载它,每次启动时都要这样做。现在就去挂载它。因为这是一个 USB 磁盘,可能会被拔掉,所以你还要配置树莓派在启动时如果磁盘没有插入或有其它不可用情况时不要等待。 + +在 Linux 中,通过将分区添加到 `/etc/fstab` 配置文件中,包括你希望它被挂载的位置和一些参数来告诉计算机如何处理它。这个例子将把分区挂载到 `/srv/nfs`,所以先创建这个路径: + +``` +# 创建该磁盘分区的挂载点 +$ sudo mkdir -p /srv/nfs +``` + +接下来,使用以下语法格式修改 `/etc/fstab` 文件: + +``` +                   +``` + +使用你之前确定的 UUID 作为磁盘 ID。正如我在上一步提到的,挂载点是 `/srv/nfs`。对于文件系统类型,通常最好选择其实际的文件系统,但是因为这是一个 USB 磁盘,所以使用 `auto`。 + +对于选项值,使用 `nosuid,nodev,nofail`。 + +#### 关于手册页的一个旁白 + +其实,有*很多*可能的选项,手册页(`man`)是查看它们的最好方法。查看 `fstab` 的手册页是一个很好的开始。 + +``` +# 打开 fstab 的手册页 +$ man fstab +``` + +这将打开与 `fstab` 命令相关的手册/文档。在手册页中,每个选项都被分解成了不同的内容,以显示它的作用和常用的选择。例如,“第四个字段(fs_mntopts)”给出了该字段中可用选项的一些基本信息,并引导你到 `man 8 mount` 中获取 `mount` 选项更深入的描述。这是有道理的,因为 `/etc/fstab` 文件,本质上是告诉计算机如何自动挂载磁盘,就像你手动使用 `mount` 命令一样。 + +你可以从 `mount` 的手册页中获得更多关于你将使用的选项的信息。数字 8 表示手册页的章节。在这里,第 8 章节是*系统管理工具和守护进程*。 + +你可以从 `man` 的手册页中得到标准章节的列表。 + +回到挂载磁盘,让我们看看 `man 8 mount`。 + +``` +# 打开第 8 章节的 mount 手册页 +$ man 8 mount +``` + +在这个手册页中,你可以查看上面列出的选项的作用。 + + * `nosuid`:不理会 suid/guid 位。不允许放在 U 盘上的任何文件以 root 身份执行。这是一个良好的安全实践。 + * `nodev`:不识别文件系统中的字符或块特殊设备,即不理会在 U 盘上的任何设备节点。另一个良好的安全实践。 + * `nofail`:如果设备不存在,不要记录任何错误。这是一个 U 盘,可能没有插入,所以在这种情况下,它将被忽略。 + +回到你正在添加到 `/etc/fstab` 文件的那一行,最后还有两个选项:`fs_freq` 和 `fs_passno`。它们的值与一些过时的选项有关,*大多数*现代系统对这两个选项都只用 `0`,特别是对 USB 磁盘上的文件系统而言。`fs_freq` 的值与 `dump` 命令和文件系统的转储有关。`fs_passno` 的值定义了启动时要 `fsck` 的文件系统及其顺序,如果设置了这个值,通常根分区是 `1`,其他文件系统是 `2`,将该值设置为 `0` 以跳过在该分区上使用 `fsck`。 + +在你喜欢的编辑器中,打开 `/etc/fstab` 文件,添加 U 盘上分区的条目,将这里的值替换成前面步骤中得到的值。 + +``` +# With sudo, or as root, add the partition info to the /etc/fstab file +UUID="bd44867c-447c-4f85-8dbf-dc6b9bc65c91"    /srv/nfs    auto    nosuid,nodev,nofail,noatime 0 0 +``` + +### 启用并启动 NFS 服务器 + +安装好软件包,并将分区添加到你的 `/etc/fstab` 文件中,现在你可以开始启动 NFS 服务器了。在 Fedora 系统中,你需要启用和启动两个服务:`rpcbind` 和 `nfs-server`。使用 `systemctl` 命令来完成这项工作。 + +``` +# 启动 NFS 服务器和 rpcbind +$ sudo systemctl enable rpcbind.service +$ sudo systemctl enable nfs-server.service +$ sudo systemctl start rpcbind.service +$ sudo systemctl start nfs-server.service +``` + +在 Raspbian 或其他基于 Debian 的发行版上,你只需要使用 `systemctl` 命令启用并启动 `nfs-kernel-server` 服务即可,方法同上。 + +#### RPCBind + +rpcbind 工具用于将远程过程调用(RPC)服务映射到其监听的端口。根据 rpcbind 手册页: + +> “当一个 RPC 服务启动时,它会告诉 rpcbind 它正在监听的地址,以及它准备服务的 RPC 程序号。当客户机想对给定的程序号进行 RPC 调用时,它首先与服务器机器上的 rpcbind 联系,以确定 RPC 请求应该发送到哪里的地址。” + +在 NFS 服务器这个案例中,rpcbind 会将 NFS 的协议号映射到 NFS 服务器监听的端口上。但是,NFSv4 不需要使用 rpcbind。如果你*只*使用 NFSv4 (通过从配置中删除版本 2 和版本 3),则不需要使用 rpcbind。我把它放在这里是为了向后兼容 NFSv3。 + +### 导出挂载的文件系统 + +NFS 服务器根据另一个配置文件 `/etc/exports` 来决定与哪些远程客户端共享(导出)哪些文件系统。这个文件只是一个 IP(或子网)与要共享的文件系统的映射,以及一些选项(只读或读写、root 去除等)。该文件的格式是: + +``` +<目录>     <主机>(选项) +``` + +在这个例子中,你将导出挂载到 `/srv/nfs` 的分区。这是“目录”部分。 + +第二部分,主机,包括你要导出这个分区的主机。这些主机可以是单个主机:使用具有完全限定域名(FQDN)或主机名、主机的 IP 地址来指定;也可以是一组主机:使用通配符字符来匹配域(如 *.example.org)、IP 网络(如无类域间路由 CIDR 标识)或网组表示。 + +第三部分包括应用于该导出的选项。 + + * `ro/rw`:将文件系统导出为只读或读写。 + * `wdelay`:如果即将进行另一次写入,则推迟对磁盘的写入,以提高性能(如果你使用的是固态 USB 磁盘,这*可能*没有那么有用) + * `root_squash`:防止客户机上的任何 root 用户在主机上有 root 权限,并将 root UID 设置为 `nfsnobody` 作为安全防范措施。 + +测试导出你挂载在 `/srv/nfs` 处的分区到一个客户端 —— 例如,一台笔记本电脑。确定你的客户机的 IP 地址(我的笔记本是 `192.168.2.64`,但你的可能会不同)。你可以把它共享到一个大的子网,但为了测试,请限制在单个 IP 地址上。这个 IP 的 CIDR 标识是 `192.168.2.64/32`,`/32` 子网代表一个 IP。 + +使用你喜欢的编辑器编辑 `/etc/exports` 文件,写上你的目录、主机 CIDR 以及 `rw` 和 `root_squash` 选项。 + +``` +# 像这样编辑你的 /etc/exports 文件,替换为你的系统上的信息 +/srv/nfs    192.168.2.64/32(rw,root_squash) +``` + +注:如果你从另一个地方复制了 `/etc/exports` 文件,或者用副本覆盖了原文件,你可能需要恢复该文件的 SELinux 上下文。你可以使用 `restorecon` 命令来恢复。 + +``` +# 恢复 /etc/exports 文件的 SELinux 上下文 +$ sudo restorecon /etc/exports +``` + +完成后,重新启动 NFS 服务器,以接收对 `/etc/exports` 文件的更改。 + +``` +# 重新启动 NFS 服务器 +$ sudo systemctl restart nfs-server.service +``` + +### 给 NFS 服务打开防火墙 + +有些系统,默认不运行[防火墙服务][6]。比如 Raspbian,默认是开放 iptables 规则,不同服务打开的端口在机器外部立即就可以使用。相比之下,Fedora 服务器默认运行的是 firewalld 服务,所以你必须为 NFS 服务器(以及 rpcbind,如果你将使用 NFSv3)打开端口。你可以通过 `firewall-cmd` 命令来实现。 + +检查 firewalld 使用的区域并获取默认区域。对于 Fedora 服务器,这是 `FedoraServer` 区域。 + +``` +# 列出区域 +# 出于简洁省略了部分输出 +$ sudo firewall-cmd --list-all-zones + +# R获取默认区域信息 +# 记下默认区域 +$ sudo firewall-cmd --get-default-zone + +# 永久加入 nfs 服务到允许端口列表 +$ sudo firewall-cmd --add-service=nfs --permanent + +# 对于 NFSv3,我们需要再加一些端口: nfsv3、 rpc-mountd、 rpc-bind +$ sudo firewall-cmd --add-service=(nfs3,mountd,rpc-bind) + +# 查看默认区域的服务,以你的系统中使用的默认区域相应替换 +$ sudo firewall-cmd --list-services --zone=FedoraServer + +# 如果一切正常,重载 firewalld +$ sudo firewall-cmd --reload +``` + +就这样,你已经成功地将 NFS 服务器与你挂载的 U 盘分区配置在一起,并将其导出到你的测试系统中进行共享。现在你可以在你添加到导出列表的系统上测试挂载它。 + +### 测试 NFS 导出 + +首先,从 NFS 服务器上,在 `/srv/nfs` 目录下创建一个文件来读取。 + +``` +# 创建一个测试文件以共享 +echo "Can you see this?" >> /srv/nfs/nfs_test +``` + +现在,在你添加到导出列表中的客户端系统上,首先确保 NFS 客户端包已经安装好。在 Fedora 系统上,它是 `nfs-utils` 包,可以用 `dnf` 安装。Raspbian 系统有 `libnfs-utils` 包,可以用 `apt-get` 安装。 + +安装 NFS 客户端包: + +``` +# 用 dnf 安装 nfs-utils 软件包 +$ sudo dnf install nfs-utils +``` + +一旦安装了客户端包,你就可以测试 NFS 的导出了。同样在客户端,使用带有 NFS 服务器 IP 和导出路径的 `mount` 命令,并将其挂载到客户端的一个位置,在这个测试中是 `/mnt` 目录。在这个例子中,我的 NFS 服务器的 IP 是 `192.168.2.109`,但你的可能会有所不同。 + +``` +# 挂载 NFS 服务器的输出到客户端主机 +# 确保替换为你的主机的相应信息 +$ sudo mount 192.168.2.109:/srv/nfs /mnt + +# 查看 nfs_test 文件是不是可见 +$ cat /mnt/nfs_test +Can you see this? +``` + +成功了!你现在已经有了一个可以工作的 NFS 服务器,可以与多个主机共享文件,允许多个读/写访问,并为你的数据提供集中存储和备份。家庭实验室的共享存储有很多选择,但 NFS 是一种古老的、高效的、可以添加到你的“家庭私有云”家庭实验室中的好选择。本系列未来的文章将扩展如何在客户端上自动挂载 NFS 共享,以及如何将 NFS 作为 Kubernetes 持久卷的存储类。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/nfs-raspberry-pi + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO (Blue folders flying in the clouds above a city skyline) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://linux.cn/article-12277-1.html +[4]: https://opensource.com/sites/default/files/uploads/raspberrypi_with_hard-disk.jpg (Raspberry Pi with a USB hard disk) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/article/18/9/linux-iptables-firewalld diff --git a/published/202007/20200525 Foliate- A Modern eBook Reader App for Linux.md b/published/202007/20200525 Foliate- A Modern eBook Reader App for Linux.md new file mode 100644 index 0000000000..39fc680f6e --- /dev/null +++ b/published/202007/20200525 Foliate- A Modern eBook Reader App for Linux.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12462-1.html) +[#]: subject: (Foliate: A Modern eBook Reader App for Linux) +[#]: via: (https://itsfoss.com/foliate-ebook-viewer/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Foliate:适用于 Linux 的现代电子书阅读器应用 +====== + +> Foliate 是一款简洁、优雅的开源电子书阅读器,可在 Linux 桌面上提供类似 Kindle 的阅读体验。 + +![](https://img.linux.net.cn/data/attachment/album/202007/28/230931vpsyu25yua8855u3.jpg) + +虽然我们已经有了一个 [Linux 最佳电子书阅读器][2]的列表,但最近我遇到了另一个 Linux 电子书阅读器。它叫 [Foliate][3]。 + +![][1] + +Foliate 是一个现代的 GTK 电子书查看器,它有许多基本功能。如果你拥有亚马逊 Kindle 或其他电子书阅读器,那么你可能会想念那种在桌面上阅读的体验。 + +![](https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/foliate-library-view.jpg?w=800&ssl=1) + +Foliate 解决了那些抱怨。Foliate 会显示书的估计剩余阅读时间和页数。你可以添加书签、高亮文本和添加注释。你可以导出数据,也可以轻松同步它们。 + +![Foliate Ebook Viewer Features][4] + +你也可以使用维基词典和维基百科查询单词。你可以在页面视图和滚动视图之间切换。它还有几个主题,以满足你的阅读偏好。 + +![][5] + +最棒的是,它正在积极维护和开发。 + +### Foliate 的功能 + +![][6] + +让我们来看看 Foliate 提供的所有功能: + + * 支持 .epub、.mobi、.azw、未打包的 EPUB 文件、文本文件、漫画存档(cbr、.cbz、.cbt、.cb7),小说书(.fb2、.fb2.zip)和 .azw3 文件。它不支持 PDF 文件。 + * 它让你可以在双页浏览模式下阅读电子书,并提供滚动查看模式。 + * 能够自定义字体、行距、边距和亮度。 + * 图书馆视图,显示最近的书籍和阅读进度。 + * 默认主题包括浅色、棕褐色、深色、Solarized 深色/浅色、Gruvbox 浅色/深色、灰色、Nord 和反转模式。 + * 你还可以添加自定义主题调整电子书浏览器的外观。 + * 带有章节标记的阅读进度滑块。 + * 书签和注释支持。 + * 能够在书中查找文本。 + * 能够放大和缩小。 + * 启用/禁用侧边栏进行导航。 + * 使用 [维基词典][7] 和 [维基百科][8] 快速查找字典 + * 使用谷歌翻译翻译文字 + * 触摸板手势,使用两指滑动即可翻页 + * 使用 [eSpeak NG][9] 和 [Festival][10] 支持文字转语音 + +### 在 Linux 上安装 Foliate + +对于基于 Ubuntu 和 Debian 的 Linux 发行版,你可以从它的 [GitHub 发布页面][13]获取 .deb 文件。只需双击即可[从 deb 文件安装应用][14]。 + +对于 Fedora、Arch、SUSE 等其他 Linux 发行版。Foliate 可提供 [Flatpak][15] 和 [Snap][16] 包。如果你不知道如何使用它们,那么你可以按照我们[使用 flatpak][17] 和[使用 snap 包][18]指南来开始使用。 + +如果需要,你可以浏览它的 [GitHub 页面][19]以从源代码开始构建。 + +- [下载 Foliate 应用][20] + +### 总结 + +我使用 GitHub 上提供的最新 .deb 文件在 Pop!_OS 19.10 上进行了尝试,并且效果很好。我不喜欢在桌面上阅读很久,但我喜欢它的功能。 + +你是否尝试过 Foliate?请随时分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/foliate-ebook-viewer/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-app.jpg?ssl=1 +[2]: https://linux.cn/article-10383-1.html +[3]: https://johnfactotum.github.io/foliate/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-ebook-viewer-features.jpg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-screenshot.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-options.jpg?ssl=1 +[7]: https://en.wiktionary.org/wiki/Wiktionary:Main_Page +[8]: https://en.wikipedia.org/wiki/Main_Page +[9]: https://github.com/espeak-ng/espeak-ng +[10]: http://www.cstr.ed.ac.uk/projects/festival/ +[13]: https://github.com/johnfactotum/foliate/releases +[14]: https://itsfoss.com/install-deb-files-ubuntu/ +[15]: https://flathub.org/apps/details/com.github.johnfactotum.Foliate +[16]: https://snapcraft.io/foliate +[17]: https://itsfoss.com/flatpak-guide/ +[18]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[19]: https://github.com/johnfactotum/foliate +[20]: tmp.6FO70BtAuy \ No newline at end of file diff --git a/published/202007/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md b/published/202007/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md new file mode 100644 index 0000000000..e297ca2521 --- /dev/null +++ b/published/202007/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12371-1.html) +[#]: subject: (How Cloud-init can be used for your Raspberry Pi homelab) +[#]: via: (https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +在你的树莓派家庭实验室中使用 Cloud-init +====== + +> 了解了云行业的标准,该向你的家庭实验室自动添加新设备和用户了。 + +![](https://img.linux.net.cn/data/attachment/album/202007/01/203559wt8tnnnxnc6jcnn8.jpg) + +[Cloud-init][2](可以说)是一个标准,云提供商用它来为云实例提供初始化和配置数据。它最常用于新实例的首次启动,以自动完成网络设置、账户创建和 SSH 密钥安装等使新系统上线所需的任何事情,以便用户可以访问它。 + +在之前的一篇文章《[修改磁盘镜像来创建基于树莓派的家庭实验室][3]》中,我展示了如何为像树莓派这样的单板计算机定制操作系统镜像以实现类似的目标。有了 Cloud-init,就不需要向镜像中添加自定义数据。一旦在镜像中启用了它,你的虚拟机、物理服务器,甚至是小小的树莓派都可以表现得像你自己的 “家庭私有云” 中的云计算实例。新机器只需插入、打开,就可以自动成为你的[家庭实验室][4]的一部分。 + +说实话,Cloud-init 的设计并没有考虑到家庭实验室。正如我所提到的,你可以很容易地修改给定的一套系统磁盘镜像,以启用 SSH 访问并在第一次启动后对它们进行配置。Cloud-init 是为大规模的云提供商设计的,这些提供商需要容纳许多客户,维护一组小的镜像,并为这些客户提供访问实例的机制,而无需为每个客户定制一个镜像。拥有单个管理员的家庭实验室则不会面临同样的挑战。 + +不过,Cloud-init 在家庭实验室中也不是没有可取之处。教育是我的家庭私有云项目的目标之一,而为你的家庭实验室设置 Cloud-init 是一个很好的方式,可以获得大大小小的云提供商大量使用的技术的经验。Cloud-init 也是其他初始配置选项的替代方案之一。与其为家庭实验室中的每台设备定制每个镜像、ISO 等,并在你要进行更改时面临繁琐的更新,不如直接启用 Cloud-init。这减少了技术债务 —— 还有什么比*个人*技术债务更糟糕的吗?最后,在你的家庭实验室中使用 Cloud-init 可以让你的私有云实例与你拥有的或将来可能拥有的任何公有云实例表现相同 —— 这是真正的[混合云][5]。 + +### 关于 Cloud-init + +当为 Cloud-init 配置的实例启动并且服务开始运行时(实际上是 systemd 中的四个服务,以处理启动过程中的依赖关系),它会检查其配置中的[数据源][6],以确定其运行在什么类型的云中。每个主要的云提供商都有一个数据源配置,告诉实例在哪里以及如何检索配置信息。然后,实例使用数据源信息检索云提供商提供的配置信息(如网络信息和实例识别信息)和客户提供的配置数据(如要复制的授权密钥、要创建的用户账户以及许多其他可能的任务)。 + +检索数据后,Cloud-init 再对实例进行配置:设置网络、复制授权密钥等,最后完成启动过程。然后,远程用户就可以访问它,准备好使用 [Ansible][7] 或 [Puppet][8] 等工具进行进一步的配置,或者准备好接收工作负载并开始分配任务。 + +### 配置数据 + +如上所述,Cloud-init 使用的配置数据来自两个潜在来源:云提供商和实例用户。在家庭实验室中,你扮演着这两种角色:作为云提供商提供网络和实例信息,作为用户提供配置信息。 + +#### 云提供商元数据文件 + +在你的云提供商角色中,你的家庭实验室数据源将为你的私有云实例提供一个元数据文件。这个[元数据][9]文件包含实例 ID、云类型、Python 版本(Cloud-init 用 Python 编写并使用 Python)或要分配给主机的 SSH 公钥等信息。如果你不使用 DHCP(或 Cloud-init 支持的其他机制,如镜像中的配置文件或内核参数),元数据文件还可能包含网络信息。 + +#### 用户提供的用户数据文件 + +Cloud-init 的真正价值在于用户数据文件。[用户数据][10]文件由用户提供给云提供商,并包含在数据源中,它将实例从一台普通的机器变成了用户舰队的一员。用户数据文件可以以可执行脚本的形式出现,与正常情况下脚本的工作方式相同;也可以以云服务配置 YAML 文件的形式出现,利用 [Cloud-init 的模块][11] 来执行配置任务。 + +### 数据源 + +数据源是由云提供商提供的服务,它为实例提供了元数据和用户数据文件。实例镜像或 ISO 被配置为告知实例正在使用什么数据源。 + +例如,亚马逊 AWS 提供了一个 [link-local][12] 文件,它将用实例的自定义数据来响应实例的 HTTP 请求。其他云提供商也有自己的机制。幸运的是,对于家庭私有云项目来说,也有 NoCloud 数据源。 + +[NoCloud][13] 数据源允许通过内核命令以键值对的形式提供配置信息,或通过挂载的 ISO 文件系统以用户数据和元数据文件的形式提供。这些对于虚拟机来说很有用,尤其是与自动化搭配来创建虚拟机。 + +还有一个 NoCloudNet 数据源,它的行为类似于 AWS EC2 数据源,提供一个 IP 地址或 DNS 名称,通过 HTTP 从这里检索用户数据和元数据。这对于你的家庭实验室中的物理机器来说是最有帮助的,比如树莓派、[NUC][14] 或多余的服务器设备。虽然 NoCloud 可以工作,但它需要更多的人工关注 —— 这是云实例的反模式。 + +### 家庭实验室的 Cloud-init + +我希望这能让你了解到 Cloud-init 是什么,以及它对你的家庭实验室有何帮助。它是一个令人难以置信的工具,被主要的云提供商所接受,在家里使用它可以是为了教育和乐趣,并帮助你自动向实验室添加新的物理或虚拟服务器。之后的文章将详细介绍如何创建简单的静态和更复杂的动态 Cloud-init 服务,并指导你将它们纳入你的家庭私有云。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M (gears and lightbulb to represent innovation) +[2]: https://cloudinit.readthedocs.io/ +[3]: https://linux.cn/article-12277-1.html +[4]: https://opensource.com/article/19/3/home-lab +[5]: https://www.redhat.com/en/topics/cloud-computing/what-is-hybrid-cloud +[6]: https://cloudinit.readthedocs.io/en/latest/topics/datasources.html +[7]: https://www.ansible.com/ +[8]: https://puppet.com/ +[9]: https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html# +[10]: https://cloudinit.readthedocs.io/en/latest/topics/format.html +[11]: https://cloudinit.readthedocs.io/en/latest/topics/modules.html +[12]: https://en.wikipedia.org/wiki/Link-local_address +[13]: https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html +[14]: https://en.wikipedia.org/wiki/Next_Unit_of_Computing diff --git a/published/202007/20200527 Add nodes to your private cloud using Cloud-init.md b/published/202007/20200527 Add nodes to your private cloud using Cloud-init.md new file mode 100644 index 0000000000..1f0939e103 --- /dev/null +++ b/published/202007/20200527 Add nodes to your private cloud using Cloud-init.md @@ -0,0 +1,315 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12407-1.html) +[#]: subject: (Add nodes to your private cloud using Cloud-init) +[#]: via: (https://opensource.com/article/20/5/create-simple-cloud-init-service-your-homelab) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +使用 Cloud-init 将节点添加到你的私有云中 +====== + +> 像主流云提供商的处理方式一样,在家中添加机器到你的私有云。 + +![](https://img.linux.net.cn/data/attachment/album/202007/12/100823rj096h3ax4hhehey.jpg) + +[Cloud-init][2] 是一种广泛使用的行业标准方法,用于初始化云实例。云提供商使用 Cloud-init 来定制实例的网络配置、实例信息,甚至用户提供的配置指令。它也是一个可以在你的“家庭私有云”中使用的很好的工具,可以为你的家庭实验室的虚拟机和物理机的初始设置和配置添加一点自动化 —— 并了解更多关于大型云提供商是如何工作的信息。关于更多的细节和背景,请看我之前的文章《[在你的树莓派家庭实验室中使用 Cloud-init][3]》。 + +![A screen showing the boot process for a Linux server running Cloud-init ][4] + +*运行 Cloud-init 的 Linux 服务器的启动过程(Chris Collins,[CC BY-SA 4.0][5])* + +诚然,Cloud-init 对于为许多不同客户配置机器的云提供商来说,比对于由单个系统管理员运行的家庭实验室更有用,而且 Cloud-init 解决的许多问题对于家庭实验室来说可能有点多余。然而,设置它并了解它的工作原理是了解更多关于这种云技术的好方法,更不用说它是首次启动时配置设备的好方法。 + +本教程使用 Cloud-init 的 NoCloud 数据源,它允许 Cloud-init 在传统的云提供商环境之外使用。本文将向你展示如何在客户端设备上安装 Cloud-init,并设置一个运行 Web 服务的容器来响应客户端的请求。你还将学习如何审查客户端从 Web 服务中请求的内容,并修改 Web 服务的容器,以提供基本的、静态的 Cloud-init 服务。 + +### 在现有系统上设置 Cloud-init + +Cloud-init 可能在新系统首次启动时最有用,它可以查询配置数据,并根据指令对系统进行定制。它可以[包含在树莓派和单板计算机的磁盘镜像中][6],也可以添加到用于配给provision虚拟机的镜像中。对于测试用途来说,无论是在现有系统上安装并运行 Cloud-init,还是安装一个新系统,然后设置 Cloud-init,都是很容易的。 + +作为大多数云提供商使用的主要服务,大多数 Linux 发行版都支持 Cloud-init。在这个例子中,我将使用 Fedora 31 Server 来安装树莓派,但在 Raspbian、Ubuntu、CentOS 和大多数其他发行版上也可以用同样的方式来完成。 + +#### 安装并启用云计算初始服务 + +在你想作为 Cloud-init 客户端的系统上,安装 Cloud-init 包。如果你使用的是 Fedora: + +``` +# Install the cloud-init package +dnf install -y cloud-init +``` + +Cloud-init 实际上是四个不同的服务(至少在 systemd 下是这样),这些服务负责检索配置数据,并在启动过程的不同阶段进行配置更改,这使得可以做的事情更加灵活。虽然你不太可能直接与这些服务进行太多交互,但在你需要排除一些故障时,知道它们是什么还是很有用的。它们是: + + * cloud-init-local.service + * cloud-init.service + * cloud-config.service + * cloud-final.service + +启用所有四个服务: + +``` +# Enable the four cloud-init services +systemctl enable cloud-init-local.service +systemctl enable cloud-init.service +systemctl enable cloud-config.service +systemctl enable cloud-final.service +``` + +#### 配置数据源以查询 + +启用服务后,请配置数据源,客户端将从该数据源查询配置数据。有[许多数据源类型][7],而且大多数都是为特定的云提供商配置的。对于你的家庭实验室,请使用 NoCloud 数据源,(如上所述)它是为在没有云提供商的情况下使用 Cloud-init 而设计的。 + +NoCloud 允许以多种方式包含配置信息:以内核参数中的键/值对,用于在启动时挂载的 CD(或虚拟机中的虚拟 CD);包含在文件系统中的文件中;或者像本例中一样,通过 HTTP 从指定的 URL(“NoCloud Net” 选项)获取配置信息。 + +数据源配置可以通过内核参数提供,也可以在 Cloud-init 配置文件 `/etc/cloud/cloud.cfg` 中进行设置。该配置文件对于使用自定义磁盘镜像设置 Cloud-init 或在现有主机上进行测试非常方便。 + +Cloud-init 还会合并在 `/etc/cloud/cloud.cfg.d/` 中找到的任何 `*.cfg` 文件中的配置数据,因此为了保持整洁,请在 `/etc/cloud/cloud.cfg.d/10_datasource.cfg` 中配置数据源。Cloud-init 可以通过使用以下语法从 `seedfrom` 键指向的 HTTP 数据源中读取数据。 + +``` +seedfrom: http://ip_address:port/ +``` + +IP 地址和端口是你将在本文后面创建的 Web 服务。我使用了我的笔记本电脑的 IP 和 8080 端口。这也可以是 DNS 名称。 + +创建 `/etc/cloud/cloud.cfg.d/10_datasource.cfg` 文件: + +``` +# Add the datasource: +# /etc/cloud/cloud.cfg.d/10_datasource.cfg + +# NOTE THE TRAILING SLASH HERE! +datasource: +  NoCloud: +    seedfrom: http://ip_address:port/ +``` + +客户端设置就是这样。现在,重新启动客户端后,它将尝试从你在 `seedfrom` 键中输入的 URL 检索配置数据,并进行必要的任何配置更改。 + +下一步是设置一个 Web 服务器来侦听客户端请求,以便你确定需要提供的服务。 + +### 设置网络服务器以审查客户请求 + +你可以使用 [Podman][8] 或其他容器编排工具(如 Docker 或 Kubernetes)快速创建和运行 Web 服务器。这个例子使用的是 Podman,但同样的命令也适用于 Docker。 + +要开始,请使用 `fedora:31` 容器镜像并创建一个容器文件(对于 Docker 来说,这会是一个 Dockerfile)来安装和配置 Nginx。从该容器文件中,你可以构建一个自定义镜像,并在你希望提供 Cloud-init 服务的主机上运行它。 + +创建一个包含以下内容的容器文件: + +``` +FROM fedora:31 + +ENV NGINX_CONF_DIR "/etc/nginx/default.d" +ENV NGINX_LOG_DIR "/var/log/nginx" +ENV NGINX_CONF "/etc/nginx/nginx.conf" +ENV WWW_DIR "/usr/share/nginx/html" + +# Install Nginx and clear the yum cache +RUN dnf install -y nginx \ + && dnf clean all \ + && rm -rf /var/cache/yum + +# forward request and error logs to docker log collector +RUN ln -sf /dev/stdout ${NGINX_LOG_DIR}/access.log \ + && ln -sf /dev/stderr ${NGINX_LOG_DIR}/error.log + +# Listen on port 8080, so root privileges are not required for podman +RUN sed -i -E 's/(listen)([[:space:]]*)(\[\:\:\]\:)?80;$/\1\2\38080 default_server;/' $NGINX_CONF +EXPOSE 8080 + +# Allow Nginx PID to be managed by non-root user +RUN sed -i '/user nginx;/d' $NGINX_CONF +RUN sed -i 's/pid \/run\/nginx.pid;/pid \/tmp\/nginx.pid;/' $NGINX_CONF + +# Run as an unprivileged user +USER 1001 + +CMD ["nginx", "-g", "daemon off;"] +``` + +注:本例中使用的容器文件和其他文件可以在本项目的 [GitHub 仓库][9]中找到。 + +上面容器文件中最重要的部分是改变日志存储方式的部分(写到 STDOUT 而不是文件),这样你就可以在容器日志中看到进入该服务器的请求。其他的一些改变使你可以在没有 root 权限的情况下使用 Podman 运行容器,也可以在没有 root 权限的情况下运行容器中的进程。 + +在 Web 服务器上的第一个测试并不提供任何 Cloud-init 数据;只是用它来查看 Cloud-init 客户端的请求。 + +创建容器文件后,使用 Podman 构建并运行 Web 服务器镜像: + +``` +# Build the container image +$ podman build -f Containerfile -t cloud-init:01 . + +# Create a container from the new image, and run it +# It will listen on port 8080 +$ podman run --rm -p 8080:8080 -it cloud-init:01 +``` + +这会运行一个容器,让你的终端连接到一个伪 TTY。一开始看起来什么都没有发生,但是对主机 8080 端口的请求会被路由到容器内的 Nginx 服务器,并且在终端窗口中会出现一条日志信息。这一点可以用主机上的 `curl` 命令进行测试。 + +``` +# Use curl to send an HTTP request to the Nginx container +$ curl http://localhost:8080 +``` + +运行该 `curl` 命令后,你应该会在终端窗口中看到类似这样的日志信息: + +``` +127.0.0.1 - - [09/May/2020:19:25:10 +0000] "GET / HTTP/1.1" 200 5564 "-" "curl/7.66.0" "-" +``` + +现在,有趣的部分来了:重启 Cloud-init 客户端,并观察 Nginx 日志,看看当客户端启动时, Cloud-init 向 Web 服务器发出了什么请求。 + +当客户端完成其启动过程时,你应该会看到类似的日志消息。 + +``` +2020/05/09 22:44:28 [error] 2#0: *4 open() "/usr/share/nginx/html/meta-data" failed (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET /meta-data HTTP/1.1", host: "instance-data:8080" +127.0.0.1 - - [09/May/2020:22:44:28 +0000] "GET /meta-data HTTP/1.1" 404 3650 "-" "Cloud-Init/17.1" "-" +``` + +注:使用 `Ctrl+C` 停止正在运行的容器。 + +你可以看到请求是针对 `/meta-data` 路径的,即 `http://ip_address_of_the_webserver:8080/meta-data`。这只是一个 GET 请求 —— Cloud-init 并没有向 Web 服务器发送任何数据。它只是盲目地从数据源 URL 中请求文件,所以要由数据源来识别主机的要求。这个简单的例子只是向任何客户端发送通用数据,但一个更大的家庭实验室应该需要更复杂的服务。 + +在这里,Cloud-init 请求的是[实例元数据][10]信息。这个文件可以包含很多关于实例本身的信息,例如实例 ID、分配实例的主机名、云 ID,甚至网络信息。 + +创建一个包含实例 ID 和主机名的基本元数据文件,并尝试将其提供给 Cloud-init 客户端。 + +首先,创建一个可复制到容器镜像中的 `meta-data` 文件。 + +``` +instance-id: iid-local01 +local-hostname: raspberry +hostname: raspberry +``` + +实例 ID(`instance-id`)可以是任何东西。但是,如果你在 Cloud-init 运行后更改实例 ID,并且文件被送达客户端,就会触发 Cloud-init 再次运行。你可以使用这种机制来更新实例配置,但你应该意识到它是这种工作方式。 + +`local-hostname` 和 `hostname` 键正如其名,它们会在 Cloud-init 运行时为客户端设置主机名信息。 + +在容器文件中添加以下行以将 `meta-data` 文件复制到新镜像中。 + +``` +# Copy the meta-data file into the image for Nginx to serve it +COPY meta-data ${WWW_DIR}/meta-data +``` + +现在,用元数据文件重建镜像(使用一个新的标签以方便故障排除),并用 Podman 创建并运行一个新的容器。 + +``` +# Build a new image named cloud-init:02 +podman build -f Containerfile -t cloud-init:02 . + +# Run a new container with this new meta-data file +podman run --rm -p 8080:8080 -it cloud-init:02 +``` + +新容器运行后,重启 Cloud-init 客户端,再次观察 Nginx 日志。 + +``` +127.0.0.1 - - [09/May/2020:22:54:32 +0000] "GET /meta-data HTTP/1.1" 200 63 "-" "Cloud-Init/17.1" "-" +2020/05/09 22:54:32 [error] 2#0: *2 open() "/usr/share/nginx/html/user-data" failed (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET /user-data HTTP/1.1", host: "instance-data:8080" +127.0.0.1 - - [09/May/2020:22:54:32 +0000] "GET /user-data HTTP/1.1" 404 3650 "-" "Cloud-Init/17.1" "-" +``` + +你看,这次 `/meta-data` 路径被提供给了客户端。成功了! + +然而,客户端接着在 `/user-data` 路径上寻找第二个文件。该文件包含实例所有者提供的配置数据,而不是来自云提供商的数据。对于一个家庭实验室来说,这两个都是你自己提供的。 + +你可以使用[许多 user-data 模块][11]来配置你的实例。对于这个例子,只需使用 `write_files` 模块在客户端创建一些测试文件,并验证 Cloud-init 是否工作。 + +创建一个包含以下内容的用户数据文件: + +``` +#cloud-config + +# Create two files with example content using the write_files module +write_files: + - content: | +    "Does cloud-init work?" +   owner: root:root +   permissions: '0644' +   path: /srv/foo + - content: | +   "IT SURE DOES!" +   owner: root:root +   permissions: '0644' +   path: /srv/bar +``` + +除了使用 Cloud-init 提供的 `user-data` 模块制作 YAML 文件外,你还可以将其制作成一个可执行脚本供 Cloud-init 运行。 + +创建 `user-data` 文件后,在容器文件中添加以下行,以便在重建映像时将其复制到镜像中: + +``` +# Copy the user-data file into the container image +COPY user-data ${WWW_DIR}/user-data +``` + +重建镜像,并创建和运行一个新的容器,这次使用用户数据信息: + +``` +# Build a new image named cloud-init:03 +podman build -f Containerfile -t cloud-init:03 . + +# Run a new container with this new user-data file +podman run --rm -p 8080:8080 -it cloud-init:03 +``` + +现在,重启 Cloud-init 客户端,观察 Web 服务器上的 Nginx 日志: + +``` +127.0.0.1 - - [09/May/2020:23:01:51 +0000] "GET /meta-data HTTP/1.1" 200 63 "-" "Cloud-Init/17.1" "-" +127.0.0.1 - - [09/May/2020:23:01:51 +0000] "GET /user-data HTTP/1.1" 200 298 "-" "Cloud-Init/17.1" "- +``` + +成功了!这一次,元数据和用户数据文件都被送到了 Cloud-init 客户端。 + +### 验证 Cloud-init 已运行 + +从上面的日志中,你知道 Cloud-init 在客户端主机上运行并请求元数据和用户数据文件,但它用它们做了什么?你可以在 `write_files` 部分验证 Cloud-init 是否写入了你在用户数据文件中添加的文件。 + +在 Cloud-init 客户端上,检查 `/srv/foo` 和 `/srv/bar` 文件的内容: + +``` +# cd /srv/ && ls +bar foo +# cat foo +"Does cloud-init work?" +# cat bar +"IT SURE DOES!" +``` + +成功了!文件已经写好了,并且有你期望的内容。 + +如上所述,还有很多其他模块可以用来配置主机。例如,用户数据文件可以配置成用 `apt` 添加包、复制 SSH 的 `authorized_keys`、创建用户和组、配置和运行配置管理工具等等。我在家里的私有云中使用它来复制我的 `authorized_keys`、创建一个本地用户和组,并设置 sudo 权限。 + +### 你接下来可以做什么 + +Cloud-init 在家庭实验室中很有用,尤其是专注于云技术的实验室。本文所演示的简单服务对于家庭实验室来说可能并不是超级有用,但现在你已经知道 Cloud-init 是如何工作的了,你可以继续创建一个动态服务,可以用自定义数据配置每台主机,让家里的私有云更类似于主流云提供商提供的服务。 + +在数据源稍显复杂的情况下,将新的物理(或虚拟)机器添加到家中的私有云中,可以像插入它们并打开它们一样简单。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/create-simple-cloud-init-service-your-homelab + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://cloudinit.readthedocs.io/ +[3]: https://linux.cn/article-12371-1.html +[4]: https://opensource.com/sites/default/files/uploads/cloud-init.jpg (A screen showing the boot process for a Linux server running Cloud-init ) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://linux.cn/article-12277-1.html +[7]: https://cloudinit.readthedocs.io/en/latest/topics/datasources.html +[8]: https://podman.io/ +[9]: https://github.com/clcollins/homelabCloudInit/tree/master/simpleCloudInitService/data +[10]: https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html#what-is-instance-data +[11]: https://cloudinit.readthedocs.io/en/latest/topics/modules.html diff --git a/published/202007/20200605 Build a Kubernetes cluster with the Raspberry Pi.md b/published/202007/20200605 Build a Kubernetes cluster with the Raspberry Pi.md new file mode 100644 index 0000000000..3055c80de0 --- /dev/null +++ b/published/202007/20200605 Build a Kubernetes cluster with the Raspberry Pi.md @@ -0,0 +1,424 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12421-1.html) +[#]: subject: (Build a Kubernetes cluster with the Raspberry Pi) +[#]: via: (https://opensource.com/article/20/6/kubernetes-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +用树莓派构建 Kubernetes 集群 +====== + +> 将 Kubernetes 安装在多个树莓派上,实现自己的“家庭私有云”容器服务。 + +![](https://img.linux.net.cn/data/attachment/album/202007/15/234152ivw1y2wwhmhmpuvo.jpg) + +[Kubernetes][2] 从一开始就被设计为云原生的企业级容器编排系统。它已经成长为事实上的云容器平台,并由于接受了容器原生虚拟化和无服务器计算等新技术而继续发展。 + +从微型的边缘计算到大规模的容器环境,无论是公有云还是私有云环境,Kubernetes 都可以管理其中的容器。它是“家庭私有云”项目的理想选择,既提供了强大的容器编排,又让你有机会了解一项这样的技术 —— 它的需求如此之大,与云计算结合得如此彻底,以至于它的名字几乎就是“云计算”的代名词。 + +没有什么比 Kubernetes 更懂“云”,也没有什么能比树莓派更合适“集群起来”!在廉价的树莓派硬件上运行本地的 Kubernetes 集群是获得在真正的云技术巨头上进行管理和开发的经验的好方法。 + +### 在树莓派上安装 Kubernetes 集群 + +本练习将在三个或更多运行 Ubuntu 20.04 的树莓派 4 上安装 Kubernetes 1.18.2 集群。Ubuntu 20.04(Focal Fossa)提供了针对 64 位 ARM(ARM64)的树莓派镜像(64 位内核和用户空间)。由于目标是使用这些树莓派来运行 Kubernetes 集群,因此运行 AArch64 容器镜像的能力非常重要:很难找到 32 位的通用软件镜像乃至于标准基础镜像。借助 Ubuntu 20.04 的 ARM64 镜像,可以让你在 Kubernetes 上使用 64 位容器镜像。 + +#### AArch64 vs. ARM64;32 位 vs. 64 位;ARM vs. x86 + +请注意,AArch64 和 ARM64 实际上是同一种东西。不同的名称源于它们在不同社区中的使用。许多容器镜像都标为 AArch64,并能在标为 ARM64 的系统上正常运行。采用 AArch64/ARM64 架构的系统也能够运行 32 位的 ARM 镜像,但反之则不然:32 位的 ARM 系统无法运行 64 位的容器镜像。这就是 Ubuntu 20.04 ARM64 镜像如此有用的原因。 + +这里不会太深入地解释不同的架构类型,值得注意的是,ARM64/AArch64 和 x86\_64 架构是不同的,运行在 64 位 ARM 架构上的 Kubernetes 节点无法运行为 x86\_64 构建的容器镜像。在实践中,你会发现有些镜像没有为两种架构构建,这些镜像可能无法在你的集群中使用。你还需要在基于 Arch64 的系统上构建自己的镜像,或者跳过一些限制以让你的常规的 x86\_64 系统构建 Arch64 镜像。在“家庭私有云”项目的后续文章中,我将介绍如何在常规系统上构建 AArch64 镜像。 + +为了达到两全其美的效果,在本教程中设置好 Kubernetes 集群后,你可以在以后向其中添加 x86\_64 节点。你可以通过使用 [Kubernetes 的污点taint容忍toleration][3] 能力,由 Kubernetes 的调度器将给定架构的镜像调度到相应的节点上运行。 + +关于架构和镜像的内容就不多说了。是时候安装 Kubernetes 了,开始吧! + +#### 前置需求 + +这个练习的要求很低。你将需要: + +* 三台(或更多)树莓派 4(最好是 4GB 内存的型号)。 +* 在全部树莓派上安装 Ubuntu 20.04 ARM64。 + +为了简化初始设置,请阅读《[修改磁盘镜像来创建基于树莓派的家庭实验室][4]》,在将 Ubuntu 镜像写入 SD 卡并安装在树莓派上之前,添加一个用户和 SSH 授权密钥(`authorized_keys`)。 + +### 配置主机 + +在 Ubuntu 被安装在树莓派上,并且可以通过 SSH 访问后,你需要在安装 Kubernetes 之前做一些修改。 + +#### 安装和配置 Docker + +截至目前,Ubuntu 20.04 在 base 软件库中提供了最新版本的 Docker,即 v19.03,可以直接使用 `apt` 命令安装它。请注意,包名是 `docker.io`。请在所有的树莓派上安装 Docker: + +``` +# 安装 docker.io 软件包 +$ sudo apt install -y docker.io +``` + +安装好软件包后,你需要做一些修改来启用 [cgroup][5](控制组)。cgroup 允许 Linux 内核限制和隔离资源。实际上,这可以让 Kubernetes 更好地管理其运行的容器所使用的资源,并通过让容器彼此隔离来增加安全性。 + +在对所有树莓派进行以下修改之前,请检查 `docker info` 的输出: + +``` +# 检查 `docker info` +# 省略了某些输出 +$ sudo docker info +(...) + Cgroup Driver: cgroups +(...) +WARNING: No memory limit support +WARNING: No swap limit support +WARNING: No kernel memory limit support +WARNING: No kernel memory TCP limit support +WARNING: No oom kill disable support +``` + +上面的输出突出显示了需要修改的部分:cgroup 驱动和限制支持。 + +首先,将 Docker 使用的默认 cgroup 驱动从 `cgroups` 改为 `systemd`,让 systemd 充当 cgroup 管理器,确保只有一个 cgroup 管理器在使用。这有助于系统的稳定性,这也是 Kubernetes 所推荐的。要做到这一点,请创建 `/etc/docker/daemon.json` 文件或将内容替换为: + +``` +# 创建或替换 /etc/docker/daemon.json 以启用 cgroup 的 systemd 驱动 + +$ sudo cat > /etc/docker/daemon.json <容器网络接口Container Network Interface(CNI)加载项使用。本练习使用的是 [Flannel][7] CNI。你选择的 CIDR 不应该与你的家庭网络中当前使用的任何 CIDR 重叠,也不应该与你的路由器或 DHCP 服务器管理的 CIDR 重叠。确保使用一个比你预期需要的更大的子网:**总是**有比你最初计划的更多的 Pod!在这个例子中,我将使用 CIDR 地址 `10.244.0.0/16`,但你可以选择一个适合你的。 + +有了这些决定,你就可以初始化控制平面节点了。用 SSH 或其他方式登录到你为控制平面指定的节点。 + +#### 初始化控制平面 + +Kubernetes 使用一个引导令牌来验证被加入集群的节点。当初始化控制平面节点时,需要将此令牌传递给 `kubeadm init` 命令。用 `kubeadm token generate` 命令生成一个令牌: + +``` +# 生成一个引导令牌来验证加入集群的节点 +$ TOKEN=$(sudo kubeadm token generate) +$ echo $TOKEN +d584xg.xupvwv7wllcpmwjy +``` + +现在你可以使用 `kubeadm init` 命令来初始化控制平面了: + +``` +# 初始化控制平面 +#(输出略) +$ sudo kubeadm init --token=${TOKEN} --kubernetes-version=v1.18.2 --pod-network-cidr=10.244.0.0/16 +``` + +如果一切顺利,你应该在输出的最后看到类似这样的东西: + +``` +Your Kubernetes control-plane has initialized successfully! + +To start using your cluster, you need to run the following as a regular user: + + mkdir -p $HOME/.kube + sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config + sudo chown $(id -u):$(id -g) $HOME/.kube/config + +You should now deploy a pod network to the cluster. +Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: + https://kubernetes.io/docs/concepts/cluster-administration/addons/ + +Then you can join any number of worker nodes by running the following on each as root: + +kubeadm join 192.168.2.114:6443 --token zqqoy7.9oi8dpkfmqkop2p5 \ + --discovery-token-ca-cert-hash sha256:71270ea137214422221319c1bdb9ba6d4b76abfa2506753703ed654a90c4982b +``` + +注意两点:第一,Kubernetes 的 `kubectl` 连接信息已经写入到 `/etc/kubernetes/admin.conf`。这个 kubeconfig 文件可以复制到用户的 `~/.kube/config` 中,可以是主节点上的 root 用户或普通用户,也可以是远程机器。这样你就可以用 `kubectl` 命令来控制你的集群。 + +其次,输出中以 `kubernetes join` 开头的最后一行是你可以运行的命令,你可以运行这些命令加入更多的节点到集群中。 + +将新的 kubeconfig 复制到你的用户可以使用的地方后,你可以用 `kubectl get nodes` 命令来验证控制平面是否已经安装: + +``` +# 显示 Kubernetes 集群中的节点 +# 你的节点名称会有所不同 +$ kubectl get nodes +NAME         STATUS   ROLES    AGE     VERSION +elderberry   Ready    master   7m32s   v1.18.2 +``` + +#### 安装 CNI 加载项 + +CNI 加载项负责 Pod 网络的配置和清理。如前所述,这个练习使用的是 Flannel CNI 加载项,在已经设置好 `podCIDR` 值的情况下,你只需下载 Flannel YAML 并使用 `kubectl apply` 将其安装到集群中。这可以用 `kubectl apply -f -` 从标准输入中获取数据,用一行命令完成。这将创建管理 Pod 网络所需的 ClusterRoles、ServiceAccounts 和 DaemonSets 等。 + +下载并应用 Flannel YAML 数据到集群中: + +``` +# 下载 Flannel YAML 数据并应用它 +# (输出略) +$ curl -sSL https://raw.githubusercontent.com/coreos/flannel/v0.12.0/Documentation/kube-flannel.yml | kubectl apply -f - +``` + +#### 将计算节点加入到集群中 + +有了 CNI 加载项,现在是时候将计算节点添加到集群中了。加入计算节点只需运行 `kube init` 命令末尾提供的 `kubeadm join` 命令来初始化控制平面节点。对于你想加入集群的其他树莓派,登录主机,运行命令即可: + +``` +# 加入节点到集群,你的令牌和 ca-cert-hash 应各有不同 +$ sudo kubeadm join 192.168.2.114:6443 --token zqqoy7.9oi8dpkfmqkop2p5 \ +    --discovery-token-ca-cert-hash sha256:71270ea137214422221319c1bdb9ba6d4b76abfa2506753703ed654a90c4982b +``` + +一旦你完成了每个节点的加入,你应该能够在 `kubectl get nodes` 的输出中看到新节点: + +``` +# 显示 Kubernetes 集群中的节点 +# 你的节点名称会有所不同 +$ kubectl get nodes +NAME         STATUS   ROLES    AGE     VERSION +elderberry   Ready    master   7m32s   v1.18.2 +gooseberry    Ready    <none>   2m39s   v1.18.2 +huckleberry   Ready    <none>   17s     v1.18.2 +``` + +#### 验证集群 + +此时,你已经拥有了一个完全正常工作的 Kubernetes 集群。你可以运行 Pod、创建部署和作业等。你可以使用[服务][8]从集群中的任何一个节点访问集群中运行的应用程序。你可以通过 NodePort 服务或入口控制器实现外部访问。 + +要验证集群正在运行,请创建一个新的命名空间、部署和服务,并检查在部署中运行的 Pod 是否按预期响应。此部署使用 `quay.io/clcollins/kube-verify:01` 镜像,这是一个监听请求的 Nginx 容器(实际上,与文章《[使用 Cloud-init 将节点添加到你的私有云][9]》中使用的镜像相同)。你可以在[这里][10]查看镜像的容器文件。 + +为部署创建一个名为 `kube-verify` 的命名空间: + +``` +# 创建一个新的命名空间 +$ kubectl create namespace kube-verify +# 列出命名空间 +$ kubectl get namespaces +NAME              STATUS   AGE +default           Active   63m +kube-node-lease   Active   63m +kube-public       Active   63m +kube-system       Active   63m +kube-verify       Active   19s +``` + +现在,在新的命名空间创建一个部署: + +``` +# 创建一个新的部署 +$ cat < + + + +``` + +成功了!你的服务正在运行,容器内的 Nginx 正在响应你的请求。你的服务正在运行,容器内的 Nginx 正在响应你的请求。 + +此时,你的树莓派上有一个正在运行的 Kubernetes 集群,安装了一个 CNI 加载项(Flannel),并有一个运行 Nginx Web 服务器的测试部署和服务。在大型公有云中,Kubernetes 有不同的入口控制器来与不同的解决方案交互,比如最近报道的 [Skipper][12] 项目。同样,私有云也有与硬件负载均衡器设备(如 F5 Networks 的负载均衡器)交互的入口控制器,或用于处理进入节点的流量的 Nginx 和 HAProxy 控制器。 + +在以后的文章中,我将通过安装自己的入口控制器来解决将集群中的服务暴露给外界的问题。我还将研究动态存储供应器和 StorageClasses,以便为应用程序分配持久性存储,包括利用你在上一篇文章《[将树莓派家庭实验室变成网络文件系统][13]》中设置的 NFS 服务器来为你的 Pod 创建按需存储。 + +### 去吧,Kubernetes + +“Kubernetes”(κυβερνήτης)在希腊语中是飞行员的意思 —— 但这是否意味着驾驶船只以及引导船只的人?诶,不是。“Kubernan”(κυβερνάω)是希腊语“驾驶”或“引导”的意思,因此,去吧,Kubernan,如果你在会议上或其它什么活动上看到我,请试着给我一个动词或名词的通行证,以另一种语言 —— 我不会说的语言。 + +免责声明:如前所述,我不会读也不会讲希腊语,尤其是古希腊语,所以我选择相信我在网上读到的东西。你知道那是怎么一回事。我对此有所保留,放过我吧,因为我没有开“对我来说都是希腊语”这种玩笑。然而,只是提一下,虽然我可以开玩笑,但是实际上没有,所以我要么偷偷摸摸,要么聪明,要么两者兼而有之。或者,两者都不是。我并没有说这是个好笑话。 + +所以,去吧,像专业人员一样在你的家庭私有云中用自己的 Kubernetes 容器服务来试运行你的容器吧!当你越来越得心应手时,你可以修改你的 Kubernetes 集群,尝试不同的选项,比如前面提到的入口控制器和用于持久卷的动态 StorageClasses。 + +这种持续学习是 [DevOps][14] 的核心,持续集成和新服务交付反映了敏捷方法论,当我们学会了处理云实现的大规模扩容,并发现我们的传统做法无法跟上步伐时,我们就接受了这两种方法论。 + +你看,技术、策略、哲学、一小段希腊语和一个可怕的原始笑话,都汇聚在一篇文章当中。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/kubernetes-raspberry-pi + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_cartoon.png?itok=m3TcBONJ (Cartoon graphic of Raspberry Pi board) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ +[4]: https://linux.cn/article-12277-1.html +[5]: https://en.wikipedia.org/wiki/Cgroups +[6]: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing +[7]: https://github.com/coreos/flannel +[8]: https://kubernetes.io/docs/concepts/services-networking/service/ +[9]: https://linux.cn/article-12407-1.html +[10]: https://github.com/clcollins/homelabCloudInit/blob/master/simpleCloudInitService/data/Containerfile +[11]: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" +[12]: https://opensource.com/article/20/4/http-kubernetes-skipper +[13]: https://linux.cn/article-12413-1.html +[14]: https://opensource.com/tags/devops diff --git a/published/202007/20200608 How to Create Curve Text in GIMP in 5 Simple Steps -GIMP Beginner-s Tutorial.md b/published/202007/20200608 How to Create Curve Text in GIMP in 5 Simple Steps -GIMP Beginner-s Tutorial.md new file mode 100644 index 0000000000..3a6c0a44d4 --- /dev/null +++ b/published/202007/20200608 How to Create Curve Text in GIMP in 5 Simple Steps -GIMP Beginner-s Tutorial.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12396-1.html) +[#]: subject: (How to Create Curve Text in GIMP in 5 Simple Steps [GIMP Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/curve-text-gimp/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +GIMP 教程:如何在 GIMP 中创建曲线文本 +====== + +当你在 GIMP 中制作一个徽章、海报或其它任何作品时,你需要扭曲或弯曲一些文本。多功能的 [GIMP][1] 工具提供了一些创建弯曲文本的方法。取决于你将如何使用它和你想给予文本的弧度,有一些适合不同情况的方法。 + +在本篇教程中,我将向你展示我最喜欢的创建曲线文本的方法。 + +### 如何在 GIMP 中创建曲线文本 + +![][2] + +请确保你已经在你的系统上安装了 GIMP。 + +#### 步骤 1: 创建一个你想要的匹配曲线的路径 + +创建一个新的图像或打开一个现有的图像。选择 “工具 -> 路径”,然后大致考虑曲线文本的位置,通过分别单击路径点的开始点和结束点来创建路径。 + +![创建一个路径][3] + +**然后给你的路径一个曲率。**首先向上或向下拖动中间的直线,然后通过移动调整点进行微调。这将给予它一个拱形结构。 + +![弯曲路径][4] + +#### 步骤 2: 创建你想弯曲的文本 + +当你对自己的曲线路径满意时,你可以移动到接下来的步骤,并 **创建你的文本**。 + +你可能想更改字体及其大小。我的选择只是为了演示用途。 + +![创建一个文本][5] + +#### 步骤 3: 创建一个新的图层 + +我强烈建议分割 GIMP 图像中的每个不同的元素到不同的图层中,以便很容易地控制它们,像移动,打开/关闭一个元素等等。 + +遵循这一规则,我们要弯曲的文本将被放置到一个新的图层中。建议使用像 “Curved Text” 一样的名字来命名你的新的图层,或者一些类似的东西来很容易地识别它。 + +![为弯曲的文本创建一个新的图层][6] + +#### 步骤 4: 弯曲文本 + +现在你需要在你的文本图层上单击,接下来在其上右击,并单击“文字对齐路径”来折弯你的文本。弯曲的文本将被放置到新创建的图层。 + +![文字对齐路径][7] + +你把文本弯曲了!让我们使用颜色填充文本来使其更令人满意。 + +### 步骤 5: 最后的修饰和导出 + +单击弯曲的文本图层,然后转到路径选项卡来选择文本边界。 + +![路径选择][8] + +最后,选择油漆桶工具,选择一种颜色,并如下应用你的选择区。 + +![][9] + +随着最后一步的到来,打开不需要的层的可见性,只保留曲线文本。接下来,需要导出你的文件为你喜欢的图像格式。 + +![][10] + +#### 额外提示:创建阴影效果 + +我还有一个作为一次挑战的额外的步骤,如果你想更进一步的话。让我们在 [GIMP 中勾勒文本][11]以创建一个弯曲文本的阴影效果。 + +我将给予你一些提示: + + * 重新启用所有图层 + * 单击弯曲文本图层,并使用移动工具来到处移动文本 + * 创建另一个图层,并使用黑色来重复油漆桶填充程序 + * 以一种模拟一种阴影位置的方式覆盖图层(你可能需要更改图层顺序) + * 关闭辅助图层 + +最终结果: + +![][12] + +让我在评论区知道你们对这篇 GIMP 教程的想法,以及有多少人尝试了这一额外的步骤。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/curve-text-gimp/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Curve-text-in-GIMP.jpg?ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/1image-1.png?fit=800%2C508&ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.png?fit=800%2C500&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.png?fit=800%2C503&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/new-layer.png?fit=800%2C637&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/text-along-path.png?fit=800%2C625&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/path-to-selection.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/6.png?fit=800%2C539&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/4.png-copy.png?ssl=1 +[11]: https://itsfoss.com/gimp-text-outline/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/its-foss-curved.jpg?fit=800%2C409&ssl=1 +[13]: https://itsfoss.com/subscribe-to-newsletter/ diff --git a/published/202007/20200611 Stop debugging Go with Println and use Delve instead.md b/published/202007/20200611 Stop debugging Go with Println and use Delve instead.md new file mode 100644 index 0000000000..ed93db45b4 --- /dev/null +++ b/published/202007/20200611 Stop debugging Go with Println and use Delve instead.md @@ -0,0 +1,552 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12400-1.html) +[#]: subject: (Stop debugging Go with Println and use Delve instead) +[#]: via: (https://opensource.com/article/20/6/debug-go-delve) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +使用 Delve 代替 Println 来调试 Go 程序 +====== + +> Delve 是能让调试变成轻而易举的事的万能工具包。 + +![](https://img.linux.net.cn/data/attachment/album/202007/09/234357pavw88sbxab0makj.jpg) + +你上次尝试去学习一种新的编程语言时什么时候?你有没有持之以恒,你是那些在新事物发布的第一时间就勇敢地去尝试的一员吗?不管怎样,学习一种新的语言也许非常有用,也会有很多乐趣。 + +你尝试着写简单的 “Hello, world!”,然后写一些示例代码并执行,继续做一些小的修改,之后继续前进。我敢保证我们都有过这个经历,不论我们使用哪种技术。假如你尝试用一段时间一种语言,并且你希望能够精通它,那么有一些事物能在你的进取之路上帮助你。 + +其中之一就是调试器。有些人喜欢在代码中用简单的 “print” 语句进行调试,这种方式很适合代码量少的简单程序;然而,如果你处理的是有多个开发者和几千行代码的大型项目,你应该使用调试器。 + +最近我开始学习 Go 编程语言了,在本文中,我们将探讨一种名为 Delve 的调试器。Delve 是专门用来调试 Go 程序的工具,我们会借助一些 Go 示例代码来了解下它的一些功能。不要担心这里展示的 Go 示例代码;即使你之前没有写过 Go 代码也能看懂。Go 的目标之一是简单,因此代码是始终如一的,理解和解释起来都很容易。 + +### Delve 介绍 + +Delve 是托管在 [GitHub][2] 上的一个开源项目。 + +它自己的文档中写道: + +> Delve 是 Go 编程语言的调试器。该项目的目标是为 Go 提供一个简单、全功能的调试工具。Delve 应该是易于调用和易于使用的。当你使用调试器时,事情可能不会按你的思路运行。如果你这样想,那么你不适合用 Delve。 + +让我们来近距离看一下。 + +我的测试系统是运行着 Fedora Linux 的笔记本电脑,Go 编译器版本如下: + +``` +$ cat /etc/fedora-release +Fedora release 30 (Thirty) +$ +$ go version +go version go1.12.17 linux/amd64 +$ +``` + +### Golang 安装 + +如果你没有安装 Go,你可以运行下面的命令,很轻松地就可以从配置的仓库中获取。 + +``` +$ dnf install golang.x86_64 +``` + +或者,你可以在[安装页面][3]找到适合你的操作系统的其他安装版本。 + +在开始之前,请先确认已经设置好了 Go 工具依赖的下列各个路径。如果这些路径没有设置,有些示例可能不能正常运行。你可以在 SHELL 的 RC 文件中轻松设置这些环境变量,我的机器上是在 `$HOME/bashrc` 文件中设置的。 + +``` +$ go env | grep GOPATH +GOPATH="/home/user/go" +$ +$ go env | grep GOBIN +GOBIN="/home/user/go/gobin" +$ +``` + +### Delve 安装 + +你可以像下面那样,通过运行一个简单的 `go get` 命令来安装 Delve。`go get` 是 Golang 从外部源下载和安装需要的包的方式。如果你安装过程中遇到了问题,可以查看 [Delve 安装教程][4]。 + +``` +$ go get -u github.com/go-delve/delve/cmd/dlv +$ +``` + +运行上面的命令,就会把 Delve 下载到你的 `$GOPATH` 的位置,如果你没有把 `$GOPATH` 设置成其他值,那么默认情况下 `$GOPATH` 和 `$HOME/go` 是同一个路径。 + +你可以进入 `go/` 目录,你可以在 `bin/` 目录下看到 `dlv`。 + +``` +$ ls -l $HOME/go +total 8 +drwxrwxr-x. 2 user user 4096 May 25 19:11 bin +drwxrwxr-x. 4 user user 4096 May 25 19:21 src +$ +$ ls -l ~/go/bin/ +total 19596 +-rwxrwxr-x. 1 user user 20062654 May 25 19:17 dlv +$ +``` + +因为你把 Delve 安装到了 `$GOPATH`,所以你可以像运行普通的 shell 命令一样运行它,即每次运行时你不必先进入它所在的目录。你可以通过 `version` 选项来验证 `dlv` 是否正确安装。示例中安装的版本是 1.4.1。 + +``` +$ which dlv +~/go/bin/dlv +$ +$ dlv version +Delve Debugger +Version: 1.4.1 +Build: $Id: bda606147ff48b58bde39e20b9e11378eaa4db46 $ +$ +``` + +现在,我们一起在 Go 程序中使用 Delve 来理解下它的功能以及如何使用它们。我们先来写一个 `hello.go`,简单地打印一条 `Hello, world!` 信息。 + +记着,我把这些示例程序放到了 `$GOBIN` 目录下。 + +``` +$ pwd +/home/user/go/gobin +$ +$ cat hello.go +package main + +import "fmt" + +func main() { +        fmt.Println("Hello, world!") +} +$ +``` + +运行 `build` 命令来编译一个 Go 程序,它的输入是 `.go` 后缀的文件。如果程序没有语法错误,Go 编译器把它编译成一个二进制可执行文件。这个文件可以被直接运行,运行后我们会在屏幕上看到 `Hello, world!` 信息。 + +``` +$ go build hello.go +$ +$ ls -l hello +-rwxrwxr-x. 1 user user 1997284 May 26 12:13 hello +$ +$ ./hello +Hello, world! +$ +``` + +### 在 Delve 中加载程序 + +把一个程序加载进 Delve 调试器有两种方式。 + +#### 在源码编译成二进制文件之前使用 debug 参数 + +第一种方式是在需要时对源码使用 `debug` 命令。Delve 会为你编译出一个名为 `__debug_bin` 的二进制文件,并把它加载进调试器。 + +在这个例子中,你可以进入 `hello.go` 所在的目录,然后运行 `dlv debug` 命令。如果目录中有多个源文件且每个文件都有自己的主函数,Delve 则可能抛出错误,它期望的是单个程序或从单个项目构建成单个二进制文件。如果出现了这种错误,那么你就应该用下面展示的第二种方式。 + +``` +$ ls -l +total 4 +-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go +$ +$ dlv debug +Type 'help' for list of commands. +(dlv) +``` + +现在打开另一个终端,列出目录下的文件。你可以看到一个多出来的 `__debug_bin` 二进制文件,这个文件是由源码编译生成的,并会加载进调试器。你现在可以回到 `dlv` 提示框继续使用 Delve。 + +``` +$ ls -l +total 2036 +-rwxrwxr-x. 1 user user 2077085 Jun  4 11:48 __debug_bin +-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go +$ +``` + +#### 使用 exec 参数 + +如果你已经有提前编译好的 Go 程序或者已经用 `go build` 命令编译完成了,不想再用 Delve 编译出 `__debug_bin` 二进制文件,那么第二种把程序加载进 Delve 的方法在这些情况下会很有用。在上述情况下,你可以使用 `exec` 命令来把整个目录加载进 Delve 调试器。 + +``` +$ ls -l +total 4 +-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go +$ +$ go build hello.go +$ +$ ls -l +total 1956 +-rwxrwxr-x. 1 user user 1997284 Jun  4 11:54 hello +-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go +$ +$ dlv exec ./hello +Type 'help' for list of commands. +(dlv) +``` + +### 查看 delve 帮助信息 + +在 `dlv` 提示符中,你可以运行 `help` 来查看 Delve 提供的多种帮助选项。命令列表相当长,这里我们只列举一些重要的功能。下面是 Delve 的功能概览。 + +``` +(dlv) help +The following commands are available: + +Running the program: + +Manipulating breakpoints: + +Viewing program variables and memory: + +Listing and switching between threads and goroutines: + +Viewing the call stack and selecting frames: + +Other commands: + +Type help followed by a command for full documentation. +(dlv) +``` + +#### 设置断点 + +现在我们已经把 hello.go 程序加载进了 Delve 调试器,我们在主函数处设置断点,稍后来确认它。在 Go 中,主程序从 `main.main` 处开始执行,因此你需要给这个名字提供个 `break` 命令。之后,我们可以用 `breakpoints` 命令来检查断点是否正确设置了。 + +不要忘了你还可以用命令简写,因此你可以用 `b main.main` 来代替 `break main.main`,两者效果相同,`bp` 和 `breakpoints` 同理。你可以通过运行 `help` 命令查看帮助信息来找到你想要的命令简写。 + +``` +(dlv) break main.main +Breakpoint 1 set at 0x4a228f for main.main() ./hello.go:5 +(dlv) breakpoints +Breakpoint runtime-fatal-throw at 0x42c410 for runtime.fatalthrow() /usr/lib/golang/src/runtime/panic.go:663 (0) +Breakpoint unrecovered-panic at 0x42c480 for runtime.fatalpanic() /usr/lib/golang/src/runtime/panic.go:690 (0) +        print runtime.curg._panic.arg +Breakpoint 1 at 0x4a228f for main.main() ./hello.go:5 (0) +(dlv) +``` + +#### 程序继续执行 + +现在,我们用 `continue` 来继续运行程序。它会运行到断点处中止,在我们的例子中,会运行到主函数的 `main.main` 处中止。从这里开始,我们可以用 `next` 命令来逐行执行程序。请注意,当我们运行到 `fmt.Println("Hello, world!")` 处时,即使我们还在调试器里,我们也能看到打印到屏幕的 `Hello, world!`。 + +``` +(dlv) continue +> main.main() ./hello.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a228f) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func main() { +     6:         fmt.Println("Hello, world!") +     7: } +(dlv) next +> main.main() ./hello.go:6 (PC: 0x4a229d) +     1: package main +     2: +     3: import "fmt" +     4: +     5: func main() { +=>   6:              fmt.Println("Hello, world!") +     7: } +(dlv) next +Hello, world! +> main.main() ./hello.go:7 (PC: 0x4a22ff) +     2: +     3: import "fmt" +     4: +     5: func main() { +     6:         fmt.Println("Hello, world!") +=>   7:      } +(dlv) +``` + +#### 退出 Delve + +你随时可以运行 `quit` 命令来退出调试器,退出之后你会回到 shell 提示符。相当简单,对吗? + +``` +(dlv) quit +$ +``` + +### Delve 的其他功能 + +我们用其他的 Go 程序来探索下 Delve 的其他功能。这次,我们从 [golang 教程][5] 中找了一个程序。如果你要学习 Go 语言,那么 Golang 教程应该是你的第一站。 + +下面的程序,`functions.go` 中简单展示了 Go 程序中是怎样定义和调用函数的。这里,我们有一个简单的把两数相加并返回和值的 `add()` 函数。你可以像下面那样构建程序并运行它。 + +``` +$ cat functions.go +package main + +import "fmt" + +func add(x int, y int) int { +        return x + y +} + +func main() { +        fmt.Println(add(42, 13)) +} +$ +``` + +你可以像下面那样构建和运行程序。 + +``` +$ go build functions.go  && ./functions +55 +$ +``` + +#### 进入函数 + +跟前面展示的一样,我们用前面提到的一个选项来把二进制文件加载进 Delve 调试器,再一次在 `main.main` 处设置断点,继续运行程序直到断点处。然后执行 `next` 直到 `fmt.Println(add(42, 13))` 处;这里我们调用了 `add()` 函数。我们可以像下面展示的那样,用 Delve 的 `step` 命令从 `main` 函数进入 `add()` 函数。 + +``` +$ dlv debug +Type 'help' for list of commands. +(dlv) break main.main +Breakpoint 1 set at 0x4a22b3 for main.main() ./functions.go:9 +(dlv) c +> main.main() ./functions.go:9 (hits goroutine(1):1 total:1) (PC: 0x4a22b3) +     4: +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +=>   9:      func main() { +    10:         fmt.Println(add(42, 13)) +    11: } +(dlv) next +> main.main() ./functions.go:10 (PC: 0x4a22c1) +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +=>  10:              fmt.Println(add(42, 13)) +    11: } +(dlv) step +> main.add() ./functions.go:5 (PC: 0x4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) +``` + +#### 使用`文件名:行号`来设置断点 + +上面的例子中,我们经过 `main` 函数进入了 `add()` 函数,但是你也可以在你想加断点的地方直接使用“文件名:行号”的组合。下面是在 `add()` 函数开始处加断点的另一种方式。 + +``` +(dlv) break functions.go:5 +Breakpoint 1 set at 0x4a2280 for main.add() ./functions.go:5 +(dlv) continue +> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) +``` + +#### 查看当前的栈信息 + +现在我们运行到了 `add()` 函数,我们可以在 Delve 中用 `stack` 命令查看当前栈的内容。这里在 `0` 位置展示了栈顶的函数 `add()` ,紧接着在 `1` 位置展示了调用 `add()` 函数的 `main.main`。在 `main.main` 下面的函数属于 Go 运行时,是用来处理加载和执行该程序的。 + +``` +(dlv) stack +0  0x00000000004a2280 in main.add +   at ./functions.go:5 +1  0x00000000004a22d7 in main.main +   at ./functions.go:10 +2  0x000000000042dd1f in runtime.main +   at /usr/lib/golang/src/runtime/proc.go:200 +3  0x0000000000458171 in runtime.goexit +   at /usr/lib/golang/src/runtime/asm_amd64.s:1337 +(dlv) +``` + +#### 在帧之间跳转 + +在 Delve 中我们可以用 `frame` 命令实现帧之间的跳转。在下面的例子中,我们用 `frame` 实现了从 `add()` 帧跳到 `main.main` 帧,以此类推。 + +``` +(dlv) frame 0 +> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280) +Frame 0: ./functions.go:5 (PC: 4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) frame 1 +> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280) +Frame 1: ./functions.go:10 (PC: 4a22d7) +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +=>  10:              fmt.Println(add(42, 13)) +    11: } +(dlv) +``` + +#### 打印函数参数 + +一个函数通常会接收多个参数。在 `add()` 函数中,它的入参是两个整型。Delve 有个便捷的 `args` 命令,它能打印出命令行传给函数的参数。 + +``` +(dlv) args +x = 42 +y = 13 +~r2 = 824633786832 +(dlv) +``` + +#### 查看反汇编码 + +由于我们是调试编译出的二进制文件,因此如果我们能查看编译器生成的汇编语言指令将会非常有用。Delve 提供了一个 `disassemble` 命令来查看这些指令。在下面的例子中,我们用它来查看 `add()` 函数的汇编指令。 + +``` +(dlv) step +> main.add() ./functions.go:5 (PC: 0x4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) disassemble +TEXT main.add(SB) /home/user/go/gobin/functions.go +=>   functions.go:5  0x4a2280   48c744241800000000   mov qword ptr [rsp+0x18], 0x0 +        functions.go:6  0x4a2289   488b442408           mov rax, qword ptr [rsp+0x8] +        functions.go:6  0x4a228e   4803442410           add rax, qword ptr [rsp+0x10] +        functions.go:6  0x4a2293   4889442418           mov qword ptr [rsp+0x18], rax +        functions.go:6  0x4a2298   c3                   ret +(dlv) +``` + +#### 单步退出函数 + +另一个功能是 `stepout`,这个功能可以让我们跳回到函数被调用的地方。在我们的例子中,如果我们想回到 `main.main` 函数,我们只需要简单地运行 `stepout` 命令,它就会把我们带回去。在我们调试大型代码库时,这个功能会是一个非常便捷的工具。 + +``` +(dlv) stepout +> main.main() ./functions.go:10 (PC: 0x4a22d7) +Values returned: +        ~r2: 55 + +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +=>  10:              fmt.Println(add(42, 13)) +    11: } +(dlv) +``` + +#### 打印变量信息 + +我们一起通过 [Go 教程][6] 的另一个示例程序来看下 Delve 是怎么处理 Go 中的变量的。下面的示例程序定义和初始化了一些不同类型的变量。你可以构建和运行程序。 + +``` +$ cat variables.go +package main + +import "fmt" + +var i, j int = 1, 2 + +func main() { +        var c, python, java = true, false, "no!" +        fmt.Println(i, j, c, python, java) +} +$ + +$ go build variables.go &&; ./variables +1 2 true false no! +$ +``` + +像前面说过的那样,用 `delve debug` 在调试器中加载程序。你可以在 Delve 中用 `print` 命令通过变量名来展示他们当前的值。 + +``` +(dlv) print c +true +(dlv) print java +"no!" +(dlv) +``` + +或者,你还可以用 `locals` 命令来打印函数内所有的局部变量。 + +``` +(dlv) locals +python = false +c = true +java = "no!" +(dlv) +``` + +如果你不知道变量的类型,你可以用 `whatis` 命令来通过变量名来打印它的类型。 + +``` +(dlv) whatis python +bool +(dlv) whatis c +bool +(dlv) whatis java +string +(dlv) +``` + +### 总结 + +现在我们只是了解了 Delve 所有功能的皮毛。你可以自己去查看帮助内容,尝试下其它的命令。你还可以把 Delve 绑定到运行中的 Go 程序上(守护进程!),如果你安装了 Go 源码库,你甚至可以用 Delve 导出 Golang 库内部的信息。勇敢去探索吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/debug-go-delve + +作者:[Gaurav Kamathe][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen) +[2]: https://github.com/go-delve/delve +[3]: https://golang.org/doc/install +[4]: https://github.com/go-delve/delve/blob/master/Documentation/installation/linux/install.md +[5]: https://tour.golang.org/basics/4 +[6]: https://tour.golang.org/basics/9 diff --git a/published/202007/20200616 How to know if you-re ready to switch from Mac to Linux.md b/published/202007/20200616 How to know if you-re ready to switch from Mac to Linux.md new file mode 100644 index 0000000000..271caf1707 --- /dev/null +++ b/published/202007/20200616 How to know if you-re ready to switch from Mac to Linux.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12375-1.html) +[#]: subject: (How to know if you're ready to switch from Mac to Linux) +[#]: via: (https://opensource.com/article/20/6/mac-to-linux) +[#]: author: (Marko Saric https://opensource.com/users/markosaric) + +你是否已经准备好从 Mac 切换到 Linux 了? +====== + +> 你几乎可以在 Linux 上做任何你在 Mac 上可以做的事情 —— 这是你拥有一个开源操作系统的自由。 + +![](https://img.linux.net.cn/data/attachment/album/202007/02/222534g8bdabsllplnzl6c.jpg) + +我[从 Mac 转到 Linux][2] 已经两年了。在使用 Linux 之前,我用的 Apple 的系统用了 15 年,而当我在 2018 年安装第一个 Linux 发行版时,还只是一个纯粹的新手。 + +这些日子以来,我只用 Linux,我可以用它完成任何任务。浏览网页、观看 Netflix 影片、写作以及编辑我的 Wordpress [博客][3],甚至还在上面跑我的[开源网页分析项目][4]。 + +我甚至还不是一个开发者!Linux 被认为不适合日常使用,对非技术人员也不够友好的日子已经一去不返了。 + +最近有很多关于 Mac 的讨论,越来越多的人已经在考虑转到 Linux。我打算分享我的切换过程中的一些经验,帮助其它新手也能从容转移。 + +### 你该不该换? + +在换系统之前,最好想清楚,因为有时候 Linux 可能跟你预期不一样。如果你仍希望跟 Apple Watch 无缝配对、可以用 FaceTime 给朋友打电话、或者你想打开 iMovie 看视频,那最好还是不要换了。这些都是 Apple 的专有产品,你只能在 Apple 的“围墙花园”里面使用。如果离不开 Apple 的生态系统,那么 Linux 可能不太适合你。 + +我对 Apple 生态没有太多挂念,我不用 iPhone,所以跟手机的协作没那么必要。我也不用 iCloud、FaceTime,当然也包括 Siri。我早就对开源充满兴趣,只是一直没有行动。 + +### 检查你的必备软件清单 + +我还在使用 Mac 的时候,就已经开始探索开源软件,我发现大部分在 Mac 上使用的软件,在 Linux 也可以运行。 + +很熟悉用火狐浏览网页吗?在 Linux 上它也可以运行。想用 VLC 看视频?它也有 Linux 版本。喜欢用 Audacity 录制、编辑音频?它正在 Linux 上等着你呢。你用 OBS Studio 直播?在 Linux 直接下载安装吧。一直用 Telegram 跟朋友和家人保持联系吗?Linux 上当然少不了它。 + +此外,Linux 不仅仅意味着开源软件。你最喜欢的大部分(也可能是所有)非 Apple 专有软件,都能在 Linux 见到它们的身影。Spotify、Slack、Zoom、Stream、Discord、Skype、Chrome 以及很多闭源软件,都可以使用。而且,在你 Mac 浏览器里面运行的任何东西,同样能够运行在 Linux 浏览器。 + +你能在 Linux 找到你的必备软件,或者更好的替代品吗?请再三确认,做到有备无患。用你最常用的搜索引擎,在网上检索一下。搜索“软件名 + Linux” 或者“软件名 + Linux 替代品”,然后再去 [Flathub][5] 网站查看你能在 Linux 用 Flatpak 安装的专有软件有哪些。 + +### 请牢记:Linux 不等于 Mac + +如果你希望能够从 Mac 轻松转移到 Linux,我相信有一点很重要,你需要保持包容的思想以及愿意学习新操作系统的心态。Linux 并不等于 Mac,所以你需要给自己一些时间去接触并了解它。 + +如果你想让 Linux 用起来、看起来跟你习惯的 macOS 一模一样,那么 Linux 可能也不适合你。尽管你可以通过各种方法[把 Linux 桌面环境打造得跟 macOS 相似][14],但我觉得要想成功转移到 Linux,最好的办法是从拥抱 Linux 开始。 + +试试新的工作流,该怎么用就怎么用。不要总想着把 Linux 变成其它东西。你会跟我一样,像享受 Mac 一样享受 Linux,甚至能有更好的体验感。 + +还记得你第一次使用 Mac 吧:你肯定花了不少时间去习惯它的用法。那么请给 Linux 同样多的时间和关怀。 + +### 选择一个 Linux 发行版 + +有别于 Windows 和 macOS,Linux 不止一个单一的操作系统。不同的 Linux 操作系统被称作发行版,开始使用 Linux 之后,我尝试过好几个不同的发行版。我也用过不同的桌面环境,或者图形界面。在美观度、易用性、工作流以及集成软件上,它们有很大差异。 + +尽管作为 Mac 的替代品,被提及最多的是 [ElementaryOS][6] 和 [Pop!_OS][7],但我仍建议从 [Fedora 工作站][8] 开始,理由如下: + +- 使用 [Fedora 介质写入器][9],容易安装 +- 几乎可以支持你所有的硬件,开箱即用 +- 支持最新的 Linux 软件 +- 运行原生无改动的 GNOME 桌面环境 +- 有一个大型开发团队以及一个庞大的社区在背后支持 + +在我看来,对从 macOS 过来的新手来说,[GNOME][10] 是易用性、一致性、流畅性和用户体验最好的桌面环境。它拥有 Linux 世界中最多的开发资源和用户基数,所以你的使用体验会很好。 + +Fedora 可以为你打开一扇 Linux 的大门,当你适应之后,就可以开始进一步探索各个发行版、桌面环境,甚至窗口管理器之类的玩意了。 + +### 熟悉 GNOME + +GNOME 是 Fedora 和许多其它 Linux 发行版的默认窗口管理器。它最近 [升级到 GNOME 3.36][11],带来了 Mac 用户会喜欢的现代设计。 + +一定要做好心理准备,Linux、Fedora 工作站和 GNOME 并不是 Apple 和 macOS。GNOME 非常干净、简约、现代、独创。它不会分散你的注意力,没有桌面图标,没有可见的坞站,窗口上甚至没有最小化和最大化按钮。但是不要慌张,如果你去尝试,它会证明这是你用过最好、最有生产力的操作系统。 + +GNOME 不会给你带来困扰。启动之后,你唯一能看到的东西只有顶栏和背景图片。顶栏由这几样东西组成,“活动”在左边,时间和日期在中间(这也是你的通知中心),右边是网络、蓝牙、VPN、声音、亮度、电池等托盘图标之类的东西。 + +#### 为什么 GNOME 像 Mac + +你会注意到一些跟 macOS 的相似之处,例如窗口吸附、空格预览(用起来跟 “Quick Look” 一模一样)。 + +如果你把鼠标光标移动到左上角,点击顶栏的“活动”,或者按下键盘上超级键(`Super` 键,也就是 Mac 上的 `ஐ` 键),你会看到“活动概览”。它有点像 macOS 系统上“调度中心”和“聚焦搜索”的结合体。它会在屏幕中间展示已打开软件和窗口的概览。在左手边,你可以看到坞站,上面有你打开的软件和常用软件。所有打开的软件下面会有一个指示标志,在右手边,你可以看到不同的工作区。 + +在顶栏中间,有一个搜索框。只要你开始输入,焦点就会转移到搜索框。它能搜索你已经安装的软件和文件内容,可以在软件中心搜索指定的软件、进行计算、向你展示时间或者天气,当然它能做的还有很多。它就像“聚焦”一样。只需开始输入你要搜索的内容,按下回车就可以打开软件或者文件。 + +你也能看到一列安装好的软件(更像 Mac 上的“启动台”),点击坞站中的“显示应用”图标,或者按 `Super + A` 就行。 + +总体来说,Linux 是一个轻量级的系统,即使在很老的硬件上也能跑得很顺畅,跟 macOS 比起来仅仅占用很少的磁盘空间。并且不像 macOS,你可以删除任何你不想要或不需要的预装软件。 + +#### 自定义你的 GNOME 设置 + +浏览一下 GNOME 设置,熟悉它的选项,做一些更改,让它用起来更舒服。下面是一些我装好 GNOME 必做的事情。 + +- 在“鼠标和触摸板”中,我禁用“自然滚动”、启用“轻触点击”。 +- 在“显示”中,我打开“夜光”功能,在晚上,屏幕会让颜色变暖,减少眼睛疲劳。 +- 我也安装了 [GNOME 优化][12],因为它可以更改额外的设置选项。 +- 在“GNOME 优化”中,我启用了 “Over-Amplification” 设置,这样就能获得更高的音量。 +- 在“GNOME 优化”中,相比默认的亮色主题,我更喜欢 “Adwaita Dark” 主题。 + +#### 习惯使用键盘操作 + +GNOME 是以一个极度以键盘为中心的操作系统,所以尽量多使用键盘。在 GNOME 设置中的“键盘快捷键”部分,你可以找到各个快捷键。 + +你也可以根据自己的理想工作流程来设置键盘快捷键。我将我最常用的应用程序设置为使用超级键打开。比如说,`Super + B` 打开我的浏览器,`Super + F` 打开“文件”,`Super + T` 打开终端。我还把 `Ctrl + Q` 设置成关闭窗口。 + +我使用 `Super + Tab` 在打开的应用程序之间切换,`Super + H` 隐藏一个窗口,`F11` 全屏打开软件,`Super + Left` 把窗口吸附到屏幕左边,`Super + Right` 把窗口吸附到屏幕左边,等等。 + +### 在 Mac 上尝试 Linux 之后再做决定 + +在完全安装 Linux 之前,在你的 Mac 上先尝试 Fedora。从 [Fefora 官网][9]下载 ISO 镜像。使用 [Etcher][13] 将 ISO 镜像写入 USB 驱动器,然后在启动时点击 `Option` 键,这样你就可以在即用模式下尝试了。 + +现在您无需在 Mac 上安装任何东西就可以探索 Fedora 工作站了。试试各种东西,能否正常工作:能不能连接 WiFi?触控板是否正常?有没有声音?等等。 + +也记得花时间来尝试 GNOME。测试我上面提到的不同功能。打开一些安装好的软件。如果一切看起来都还不错,如果你喜欢这样的 Fedora 工作站和 GNOME,并且很肯定这就是你想要的,那么把它安装到你的 Mac 吧。 + +尽情探索 Linux 世界吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/mac-to-linux + +作者:[Marko Saric][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/markosaric +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) +[2]: https://markosaric.com/linux/ +[3]: https://markosaric.com/how-start-blog/ +[4]: https://plausible.io/open-source-website-analytics +[5]: https://flathub.org/apps +[6]: https://opensource.com/article/20/2/macbook-linux-elementary +[7]: https://support.system76.com/articles/pop-basics/ +[8]: https://getfedora.org/ +[9]: https://getfedora.org/en/workstation/download/ +[10]: https://www.gnome.org/ +[11]: https://www.gnome.org/news/2020/03/gnome-3-36-released/ +[12]: https://wiki.gnome.org/Apps/Tweaks +[13]: https://www.balena.io/etcher/ +[14]: https://linux.cn/article-12361-1.html \ No newline at end of file diff --git a/published/202007/20200616 How to loop forever in bash on Linux.md b/published/202007/20200616 How to loop forever in bash on Linux.md new file mode 100644 index 0000000000..756836f72f --- /dev/null +++ b/published/202007/20200616 How to loop forever in bash on Linux.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12368-1.html) +[#]: subject: (How to loop forever in bash on Linux) +[#]: via: (https://www.networkworld.com/article/3562576/how-to-loop-forever-in-bash-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 的 bash 中永远循环 +====== + +![tine ivanic][1] + +在 Linux 中有很多永远循环(或直到你决定停止)的方法,你可以在命令行或脚本中执行此操作。 + +`for` 和 `while` 命令使这件事非常容易。关于相应的语法和策略,只有几件事要牢记。 + +### 使用 while + +最简单的永远循环之一是使用 `while` 命令,后面跟上条件 `true`。 你不必使用诸如 `while [ 1 -eq 1 ]` 之类的逻辑或类似的测试。 `while true` 测试表示循环将一直运行,直到你使用 `CTRL-C` 停止循环、关闭终端窗口或注销为止。这是一个例子: + +``` +$ while true +> do +> echo Keep running +> sleep 3 +> done +Keep running +Keep running +Keep running +^C +``` + +你也可以使用 `while :` 做同样的事情。这里的关键是 `:` 总是返回成功,因此就像 `while true` 一样,此测试永远不会失败,并且循环会继续运行: + +``` +$ while : +> do +> echo Keep running +> sleep 3 +> done +Keep running +Keep running +^C +``` + +如果你在脚本中插入了无限循环,并想提醒使用它的人如何退出脚本,那么可以使用 `echo` 命令添加提示: + +``` +while : +do + echo Keep running + echo "Press CTRL+C to exit" + sleep 1 +done +``` + +### 使用 for + +`for` 命令还提供了一种永远循环的简便方法。虽然不如 `while true` 明显,但语法相当简单。你只需要在有界循环中替换参数即可,它通常类似于 “c 从等于 1 开始递增,直到 5”: + +``` +$ for (( c=1; c<=5; c++ )) +``` + +不指定任何参数的情况下: + +``` +$ for (( ; ; )) +``` + +没有起始值、增量或退出测试,此循环将永远运行或被强制停止: + +``` +$ for (( ; ; )) +> do +> echo Keep running +> echo “Press CTRL+C to exit” +> sleep 2 +> done +Keep your spirits up +Keep your spirits up +Keep your spirits up +``` + +### 为什么要永远循环? + +在现实中,你不会想永远循环下去,但一直运行直到想要回家、工作完成或者遇到问题才退出并不罕见。任何构造为无限循环的循环都可以设置为根据各种情况退出。 + +该脚本将一直处理数据直到下午 5 点,或者说检查发现第一次超过 5 点的时间: + +``` +#!/bin/bash + +while true +do + if [ `date +%H` -ge 17 ]; then + exit # exit script + fi + echo keep running + ~/bin/process_data # do some work +done +``` + +如果要退出循环而不是退出脚本,请使用 `break` 命令而不是 `exit`。 + +``` +#!/bin/bash + +while true +do + if [ `date +%H` -ge 17 ]; then + break # exit loop + fi + echo keep running + ~/bin/process_data +done +… run other commands here … +``` + +### 总结 + +永远循环很容易。指定要停止循环的条件却需要花费一些额外的精力。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3562576/how-to-loop-forever-in-bash-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2020/06/nw_circular-staircase_loop_infinity_nautilus_by-tine-ivanic-via-unsplash-100848725-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200617 4 essential tools to set up your Python environment for success.md b/published/202007/20200617 4 essential tools to set up your Python environment for success.md new file mode 100644 index 0000000000..26309e20ba --- /dev/null +++ b/published/202007/20200617 4 essential tools to set up your Python environment for success.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12369-1.html) +[#]: subject: (4 essential tools to set up your Python environment for success) +[#]: via: (https://opensource.com/article/20/6/python-tools) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +建立成功的 Python 环境的 4 个基本工具 +====== + +> 选择的这些工具将简化你的 Python 环境,以实现顺畅和一致的开发实践。 + +![](https://img.linux.net.cn/data/attachment/album/202007/01/123009yolmlzp1yu1y88ew.jpg) + +Python 是一门出色的通用编程语言,经常作为第一门编程语言来教授。二十年来,我为它撰写了很多本书,而它仍然是[我的首选语言][2]。虽然通常来说这门语言是简洁明了的,但是(正如 [xkcd][3] 讽刺的),从来没有人说过配置 Python 环境也是一样的简单。 + +![xkcd python illustration][4] + +*一个复杂的Python环境。 [xkcd][3]* + +在日常生活中有很多使用 Python 的方法。我将解释我是如何使用这些 Python 生态系统工具的。但坦诚的说,我仍在寻找更好的替代品。 + +### 使用 pyenv 来管理 Python 版本 + +我发现在机器上运行一个特定版本的 Python 的最好方法是使用 `pyenv`。这个软件可以在 Linux、Mac OS X 和 WSL2 上工作:这是我通常关心的三个 “类 UNIX” 环境。 + +安装 `pyenv` 本身有时会有点棘手。一种方法是使用专用的 [pyenv 安装程序][5],它使用 `curl | bash` 方法来进行(详见其说明)。 + +如果你是在 Mac 上(或者你运行 Homebrew 的其他系统),你可以按照[这里][6]的说明来安装和使用 `pyenv`。 + +按照说明安装和设置了 `pyenv` 之后,你可以使用 `pyenv global` 来设置一个 “默认的” Python 版本。一般来说,你会选择你的 “首选” 版本。这通常是最新的稳定版本,但如果有其他考虑因素也可能做出不同的选择。 + +### 使用 virtualenvwrapper 让虚拟环境更简单 + +使用 `pyenv` 安装 Python 的一个好处是,你所有后继安装的 Python 解释器环境都是你自己的,而不是操作系统层面的。 + +虽然在 Python 本身内部安装东西通常不是最好的选择,但有一个例外:在上面选择的 “首选” Python 中,安装并配置 `virtualenvwrapper`。这样你就可以瞬间创建和切换到虚拟环境。 + +我在[这篇文章中][7]具体介绍了如何安装和使用 `virtualenvwrapper`。 + +这里我推荐一个独特的工作流程:你可以制作一个可以大量重复运行的虚拟环境,用来做运行器runner。在这个环境中,可以安装你最喜欢的运行器 —— 也就是你会经常用来运行其他软件的软件。就目前而言,我的首选是 `tox`。 + +### 使用 tox 作为 Python 运行器 + +[tox][8] 是一个很好的工具,可以让你的 Python 测试自动化。在每个 Python 环境中,我都会创建一个 `tox.ini` 文件。无论我使用什么系统做持续集成,都可以运行它,我可以用上面文章中描述的 `virtualenvwrapper` 的 `workon` 语法在本地运行同样的东西: + +``` +$ workon runner +$ tox +``` + +这个工作流程之所以重要,是因为我要在多个版本的 Python 和多个版本的依赖库中测试我的代码。这意味着在 `tox` 运行器中会有多个环境。一些会尝试在最新的依赖关系中运行,一些会尝试在冻结的依赖关系中运行(接下来会有更多的介绍),我也可能会用 `pip-compile` 在本地生成这些环境。 + +附注:我目前正在[研究使用 nox][9] 作为 `tox` 的替代品。原因超出了本文的范畴,但值得一试。 + +### 使用 pip-compile 进行 Python 依赖性管理 + +Python 是一种动态编程语言,这意味着它在每次执行代码时都会加载其依赖关系。能否确切了解每个依赖项的具体运行版本可能意味着是平稳运行代码还是意外崩溃。这意味着我们必须考虑依赖管理工具。 + +对于每个新项目,我都会包含一个 `requirements.in` 文件,(通常)只有以下内容: + +``` +. +``` + +是的,没错。只有一个点的单行。我在 `setup.py` 文件中记录了 “宽松” 的依赖关系,比如 `Twisted>=17.5`。这与 `Twisted==18.1` 这样的确切依赖关系形成了鲜明对比,后者在需要一个特性或错误修复时,难以升级到新版本的库。 + +`.` 的意思是 “当前目录”,它使用当前目录下的 `setup.py` 作为依赖关系的来源。 + +这意味着使用 `pip-compile requirements.in > requirements.txt` 会创建一个冻结的依赖文件。你可以在 `virtualenvwrapper` 创建的虚拟环境中或者 `tox.ini` 中使用这个依赖文件。 + +有时,也可以从 `requirements-dev.in`(内容:`.[dev]`)生成 `requirements-dev.txt`,或从 `requirements-test.in`(内容:`.[test]`)生成 `requirements-test.txt`。 + +我正在研究在这个流程中是否应该用 [dephell][10] 代替 `pip-compile`。`dephell` 工具有许多有趣的功能,比如使用异步 HTTP 请求来下载依赖项。 + +### 结论 + +Python 的功能既强大又赏心悦目。为了编写这些代码,我依靠了一个对我来说很有效的特定工具链。工具 `pyenv`、`virtualenvwrapper`、`tox` 和 `pip-compile` 都是独立的。但是,它们各有各的作用,没有重叠,它们一起打造了一个强大的 Python 工作流。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/python-tools + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks) +[2]: https://opensource.com/article/19/10/why-love-python +[3]: https://xkcd.com/1987/ +[4]: https://opensource.com/sites/default/files/uploads/python_environment_xkcd_1.png (xkcd python illustration) +[5]: https://github.com/pyenv/pyenv-installer +[6]: https://linux.cn/article-12241-1.html +[7]: https://linux.cn/article-11086-1.html +[8]: https://opensource.com/article/19/5/python-tox +[9]: https://nox.thea.codes/en/stable/ +[10]: https://github.com/dephell/dephell diff --git a/published/202007/20200622 7 open source alternatives to VS Code.md b/published/202007/20200622 7 open source alternatives to VS Code.md new file mode 100644 index 0000000000..6526252de9 --- /dev/null +++ b/published/202007/20200622 7 open source alternatives to VS Code.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12382-1.html) +[#]: subject: (7 open source alternatives to VS Code) +[#]: via: (https://opensource.com/article/20/6/open-source-alternatives-vs-code) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +VS Code 的 7 个开源替代品 +====== + +> 为了避免使用微软版本的 VS Code,我们需要另行选择一个开源的代码编辑器。 + +![](https://img.linux.net.cn/data/attachment/album/202007/05/112348n834svpa48v08vsa.png) + +Visual Studio Code,也叫 VS Code,是一个跨平台代码编辑器,通用于 Linux、Windows 以及 macOS。它既能编辑简单文本,也能像集成开发环境(IDE)一样管理整个代码库。它可以通过插件进行扩展,并且已经被证明是一个可靠的文本编辑器,很轻松地就击败了非开源的强大竞品编辑器。 + +微软以开源的方式发布了 VS Code,但是你从微软下载的版本其实并不是开源的。然而,你仍有办法以开源的方式使用 VS Code,或者直接选择其它的开源替代品。 + +### 以开源的方式构建 VS Code + +你可以在 [GitHub][2] 获得 VS Code 的源代码。然而当你 [从微软][3] 下载 VS Code 时,你会发现它是基于 [微软软件许可证][4] 授权的。这并不是一个开源许可证。其区别在于构建过程。 + +Chris Dias 是微软 VS Code 项目开发者之一,他对 VS Code [作了一个对比][5],就像 Chrome 浏览器和其开源的“上游”项目 [Chromium][6] 一样。VS Code 确实是基于开源代码库构建的。微软官方发布的版本带有一些与微软相关的功能,包括一项商标、一个插件库、一个 C# 调试器以及遥测。但如果你克隆仓库然后自行编译,这些东西都不会被加入,所以你会得到一个名为 Code - OSS 的“干净”版本(OSS 代表开源软件)。 + +实际上,VS Code 与 Code - OSS 之间的差异很小。最值得注意的是,VS Code 包含遥测功能,它会记录使用数据。微软不可能监控你的一举一动,而且目前越来越多软件都在收集使用数据。是否在乎 VS Code 的遥测功能,完全取决于你自己。如果你不希望它追踪你的使用情况,这里有一些很棒的 VS Code(开源)替代品。 + +### VSCodium + +![Code OSS screenshot][7] + +最简单的替代方案就是构建不带微软附属功能的 VS Code 版本。[VSCodium][9] 项目提供了可下载的 Code-OSS 可执行文件,它基于 VS Code 代码库编译,没有配置微软的 `product.json` 中的改变。VSCodium 的开发者还竭尽全力禁用了所有难以寻找的遥测选项,除非你自行编译,否则这已经是你能找到的最干净的 VS Code 版本了。 + +VSCodium 提醒说,VS Code 悄悄地包含了一些专有工具,这些工具无法与开源版本一起提供。这包括一个 C# 调试器和部分插件。如果你需要它们,可以在 [文档中] 找到解决办法。假如你依赖 VS Code 中某些特定的功能,你应该验证它在 VSCodium 中是否可以发挥功用。 + +此外,你还应该验证是否已禁用所有的遥测功能。 + +### Code - OSS + +如果不想用 VSCodium 的版本,你可以自己 [从头编译 VS Code][12],得到一样的版本。可执行文件叫做 `Code - OSS`,而不是 `VSCode`,适用于 VSCodium 的许可证限制也适用于你的构建,而工作方式也是一样。 + +如果通过编译源码构建应用,首次启动时你要确保 [所有遥测都已经被禁用]。 + +### Atom + +![Atom screenshot][13] + +[Atom][14] 是一个类似于 IDE 的文本编辑器,当微软收购 Github 的同时也收购了它。和 VS Code 一样,你可以使用插件,扩展 Atom 编辑器,此外,你还能通过自己的工具和主题实现定制。它开源且与 Github 集成。简而言之,只要你能找到你想用的插件,或者你愿意自己动手写,那么 Atom 几乎可以满足你的一切需求。 + +跟 VS Code 一样,Atom 也 [默认包含遥测][15]。你可以禁用这个功能,而且跟 VS Code 不同的是,使用插件不受任何限制,所以不必再因为隐私改变你的工作流。对写代码的人来说,毫无疑问 Atom 是很有用的工具,而对于 [使用电脑的任何人][16],它同样会是一个很赞的编辑器。如果你需要一个顺手的通用文本编辑器,请试试 Atom。 + +### GNOME Builder + +![GNOME Builder screenshot][17] + +为 GNOME 桌面而开发的 IDE,[GNOME Builder][18] 是一个 Linux 平台的代码编辑器,专门用于构建 GNOME 应用。如果你为 Linux 构建应用程序,希望轻松解决兼容性问题,那么 Builder 就是最简单的选择。从 [Flathub.org][19] 安装 Builder;当你开启一个新项目,如果没有安装 GNOME SDK,它会提醒你。这意味着当维护你的应用时,你不必刻意关注 GNOME 的状态,因为 Builder 在替你做这件事。 + +然而,Builder 不仅能构建 GNOME 程序。它还支持各种各样的编程语言,包括 Python、Rust、C/C++、Java、Go、JavaScript、TypeScript、VB.NET、Markdown 和几种标记语言等等。它对部分语言有全面的支持,包括自动补全以及弹出式函数定义,但是其它语言仅仅含有一些比较方便的功能,例如语法高亮跟自动匹配括号。不管你是不是一个专门的程序员,或者你只想要一个给力的 HTML 和 CSS 编辑器,这个 IDE 都能让你舒心使用。 + +### Geany + +![Geany screenshot][20] + +[Geany][21] 是一个强大、稳定而轻量级的编辑器,它有很多有用的特性,能帮你写 Bash、Python、Lua、XML、HTML、LaTex,当然远不止这些。对 50 种各种编程及脚本语言、标记语言和各种文件类型(比如 .diff 和 .po),Geany 都有很好的支持。退一万步讲,Geany 还有括号匹配和语法高亮 —— 通常来说,它包含更多功能。 + +Geany 是一个小型编辑器,但是通过插件,你可以为它添加特性,例如项目视图面板、文件系统树、调试、终端等,直到它看起来像一个 IDE。当然,萝卜白菜各有所爱,你也可以尽量使它保持简洁易用。如果因为电脑 CPU 或者内存的限制而无法使用 VS Code,那么很明显 Geany 可以作为你的选择。它只占用少量内存,而且启动迅速。即便跟运行在终端里的 Vim 相比,Geany 稍显笨重,但就算在树莓派,它也能做到快速、灵活。 + +### Brackets + +![Brackets screenshot][22] + +[Brackets][23] 是一款面向网页开发者的文本编辑器和 IDE。对于 HTML、CSS、JavaScript、PHP 甚至 Python,它都有很强大的支持。而且跟 VS Code 一样,它也有一个很丰富的插件生态,所以你可以最大限度地扩展它,以适应你所有编程语言的工作。 + +有的插件用于辅助解析语言、运行脚本,甚至编译执行代码。Brackets 有一个传统的界面,不管你是否熟悉 IDE 或者像记事本一样简单的文本编辑器,都能驾轻就熟。如果稍微花点时间,添加几个相关插件,然后熟悉它们,你会发现 Brackets 真的是一个很精妙、很有用的编辑器,不管你输入什么,它都能通过自动补全、提示帮你避免低级错误。假如你是程序员,它能帮你加快测验和调试周期。 + +### Che + +![Che screenshot][24] + +如果你喜欢新技术,那你应当尝试 [Che][25] 编辑器。这是一个基于云的 IDE,所以它默认以软件即服务(SaaS)的形式运行,但它是完全开源的,如果你有 Kubernetes 实例,那就可以运行为*你自己的* SaaS。 + +Che 不仅是一个在线 IDE,而且是一个为云开发而构建的 IDE。在 Che 的概念里,用户无需查看本地文件系统。由于它在云端工作,所以你也可以这么做。事实上,如果你有一台 Git 服务器,那就可以直接把它当作你的文件系统,在它的仓库中完成你的项目。当然,你也可以下载所有文件做本地备份。 + +但 Che 的主要特点,也是云开发者最为兴奋的一点,它是一个功能全面、带有 Kubernetes 感知功能的开源 IDE。如果你正在为云构建应用、网站或容器(或三者的组合),那么 Che 是一个你需要尝试的编辑器。 + +### 那么你的选择是? + +你有没有在使用这些 VS Code 替代品中的某一个呢?想不想挑一个试试呢?欢迎在评论中分享你的见解。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/open-source-alternatives-vs-code + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://github.com/microsoft/vscode +[3]: https://code.visualstudio.com/ +[4]: https://code.visualstudio.com/license +[5]: https://github.com/Microsoft/vscode/issues/60#issuecomment-161792005 +[6]: https://www.chromium.org/ +[7]: https://opensource.com/sites/default/files/uploads/code-oss.png (Code OSS screenshot) +[8]: https://creativecommons.org/licenses/by-sa/4.0/ +[9]: https://vscodium.com/ +[10]: https://github.com/VSCodium/vscodium/blob/master/DOCS.md +[11]: https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting +[12]: https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run +[13]: https://opensource.com/sites/default/files/uploads/atom.jpg (Atom screenshot) +[14]: http://atom.io +[15]: https://discuss.atom.io/t/how-do-i-disable-the-metrics-or-tracking/24520 +[16]: https://opensource.com/article/19/4/write-git +[17]: https://opensource.com/sites/default/files/uploads/builder.png (GNOME Builder screenshot) +[18]: https://wiki.gnome.org/Apps/Builder +[19]: https://flathub.org/apps/details/org.gnome.Builder +[20]: https://opensource.com/sites/default/files/uploads/geany.png (Geany screenshot) +[21]: https://www.geany.org/ +[22]: https://opensource.com/sites/default/files/uploads/brackets.jpg (Brackets screenshot) +[23]: http://brackets.io/ +[24]: https://opensource.com/sites/default/files/uploads/che-cpp.jpg (Che screenshot) +[25]: https://www.eclipse.org/che/extend/ diff --git a/published/202007/20200622 Linux tools for improving your time management.md b/published/202007/20200622 Linux tools for improving your time management.md new file mode 100644 index 0000000000..af35552fa3 --- /dev/null +++ b/published/202007/20200622 Linux tools for improving your time management.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12388-1.html) +[#]: subject: (Linux tools for improving your time management) +[#]: via: (https://opensource.com/article/20/6/linux-time-management) +[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur) + +时间管理专家的 Linux 工具 +====== + +> 无论你是需要帮助来保持专注、保持及时性,还是为了找到避免重复的捷径,这些 Linux 工具能够帮助你。 + +![](https://img.linux.net.cn/data/attachment/album/202007/07/084943stbchr65ke6r1cqh.jpg) + +生产力是一个主观术语,但从本质上讲,它是衡量特定任务完成效率的标准。每个人都有不同的方式来提高他们的生产力:有些人需要帮助专注于任务里、有些人需要特殊的工作环境、有些人需要警报和提醒以避免错过截止日期,还有些人需要协助处理重复的手工活。幸运的是,有多种工具和技术可为你提供所需的特定支持。特别地,如果你是 Linux 用户,有一些调整可以帮助你提高生产力。这是我经常使用的两个。 + +### 剪贴板指示器 + +你是否在日常使用中,在多个文档之间的大量使用复制和粘贴?如果是这样,那么 [剪贴板指示器][2] 应该成为你的首选方案之一。将剪贴板指示器作为 GNOME 扩展安装到 Linux 发行版中。以我的经验,它对 GNOME Shell 的性能影响很小,至少比我尝试过的其他方案要小。 + +该工具添加了一个指示器菜单到顶部面板,并缓存剪贴板历史。你可以设置历史记录大小、要预览的字符数量。它可以在复制时显示通知,并充当保存任意复制内容的临时空间。 + +![Clipboard indicator menu on GNOME desktop][3] + +安装扩展程序和连接器的最简单方法是使用发行版的包管理器。 + +对于 Fedora、CentOS 或 RHEL,请使用: + +``` +$ sudo dnf install chrome-gnome-shell +``` + +在 Ubuntu 或 Debian 上,请改用 `apt install`。 + +安装完成后,进入 并查看已安装的扩展。 + +如果你使用的是 Firefox,请使用 Firefox 浏览器附加组件并安装 “GNOME Shell integration”。你将在 Firefox 工具栏中看到一个很小的脚印图标,它将带你进入“扩展”页面。在该页面上,搜索 “Clipboard Indicator” 扩展并启用它。 + +现在,按照提示下载 GNOME 扩展并激活它。你可以查看 `~/.local/share/gnome-shell/extensions` 来浏览你的扩展。 + +好了!你将在 GNOME 桌面的右上角看到一个新图标。复制任意内容并尝试其设置。 + +也可以使用以下命令通过 Git 进行快速安装:将仓库克隆到本地的 gnome-shell 扩展目录中: + +``` +$ git clone https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator.git ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com +``` + +进入 GNOME Tweaks 工具,然后从“扩展”页面激活它。 + +### 番茄计时器(Pomodoro) + +![Using the pomodoro timer on GNOME][4] + +Pomodoro 技术是一种时间管理理念,旨在为用户提供最大注意力。每个 25 分钟的工作时间称为“pomodoro”(意大利语的“番茄”);每个番茄之后,你需要休息五分钟。每四个番茄时间,即每 100 分钟,你就要休息 15 至 20 分钟。如果你有大量的待办事项,那么使用 Pomodoro 技术可以通过强迫你遵守严格的时间安排来帮助你更快地完成项目。 + +可以通过 GNOME Tweaks 网页 (extensions.gnome.org)或通过命令行来管理安装过程。对于后者,请根据你的 Linux 发行版和版本,并使用以下命令进行安装: + +``` +$ sudo dnf install gnome-shell-extension-pomodoro +``` + +或者,如果你希望从源代码构建: + +``` +$ git clone -b gnome-3.34 https://github.com/codito/gnome-pomodoro.git +$ cd gnome-pomodoro +``` + +源码有许多依赖关系,其中许多可能已经安装。为了确保这点,请安装以下内容。 + +``` +$ sudo dnf install autoconf-archive gettext vala vala-tools pkg-config desktop-file-utils glib2-devel gtk3-devel libappstream-glib-devel libappindicator-gtk3-devel libcanberra-devel libpeas-devel sqlite-devel gom-devel gobject-introspection-devel gsettings-desktop-schemas-devel gstreamer1-devel +``` + +在源代码的解压目录中,完成构建。 + +``` +$ ./autogen.sh --prefix=/usr --datadir=/usr/share  +$ make  +$ sudo make install  +``` + +不管是怎么安装的,请进入 GNOME Tweaks 并打开番茄计时器。如果你还没有 GNOME Tweaks,请通过包管理器或所选的软件安装程序进行安装。例如,在 Fedora 上: + +``` +$ sudo dnf install gnome-tweaks +``` + +在 Ubuntu 或 Debian上,请改用 `apt install`。 + +Pomodoro 桌面集成当前可在 GNOME Shell 中使用,并且它们计划在将来支持更多桌面。 查看 获取有关该项目的最新信息。同时,对于 KDE 用户,还有一个名为 [Fokus][5] 的替代品。 + +### Linux 上的生产力 + +生产力是个人的,但这是我们所有人都在以某种方式追求的东西。这些工具中的每一个要么节省了我的时间,要么使我的工作效率提高了,它们可以与 Linux 快速集成。 + +你是否有喜欢的生产力工具?请在评论中分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/linux-time-management + +作者:[Sudeshna Sur][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sudeshna-sur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://extensions.gnome.org/extension/779/clipboard-indicator/ +[3]: https://opensource.com/sites/default/files/uploads/gnome-tweaks-productivity_0.png (Clipboard indicator menu on GNOME desktop) +[4]: https://opensource.com/sites/default/files/uploads/pomodoro-timer-fedora-opensourcecom.png (Using the pomodoro timer on GNOME) +[5]: https://store.kde.org/p/1308861/ diff --git a/published/202007/20200622 Missing Photoshop on Linux- Use PhotoGIMP and Convert GIMP into Photoshop.md b/published/202007/20200622 Missing Photoshop on Linux- Use PhotoGIMP and Convert GIMP into Photoshop.md new file mode 100644 index 0000000000..0b75d249c9 --- /dev/null +++ b/published/202007/20200622 Missing Photoshop on Linux- Use PhotoGIMP and Convert GIMP into Photoshop.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12373-1.html) +[#]: subject: (Missing Photoshop on Linux? Use PhotoGIMP and Convert GIMP into Photoshop) +[#]: via: (https://itsfoss.com/photogimp/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Linux 上缺少 Photoshop?使用 PhotoGIMP 将 GIMP 变为 Photoshop +====== + +[Adobe Photoshop][1] 不适用于桌面 Linux。GIMP 是 [Linux 上 Adobe Photoshop 的最佳替代品][2]。 + +如果你使用过 Photoshop,那么你会注意到 [GIMP][3] 和 Photoshop 相比有不同的设置、键盘快捷键和布局。 + +这没有错。毕竟,它们都是两种不同的软件,而且它们不必看起来相同。 + +但是,习惯了 Photoshop 的人们发现在切换到 GIMP 的时很难忘记他们反复学习的肌肉记忆。这可能会使某些人感到沮丧,因为使用新的界面意味着要学习大量的键盘快捷键,并花时间在查找工具位于何处。 + +为了帮助从 Photoshop 切换到 GIMP 的人,[Diolinux][4] 推出了一个在 GIMP 中模仿 Adobe Photoshop 的工具。 + +### PhotoGIMP:在 Linux 中为 GIMP 提供 Adobe Photoshop 的外观 + +![][5] + +[PhotoGIMP][6] 不是独立的图形软件。它是 GIMP 2.10 的补丁。你需要在系统上安装 GIMP 才能使用 PhotoGIMP。 + +当你应用 PhotoGIMP 补丁时,它将更改 GIMP 布局以模仿 Adobe Photoshop。 + + * 默认安装数百种新字体 + * 安装新的 Python 过滤器,例如 “heal selection” + * 添加新的启动画面 + * 添加新的默认设置以最大化画布空间 + * 添加类似于 Adobe Photoshop 的键盘快捷键 + +PhotoGIMP 还在自定义 `.desktop` 文件中添加新的图标和名称。让我们看看如何使用它。 + +### 在 Linux 上安装 PhotoGIMP (适合中级到专业用户) + +PhotoGIMP 本质是一个补丁。在 Linux 中下载并[解压 zip 文件][7]。你将在解压的文件夹中找到以下隐藏的文件夹: + + * `.icons`:其中包含新的 PhotoGIMP 图标 + * `.local`:包含个性化的 `.desktop` 文件,以便你在系统菜单中看到的是 PhotoGIMP 而不是 GIMP + * `.var`:包含 GIMP 补丁的主文件夹 + +你应该[使用 Ctrl+H 快捷键在 Ubuntu 中显示隐藏文件][8]。 + +警告:建议你备份 GIMP 配置文件,以便在不喜欢 PhotoGIMP 时可以还原。只需将 GIMP 配置文件复制到其他位置即可备份。 + +目前,PhotoGIMP 主要与通过 [Flatpak][9] 安装的 GIMP 兼容。如果你使用 Flatpak 安装了 GIMP,那么只需将这些隐藏的文件夹复制粘贴到家目录中,它将 GIMP 转换为 Adobe Photoshop 类似的设置。 + +但是,如果你通过 apt、snap 或发行版的包管理器安装了 GIMP,那么必须找到 GIMP 的配置文件夹,然后粘贴 PhotoGIMP 的 `.var` 目录的内容。当出现询问时,请选择合并选项并替换同名的现有文件。 + +我[使用 apt 在 Ubuntu 20.04 中安装了 GIMP][10]。对我来说,GIMP 配置文件在 `~/.config/GIMP/2.10`。我复制了 `.var/app/org.gimp.GIMP/config/GIMP/2.10` 目录,并启动 GIMP 查看 PhotoGIMP 的启动页。 + +这是打了 PhotoGIMP 补丁后的 GIMP 界面: + +![][11] + +我尝试了几个 Photoshop 快捷键来检查它所做的更改,一切似乎可以正常工作。 + +- [下载 PhotoGIMP][12] + +我还找到了 [Snap 包形式的 PhotoGIMP][13],但它是 2019 年的,我不确定它是否可以在所有地方使用,或者仅适用于 snap 安装。 + +### 总结 + +这不是类似的第一个项目。几年前,我们有一个类似的项目叫 Gimpshop。Gimpshop 项目在过去的几年中没有任何进展,可以肯定地认为该项目已经死亡。有一个名为 Gimpshop 的网站,但该网站来自冒名者试图以 Gimpshop 的名义获利。 + +我不是 Adobe Photoshop 用户。我甚至不是 GIMP 专家,这就是为什么我们的 [GIMP 教程][14] 用 Dimitrios 的原因。 + +因此,我无法评论 PhotoGIMP 项目的实用性。如果你熟悉这两种软件,那么应该能够比我更好地进行判断。 + +如果你尝试使用 PhotoGIMP,请与他人分享你的经验,并告诉我们是否值得安装。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/photogimp/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.adobe.com/in/products/photoshop.html +[2]: https://itsfoss.com/open-source-photoshop-alternatives/ +[3]: https://www.gimp.org/ +[4]: https://diolinux.com.br/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-feature.jpg?ssl=1 +[6]: https://github.com/Diolinux/PhotoGIMP +[7]: https://itsfoss.com/unzip-linux/ +[8]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[9]: https://flatpak.org/ +[10]: https://itsfoss.com/gimp-2-10-release/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-editor-interface.jpg?resize=800%2C538&ssl=1 +[12]: https://github.com/Diolinux/PhotoGIMP/releases +[13]: https://snapcraft.io/photogimp +[14]: https://itsfoss.com/tag/gimp-tips/ diff --git a/published/202007/20200622 Protect your system with fail2ban and firewalld blacklists.md b/published/202007/20200622 Protect your system with fail2ban and firewalld blacklists.md new file mode 100644 index 0000000000..4cd9c9c586 --- /dev/null +++ b/published/202007/20200622 Protect your system with fail2ban and firewalld blacklists.md @@ -0,0 +1,339 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12417-1.html) +[#]: subject: (Protect your system with fail2ban and firewalld blacklists) +[#]: via: (https://fedoramagazine.org/protect-your-system-with-fail2ban-and-firewalld-blacklists/) +[#]: author: (hobbes1069 https://fedoramagazine.org/author/hobbes1069/) + +使用 fail2ban 和 FirewallD 黑名单保护你的系统 +====== + +![][1] + +如果你运行的服务器有面向公众的 SSH 访问,你可能遇到过恶意登录尝试。本文介绍了如何使用两个实用程序来防止入侵者进入我们的系统。 + +为了防止反复的 ssh 登录尝试,我们来看看 fail2ban。而且,如果你不经常旅行,基本上停留在一两个国家,你可以将 FirewallD 配置为只允许[从你选择的国家访问][2]。 + +首先,让我们为不熟悉这些应用程序的人员介绍一些术语,以完成这项工作: + +**fail2ban**:一个守护进程,用于禁止发生多次认证错误的主机。fail2ban 将监控 SystemD 日志,以查找对任何已启用的“监狱jail”的失败的验证尝试。在达到指定失败次数后,它将添加一个防火墙规则,在配置的时间内阻止该特定 IP 地址。 + +**FirewallD**:一个带有 D-Bus 接口的防火墙守护进程,提供动态防火墙。除非你另行决定使用传统的 iptables,否则你已经在所有支持的 Fedora 和 CentOS 上安装了 FirewallD。 + +### 假定前提 + +* 主机系统有一个互联网连接,并且要么是直接暴露在互联网上,要么是通过 DMZ(这两个都是非常糟糕的想法,除非你知道你在做什么),要么是有一个端口从路由器转发过来。 +* 虽然大部分的内容可能适用于其他系统,但本文假设当前系统是 Fedora(31 及以上)或 RHEL/CentOS 8 版本。在 CentOS 上,你必须用 `sudo dnf install epel-release` 启用 Fedora EPEL 仓库。 + +### 安装与配置 + +#### Fail2Ban + +很有可能已经有某个 Firewalld 区已经允许 SSH 访问,但 sshd 服务本身默认没有启用。要手动启动它,并且不在启动时永久启用它: + +``` +$ sudo systemctl start sshd +``` + +或者在系统启动时启用,并同时启动它: + +``` +$ sudo systemctl enable --now sshd +``` + +下一步就是安装、配置、启用 fail2ban。和往常一样,安装可以通过命令行完成: + +``` +$ sudo dnf install fail2ban +``` + +安装完毕后,下一步就是配置“监狱”(你要以设置的任何阈值监视并禁止的服务)。默认情况下,IP 会被禁止 1 小时(这其实不够长)。最好的做法是使用 `*.local` 文件覆盖系统默认值,而不是直接修改 `*.config` 文件。如果我们查看我的 `jail.local`,我们可以看到: + +``` +# cat /etc/fail2ban/jail.local +[DEFAULT] + +# "bantime" is the number of seconds that a host is banned. +bantime = 1d + +# A host is banned if it has generated "maxretry" during the last "findtime" +findtime = 1h + +# "maxretry" is the number of failures before a host get banned. +maxretry = 5 +``` + +换成通俗的语言讲,就是在过去一小时内尝试 5 次后,该 IP 将被封禁 1 天。对于多次被封的 IP,也可以选择增加封禁时间,但这是另一篇文章的主题。 + +下一步是配置“监狱”。在本教程中显示的是 `sshd`,但其他服务的步骤大致相同。在 `/etc/fail2ban/jail.d` 中创建一个配置文件。这是我的文件: + +``` +# cat /etc/fail2ban/jail.d/sshd.local +[sshd] +enabled = true +``` + +就这么简单! 很多配置已经在为 Fedora 构建的软件包中处理了(提示:我是当前的维护者)。接下来启用并启动 fail2ban 服务: + +``` +$ sudo systemctl enable --now fail2ban +``` + +希望没有立即出错,如果没有,请使用下面的命令检查 fail2ban 的状态: + +``` +$ sudo systemctl status fail2ban +``` + +如果它没有错误地启动,应该是这样的: + +``` +$ systemctl status fail2ban +● fail2ban.service - Fail2Ban Service +Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; disabled; vendor preset: disabled) +Active: active (running) since Tue 2020-06-16 07:57:40 CDT; 5s ago +Docs: man:fail2ban(1) +Process: 11230 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS) +Main PID: 11235 (f2b/server) +Tasks: 5 (limit: 4630) +Memory: 12.7M +CPU: 109ms +CGroup: /system.slice/fail2ban.service +└─11235 /usr/bin/python3 -s /usr/bin/fail2ban-server -xf start +Jun 16 07:57:40 localhost.localdomain systemd[1]: Starting Fail2Ban Service… +Jun 16 07:57:40 localhost.localdomain systemd[1]: Started Fail2Ban Service. +Jun 16 07:57:41 localhost.localdomain fail2ban-server[11235]: Server ready +``` + +如果是刚刚启动的,fail2ban 不太可能显示任何有意思的信息,但要检查 fail2ban 的状态,并确保“监狱”被启用,请输入: + +``` +$ sudo fail2ban-client status +Status +|- Number of jail: 1 +`- Jail list: sshd +``` + +sshd “监狱”的上级状态也会显示出来。如果启用了多个“监狱”,它们会在这里显示出来。 + +要查看一个“监狱”的详细状态,只需在前面的命令中添加“监狱”名称。下面是我的系统的输出,它已经运行了一段时间。我已经从输出中删除了被禁止的 IP: + +``` +$ sudo fail2ban-client status sshd +Status for the jail: sshd +|- Filter +| |- Currently failed: 8 +| |- Total failed: 4399 +| `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd +`- Actions + |- Currently banned: 101 + |- Total banned: 684 + `- Banned IP list: ... +``` + +监控 fail2ban 日志文件是否有入侵尝试,可以通过“尾随”日志来实现: + +``` +$ sudo tail -f /var/log/fail2ban.log +``` + +`tail` 是一个很好的命令行工具,默认情况下,它可以显示一个文件的最后 10 行。添加 `-f` 告诉它尾随文件,这是个观察一个仍在被写入的文件的很好方式。 + +由于输出的内容中有真实的 IP,所以这里不会提供样本,但它的可读性很高。`INFO` 行通常是登录的尝试。如果从一个特定的 IP 地址进行了足够多的尝试,你会看到一个 `NOTICE` 行显示一个 IP 地址被禁止。在达到禁止时间后,你会看到一个 `NOTICE` 解禁行。 + +注意几个警告行。最常见的情况是,当添加了一个禁止后,fail2ban 发现该 IP 地址已经在其禁止数据库中,这意味着禁止可能无法正常工作。如果是最近安装的 fail2ban 包,它应该被设置为 FirewallD 的富规则。这个包在 fail2ban-0.11.1-6 版本时从 ipset 方式切换到了富规则方式,所以如果你的 fail2ban 安装时间较早,它可能还在尝试使用 ipset 方式,这种方式使用的是传统的 iptables,不是很可靠。 + +#### FirewallD 配置 + +##### 被动还是主动? + +有两种策略可以分开或一起使用:**被动**地将单个 IP 地址或**主动**地根据来源国将子网永久列入黑名单。 + +对于被动方式,一旦 fail2ban 运行了一段时间,最好再运行 `sudo fail2ban-client status sshd` 来看看有哪些坏蛋。很可能会有很多被禁止的 IP 地址。选择一个,然后试着对它运行 `whois`。在输出结果中可能会有很多有趣的信息,但是对于这个方法来说,只有来源国是重要的。为了保持简单,让我们过滤掉除了国家以外的所有信息。 + +在这个例子中,我们将使用一些著名的域名: + +``` +$ whois google.com | grep -i country +Registrant Country: US +Admin Country: US +Tech Country: US +``` + +``` +$ whois rpmfusion.org | grep -i country +Registrant Country: FR +``` + +``` +$ whois aliexpress.com | grep -i country +Registrant Country: CN +``` + +使用 `grep -i` 的原因是为了使 `grep` 不区分大小写,而大多数条目都使用的是 “Country”,而有些条目则是全小写的 “country”,所以这种方法无论如何都能匹配。 + +现在知道了尝试入侵的来源国,问题是,“是否有来自这个国家的人有合法的理由连接到这台计算机?”如果答案是否定的,那么封锁整个国家应该是可以接受的。 + +从功能上看,主动式方法它与被动式方法没有太大区别,然而,来自有些国家的入侵企图是非常普遍的。如果你的系统既不放在这些国家里,也没有任何源自这些国家的客户,那么为什么不现在就把它们加入黑名单而是等待呢?(LCTT 译注:我的经验是,动辄以国家的范畴而列入黑名单有些过于武断。建议可以将该 IP 所属的 WHOIS 网段放入到黑名单,因为这些网段往往具有相同的使用性质,如都用于用户接入或 IDC 托管,其安全状况也大致相同,因此,如果有来自该网段的某个 IP 的恶意尝试,可以预期该网段内的其它 IP 也可能被利用来做这样的尝试。) + +##### 黑名单脚本和配置 + +那么如何做到这一点呢?用 FirewallD ipset。我开发了下面的脚本来尽可能地自动化这个过程: + +``` +#!/bin/bash +# Based on the below article +# https://www.linode.com/community/questions/11143/top-tip-firewalld-and-ipset-country-blacklist + +# Source the blacklisted countries from the configuration file +. /etc/blacklist-by-country + +# Create a temporary working directory +ipdeny_tmp_dir=$(mktemp -d -t blacklist-XXXXXXXXXX) +pushd $ipdeny_tmp_dir + +# Download the latest network addresses by country file +curl -LO http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz +tar xf all-zones.tar.gz + +# For updates, remove the ipset blacklist and recreate +if firewall-cmd -q --zone=drop --query-source=ipset:blacklist; then + firewall-cmd -q --permanent --delete-ipset=blacklist +fi + +# Create the ipset blacklist which accepts both IP addresses and networks +firewall-cmd -q --permanent --new-ipset=blacklist --type=hash:net \ + --option=family=inet --option=hashsize=4096 --option=maxelem=200000 \ + --set-description="An ipset list of networks or ips to be dropped." + +# Add the address ranges by country per ipdeny.com to the blacklist +for country in $countries; do + firewall-cmd -q --permanent --ipset=blacklist \ + --add-entries-from-file=./$country.zone && \ + echo "Added $country to blacklist ipset." +done + +# Block individual IPs if the configuration file exists and is not empty +if [ -s "/etc/blacklist-by-ip" ]; then + echo "Adding IPs blacklists." + firewall-cmd -q --permanent --ipset=blacklist \ + --add-entries-from-file=/etc/blacklist-by-ip && \ + echo "Added IPs to blacklist ipset." +fi + +# Add the blacklist ipset to the drop zone if not already setup +if firewall-cmd -q --zone=drop --query-source=ipset:blacklist; then + echo "Blacklist already in firewalld drop zone." +else + echo "Adding ipset blacklist to firewalld drop zone." + firewall-cmd --permanent --zone=drop --add-source=ipset:blacklist +fi + +firewall-cmd -q --reload + +popd +rm -rf $ipdeny_tmp_dir +``` + +这个应该安装到 `/usr/local/sbin`,不要忘了让它可执行! + +``` +$ sudo chmod +x /usr/local/sbin/firewalld-blacklist +``` + +然后创建一个配置文件 `/etc/blacklist-by-country`: + +``` +# Which countries should be blocked? +# Use the two letter designation separated by a space. +countries="" +``` + +而另一个配置文件 `/etc/blacklist-by-ip`,每行只有一个 IP,没有任何额外的格式化。 + +在这个例子中,从 ipdeny 的区文件中随机选择了 10 个国家: + +``` +# ls | shuf -n 10 | sed "s/\.zone//g" | tr '\n' ' ' +nl ee ie pk is sv na om gp bn +``` + +现在只要在配置文件中加入至少一个国家,就可以运行了! + +``` +$ sudo firewalld-blacklist + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed +100 142 100 142 0 0 1014 0 --:--:-- --:--:-- --:--:-- 1014 +100 662k 100 662k 0 0 989k 0 --:--:-- --:--:-- --:--:-- 989k +Added nl to blacklist ipset. +Added ee to blacklist ipset. +Added ie to blacklist ipset. +Added pk to blacklist ipset. +Added is to blacklist ipset. +Added sv to blacklist ipset. +Added na to blacklist ipset. +Added om to blacklist ipset. +Added gp to blacklist ipset. +Added bn to blacklist ipset. +Adding ipset blacklist to firewalld drop zone. +success +``` + +要验证 FirewallD 黑名单是否成功,请检查 `drop` 区和 `blacklist` ipset。 + +``` +$ sudo firewall-cmd --info-zone=drop +drop (active) + target: DROP + icmp-block-inversion: no + interfaces: + sources: ipset:blacklist + services: + ports: + protocols: + masquerade: no + forward-ports: + source-ports: + icmp-blocks: + rich rules: + +$ sudo firewall-cmd --info-ipset=blacklist | less +blacklist + type: hash:net + options: family=inet hashsize=4096 maxelem=200000 + entries: +``` + +第二条命令将输出所有的子网,这些子网是基于被封杀的国家而添加的,可能会相当长。 + +### 那么现在我该怎么做? + +虽然在开始的时候,监控的频率会比较高,但随着时间的推移,入侵尝试的次数应该会随着黑名单的增加而减少。那么目标应该是维护而不是主动监控。 + +为此,我创建了一个 SystemD 服务文件和定时器,这样每月都会刷新由 ipdeny 维护的每个国家的子网。事实上,这里讨论的所有内容都可以从我的 [pagure.io](https://pagure.io/firewalld-blacklist) 项目中下载。 + +是不是很高兴你看完了整篇文章?现在只要把服务文件和定时器下载到 `/etc/systemd/system/`,并启用定时器就行了: + +``` +$ sudo systemctl daemon-reload +$ sudo systemctl enable --now firewalld-blacklist.timer +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/protect-your-system-with-fail2ban-and-firewalld-blacklists/ + +作者:[hobbes1069][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/hobbes1069/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/fail2ban-and-firewalld-816x345.png +[2]: https://www.linode.com/community/questions/11143/top-tip-firewalld-and-ipset-country-blacklist diff --git a/published/202007/20200624 How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space.md b/published/202007/20200624 How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space.md new file mode 100644 index 0000000000..3ca4e2946f --- /dev/null +++ b/published/202007/20200624 How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12414-1.html) +[#]: subject: (How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space) +[#]: via: (https://itsfoss.com/disable-ubuntu-dock/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 20.04 上禁用坞站(dock) +====== + +左侧的启动器已成为 [Ubuntu][1] 桌面的标识。它是在 [Unity 桌面][2]中引入的,甚至在 [Ubuntu 切换到 GNOME][3]时就有了,它复刻了 “Dash to Panel”,以在 [GNOME][4] 上创建一个类似的坞站dock。 + +就个人而言,我发现它对于快速访问常用应用非常方便,但并非所有人都希望它额外占用屏幕上的一些空间。 + +从 [Ubuntu 20.04][5] 开始,你可以轻松禁用坞站。在本教程中,让我向你展示如何以图形和命令的方式执行此操作。 + +![][6] + +### 通过扩展应用禁用 Ubuntu Dock + +[Ubuntu 20.04 的主要功能][7]之一是引入“扩展Extension”应用来管理系统上的 GNOME 扩展。只需在 GNOME 菜单中查找它(按下 Windows 键并输入): + +![Look for Extensions app in the menu][8] + +> 没有找到扩展应用? +> +> 如果尚未安装,你应该启用 GNOME Shell 扩展,“扩展” GUI 是此软件包的一部分。 +> +> ``` +> sudo apt install gnome-shell-extensions +> ``` +> +> 这仅对 [GNOME 3.36][9] 或 Ubuntu 20.04(或更高版本) 中的更高版本有效。 + +启动“扩展”应用,你应该在“内置”扩展下看到 Ubuntu Dock。你只需要关闭即可禁用坞站。 + +![Disable Ubuntu Dock][10] + +更改是即时的,你会看到坞站立即消失。 + +你可以用相同的方式恢复。只需打开它,它就会立即显示。 + +在 Ubuntu 20.04 中非常容易隐藏坞站,不是吗? + +### 替代方法:通过命令行禁用 Ubuntu 坞站 + +如果你是终端爱好者,并且喜欢在终端中做事,那么我有一个对你而言的好消息。你可以从命令行禁用 Ubuntu 坞站。 + +使用 `Ctrl+Alt+T` 打开终端。你可能已经知道 [Ubuntu 中的键盘快捷键][11]。 + +在终端中,使用以下命令列出所有可用的 GNOME 扩展: + +``` +gnome-extensions list +``` + +这将显示类似于以下的输出: + +![List GNOME Extensions][12] + +默认的 Ubuntu 坞站扩展是 `ubuntu-dock@ubuntu.com`。你可以使用以下命令将其禁用: + +``` +gnome-extensions disable ubuntu-dock@ubuntu.com +``` + +屏幕上不会显示任何输出,但是你会注意到启动器(坞站)从左侧消失了。 + +如果需要,你可以使用与上面相同的命令再次启用它,但使用启用选项: + +``` +gnome-extensions enable ubuntu-dock@ubuntu.com +``` + +### 总结 + +在 Ubuntu 18.04 中也有禁用坞站的方法。但是,如果你尝试在 18.04 中删除它,这可能会导致不想要的结果。删除此软件包也会删除 ubuntu-desktop 包,最终可能会导致系统崩溃,例如没有应用菜单。 + +这就是为什么我不建议在 Ubuntu 18.04 上删除它的原因。 + +好消息是 Ubuntu 20.04 提供了一种隐藏任务栏的方法。用户拥有更大的自由度和更多的屏幕空间。说到更多的屏幕空间,你是否知道可以[从 Firefox 移除顶部标题栏并获得更多的屏幕空间][14]? + +我想知道你喜欢怎样的 Ubuntu 桌面?要坞站,不要坞站,还是不要 GNOME? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/disable-ubuntu-dock/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntu.com/ +[2]: https://itsfoss.com/keeping-ubuntu-unity-alive/ +[3]: https://itsfoss.com/ubuntu-unity-shutdown/ +[4]: https://www.gnome.org/ +[5]: https://itsfoss.com/download-ubuntu-20-04/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/disable-dock-in-ubuntu.png?ssl=1 +[7]: https://itsfoss.com/ubuntu-20-04-release-features/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/GNOME-extensions-app-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/gnome-3-36-release/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/disable-ubuntu-dock.png?ssl=1 +[11]: https://itsfoss.com/ubuntu-shortcuts/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/list-gnome-extensions.png?ssl=1 +[13]: https://itsfoss.com/cdn-cgi/l/email-protection +[14]: https://itsfoss.com/remove-title-bar-firefox/ diff --git a/published/202007/20200625 How to stress test your Linux system.md b/published/202007/20200625 How to stress test your Linux system.md new file mode 100644 index 0000000000..a9cc40f818 --- /dev/null +++ b/published/202007/20200625 How to stress test your Linux system.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12389-1.html) +[#]: subject: (How to stress test your Linux system) +[#]: via: (https://www.networkworld.com/article/3563334/how-to-stress-test-your-linux-system.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何对你的 Linux 系统进行压力测试 +====== + +> 如果你想了解 Linux 服务器在重压之下的运行情况,那么给 Linux 服务器施加压力是个不错的主意。在这篇文章中,我们将看一些工具,可以帮助你增加服务器压力并衡量结果。 + +![](https://images.idgesg.net/images/article/2020/06/stress-test2_linux-penguin-stress-ball_hand-squeezing_by-digitalsoul-getty-images_1136841639-100850120-large.jpg) + +为什么你会想给你的 Linux 系统施加压力呢?因为有时你可能想知道当一个系统由于大量运行的进程、繁重的网络流量、过多的内存使用等原因而承受很大的压力时,它的表现如何。这种压力测试可以帮助确保系统已经做好了 “上市” 的准备。 + +如果你需要预测应用程序可能需要多长时间才能做出反应,以及哪些(如果有的话)进程可能会在重负载下失败或运行缓慢,那么在前期进行压力测试是一个非常好的主意。 + +幸运的是,对于那些需要能够预测 Linux 系统在压力下的反应的人来说,你可以采用一些有用的技术和工具来使这个过程更容易。在这篇文章中,我们将研究其中的一些。 + +### 自己动手做个循环 + +第一种技术是在命令行上运行一些循环,观察它们对系统的影响。这种方式可以大大增加 CPU 的负荷。使用 `uptime` 或类似的命令可以很容易地看到结果。 + +在下面的命令中,我们启动了四个无尽循环。你可以通过添加数字或使用 bash 表达式,如 `{1...6}` 来代替 `1 2 3 4` 以增加循环次数: + +``` +for i in 1 2 3 4; do while : ; do : ; done & done +``` + +在命令行上输入后,将在后台启动四个无尽循环: + +``` +$ for i in 1 2 3 4; do while : ; do : ; done & done +[1] 205012 +[2] 205013 +[3] 205014 +[4] 205015 +``` + +在这种情况下,发起了作业 1-4,作业号和进程号会相应显示出来。 + +要观察对平均负载的影响,请使用如下所示的命令。在本例中,`uptime` 命令每 30 秒运行一次: + +``` +$ while true; do uptime; sleep 30; done +``` + +如果你打算定期运行这样的测试,你可以将循环命令放入脚本 `watch-it` 中。 + +``` +#!/bin/bash + +while true +do + uptime + sleep 30 +done +``` + +在输出中,你可以看到平均负载是如何增加的,然后在循环结束后又开始下降。 + +``` + 11:25:34 up 5 days, 17:27, 2 users, load average: 0.15, 0.14, 0.08 + 11:26:04 up 5 days, 17:27, 2 users, load average: 0.09, 0.12, 0.08 + 11:26:34 up 5 days, 17:28, 2 users, load average: 1.42, 0.43, 0.18 + 11:27:04 up 5 days, 17:28, 2 users, load average: 2.50, 0.79, 0.31 + 11:27:34 up 5 days, 17:29, 2 users, load average: 3.09, 1.10, 0.43 + 11:28:04 up 5 days, 17:29, 2 users, load average: 3.45, 1.38, 0.54 + 11:28:34 up 5 days, 17:30, 2 users, load average: 3.67, 1.63, 0.66 + 11:29:04 up 5 days, 17:30, 2 users, load average: 3.80, 1.86, 0.76 + 11:29:34 up 5 days, 17:31, 2 users, load average: 3.88, 2.06, 0.87 + 11:30:04 up 5 days, 17:31, 2 users, load average: 3.93, 2.25, 0.97 + 11:30:34 up 5 days, 17:32, 2 users, load average: 3.64, 2.35, 1.04 <== 循环停止 + 11:31:04 up 5 days, 17:32, 2 users, load average: 2.20, 2.13, 1.01 11:31:34 up 5 days, 17:33, 2 users, load average: 1.40, 1.94, 0.98 +``` + +因为所显示的负载分别代表了 1、5 和 15 分钟的平均值,所以这些值需要一段时间才能恢复到系统接近正常的状态。 + +要停止循环,请发出像下面这样的 `kill` 命令 —— 假设作业号是 1-4,就像本篇文章前面显示的那样。如果你不确定,可以使用 `jobs` 命令来确认作业号。 + +``` +$ kill %1 %2 %3 %4 +``` + +### 增加压力的专用工具 + +另一种方法是使用专门为你制造系统压力的工具。其中一种叫做 `stress`(压力),可以以多种方式对系统进行压力测试。`stress` 工具是一个工作负载生成器,提供 CPU、内存和磁盘 I/O 压力测试。 + +在使用 `--cpu` 选项时,`stress` 命令使用平方根函数强制 CPU 努力工作。指定的 CPU 数量越多,负载上升的速度就越快。 + +下面第二个脚本(`watch-it-2`)可以用来衡量对系统内存使用的影响。请注意,它使用 `free` 命令来查看加压的效果。 + +``` +$ cat watch-it-2 +#!/bin/bash + +while true +do + free + sleep 30 +done +``` + +发起任务并观察压力: + +``` +$ stress --cpu 2 + +$ ./watch-it + 13:09:14 up 5 days, 19:10, 2 users, load average: 0.00, 0.00, 0.00 + 13:09:44 up 5 days, 19:11, 2 users, load average: 0.68, 0.16, 0.05 + 13:10:14 up 5 days, 19:11, 2 users, load average: 1.20, 0.34, 0.12 + 13:10:44 up 5 days, 19:12, 2 users, load average: 1.52, 0.50, 0.18 + 13:11:14 up 5 days, 19:12, 2 users, load average: 1.71, 0.64, 0.24 + 13:11:44 up 5 days, 19:13, 2 users, load average: 1.83, 0.77, 0.30 +``` + +在命令行中指定的 CPU 越多,负载就增加的越快。 + +``` +$ stress --cpu 4 +$ ./watch-it + 13:47:49 up 5 days, 19:49, 2 users, load average: 0.00, 0.00, 0.00 + 13:48:19 up 5 days, 19:49, 2 users, load average: 1.58, 0.38, 0.13 + 13:48:49 up 5 days, 19:50, 2 users, load average: 2.61, 0.75, 0.26 + 13:49:19 up 5 days, 19:50, 2 users, load average: 3.16, 1.06, 0.38 + 13:49:49 up 5 days, 19:51, 2 users, load average: 3.49, 1.34, 0.50 + 13:50:19 up 5 days, 19:51, 2 users, load average: 3.69, 1.60, 0.61 +``` + +`stress` 命令也可以通过 `--io`(输入/输出)和 `--vm`(内存)选项增加 I/O 和内存的负载来给系统施加压力。 + +在接下来的这个例子中,运行这个增加内存压力的命令,然后启动 `watch-it-2` 脚本。 + +``` +$ stress --vm 2 + +$ watch-it-2 + total used free shared buff/cache available +Mem: 6087064 662160 2519164 8868 2905740 5117548 +Swap: 2097148 0 2097148 + total used free shared buff/cache available +Mem: 6087064 803464 2377832 8864 2905768 4976248 +Swap: 2097148 0 2097148 + total used free shared buff/cache available +Mem: 6087064 968512 2212772 8864 2905780 4811200 +Swap: 2097148 0 2097148 +``` + +`stress` 的另一个选项是使用 `--io` 选项为系统添加输入/输出活动。在这种情况下,你可以使用这样的命令: + +``` +$ stress --io 4 +``` + +然后你可以使用 `iotop` 观察受压的 I/O。注意,运行 `iotop` 需要 root 权限。 + +之前: + +``` +$ sudo iotop -o +Total DISK READ: 0.00 B/s | Total DISK WRITE: 19.36 K/s +Current DISK READ: 0.00 B/s | Current DISK WRITE: 27.10 K/s + TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND + 269308 be/4 root 0.00 B/s 0.00 B/s 0.00 % 1.24 % [kworker~fficient] + 283 be/3 root 0.00 B/s 19.36 K/s 0.00 % 0.26 % [jbd2/sda1-8] +``` + +之后: + +``` +Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s +Current DISK READ: 0.00 B/s | Current DISK WRITE: 0.00 B/s + TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND + 270983 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 51.45 % stress --io 4 + 270984 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 51.36 % stress --io 4 + 270985 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 50.95 % stress --io 4 + 270982 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 50.80 % stress --io 4 + 269308 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.09 % [kworker~fficient] +``` + +`stress` 只是给系统增加压力的若干工具之一。另一个较新的工具,`stress-ng`,将在以后的文章中介绍。 + +### 总结 + +用于系统压力测试的各种工具可以帮助你预测系统在真实世界的情况下如何响应,在这些情况下,它们受到增加的流量和计算需求。 + +虽然我们在文章中展示的是创建和测量各种类型的压力的方法,但最终的好处是压力如何帮助确定你的系统或应用程序对它的反应。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3563334/how-to-stress-test-your-linux-system.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200625 Make Bash history more useful with these tips.md b/published/202007/20200625 Make Bash history more useful with these tips.md new file mode 100644 index 0000000000..1757367d61 --- /dev/null +++ b/published/202007/20200625 Make Bash history more useful with these tips.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12381-1.html) +[#]: subject: (Make Bash history more useful with these tips) +[#]: via: (https://opensource.com/article/20/6/bash-history-control) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +这些技巧让 Bash 命令历史更加有用 +====== + +> 告诉 Bash 你想要它记住什么,甚至删除不需要的记录重写历史。 + +![](https://img.linux.net.cn/data/attachment/album/202007/05/091205hkg0egl2gge2gx9z.jpg) + +运行 [Bash][2] 的 Linux 终端有内置的历史记录,你可以用来跟踪最近的操作。要查看你的 Bash 会话的历史记录,请使用内置命令 `history`: + +``` +$ echo "foo" +foo +$ echo "bar" +bar +$ history +  1  echo "foo" +  2  echo "bar" +  3  history +``` + +与大多数命令不一样,`history` 命令不是文件系统上的可执行文件,而是 Bash 的功能。你可以使用 `type` 命令来验证: + +``` +$ type history +history is a shell builtin +``` + +### 历史控制 + +shell 历史记录的行数上限由 `HISTSIZE` 变量定义。你可以在 `.bashrc` 文件中设置此变量。以下将你的历史记录设置为 3,000 行,之后将最早的行删除以为最新命令腾出空间,该命令位于列表的底部: + +``` +export HISTSIZE=3000 +``` + +还有其他与历史相关的变量。 `HISTCONTROL` 变量控制哪些历史被记录。你可以在 `.bashrc` 中写入下面的行来强制 Bash 排除以空格开头的命令: + +``` +export HISTCONTROL=$HISTCONTROL:ignorespace +``` + +现在,如果你输入以空格开头的命令,那么它将不会记录在历史记录中: + +``` +$ echo "hello" +$     mysql -u bogus -h badpassword123 mydatabase +$ echo "world" +$ history +  1  echo "hello" +  2  echo "world" +  3  history +``` + +你也可以避免重复的条目: + +``` +export HISTCONTROL=$HISTCONTROL:ignoredups +``` + +现在,如果你一个接着一个输入两个命令,历史记录中只会显示一个: + +``` +$ ls +$ ls +$ ls +$ history +  1  ls +  2  history +``` + +如果你喜欢这两个忽略功能,那么可以使用 `ignoreboth`: + +``` +export HISTCONTROL=$HISTCONTROL:ignoreboth +``` + +### 从历史记录中删除命令 + +有时你会犯一个错误,在 shell 中输入了一些敏感内容,或者你​​只是想清理历史记录,以便它更准确地表示让某件事正常工作所采取的步骤。如果要从 Bash 的历史记录中删除命令,请在要删除的项目的行号上使用 `-d` 选项: + +``` +$ echo "foo" +foo +$ echo "bar" +bar +$ history | tail +  535  echo "foo" +  536  echo "bar" +  537  history | tail +$ history -d 536 +$ history | tail +  535  echo "foo" +  536  history | tail +  537  history -d 536 +  538  history | tail +``` + +要停止添加 `history` 条目,只要在 `HISTCONTROL` 环境变量中有 `ignorespace`,就可以在命令前添加空格: + +``` +$  history | tail +  535  echo "foo" +  536  echo "bar" +$  history -d 536 +$  history | tail +  535  echo "foo" +``` + +你可以使用 `-c` 选项清除所有会话历史记录: + +``` +$ history -c +$  history +$ +``` + +### history 命令的经验 + +操纵历史通常没有听起来那么危险,尤其是当你有目标地管理它时。例如,如果你要记录一个复杂的问题,通常最好使用会话历史来记录命令,因为通过将命令插入历史记录,你能运行它们并从而测试过程。很多时候,不执行历史命令会导致忽略小的步骤或写错小细节。 + +按需使用历史会话,并明智地控制历史记录。享受历史修改吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-history-control + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://opensource.com/resources/what-bash diff --git a/published/202007/20200626 Docker and Fedora 32.md b/published/202007/20200626 Docker and Fedora 32.md new file mode 100644 index 0000000000..51d9073614 --- /dev/null +++ b/published/202007/20200626 Docker and Fedora 32.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12433-1.html) +[#]: subject: (Docker and Fedora 32) +[#]: via: (https://fedoramagazine.org/docker-and-fedora-32/) +[#]: author: (Kevin "Eonfge" Degeling https://fedoramagazine.org/author/eonfge/) + +在 Fedora 32 上运行 Docker +====== + +![][1] + +随着 Fedora 32 的发布,[Docker][2] 的普通用户面临着一个小挑战。在编写本文时,Fedora 32 不支持 Docker。虽然还有其他选择,例如 [Podman][3] 和 [Buildah][4],但是对于许多现有用户而言,现在切换可能不是最佳时机。因此,本文可以帮助你在 Fedora 32 上设置 Docker 环境。 + +### 步骤 0:消除冲突 + +此步骤适用于从 Fedora 30 或 31 升级的任何用户。如果全新安装的 Fedora 32,那么可以跳到步骤 1。 + +删除 docker 及其所有相关组件: + +``` +sudo dnf remove docker-* +sudo dnf config-manager --disable docker-* +``` + +### 步骤 1:系统准备 + +在 Fedora 的最后两个版本中,操作系统已迁移到两项新技术: CGroups 和用于防火墙的 NFTables。尽管这些新技术的详细信息不在本教程的讨论范围之内,但是令人遗憾的是,Docker 还不支持这些新技术。因此,你必须进行一些更改才能在 Fedora 上使用 Docker。 + +#### 启用旧的 CGroups + +Fedora 仍然支持 CGroups 的先前实现,可以使用以下命令启用它: + +``` +sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0" +``` + +#### 在防火墙中将 Docker 列入白名单 + +为了让 Docker 具有网络访问权限,需要两个命令: + +``` +sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0 +sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-masquerade +``` + +第一个命令将 Docker 接口添加到受信任的环境,它允许 Docker 建立远程连接。第二个命令将允许 Docker 建立本地连接。当有多个 Docker 容器作为开发环境时,这特别有用。 + +### 步骤 2:安装 Moby + +[Moby][5] 是 Docker 的开源白牌版本。它基于相同的代码,但不带商标。它包含在 Fedora 的主仓库中,因此很容易安装: + +``` +sudo dnf install moby-engine docker-compose +``` + +这将安装 `moby-engine`、`docker-compose`、`containerd` 和其他一些相关的库。安装完成后,你必须启用系统级守护程序才能运行 Docker: + +``` +sudo systemctl enable docker +``` + +### 步骤 3:重新启动并测试 + +为了确保正确处理所有系统和设置,你现在必须重启计算机: + +``` +sudo systemctl reboot +``` + +之后,你可以使用 Docker hello-world 包来验证安装: + +``` +sudo docker run hello-world +``` + +除非遇到问题,不然你就会看到来自 Docker 的问候! + +#### 以管理员身份运行 + +可选地,你现在还可以将用户添加到 Docker 的组帐户中,以便无需输入 `sudo` 即可启动 Docker 镜像: + +``` +sudo groupadd docker +sudo usermod -aG docker $USER +``` + +注销并登录以使更改生效。如果以管理员权限运行容器的想法让你有所顾虑,那么你应该研究 Podman。 + +### 总结 + +从现在起,Docker 将按照你的习惯工作,包括 `docker-compose` 和所有与 `docker` 相关的工具。不要忘记查看官方文档,这在很多情况下可以为你提供帮助。 + +Fedora 32 上 Docker 的当前状态并不理想。缺少官方软件包可能会困扰一些人,有一个[上游问题][6]对此进行了讨论。对 [CGroups][7] 和 [NFTables][8] 缺少支持更多是技术问题,但是你可以查看它们在其公共问题上的进展。 + +这些指导应可以让你就像什么都没有发生一样继续工作。如果这不能满足你的需求,请不要忘记到 Moby 或 Docker Github 页面去寻求解决你的技术问题,或者看看 Podman,长期来看,它可能会更加强大。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/docker-and-fedora-32/ + +作者:[Kevin "Eonfge" Degeling][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/eonfge/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/f32-04-twilight-816x459.png +[2]: https://docs.docker.com/ +[3]: https://podman.io/getting-started/ +[4]: https://buildah.io/ +[5]: https://mobyproject.org/ +[6]: https://github.com/docker/for-linux/issues/955 +[7]: https://github.com/moby/moby/issues/40360 +[8]: https://github.com/moby/moby/issues/26824 diff --git a/published/202007/20200626 Open source tools for translating British to American English.md b/published/202007/20200626 Open source tools for translating British to American English.md new file mode 100644 index 0000000000..a2f1f35abb --- /dev/null +++ b/published/202007/20200626 Open source tools for translating British to American English.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12430-1.html) +[#]: subject: (Open source tools for translating British to American English) +[#]: via: (https://opensource.com/article/20/6/british-american-cli-translator) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) + +将英式英语翻译成美式英语的开源工具 +====== + +> 使用这些命令行翻译器将英式英语转换为美式英语(或反之)。 + +![Red telephone booth on a street in England][1] + +去年圣诞节,我和我的妻子去了家乡佛罗里达的皮尔斯堡,并且经常光顾海滩上的一家当地人场所。在那儿,我们遇到了一对来自英国中部地区的夫妇。音乐很响,喝酒也很闹,所以很难听清楚。另外,即使他们“似乎”在说英语,但有时理解他们在说什么仍然是一个挑战。我以为我在澳大利亚的时光会给我足够的语言能力,但是,可惜,很多东西都超出了我的想象。不止是一般的 “soccer 是 football” 或 “trunk是 boot” 之类的困惑。 + +幸运的是,有开源方案可以将“英式”翻译成“美式”。我们可能使用相同的语言,但是我们共同的言语却比多塞特郡沙夫茨伯里的之字形山要曲折得多! + +如果你碰巧在酒吧有 Linux 笔记本,那么你可以使用方便的开源命令行程序,它就叫 [美英英语翻译器][2](MIT 许可证)。 + +我在我的改造运行 Linux 的 MacBook 上安装这个翻译器: + +``` +$ npm install -g american-british-english-translator +``` + +这需要我首先[安装 Node.js][3]。 + +### 声明! + +除了翻译单词和短语,美英英语翻译器还能分析(嗯,剖析)文档。我用一个叫《独立宣言》的流行文件试了一下。它分析并返回了许多结果。其中一个比较有趣的是: + +``` +fall: +issue: Different meanings(意思不同) +details: +American English: autumn(秋天) +British English: +""" +to become pregnant. (Either as in 'I fell pregnant' or as in 'She fell for a baby.');(怀孕 —— 无论是“我怀孕了”还是“她怀孕了”) +``` + +并非如《宣言》作者所指控的“在公海俘虏”(taken captive on the high seas): + +> ”他在公海上俘虏我们的同胞,强迫他们拿起武器来反对自己的国家,成为残杀自己亲人和朋友的刽子手,或是死于自己的亲人和朋友的手下。“(He has constrained our fellow Citizens taken Captive on the high Seas to bear Arms against their Country, to become the executioners of their friends and Brethren, or to fall themselves by their Hands.) + +### 还有一个 + +对于简单的单词替换,你可以尝试 [Common_Language][4],这是一个开源(MIT 许可)Python 脚本。 + +当然,要与同伴一起喝几杯,你也许需要实际交流,并能理解他们。这就是需要用到 MARY 了。 + +[MaryTTS][5] 是一个使用 Java(GNU 许可)编写的开源多语言文本到语音合成平台。方便的[基于浏览器的界面][6]使你可以轻松地将美国酒吧谈话内容转换为男声或女声的正确英语(或其他语言)。 + +现在我可以和我的英国朋友们见面了(可以安全地再来一次),喝几杯!像当地人一样讲英语!大家干杯! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/british-american-cli-translator + +作者:[Jeff Macharyas][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/england-telephone-booth-street.jpg?itok=JQsc_piX (Red telephone booth on a street in England) +[2]: https://github.com/hyperreality/American-British-English-Translator +[3]: https://nodejs.org/en/download/ +[4]: https://github.com/willettk/common_language +[5]: https://github.com/marytts/marytts +[6]: http://mary.dfki.de:59125/ diff --git a/published/202007/20200627 An open source browser extension to zoom in on images.md b/published/202007/20200627 An open source browser extension to zoom in on images.md new file mode 100644 index 0000000000..bc056c0938 --- /dev/null +++ b/published/202007/20200627 An open source browser extension to zoom in on images.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12384-1.html) +[#]: subject: (An open source browser extension to zoom in on images) +[#]: via: (https://opensource.com/article/20/6/hoverzoom) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) + +一个可放大图像的开源的浏览器扩展 +====== + +> 想细看网络图像并不总是那么简单,但是 Hover Zoom+ 让它像鼠标滑动一样容易。 + +![Digital images of a computer desktop][1] + +你是否曾经在访问网站时希望查看更大的图像?我经常遇到这种情况,而要做到这点并不总是那么容易。 + +有时,我在源码中筛选,使用 `Ctrl + F` 搜索图像,复制图像源地址并将其粘贴到新窗口中,以便以全尺寸查看图像。或者,另一个选择是右键单击,复制图像地址,然后粘贴到新选项卡中。 + +![Example image source code ][2] + +Hover Zoom+ 让这个过程更加简单。Hover Zoom+ 是一个简单 Chrome 扩展程序,在 MIT 许可证下发布,可在 Chrome 商店中找到,它的源码可在 [GitHub][3] 上获得。它也适用于 Firefox。 + +这个应用使得该过程更加容易。只需将鼠标悬停在图像上,你将看到一个弹出窗口来显示该图像的全部内容,它会匹配你的浏览器窗口,无论图像是否被裁剪(或者图像尺寸适当,它看上去会是一样的)。这可能很有趣,因为有时可能会裁剪原始图像,以适应空间或聚焦于图像的特定部分。但是,你无法右键单击并直接从弹出窗口中保存图像。 + +根据加州圣何塞的开发人员 Oleg Anashkin 的说法,“这是原始 HoverZoom 扩展的开源版本,现已被恶意软件所占领,并被从商店中删除。在此版本中,所有间谍软件均已删除,许多 bug 已被修复,并添加了新功能。它默认不会收集任何统计信息。” + +我在 Windows 10 笔记本上的 Chrome 中安装了此扩展,然后试用了一下。安装扩展后,我将鼠标悬停在图像上,它在弹出窗口中显示了比实际更大的图像。 + +但是,Hover Zoom+ 不适用于所有网站或所有图像。它适用于 Facebook 和 Twitter,但不适用于这些网站上的赞助内容。用户可以轻松切换该应用以针对特定站点启用或禁用它。使用 Hover Zoom+ 可以很容易地看到 Instagram 上的这只可爱小猫而无需实际阅读帖子(方便!): + +![Zoomed-in image of a kitten from Facebook][4] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/hoverzoom + +作者:[Jeff Macharyas][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) +[2]: https://opensource.com/sites/default/files/uploads/source.jpg (Example image source code) +[3]: https://github.com/extesy/hoverzoom/ +[4]: https://opensource.com/sites/default/files/uploads/fb-cat.jpg (HoverZoom+ enlarged image) diff --git a/published/202007/20200627 Learn Shell Scripting for Free With These Resources -PDF, Video Courses and Interactive Websites.md b/published/202007/20200627 Learn Shell Scripting for Free With These Resources -PDF, Video Courses and Interactive Websites.md new file mode 100644 index 0000000000..a4bcd85506 --- /dev/null +++ b/published/202007/20200627 Learn Shell Scripting for Free With These Resources -PDF, Video Courses and Interactive Websites.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12379-1.html) +[#]: subject: (Learn Shell Scripting for Free With These Resources [PDF, Video Courses and Interactive Websites]) +[#]: via: (https://itsfoss.com/shell-scripting-resources/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +学习 Shell 脚本编程的免费资源 +====== + +> 你想学习 shell 脚本编程吗?或者你想提升现有的 bash 知识?我收集了以下免费的资源来帮助你学习 shell 脚本编程。 + +(LCTT 译注:毫无疑问,这些都是英文的) + +shell 是一个命令行解释器,它允许你输入命令并获得输出。当你在使用终端的时候,你就已经在看 shell 了。 + +是的,shell 是一个你可以和它进行交互的命令行界面,你可以通过它给操作系统某种指令。虽然有不同类型的 shell,但是 [bash][1](GNU Bourne-Again Shell)是在各 Linux 发行版中最流行的。 + +当谈到 shell 脚本编程的时候,也就意味着 —— 用户希望使用脚本来执行多条命令来获得一个输出。 + +也许你需要学习 shell 脚本编程作为你的课程或者工作的一部分。了解 shell 脚本编程也可以帮助你在 Linux 中自动化某些重复的任务。 + +不管出于什么原因学习 shell 脚本编程,都可以看看这些我给你展示的资源。 + +### 最好的免费学习 shell 脚本编程的资源 + +![][2] + +还没在你的系统上安装 Linux?不用担心。有很多种方法[在 Windows 上使用 Linux 终端][3]。你也可以在某些情况下[使用在线 Linux 终端][4]来练习 shell 脚本编程。 + +#### 1、学习 Shell —— 互动网站 + +![][5] + +如果你正在找一个互动网站来学习 shell 脚本编程,并且还可以在线试试,“[学习 Shell][6]” 是一个不错的起点。 + +它涵盖了基础知识,并且也提供了一些高级的练习。通常,内容还是简明扼要的 —— 因此,我建议你看看这个网站。 + +#### 2、Shell 脚本编程教程 —— 门户网站 + +![][7] + +“[Shell 脚本编程教程][8]” 是一个完全专注于 shell 脚本编程的网站。你可以选择免费阅读其中的资源,也可以购买 PDF、实体书籍和电子书来支持他们。 + +当然,花钱买纸质的版本或者电子书不是强制的。但是,这些免费资源查看起来还是很方便的。 + +#### 3、Udemy:Shell 脚本 —— 免费视频课程 + +![][9] + +毫无疑问,[Udemy][10] 是最受欢迎的在线课程平台之一。而且,除了付费认证课程之外,它还提供了不包含证书的免费内容。 + +“[Shell 脚本][11]” 是 Udemy 上推荐度最高的免费课程之一。你不需要花费任何费用就可以注册这门课。 + +#### 4、Udemy:Bash Shell 脚本编程 —— 免费视频课程 + +![][12] + +Udemy 上另一个专注于 [bash shell 脚本编程][29]的有趣且免费的课程。与前面提到的课程相比,这个资源似乎更受欢迎。所以,你可以注册这门课,看看它都教些什么。 + +别忘了 Udemy 的免费课程不能提供证书。但是,它确实是一个让人印象深刻的免费 shell 脚本编程学习资源。 + +#### 5、Bash 研究院 —— 互动游戏在线门户 + +![][13] + +顾名思义,“[Bash 研究院][15]” 专注于向用户提供 bash shell 的教学。 + +尽管它没有很多的内容,它还是非常适合初学者和有一定经验的用户。不仅仅局限于指导 —— 它也可以提供交互式的游戏来练习,不过目前已经不能用了。 + +因此,如果这个足够有趣,你可以去看看这个 [Github 页面][14],并且如果你愿意的话,还可以复刻它并对现有资源进行改进。 + +#### 6、LinkedIn:学习 Bash 脚本编程 —— 免费视频课程 + +![][16] + +LinkedIn 提供了大量免费课程来帮助你提成技能,并且为更多工作做好准备。你还可以找到一些专注于 shell 脚本编程的课程,这些课程有助于重温基本技能或者这个过程中获得一些高级技能。 + +在这里,我提供一个 [学习 Bash 脚本编程][17] 的课程链接,你还可以发现其他类似的免费课程。 + +#### 7、高级 Bash 脚本编程指南 —— 免费 PDF 书籍 + +![][18] + +这是一个令人印象深刻的《[高级 Bash 脚本编程指南][19]》,并且可以免费获得到它的 PDF 版本。这个 PDF 资源没有版权限制,在公开领域是完全免费的。 + +尽管这个资源主要是提供高级的知识,通过参考这个 PDF 并且开始学习 shell 脚本编程,它还是很适合初学者的。 + +#### 8、专业 Bash 笔记 —— 免费 PDF 书籍 + +![][20] + +如果你已经对 Bash Shell 脚本编程比较熟悉或者只是想快速总结一下,那这是一个很好的参考。 + +这个《[专业 Bash 笔记][21]》可以免费下载的书有 100 多页,通过简单的描述和例子,这本书涵盖了各种各样的主题。 + +#### 9、Tutorialspoint —— 门户网站 + +![][22] + +“[Tutorialspoint][24]” 是一个非常流行的学习各种编程语言的门户网站。我想说这对于初学者学习基础知识非常好。 + +也许这不太适合作为一个详细的资源——但是它应该是不错的免费资源。 + +#### 10、旧金山城市学院:在线笔记 —— 门户网站 + +![][25] + +也许这不是最好的免费资源 —— 但是如果你已经为学习 shell 脚本编程做好了探索每种资源的准备,为什么不看看旧金山城市学院的 “[在线笔记][26]” 呢? + +当我在网上随便搜索关于 shell 脚本编程的资源的时候,我偶然遇到到了这个资源。 + +同样需要注意的是,这个在线笔记可能会有点过时。但是,这应该还是一个值得探索的有趣资源。 + +#### 荣誉奖: Linux 手册 + +![][27] + +不要忘记,bash 手册也应该是一个相当不错的免费资源,可以用它来查看命令和使用方法。 + +尽管它不是专门为你掌握 shell 脚本编程而量身打造的,它依然是一个你可以免费使用的重要网络资源。你可以选择访问在线手册,或者直接打开终端然后输入以下命令: + +``` +man bash +``` + +### 总结 + +有很多很受欢迎的付费资源,比如这些[最好的 Linux 书籍][28]。从网络上的一些免费资源开始学习 shell 脚本编程还是很方便的。 + +除了我提到的这些,我敢肯定网上还有不计其数的资源可以帮助你学习 shell 脚本编程。 + +你喜欢换上面提到的资源吗?如果你知道我可能错过的非常棒的免费资源,记得在下面评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/shell-scripting-resources/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Bash_(Unix_shell) +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Learn-Shell-Scripting.png?ssl=1 +[3]: https://itsfoss.com/run-linux-commands-in-windows/ +[4]: https://itsfoss.com/online-linux-terminals/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/learnshell.png?ssl=1 +[6]: https://www.learnshell.org/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/shell-scripting-tutorial.png?ssl=1 +[8]: https://www.shellscript.sh/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/shell-scripting-udemy.png?ssl=1 +[10]: https://www.udemy.com +[11]: https://www.udemy.com/course/shell-scripting-i/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/bash-shell-scripting.png?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/the-bash-academy.png?ssl=1 +[14]: https://github.com/lhunath/guide.bash.academy +[15]: https://guide.bash.academy/ +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/learn-bash-scripting-linkedin.png?ssl=1 +[17]: https://www.linkedin.com/learning/learning-bash-scripting +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/advanced-bash-scripting-pdf.png?ssl=1 +[19]: http://tldp.org/LDP/abs/abs-guide.pdf +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Bash-Notes-for-Professional.jpg?ssl=1 +[21]: https://goalkicker.com/BashBook/ +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/tutorialspoint-shell.png?ssl=1 +[23]: https://en.wikipedia.org/wiki/Programming_language +[24]: https://www.tutorialspoint.com/unix/shell_scripting.htm +[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/scripting-notes-ccsf.png?ssl=1 +[26]: https://fog.ccsf.edu/~gboyd/cs160b/online/index.html +[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/bash-linux-man-page.png?ssl=1 +[28]: https://itsfoss.com/best-linux-books/ +[29]: https://www.udemy.com/course/complete-bash-shell-scripting/ \ No newline at end of file diff --git a/published/202007/20200628 How to crop images in GIMP -Quick Tip.md b/published/202007/20200628 How to crop images in GIMP -Quick Tip.md new file mode 100644 index 0000000000..df99b3db25 --- /dev/null +++ b/published/202007/20200628 How to crop images in GIMP -Quick Tip.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12427-1.html) +[#]: subject: (How to crop images in GIMP [Quick Tip]) +[#]: via: (https://itsfoss.com/crop-images-gimp/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +GIMP 教程:如何使用 GIMP 裁剪图像 +====== + +你可能想在 [GIMP][1] 中裁剪图像的原因有很多。例如,你可能希望删除无用的边框或信息来改善图像,或者你可能希望最终图像的焦点是在一个特定细节上。 + +在本教程中,我将演示如何在 GIMP 中快速裁剪图像而又不影响精度。让我们一起来看看吧。 + +### 如何在 GIMP 中裁剪图像 + +![][2] + +#### 方法 1 + +裁剪只是一种将图像修整成比原始图像更小区域的操作。裁剪图像的过程很简单。 + +你可以通过“工具”面板访问“裁剪工具”,如下所示: + +![Use Crop Tool for cropping images in GIMP][3] + +你还可以通过菜单访问裁剪工具:“工具 → 变形工具 → 裁剪Tools → Transform Tools → Crop”。 + +激活该工具后,你会注意到画布上的鼠标光标会发生变化,以表示正在使用“裁剪工具”。 + +现在,你可以在图像画布上的任意位置单击鼠标左键,并将鼠标拖到某个位置以创建裁剪边界。此时你不必担心精度,因为你可以在实际裁剪之前修改最终选区。 + +![Crop Selection][4] + +此时,将鼠标光标悬停在所选内容的四个角上会更改鼠标光标并高亮显示该区域。现在,你可以微调裁剪的选区。你可以单击并拖动任何边或角来移动部分选区。 + +选定完区域后,你只需按键盘上的回车键即可进行裁剪。 + +如果你想重新开始或者不裁剪,你可以按键盘上的 `Esc` 键。 + +#### 方法 2 + +裁剪图像的另一种方法是使用“矩形选择工具”进行选择:“工具 → 选择工具 → 选择矩形Tools → Selection Tools → Rectangle Select”。 + +![][5] + +然后,你可以使用与“裁剪工具”相同的方式高亮选区,并调整选区。选择好后,可以通过以下方式裁剪图像来适应选区:“图像 → 裁剪为选区Image → Crop to Selection”。 + +![][6] + +### 总结 + +对于 GIMP 用户而言,精确裁剪图像可以视为一项基本功能。你可以选择哪种方法更适合你的需求并探索其潜力。 + +如果你对过程有任何疑问,请在下面的评论中告诉我。如果你“渴望”更多 [GIMP 教程][7],请确保在你喜欢的社交媒体平台上订阅! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/crop-images-gimp/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-images-in-GIMP.png?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-tool.png?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-selection.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/select-1.gif?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/crop.gif?ssl=1 +[7]: https://itsfoss.com/tag/gimp-tips/ diff --git a/published/202007/20200628 Linux Mint 20 is Officially Available Now- The Performance and Visual Improvements Make it an Exciting New Release.md b/published/202007/20200628 Linux Mint 20 is Officially Available Now- The Performance and Visual Improvements Make it an Exciting New Release.md new file mode 100644 index 0000000000..2ad86e500c --- /dev/null +++ b/published/202007/20200628 Linux Mint 20 is Officially Available Now- The Performance and Visual Improvements Make it an Exciting New Release.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12376-1.html) +[#]: subject: (Linux Mint 20 is Officially Available Now! The Performance and Visual Improvements Make it an Exciting New Release) +[#]: via: (https://itsfoss.com/linux-mint-20-download/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Mint 20 正式发布了!你该升级吗? +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/03/083110avnb4rwi0rwzh56r.jpg) + +Linux Mint 20 “Ulyana” 终于发布了,可以下载了。 + +Linux Mint 19 基于 Ubuntu 18.04 LTS,而 [Mint 20][1] 则基于 [Ubuntu 20.04 LTS][2] —— 所以你会发现很多不同的地方、改进的地方,可能更棒了。 + +既然它来了,让我们来看看它的新功能,在哪里下载它,以及如何升级你的系统。 + +### Linux Mint 20:有什么新东西? + +我们制作了一段关于 Linux Mint 20 的初步视觉印象的视频,让大家更好地了解。 + +- [video](https://youtu.be/7knHfN-NUZk) + +说到 Linux Mint 20 的发布,有很多事情要谈。虽然我们已经介绍了 Linux Mint 20 的新的关键[功能][1],但我还是在这里提几点,让大家一目了然。 + + * Nemo 文件管理器在生成缩略图方面的性能提升 + * 一些重新设计的颜色主题 + * Linux Mint 20 将禁止 APT 使用 Snapd + * 一个新的图形用户界面工具,用于通过本地网络共享文件 + * 改进对多显示器的支持 + * 改进对笔记本电脑的混合图形支持 + * 不再有 32 位版本 + +除了这些变化之外,你还会注意到 Cinnamon 4.6 桌面更新后的一些视觉变化。 + +以下是 Linux Mint 20 Cinnamon 版的一些截图。 + +![Mint 20 Welcome Screen][4] + +![Mint 20 Color Themes][5] + +![Mint 20 Nemo File Manager][6] + +![Mint 20 Nemo File Manager Blue Color Theme][7] + +![Mint 20 Wallpapers][8] + +![Mint 20 Redesigned Gdebi Installer][9] + +![Mint 20 Warpinator Tool for Sharing Files on Local Network][10] + +![Mint 20 Terminal][11] + +### 升级到 Linux Mint 20:你需要知道什么? + +如果你已经在使用 Linux Mint,你可以选择升级到 Linux Mint 20。 + + * 如果你使用的是 Linux Mint 20 测试版,你可以升级到 Mint 20 稳定版。 + * 如果你正在使用 Linux Mint 19.3(这是 Mint 19 的最新迭代),你可以将系统升级到 Linux Mint 20,而不需要进行重新安装 + * Linux Mint 20 没有 32 位版本。如果你**使用 32 位的 Mint 19 系列,你将无法升级到 Mint 20** + * 如果你使用的是 Linux Mint 18 系列,你必须先通过 Mint 19 系列升级。在我看来,重新安装 Mint 20 会比较省时省事 + * 如果你使用的是 Linux Mint 17、16、15 或更低版本,你一定不要再使用它们了。这些版本已经不支持了 + +我们有一个详细的指南,展示了从 18.3 到 19 [升级 Linux Mint 版本][12]的步骤。我猜测 Mint 20 的步骤应该也是一样的。我们的团队会对 Mint 19.3 到 Mint 20 的升级做一些测试,并在适用的情况下更新这个指南。 + +在你继续升级之前,请确保备份你的数据和[使用 Timeshift 创建系统快照][13]。 + +### 下载Linux Mint 20 + +你可以简单地前往其官方下载页面,为自己抓取最新的稳定 ISO。你会发现官方支持的桌面环境的 ISO,即 Cinnamon、MATE 和 Xfce。 + +此外,还为那些网络连接缓慢或不稳定的用户提供了 Torrent链接。 + +- [下载 Linux Mint 20][14] + +如果你只是想在不更换主系统的情况下试一试,我建议先[在 VirtualBox 中安装 Linux Mint 20][15],看看这是不是你喜欢的东西。 + +你试过 Linux Mint 20 了吗?你对这个版本有什么看法?请在下面的评论区告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-mint-20-download/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12297-1.html +[2]: https://itsfoss.com/download-ubuntu-20-04/ +[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-welcome-screen.png?fit=800%2C397&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-color-themes.png?fit=800%2C396&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-nemo-file-manager.png?fit=800%2C397&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-nemo-file-manager-blue-color-theme.png?fit=800%2C450&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-wallpapers.png?fit=800%2C450&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-redesigned-gdebi-installer.png?fit=800%2C582&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-warpinator.png?fit=800%2C397&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-terminal.png?fit=800%2C540&ssl=1 +[12]: https://itsfoss.com/upgrade-linux-mint-version/ +[13]: https://itsfoss.com/backup-restore-linux-timeshift/ +[14]: https://linuxmint.com/download.php +[15]: https://itsfoss.com/install-linux-mint-in-virtualbox/ diff --git a/published/202007/20200628 entr- rerun your build when files change.md b/published/202007/20200628 entr- rerun your build when files change.md new file mode 100644 index 0000000000..6fd30b30d8 --- /dev/null +++ b/published/202007/20200628 entr- rerun your build when files change.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12403-1.html) +[#]: subject: (entr: rerun your build when files change) +[#]: via: (https://jvns.ca/blog/2020/06/28/entr/) +[#]: author: (Julia Evans https://jvns.ca/) + +entr:文件更改时重新运行构建 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/11/094223uct6386d9iwctmbh.jpg) + +这是一篇简短的文章。我是最近才发现 [entr][1] 的,我很惊奇从来没有人告诉过我?!因此,如果你和我一样,那么我告诉你它是什么。 + +[entr 的网站][1]上对它已经有很好的解释,也有很多示例。 + +总结在其头部:`entr` 是一个命令行工具,当每次更改一组指定文件中的任何一个时,都能运行一个任意命令。你在标准输入给它传递要监控的文件列表,如下所示: + +``` +git ls-files | entr bash my-build-script.sh +``` + +或者 + +``` +find . -name *.rs | entr cargo test +``` + +或者任何你希望的。 + +### 快速反馈很棒 + +就像世界上的每个程序员一样,我发现每次更改代码时都必须手动重新运行构建/测试非常烦人。 + +许多工具(例如 hugo 和 flask)都有一个内置的系统,可以在更改文件时自动重建,这很棒! + +但是通常我会自己编写一些自定义的构建过程(例如 `bash build.sh`),而 `entr` 让我有了一种神奇的构建经验,我只用一行 bash 就能得到即时反馈,知道我的改变是否修复了那个奇怪的 bug。万岁! + +### 重启服务器(entr -r) + +但是如果你正在运行服务器,并且每次都需要重新启动服务器怎么办?如果你传递 `-r`,那么 `entr` 会帮你的 + +``` +git ls-files | entr -r python my-server.py +``` + +### 清除屏幕(entr -c) + +另一个简洁的标志是 `-c`,它让你可以在重新运行命令之前清除屏幕,以免被前面构建的输出分散注意力。 + +### 与 git ls-files 一起使用 + +通常,我要跟踪的文件集和我在 git 中的文件列表大致相同,因此将 `git ls-files` 传递给 `entr` 是很自然的事情。 + +我现在有一个项目,有时候我刚创建的文件还没有在 git 里。那么如果你想包含未被跟踪的文件怎么办呢?这些 `git` 命令行参数就可以做到(我是从一个读者的邮件中得到的,谢谢你!): + +``` +git ls-files -cdmo --exclude-standard | entr your-build-script +``` + +有人给我发了邮件,说他们做了一个 `git-entr` 命令,可以执行: + +``` +git ls-files -cdmo --exclude-standard | entr -d "$@" +``` + +我觉得这真是一个很棒的主意。 + +### 每次添加新文件时重启:entr -d + +`git ls-files` 的另一个问题是有时候我添加一个新文件,当然它还没有在 git 中。`entr` 为此提供了一个很好的功能。如果你传递 `-d`,那么如果你在 `entr` 跟踪的任何目录中添加新文件,它就会退出。 + +我将它与一个 `while` 循环配合使用,它将重启 `entr` 来包括新文件,如下所示: + +``` +while true +do +{ git ls-files; git ls-files . --exclude-standard --others; } | entr -d your-build-scriot +done +``` + +### entr 在 Linux 上的工作方式:inotify + +在 Linux 中,`entr` 使用 `inotify`(用于跟踪文件更改这样的文件系统事件的系统)工作。如果用 `strace` 跟踪它,那么你会看到每个监控文件的 `inotify_add_watch` 系统调用,如下所示: + +``` +inotify_add_watch(3, "static/stylesheets/screen.css", IN_ATTRIB|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE_SELF|IN_MOVE_SELF) = 1152 +``` + +### 就这样了 + +我希望这可以帮助一些人了解 `entr`! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/06/28/entr/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: http://eradman.com/entrproject/ diff --git a/published/202007/20200630 Painless file extraction on Linux.md b/published/202007/20200630 Painless file extraction on Linux.md new file mode 100644 index 0000000000..4cd4d39c8c --- /dev/null +++ b/published/202007/20200630 Painless file extraction on Linux.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12410-1.html) +[#]: subject: (Painless file extraction on Linux) +[#]: via: (https://www.networkworld.com/article/3564265/painless-file-extraction-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux 上无痛文件提取 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/12/233401zickd110d2dl6u6f.jpg) + +从 Linux 系统的存档中提取文件没有拔牙那么痛苦,但有时看起来更复杂。在这篇文章中,我们将看看如何轻松地从 Linux 系统中可能遇到的几乎所有类型的存档中提取文件。 + +它们有很多格式,从 .gz 到 .tbz2,这些文件的命名方式都各有一些不同。当然,你可以记住所有从存档中提取文件的各种命令以及它们的选项,但是你也可以将所有经验保存到脚本中,而不再担心细节。 + +在本文中,我们将一系列提取命令组合成一个脚本,它会调用适当的命令根据文档名提取文件的内容。该脚本首先以一些命令来验证是否已经提供了一个文件名作为参数,或要求运行脚本的人提供文件名。 + +``` +#!/bin/bash + +if [ $# -eq 0 ]; then + echo -n "filename> " + read filename +else + filename=$1 +fi + +if [ ! -f "$filename" ]; then + echo "No such file: $filename" + exit $? +fi +``` + +了解了么?如果未提供任何参数,脚本将提示输入文件名,如果存在则使用它。然后,它验证文件是否实际存在。如果不是,那么脚本退出。 + +下一步是使用 bash 的 `case` 语句根据存档文件的名称调用适当的提取命令。对于其中某些文件类型(例如 .bz2),也可以使用除 `tar` 之外的其它命令,但是对于每种文件命名约定,我们仅包含一个提取命令。因此,这是带有各种存档文件名的 `case` 语句: + +``` + case $filename in + *.tar) tar xf $filename;; + *.tar.bz2) tar xjf $filename;; + *.tbz) tar xjf $filename;; + *.tbz2) tar xjf $filename;; + *.tgz) tar xzf $filename;; + *.tar.gz) tar xzf $filename;; + *.gz) gunzip $filename;; + *.bz2) bunzip2 $filename;; + *.zip) unzip $filename;; + *.Z) uncompress $filename;; + *) echo "No extract option for $filename" +esac +``` + +如果提供给脚本的文件扩展名与脚本已知的扩展名都不匹配,那么会发出 “No extract option for $filename” 的消息。如果缺少你使用的任何存档类型,只需将它们与所需的提取命令一起添加即可。 + +将 bash 头添加到脚本顶部,使其可执行,然后就可以开始了。 + +``` +#!/bin/bash + +if [ $# -eq 0 ]; then + echo -n "filename> " + read filename +else + filename=$1 +fi + +if [ ! -f "$filename" ]; then + echo "No such file: $filename" + exit $? +fi + +case $filename in + *.tar) tar xf $filename;; + *.tar.bz2) tar xjf $filename;; + *.tbz) tar xjf $filename;; + *.tbz2) tar xjf $filename;; + *.tgz) tar xzf $filename;; + *.tar.gz) tar xzf $filename;; + *.gz) gunzip $filename;; + *.bz2) bunzip2 $filename;; + *.zip) unzip $filename;; + *.Z) uncompress $filename;; + *.rar) rar x $filename ;; + *) +``` + +如果你希望脚本在提取文件时显示内容,请将详细选项(`-v`)添加到每个命令参数字符串中: + +``` +#!/bin/bash + +if [ $# -eq 0 ]; then + echo -n "filename> " + read filename +else + filename=$1 +fi + +if [ ! -f "$filename" ]; then + echo "No such file: $filename" + exit $? +fi + +case $filename in + *.tar) tar xvf $filename;; + *.tar.bz2) tar xvjf $filename;; + *.tbz) tar xvjf $filename;; + *.tbz2) tar xvjf $filename;; + *.tgz) tar xvzf $filename;; + *.tar.gz) tar xvzf $filename;; + *.gz) gunzip -v $filename;; + *.bz2) bunzip2 -v $filename;; + *.zip) unzip -v $filename;; + *.Z) uncompress -v $filename;; + *) echo "No extract option for $filename" +esac +``` + +### 总结 + +虽然可以为每个可能用到的提取命令创建别名,但是让脚本为遇到的每种文件类型提供命令要比自己停下来编写每个命令和选项容易。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3564265/painless-file-extraction-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200630 Read and write data from anywhere with redirection in the Linux terminal.md b/published/202007/20200630 Read and write data from anywhere with redirection in the Linux terminal.md new file mode 100644 index 0000000000..b55f7d8875 --- /dev/null +++ b/published/202007/20200630 Read and write data from anywhere with redirection in the Linux terminal.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12385-1.html) +[#]: subject: (Read and write data from anywhere with redirection in the Linux terminal) +[#]: via: (https://opensource.com/article/20/6/redirection-bash) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +通过重定向在 Linux 终端任意读写数据 +====== + +> 重定向是一种十分高效的数据流动方式,它能帮你减少很多鼠标和键盘上的操作。 + +![](https://img.linux.net.cn/data/attachment/album/202007/06/005419nh6mzxkmmmbsslbb.jpg) + +对于任何编程或脚本语言,输入与输出重定向都是很自然的功能。严格来说,当你使用电脑时,数据自然而然地在发生着重定向。从 `stdin`(标准输入,通常是你的键盘或者鼠标)读取输入,输入则发往 `stdout`(标准输出,一段文本或者数据流),最后错误信息送至 `stderr`。如果你使用 [Bash][2] 或 [Zsh][3] 之类的 shell,那么理解这些数据流能够让你更好地控制信息流向。 + +标准输入、标准输出以及标准错误输出都存在于 Linux 文件系统中。你可以在 `/dev` 查看: + +``` +$ ls /dev/std* +/dev/stderr@  /dev/stdin@  /dev/stdout@ +``` + +你可能没法直接使用它们,但将它们想象成你能传递数据的元位置,会很有帮助。 + +重定向的基础很简单:用一些 `>` 符号重定向输出,然后用另外一些 `<` 符号重定向输入。 + +### 重定向输出 + +将 [ls][4] 命令的输出写入一个文件: + +``` +$ ls > list.txt +``` + +你没法像平常那样看到 `ls` 的输出,因为它们并没有被发送到屏幕,而是被写入 `list.txt` 文件了,这个功能用处太多了,事实上,你甚至可以用它来将文件内容拷贝到另一个文件。不一定是文本文件,你也可以用将重定向用于二进制数据: + +``` +$ cat image.png > picture.png +``` + +(你可能会好奇为什么要这样做,有时候对于 [文件权限信息][5] 而间接有用。) + +### 重定向输入 + +你也能将输入重定向“到”一个命令。可以说,它没有重定向输出那么有用,因为许多命令已经被硬编码,只从你的参数中接收输入。但是,如果某个命令需要一系列参数,而且你把这些参数写在文件里,想要快速“复制粘贴”到终端的时候(除非你并不想复制粘贴),它就帮得上忙了。 + +``` +$ sudo dnf install $(嵌入文档here-document(简写成 here-doc)和嵌入字符串here-string 技巧。这种输入方法将一整块文本重定向至标准输入流,直到碰见一个特殊的文件结束标记(许多人习惯用 `EOF`,实际上你可以使用任何字符串,只要它是唯一的)。试着把这些(在第二个 `EOF` 标记之前)敲进你的终端: + +``` +$ echo << EOF +> foo +> bar +> baz +> EOF +``` + +输出结果: + +``` +foo +bar +baz +``` + +使用 [Bash][2] 编写脚本的人常常用这个技巧,将数行文本一次性写入文件或者打印到屏幕上。只要你别忘了末尾的文件结束标记,这会是一个帮你避免大量繁琐 `echo` 或 `printf` 语句的好办法。 + +嵌入字符串类似于嵌入文档,但是它只含有一个字符串(或者用引号包裹的几个字符串,同样会被当成一个字符串) + +``` +$ cat <<< "foo bar baz" +foo bar baz +``` + +### 重定向错误信息 + +错误信息流叫做 `stderr`,通过 `2>` 实现这个目的。下面这个命令把错误信息定向到 `output.log` 文件: + +``` +$ ls /nope 2> output.log +``` + +### 将数据送往 /dev/null + +既然标准输入、标准输出和错误输出都有自己的位置,那么“空空如也”也应该在 Linux 文件系统占有一席之地。没错,它叫做 `null`,位于 `/dev`,频繁使用的人懒得说 “slash dev slash null”,于是索性叫它 “devnull”。 + +通过重定向,你可以把数据发送到 `/dev/null`。比如,`find` 命令常常会输出很多具体信息,而且在搜索文件遇到权限冲突时,会事无巨细地报告: + +``` +$ find ~ -type f +/home/seth/actual.file +find: `/home/seth/foggy': Permission denied +find: `/home/seth/groggy': Permission denied +find: `/home/seth/soggy': Permission denied +/home/seth/zzz.file +``` + +`find` 命令把那些当作错误,所以你可以只把错误信息重定向至 `/dev/null`: + + +``` +$ find ~ -type f 2>; /dev/null +/home/seth/actual.file +/home/seth/zzz.file +``` + +### 使用重定向 + +在 Bash 中,重定向是转移数据的有效方法。你可能不会频繁使用重定向,但是学会如何使用它,能帮你在打开文件、复制粘贴数据这类需要移动鼠标、大量按键操作上,节省很多不必要的时间。不要做如此浪费时间的事情。使用重定向,好好享受生活。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/redirection-bash + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/resources/what-bash +[3]: https://opensource.com/article/19/9/getting-started-zsh +[4]: https://opensource.com/article/19/7/master-ls-command +[5]: https://opensource.com/article/19/8/linux-permissions-101 diff --git a/published/202007/20200701 13 Things To Do After Installing Linux Mint 20.md b/published/202007/20200701 13 Things To Do After Installing Linux Mint 20.md new file mode 100644 index 0000000000..eda69868ad --- /dev/null +++ b/published/202007/20200701 13 Things To Do After Installing Linux Mint 20.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12404-1.html) +[#]: subject: (13 Things To Do After Installing Linux Mint 20) +[#]: via: (https://itsfoss.com/things-to-do-after-installing-linux-mint-20/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +安装 Linux Mint 20 后需要做的 13 件事 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/11/113643ich99s7y7kw7ckw9.jpg) + +Linux Mint 毫无疑问是 [最佳 Linux 发行版][1] 之一,特别是考虑到 [Linux Mint 20][2] 的功能,我确信你也会同意这一说法。 + +假设你错过了我们的新闻报道,[Linux Mint 20 终于可以下载了][3]。 + +当然,如果你使用 Linux Mint 有一段时间了,你可能知道最好做一些什么。但是,对于新用户来说,在安装 Linux Mint 20 后,你需要做一些事,让你的体验更比以往任何时候都好。 + +### 在安装 Linux Mint 20 后建议做的事 + +在这篇文章中,我将列出其中一些要做的事来帮助你改善 Linux Mint 20 的用户体验。 + +#### 1、执行一次系统更新 + +![][4] + +安装后首先应该马上检查的是 —— 使用更新管理器进行系统更新,如上图所示。 + +为什么?因为你需要构建可用软件的本地缓存。更新所有软件包的更新也是一个好主意。 + +如果你喜欢使用终端,只需输入下面的命令来执行系统更新: + +``` +sudo apt update && sudo apt upgrade -y +``` + +#### 2、使用 Timeshift 来创建系统快照 + +![][5] + +如果你想在意外更改或错误更新后快速地恢复系统状态,有一个系统快照总是很有用的。 + +因此,如果你希望能够随时备份你的系统状态,那么使用 Timeshift 配置和创建系统快照是超级重要的。 + +如果你还不知道如何使用它的话,你可以遵循我们 [使用 Timeshift][6] 的详细指南。 + +#### 3、安装有用的软件 + +尽管在 Linux Mint 20 中已经安装有一些有用的预安装应用程序,你可能需要安装一些没有随之一起出炉的必不可少的应用程序。 + +你可以简单地使用软件包管理器或 synaptic 软件包管理器来查找和安装所需要的软件。 + +对于初学者来说,如果你想探索各种各样的工具,那么你可以遵循我们的 [必不可少的 Linux 应用程序][7] 的列表。 + +也参见: + +- [75 个最常用的 Linux 应用程序(2018 年)](https://linux.cn/article-10099-1.html) +- 100 个最佳 Ubuntu 应用([上](https://linux.cn/article-11044-1.html)、[中](https://linux.cn/article-11048-1.html)、[下](https://linux.cn/article-11057-1.html)) + +这里是一个我最喜欢的软件包列表,我希望你也来尝试一下: + + * [VLC 多媒体播放器][8] 用于视频播放 + * [FreeFileSync][9] 用来同步文件 + * [Flameshot][10] 用于截图 + * [Stacer][11] 用来优化和监控系统 + * [ActivityWatch][12] 用来跟踪你的屏幕时间并保持高效唤醒 + +#### 4、自定义主题和图标 + +![][13] + +当然,这在技术上不是必不可少的事,除非你想更改 Linux Mint 20 的外观和感觉。 + +但是,[在 Linux Mint 中更改主题和图标是非常容易的][14] ,而不需要安装任何额外的东西。 + +你会在欢迎屏幕中获得优化外观的选项。或者,你只需要进入 “主题”,并开始自定义主题。 + +![][15] + +为此,你可以搜索它或在系统设置中如上图所示找到它。 + +根据你正在使用的桌面环境,你也可以看看可用的 [最佳图标主题][16]。 + +#### 5、启用 Redshift 来保护你的眼睛 + +![][17] + +你可以在 Linux Mint 上搜索 “[Redshift][18]”,并启用它以在晚上保护你的眼睛。如你在上面的截图所见,它将根据时间自动地调整屏幕的色温。 + +你可能想启用自动启动选项,以便它在你重新启动计算机时自动启动。它可能与 [Ubuntu 20.04 LTS][19] 的夜光功能不太一样,但是如果你不需要自定义时间表或微调色温的能力,那么它就足够好了。 + +#### 6、启用 snap(如果需要的话) + +尽管 Ubuntu 比前所未有的更倾向于推崇使用 Snap,但是 Linux Mint 团队却反对使用它。因此,它禁止 APT 使用 snapd。 + +因此,你将无法获得 snap 开箱即用的支持。然而,你迟早会意识到一些软件包只以 Snap 的格式打包。在这种情况下,你将不得不在 Mint 上启用对 snap 的支持。 + +``` +sudo apt install snapd +``` + +在你完成后,你可以遵循我们的指南来了解更多关于 [在 Linux 上安装和使用 snap][20] 的信息。 + +#### 7、学习使用 Flatpak + +默认情况下,Linux Mint 带有对 Flatpak 的支持。所以,不管你是讨厌使用 snap 或只是更喜欢使用 Flatpak,在系统中保留它是个好主意。 + +现在,你只需要遵循我们关于 [在 Linux 上使用 Flatpak][21] 的指南来开始吧! + +#### 8、清理或优化你的系统 + +优化或清理系统总是好的,以避免不必要的垃圾文件占用存储空间。 + +你可以通过在终端机上输入以下内容,快速删除系统中不需要的软件包: + +``` +sudo apt autoremove +``` + +除此之外,你也可以遵循我们 [在 Linux Mint 上释放空间的一些建议][22] 。 + +#### 9、使用 Warpinator 通过网络发送/接收文件 + +Warpinator 是 Linux Mint 20 的一个新功能,可以让你在连接到网络的多台电脑上共享文件。这里是它看起来的样子: + +![][23] + +你只需要在菜单中搜索它就可以开始了! + +#### 10、使用驱动程序管理器 + +![驱动器管理器][24] + +如果你正在使用需要驱动程序的 Wi-Fi 设备、NVIDIA 显卡或 AMD 显卡,以及其它设备(如果适用的话)时,驱动程序管理器是一个重要的部分。 + +你只需要找到驱动程序管理器并启用它。它应该可以检测到正在使用的任何专有驱动程序,或者你也可以使用驱动程序管理器来利用 DVD 来安装驱动程序。 + +#### 11、设置防火墙 + +![][25] + +在大多数情况下,你可能已经保护了你的家庭网络。但是,如果你想在 Linux Mint 上有一些特殊的防火墙设置,你可以通过在菜单中搜索 “Firewall” 来实现。 + +正如你在上述截图中所看到的,你可以为家庭、企业和公共设置不同的配置文件。你只需要添加规则,并定义什么是允许访问互联网的,什么是不允许的。 + +你可以阅读我们关于 [使用 UFW 配置防火墙][26] 的详细指南。 + +#### 12、学习管理启动应用程序 + +如果你是一个有经验的用户,你可能已经知道这一点了。但是,新用户经常忘记管理他们的启动应用程序,最终影响了系统启动时间。 + +你只需要从菜单中搜索 “Startup Applications” ,你可以启动它来查找像这样的东西: + +![][27] + +你可以简单地切换你想要禁用的那些启动应用程序,添加一个延迟计时器,或从启动应用程序的列表中完全地移除它。 + +#### 13、安装必不可少的游戏应用程序 + +当然,如果你对游戏感兴趣,你可能想去阅读我们关于 [在 Linux 上的游戏][28] 的文章来探索所有的选择。 + +但是,对于初学者来说,你可以尝试安装 [GameHub][29]、[Steam][30] 和 [Lutris][31] 来玩一些游戏。 + +### 总结 + +就是这样,各位!在大多数情况下,如果你在安装 Linux Mint 20 后按照上面的要点进行操作,使其发挥出最好的效果,应该就可以了。 + +我确信你还能够做更多的事。我想知道你喜欢在安装 Linux Mint 20 后马上做了什么。在下面的评论中告诉我你的想法吧! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/things-to-do-after-installing-linux-mint-20/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-distributions/ +[2]: https://linux.cn/article-12297-1.html +[3]: https://linux.cn/article-12376-1.html +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-system-update.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/snapshot-linux-mint-timeshift.jpeg?ssl=1 +[6]: https://linux.cn/article-11619-1.html +[7]: https://linux.cn/article-10165-1.html +[8]: https://www.videolan.org/vlc/ +[9]: https://itsfoss.com/freefilesync/ +[10]: https://itsfoss.com/flameshot/ +[11]: https://itsfoss.com/optimize-ubuntu-stacer/ +[12]: https://itsfoss.com/activitywatch/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-theme.png?ssl=1 +[14]: https://itsfoss.com/install-icon-linux-mint/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-system-settings.png?ssl=1 +[16]: https://itsfoss.com/best-icon-themes-ubuntu-16-04/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-redshift-1.png?ssl=1 +[18]: https://itsfoss.com/install-redshift-linux-mint/ +[19]: https://itsfoss.com/ubuntu-20-04-release-features/ +[20]: https://itsfoss.com/install-snap-linux/ +[21]: https://itsfoss.com/flatpak-guide/ +[22]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-warpinator-1.png?ssl=1 +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2013/12/Additional-Driver-Linux-Mint-16.png?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-firewall.png?ssl=1 +[26]: https://itsfoss.com/set-up-firewall-gufw/ +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-startup-applications.png?ssl=1 +[28]: https://itsfoss.com/linux-gaming-guide/ +[29]: https://itsfoss.com/gamehub/ +[30]: https://store.steampowered.com +[31]: https://lutris.net diff --git a/published/202007/20200701 Back up your phone-s storage with this Linux utility.md b/published/202007/20200701 Back up your phone-s storage with this Linux utility.md new file mode 100644 index 0000000000..c7c9c67789 --- /dev/null +++ b/published/202007/20200701 Back up your phone-s storage with this Linux utility.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: (summer2233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12415-1.html) +[#]: subject: (Back up your phone's storage with this Linux utility) +[#]: via: (https://opensource.com/article/20/7/gphoto2-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Linux 实用程序 gPhoto2 备份手机存储 +====== + +> 尽情地拍照吧,gphoto2 能够方便、快速地将照片从你的设备传输到 Linux 计算机上。 + +![](https://img.linux.net.cn/data/attachment/album/202007/14/170729pzljppapojy44ro4.jpg) + +移动设备的最大缺点之一就是其将数据从设备传输到计算机很困难。移动设备在这一缺点上有着悠久的历史。早期的移动设备,如 Pilot 和掌上电脑 PDA 设备,需要使用特殊的同步软件来传输数据(你必须小心翼翼地做这件事,因为你的设备可能会因为电池耗尽而导致数据永久丢失);旧版 iPod 只提供特定平台的界面。现代移动设备默认将你的数据发送到在线帐户,以便你可以在计算机上再次下载。 + +好消息——如果你正在运行 Linux,你可以使用 `gphoto2` 命令与移动设备进行连接。`gphoto2` 最初是作为一种与数码相机通信的方式而开发的,那时的数码相机只有传统的相机功能,现在的 `gphoto2` 可以和许多不同种类的移动设备通讯。别让这个名字骗了你,它可以处理所有类型的文件,而不仅仅是照片。更棒的是,它可以编写脚本、很灵活、并且比大多数 GUI 界面功能强大得多。 + +如果你曾经为在计算机和移动设备之间同步数据而苦恼,请了解一下 `gphoto2`。 + +### 安装 gPhoto2 + +很可能你的 Linux 系统已经安装了 libgphoto2,因为它是与移动设备连接的一个关键库,但你可能还需要安装命令 `gphoto2`,该命令可能在你的存储库中。 + +在 Fedora 或 RHEL 上: + +``` +$ sudo dnf install gphoto2 +``` + +在 Debian 或 Ubuntu 上: + +``` +$ sudo apt install gphoto2 +``` + +### 验证兼容性 + +若要确认你的移动设备是否受支持,请使用 `--list-cameras`,通过管道传输到 `less`: + +``` +$ gPhoto2 --list-cameras | less +``` + +或者你可以通过管道把它传送到 `grep` 来搜索一个词。例如,如果你有三星 Galaxy,则使用 `grep`,并通过选项 `-i` 关闭区分大小写: + +``` +$ gphoto2 --list-cameras | grep -i galaxy +  "Samsung Galaxy models (MTP)" +  "Samsung Galaxy models (MTP+ADB)" +  "Samsung Galaxy models Kies mode" +``` + +这证实了三星 Galaxy 设备支持通过 MTP 连接和通过 ADB 连接 MTP。 + +如果你没有在列表中找到自己的移动设备,你仍然可以尝试使用 `gphoto2`,可能你的设备在列表中使用了不同的称呼。 + +### 查找移动设备 + +要使用 gPhoto2,首先必须将移动设备插入计算机,设置为 MTP 模式,并且授予计算机与它交互的权限。这通常需要在你的移动设备上操作,往往是在屏幕上按下一个按钮,以允许其文件系统被刚刚连接的计算机访问。 + +![Screenshot of allow access message][2] + +如果你不授权电脑访问移动设备,那么 gPhoto2 可以检测到你的移动设备,但它不能与之交互。 + +要确保计算机检测到你连接的移动设备,请使用 `--auto-detect` 选项: + +``` +$ gphoto2 --auto-detect +Model                       Port +--------------------------------------- +Samsung Galaxy models (MTP) usb:002,010 +``` + +如果你的移动设备没有被检测到,请先检查数据线,然后检查你的设备是否配置为通过 MTP、ADB 或其它 gPhoto2 支持的协议连接,如 `--list-cameras` 所示。 + +### 查询你的设备支持的特性 + +对于现代设备,通常有过多的潜在功能,但并非所有移动设备都支持这些功能。你可以用 `--abilities` 选项来确定自己的移动设备支持哪些功能。我觉得结果看起来直观。 + +``` +$ gphoto2 --abilities +Abilities for camera            : Samsung Galaxy models (MTP) +Serial port support             : no +USB support                     : yes +Capture choices                 : Capture not supported by driver +Configuration support           : no +Delete selected files on camera : yes +Delete all files on camera      : no +File preview (thumbnail) support: no +File upload support             : yes +``` + +如果只连接一个设备,那么不需要指定查询的设备。但是,如果连接了多个 gPhoto2 可以与之交互的设备,则可以通过端口、相机型号或 usbid 指定设备。 + +### 与你的移动设备交互 + +如果你的设备支持拍摄功能,则可以从计算机调用你的摄像头来获取媒体。例如,要拍摄照片: + +``` +$ gphoto2 --capture-image +``` + +要拍摄照片并立即将其传输到连接的计算机: + +``` +$ gphoto2 --capture-image-and-download +``` + +你也可以录制视频和声音。如果连接了多个拍摄设备,可以按端口、相机型号或 usbid 指定要使用的设备: + +``` +$ gphoto2 --camera "Samsung Galaxy models (MTP)" \ +--capture-image-and-download +``` + +### 文件和文件夹 + +要想更加智能地管理移动设备上的文件,你需要了解 gPhoto2 连接的文件系统的结构。 + +你可以使用 `--get-folders` 选项查看可用文件夹: + +``` +$ gphoto2 --list-folders +There are 2 folders in folder '/'.                                             + - store_00010001 + - store_00020002 +There are 0 folders in folder '/store_00010001'. +There are 0 folders in folder '/store_00020002'. +``` + +每个文件夹代表设备上的一个存储单元。在本例中,`store_00010001` 是内部存储器,`store_00020002` 是 SD 卡,这可能与你的设备的结构不同。 + +### 获取文件 + +现在你知道了设备的文件夹布局,就可以从设备获取照片了。你可以使用许多不同的选项,具体取决于你想从设备中获取什么。 + +如果你知道绝对路径,则可以获取指定的文件: + +``` +$ gphoto2 --get-file IMG_0001.jpg --folder /store_00010001/myphotos +``` + +你可以同时获得所有的文件: + +``` +$ gphoto2 --get-all-files --folder /store_00010001/myfiles +``` + +你可以只获取音频文件: + +``` +gphoto2 --get-all-audio-data --folder /store_00010001/mysounds +``` + +gPhoto2 还有其他的选择,其中大多数取决于你连接的设备和使用协议是否支持。 + +### 上传文件 + +现在你知道了潜在的目标文件夹,就可以将文件从计算机上传到你的设备。例如,假设有一个名为 `example.epub` 的文件在当前目录中,你可以使用 `--upload-file` 选项和 `--folder` 选项将文件发送到设备并指定要上传到的目录: + +``` +$ gphoto2 --upload file example.epub \ +--folder store_00010001 +``` + +如果你希望将多个文件上传到同一个位置,你可以在设备上创建一个目录: + + +``` +$ gphoto2 --mkdir books \ +--folder store_00010001 +$ gphoto2 --upload-file *.epub \ +--folder store_00010001/books +``` + +### 列出文件 + +若要查看设备上的文件,请使用 `--list-files` 选项: + +``` +$ gphoto2 --list-files --folder /store_00010001 +There is 1 file in folder '/store_00010001' +#1     example.epub 17713 KB application/x-unknown +$ gphoto2 --list-files --folder /store_00010001/books +There is 1 file in folder '/store_00010001' +#1    example0.epub 17713 KB application/x-unknown +#2    example1.epub 12264 KB application/x-unknown +[...] +``` + +### 探索你的使用方式 + +gPhoto2 的大部分功能取决于你的设备,因此不同用户的体验可能不尽相同。在 `gphoto2 --help` 中列出了许多操作供你探索。使用gPhoto2,再也不用费劲把文件从你的设备传输到电脑上了! + +这些开源图片库能够帮助你组织文件,并让的图片看起来很棒。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/gphoto2-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[summer2233](https://github.com/summer2233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone) +[2]: https://opensource.com/sites/default/files/uploads/gphoto2-mtp-allow.jpg (Screenshot of allow access message) diff --git a/published/202007/20200701 Customizing Bash.md b/published/202007/20200701 Customizing Bash.md new file mode 100755 index 0000000000..547ae50180 --- /dev/null +++ b/published/202007/20200701 Customizing Bash.md @@ -0,0 +1,277 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12429-1.html) +[#]: subject: (Customizing Bash) +[#]: via: (https://fedoramagazine.org/customizing-bash/) +[#]: author: (Stephen Snow https://fedoramagazine.org/author/jakfrost/) + +深入了解定制 Bash +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/19/110018bl392bj3g3g41a23.jpg) + +操作系统的最外层 —— 也就是跟你直接打交道的 —— 叫做 [shell][2](“外壳”)。Fedora 预装了好几种不同的 shell。shell 可以是图形界面,或者字符界面。在文档中,你常常能见到两个母缩写词 GUI (图形用户界面Graphical User Interface)跟 CLI(命令行界面Command-Line Interface),它们用来区分图形和基于字符的 shell/界面。[GNOME][5] 和 [Bash][6] 分别是 Fedora 默认的图形和命令行界面,不过你也可以使用其它 [GUI][3] 或者 [CLI][4] shell。 + +接下来在这篇文章中,我们会讨论一些比较推荐的 Bash 字符界面的点文件配置。 + +### Bash 概览 + +Bash 参考手册中写道: + +> 根本上来说,shell 只是一个能执行命令的宏处理器。宏处理器这个词意味着通过扩展文本跟符号,从而构成更复杂的表达式。 +> +> **Bash 参考手册** +> **第五版,Bash 5.0** +> **2019 年 5 月** + +除了能使用其它程序之外,Bash shell 还含有一些内置命令和关键字。Bash 内置功能很强大,甚至能够作为一门 [高级语言][7] 独当一面。Bash 的几个关键字和操作符类似于 [C 语言][8]。 + +Bash 能够以交互式或非交互式模式启动。Bash 的交互模式是一个很多人都熟悉的典型的终端/命令行界面。[GNOME 终端][9] 默认以交互模式打开 Bash。Bash 在非交互模式下运行的例子是,当命令和数据从文件或 shell 脚本通过 [管道][10] 传送到 Bash 时。其它 Bash 可以运行的模式包括:登录login非登录non-login远程remote、POSIX、Unix sh、受限restricted,以及使用与用户不同的 UID/GID 模式。各种模式是可以相互组合的。比如,交互式 + 受限 + POSIX 或者非交互式 + 非登录 + 远程。不同的启动模式,决定着 Bash 所读取的启动文件。理解这些操作模式,有助于帮助我们修改启动文件。 + +根据 Bash 参考手册,它会: + +> 1. 从文件中...、从作为 `-c` 调用选项传入参数的字符...,或者从用户的终端中读取输入。 +> 2. 将输入分解成单词和操作符,遵循 [它的] 引用规则。...这些标记使用元字符隔开。这一步执行别名展开。 +> 3. 将标记解析成简单与复合命令。 +> 4. 执行各种 shell 展开...,将展开之后的标记分解成文件名...以及命令和参数的列表。 +> 5. 执行必要的重定向...并从参数列表中去除重定向操作符及其操作数。 +> 6. 执行命令。 +> 7. 必要时等待命令完成,并收集退出状态。 +> +> **Bash 参考文档** +> **第五版,Bash 版本 5.0** +> **2019 年 5 月** + +当用户开启终端模拟器进入命令行环境时,便启动了一次交互式 shell 会话。GNOME 终端默认以非登录模式为用户打开 Shell。你可以在 “编辑 → 首选项 → 配置文件 → 命令Edit → Preferences → Profilles → Command” 中配置 GNOME 终端以何种模式(登录与非登录式)启动。也可以在 Bash 启动时通过向其传递 `-login` 标志来要求进入登录模式。要注意一点,Bash 的登录模式与非交互模式并不互斥。可以让 Bash 同时以登录模式和非交互模式运行。 + +### 启动 Bash + +除非传入 `-noprofile` 选项,否则登录模式的 Bash shell 会默认读取并执行某些初始化文件中命令。如果 `/etc/profile` 存在,它会是第一个被执行的文件,紧接着是按 `~/.bash_profile`、`~/.bash_login` 或 `~/.profile` 顺序找到的第一个文件。当用户退出登录模式的 shell 时,或者有脚本在非交互式登录模式的 shell 中调用了内置 `exit` 命令,Bash 会读取并执行 `~/.bash_logout` 中的命令,如果 `/etc/bash_logout` 存在的话,会紧接着执行它。通常来说,`/etc/profile` 会援引source `/etc/bashrc` 文件,读取并执行其中的命令,然后查找并读取执行 `/etc/profile.d` 目录中以 `.sh` 结尾的文件。同样的,`~/.bash_profile` 通常也会援引source `~/.bashrc` 文件。`/etc/bashrc` 和 `~/.bashrc` 都会进行检查,避免重复援引source。 + +(LCTT 译注:在 Bash 中,脚本会通过 `source` 或 `.` 命令来将另外一个脚本引入其中,这个行为称之为 “source”、“sourcing”,但是该行为一直没有公认且常用的翻译方法。经过多番斟酌,我认为可以译做“援引”,理由如下:1、“援引”具有“引用、引入”的意思,符合该行为;2、“援”这个词的发音和“source” 常见的汉语意思“源”同音,便于记忆。以上是我们的愚见,供大家参考讨论。—— 老王,2020/7/19) + +一个交互式的 shell,如果不是登录 shell,那么当它第一次被调用的时候,会执行 `~/.bashrc` 文件。这是用户在 Fedora 上打开终端时通常会进入的 shell 类型。当 Bash 以非交互模式启动 —— 就像运行脚本时那样 —— 它会寻找 `BASH_ENV` 环境变量。如果找到了,就会展开它的值作为文件名,接着读取并执行该文件。效果跟执行以下命令相同: + +``` +if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi +``` + +值得注意的是,不会使用 `PATH` 环境变量的值来搜索该文件名(LCTT 译注:意即不会检索搜索路径)。 + +### 重要的用户点文件 + +Bash 最广为人知的用户点文件是 `~/.bashrc`。通过编辑该文件,可以设置大多数个性化选项。由于我们常常需要设置一些选项,会改动上面提及甚至没有提及的文件,所以大部分自定义选项会成为一个麻烦事。Bash 环境具有很高的可定制性,正是为了适应不同用户的不同需求。 + +![][11] + +当登录 shell 正常退出时,如果 `~/.bash_logout` 和 `/etc/bash_logout` 存在,它们会被调用。下一幅图展示了 Bash 作为交互式 shell 启动时的过程。例如,当用户从桌面环境打开终端模拟器时,会按照以下顺序进行。 + +![][12] + +我们已经知道,在不同的启动模式下,Bash 会执行不同的命令,所以很明显,只有几种最需要关注的典型启动模式。分别是非交互、交互式登录 shell,和非交互式、交互式非登录 shell。如果想定义某些全局环境,那么需要将一个具有唯一名称、以 `.sh` 为后缀的文件(例如 `custom.sh`)放置在 `/etc/profile.d` 目录。 + +对于非交互式非登录启动方式,需要特别注意。在这种模式下,Bash 会检查 `BASH_ENV` 变量。如果定义了该变量,Bash 会援引它所指向的文件。另外,处理 `BASH_ENV` 时并不会使用 `PATH` 变量所存储的值(LCTT 译注:意即不会检索搜索路径),所以它必须包含执行文件的绝对路径。比如说,如果有人希望非交互式执行脚本时,shell 能读取 `~/.bashrc` 文件中的设置,那么他可以把类似下面这样的内容放在一个名为 `/etc/profile.d/custom.sh` 的文件中... + +``` +# custom.sh +. +. +. +# 如果使用 Fedora Workstation +BASH_ENV="/home/username/.bashrc" +. +. +. +# 如果使用 Fedora Silverblue Workstation +BASH_ENV="/var/home/username/.bashrc" + +export BASH_ENV +``` + +上面这份脚本会让每个 shell 脚本在运行之前先执行该用户的 `~/.bashrc`。 + +用户一般都会自定义他们的系统环境,以便契合他们自己的工作习惯与偏好。举例来说,用户可以通过别名来实现这种程度的自定义。拥有相同起始参数、需要频繁使用的命令是制作别名的最佳选择。以下展示了一些来自 `~/.bashrc` 文件中定义的别名。 + +``` +# .bashrc +# 执行全局文件 +if [ -f /etc/bashrc ]; + then . /etc/bashrc +fi +. +. +. +# 用户别名和函数 +alias ls='ls -hF --color=auto' +alias la='ls -ahF --color=auto' + +# 让 dir 命令用起来像在 Windows 那样 +alias dir='ls --color=auto --format=long' + +# 用颜色高亮 grep 结果 +alias grep='grep --color=auto' +``` + +在系统中,别名是一种自定义各种命令的方法。它能减少击键次数,而且让命令用起来更方便。针对用户级别的别名通常存放在该用户的 `~/.bashrc` 文件中。 + +如果你发现自己经常要去历史中查找曾经执行过的某条命令,那可能需要改改历史设置了。你依然可以在 `~/.bashrc` 文件中设置针对用户级别的历史选项。比如说,如习惯同时使用多个终端,那你可能要启用 `histappend` 选项。某些 Bash 相关的 shell 选项本质上是布尔值(接收 `on` 或 `off`),通常可以用内置命令 `shopt` 启用或禁用。接收更复杂的值的 Bash 选项(如 `HISTTIMEFORMAT`),常常通过赋值给环境变量来达到配置目的。以下演示如何以 shell 选项和环境变量定制 Bash。 + +``` +# 配置 Bash 历史 + +# 用制表符扩展目录环境变量,并设置 histappend +shopt -s direxpand histappend + +# ignoreboth 等同于 ignorespace 和 ignoredup +HISTCONTROL='ignoreboth' + +# 控制 `history` 输出中的时间格式 +HISTTIMEFORMAT="[%F %T] " + +# 无限历史记录 +# NB:在新版 Bash 中,任何 < 0 的写法都有效,但是在 CentOS/RHEL 中,只有这样才行得通 +HISTSIZE= +HISTFILESIZE= + +# 或者对于使用新版 Bash 的人 +HISTSIZE=-1 +HISTFILESIZE=-1 +``` + +上面例子中的 `direxpand` 选项,可以让 Bash 在文件名补全时,用单词展开结果替换目录名。它会改变 readline 编辑缓冲区的内容,所以你所输入的东西已经被补全得到的结果替换了。 + +`HISTCONTROL` 变量用于启用或禁用命令历史的某些过滤选项。重复行、以空白打头的行,都能通过该选项将它们从命令历史中过滤掉。引用自 Dusty Mabe,这是我从他那儿得到的技巧: + +> `ignoredup` 可以让历史不记录重复条目(如果你反复执行同一条命令)。`ignorespace` 会忽略前面有空白的条目,当你在设置一个包含敏感信息的环境变量或者执行一条不想被记录进磁盘的命令时,这就很有用。`ignoreboth` 相当于这两条选项的结合体。 +> +> **Dusty Mabe – Redhat 首席软件工程师,2020.6.19** + +对于命令行重度用户,Bash 有一个 `CDPATH` 环境变量。如果 `CDPATH` 包含一系列供 `cd` 命令搜索的目录,且提供一个相对路径作为第一个参数,那么它会按顺序检查所有列出的目录,寻找匹配的子目录并切换到第一个匹配结果目录。 + +``` +# .bash_profile + +# 设置 CDPATH +CDPATH="/var/home/username/favdir1:/var/home/username/favdir2:/var/home/username/favdir3" + +# 也可以写成这样 +CDPATH="/:~:/var:~/favdir1:~/favdir2:~/favdir3" + +export CDPATH +``` + +`CDPATH` 通常像 `PATH` 一样的方式进行更新 —— 通过在赋值右侧引用自身来保留原来的值。 + +``` +# .bash_profile + +# 设置 CDPATH +CDPATH="/var/home/username/favdir1:/var/home/username/favdir2:/var/home/username/favdir3" + +# 或者写成这样 +CDPATH="/:~:/var:~/favdir1:~/favdir2:~/favdir3" + +CDPATH="$CDPATH:~/favdir4:~/favdir5" + +export CDPATH +``` + +`PATH` 是另一个极其重要的变量。它是系统上的命令的搜索路径。注意,有些应用要求将它们自己的目录加入 `PATH` 变量,这样才能正常使用。跟 `CDPATH` 一样,通过在赋值右侧引用原值来追加新值到 `PATH` 变量。如果你希望将新值前置,只需要把原来的值(`$PATH`)放到列表末尾即可。还有注意的是在 Fedora,这一列值通过冒号分隔(`:`)。 + +``` +# .bash_profile + +# 添加 PATH 值到 PAHT 环境变量 +PATH="$PATH:~/bin:~:/usr/bin:/bin:~/jdk-13.0.2:~/apache-maven-3.6.3" + +export PATH +``` + +命令提示符是另一个流行的自定义选项。它有七个可定制的参数: + +> - `PROMPT_COMMAND`:如果设置了,会在每一个主提示符(`$PS1`)出现之前执行该值。 +> - `PROMPT_DIRTRIM`:如果设置成大于零的数,则该值用作展开 `\w` 和 `\W` 提示符字符串转义符时保留的尾随目录组件数量。删除的字符将替换为省略号。 +> - `PS0`:这个参数的值像 `PS1` 一样展开,在交互式 shell 读取命令之后、执行命令之前展示。 +> - `PS1`:主提示符字符串。默认值是 `\s-\v\$ `。 +> - `PS2`:次提示符字符串。默认是 `> `。在显示之前,`PS2` 像 `PS1` 那样展开。 +> - `PS3`:这个参数的值用作 `select` 命令的提示符。如果这个变量没有设置,`select` 命令会用 `#? ` 作为提示符。 +> - `PS4`:这个参数的值像 `PS1` 那样展开,如果设置了 `-x` 选项,这个展开值会在命令行被回显之前作为提示符显示。展开后的值的第一个字符在必要时会复制数次,指示间接层数。默认值是 `+ `。 +> +> **Bash 参考文档** +> **第五版,Bash 版本 5.0** +> **2019 年 5 月** + + Bash 的这一个方面就可以用整篇文章来讨论。你可以找到许许多多信息和例子。在本文末尾链接的存储库中提供了一些点文件范例,包括提示符重新配置。你可以随意使用该存储库中的例子进行学习和体验。 + +### 总结 + +既然你已经掌握了一些 Bash 的工作原理,那就可以轻松修改你的 Bash 点文件,满足你自己的需求和习惯。美化你的提示符,制作一些别名,这样你的电脑才真的属于你。查看 `/etc/profile`、`/etc/bashrc` 和 `/etc/profile.d/` 这些文件的内容,获得一些启发。 + +你也可以在这里写一些关于终端模拟器的评论。有很多办法可以将你最喜欢的终端,完全配置成你想要的样子。你或许早就想到了,但是通常可以通过……嗯……用户家目录的点文件实现这个目的。终端模拟器也可以作为登录会话启动,有些人总喜欢用登录环境。你使用终端和电脑的姿势,取决于你如何修改(或不修改)你的点文件。 + +如果你很好奇自己的命令行处于什么会话状态,使用下面这个脚本来判断一下。 + +``` +#!/bin/bash + +case "$-" in + (*i*) echo This shell is interactive ;; + (*) echo This shell is not interactive ;; +esac +``` + +把这几行放到一个文件里,加上可执行权限,然后运行,就能看到你当前处于何种类型的 shell。`$-` 在 Bash 中是一个变量,如果是交互式 shell,它会包含字母 `i`。此外,你可以直接输出 `$-` 变量然后检查它的输出中是否含有 `i` 标记。 + +``` +$ echo $- +``` + +### 参考信息 + +可以参考以下资料以获取更多信息和示例。Bash 手册也是一个很好的信息来源。请注意,确保你的本地手册页记录了你当前运行的 Bash 版本的特性,因为在网上找到的信息有时可能太老(过时了)或太新(你的系统还没有安装)。 + +- +- (在该网站中,你必须要输入一个有效的电子邮箱地址,或者注册,才能下载。) +- + +对本文有各种形式(点文件示例、提示,以及脚本文件)贡献的社区成员: + + * Micah Abbott – 首席质量工程师 + * John Lebon – 首席软件工程师 + * Dusty Mabe – 首席软件工程师 + * Colin Walters – 高级首席软件工程师 + +示例点文件和脚本可以在这个存储库中找到: + +- + +请仔细检查上面所提供的存储库中的信息。有些可能已经过时了。里面还包含很多开发中的自定义脚本和宠物容器pet container配置例子,那些不是点文件。我推荐从 John Lebon 的点文件开始学习,从头到尾都含有完善的解说,它们是我见过的最详细的,并且包含了非常好的描述。祝你学得开心! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/customizing-bash/ + +作者:[Stephen Snow][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/jakfrost/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/bashenvironment-816x346.png +[2]: https://en.wikipedia.org/wiki/Shell_(computing) +[3]: https://fedoramagazine.org/fedoras-gaggle-of-desktops/ +[4]: https://en.wikipedia.org/wiki/Comparison_of_command_shells +[5]: https://en.wikipedia.org/wiki/GNOME +[6]: https://en.wikipedia.org/wiki/Bash_(Unix_shell) +[7]: https://en.wikipedia.org/wiki/High-level_programming_language +[8]: https://en.wikipedia.org/wiki/C_(programming_language) +[9]: https://en.wikipedia.org/wiki/GNOME_Terminal +[10]: https://en.wikipedia.org/wiki/Pipeline_(Unix) +[11]: https://fedoramagazine.org/wp-content/uploads/2020/06/bash-initialization-1-1024x711.png +[12]: https://fedoramagazine.org/wp-content/uploads/2020/06/bash-initialization-2-1024x544.png +[13]: https://en.wikipedia.org/wiki/Boolean_data_type diff --git a/published/202007/20200701 How to install Java on a Mac.md b/published/202007/20200701 How to install Java on a Mac.md new file mode 100644 index 0000000000..0e59880994 --- /dev/null +++ b/published/202007/20200701 How to install Java on a Mac.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12393-1.html) +[#]: subject: (How to install Java on a Mac) +[#]: via: (https://opensource.com/article/20/7/install-java-mac) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +如何在 Mac 上安装 Java +====== + +> macOS 用户可以运行 Java 的开源版本,以及用于云原生cloud native开发的新框架。 + +![](https://img.linux.net.cn/data/attachment/album/202007/08/123211djuaz9io7l9dlpd7.jpg) + +五月底,Java 庆祝了它的 25 周年纪念日,为了纪念这一时刻,世界各地的开发人员使用 [#MovedByJava][3] 这一标签分享他们使用这一编程语言的成就、记忆以及愿景。 + +> 我的时间线: +> +> * 1999 开始学习 Java +> * 2007 创建 [@grailsframework][4] +> * 2008 共同创建 G20ne +> * 2009 被 SpringSource 收购 +> * 2015 加入 [@ObjectComputing][5] +> * 2018 创建 [@micronautfw][6] / 获得 [@groundbreakers][7] 奖 +> * 2019 成为 [@Java_Champions][8] +> +> 感谢你 [@java][9]![#MovedByJava][10] +> +> — Graeme Rocher (@graemerocher) [2020年5月21日][11] + +多年来,许多技术和趋势都促进了 Java 堆栈的开发、部署和在标准应用程序服务器上运行多个应用的能力。为 [Kubernetes][12] 构建容器镜像使得 Java 开发者可以在多个云环境中打包和部署[微服务][13]microservices,而不是在虚拟机上运行几个应用程序服务器。 + +![Timeline of technology contributions to Java][14] + +有了这些技术,Java 应用程序栈被优化为运行更大的堆和可以在运行时做出决策的高动态框架。然而不幸的是,这些努力还不足以使 Java 成为开发人员为无服务器serverless和事件驱动平台开发云原生cloud native Java 应用程序的首选编程语言。其他语言填补了这部分空缺,特别是 JavaScript、Python 和 Go,而 Rust 和 WebAssembly 也成了新的选择。 + +尽管存在这种竞争,[云原生 Java][16]cloud native Java 正在对以云为中心的软件开发产生影响。好在,新的 Java 框架(比如,[Quarkus][17]、[Micronaut][18] 和 [Helidon][19])最近已经战胜了这些挑战,它们提供了编译速度更快而且更小的应用,同时它们在设计之初就将分布式系统考虑了进去。 + +### 如何在 macOS 上安装 Java + +Java 开发的未来将从更多人安装和使用 Java 开始。因此,我将介绍如何在 macOS 上安装并开始使用 Java 开发环境。(如果你运行的是 Linux,请查看 Seth Kenlon 的文章《[如何在 Linux 上安装 Java][20]》) + +#### 通过 Brew 仓库安装 OpenJDK + +Homebrew 是 macOS 事实上的标准软件包管理器。如果你还没有安装的话,Matthew Broberg 的文章《[Homebrew 简介][21]》将带你完成这些步骤。 + +当你在 Mac 上安装好 Homebrew 后,使用 `brew` 命令安装 [OpenJDK][22],这是编写 Java 应用程序的开源方式: + +``` +$ brew cask install java +``` + +不到一分钟就能看到: + +``` +🍺 java was successfully installed! +``` + +通过 `java -version` 命令确认 OpenJDK 已经正确安装: + +``` +$ java -version +openjdk version "14.0.1" 2020-04-14 +OpenJDK Runtime Environment (build 14.0.1+7) +OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing +``` + +从输出中可以确认 OpenJDK 14 (本文撰写时的最新版本)已经安装。 + +#### 从二进制文件安装 OpenJDK + +如果你并不热衷于包管理器,并且更愿意自己来管理 Java 的话,那么你总是可以选择下载并且手动安装。 + +我在 OpenJDK 主页上找到了最新版本的下载链接。下载 OpenJDK 14 的二进制文件: + +``` +$ wget https://download.java.net/java/GA/jdk14.0.1/664493ef4a6946b186ff29eb326336a2/7/GPL/openjdk-14.0.1_osx-x64_bin.tar.gz +``` + +移动到你保存二进制文件的目录,然后解压: + +``` +$ tar -xf openjdk-14.0.1_osx-x64_bin.tar.gz +``` + +接下来,将 Java 加入到你的 PATH: + +``` +$ export PATH=$PWD/jdk-14.0.1.jdk/Contents/Home/bin:$PATH +``` + +同时,将这条命令加到你的点文件中,`.bash_profile` 还是 `.zshrc` 取决于你运行的 shell。你可以在《[如何在 Linux 中设置你的 $PATH 变量][23]》一文中了解更多关于配置 `$PATH` 变量的内容。 + +最后,验证你安装的 OpenJDK 14: + +``` +$ java -version +openjdk version "14.0.1" 2020-04-14 +OpenJDK Runtime Environment (build 14.0.1+7) +OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing) +``` + +### 在 Mac 上编写你的第一个[微服务][13]microservices + +现在,你已经准备好在 maxOS 上使用 OpenJDK 堆栈开发云原生cloud native Java 应用程序了。在本教程中,你将在 [Quarkus][17] 上创建一个新的 Java 项目,这个项目使用依赖注入dependency injection来公布 REST API。 + +你需要 [Maven][24] 启动,它是一个非常流行的 Java 依赖管理器。从 Maven 的网站[安装][25]它,或者通过 Homebrew 使用 `brew install maven` 命令。 + +执行以下 Maven 命令来配置 Quarkus 项目,并且创建一个简单的 web 应用: + +``` +$ mvn io.quarkus:quarkus-maven-plugin:1.5.1.Final:create \ +    -DprojectGroupId=com.example \ +    -DprojectArtifactId=getting-started \ +    -DclassName="com.example.GreetingResource" \ +    -Dpath="/hello" +cd getting-started +``` + +运行这个应用: + +``` +$ ./mvnw quarkus:dev +``` + +当应用程序运行的时候,你可以看到这个输出: + +``` +__  ____  __  _____   ___  __ ____  ______ + --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ + -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   +\--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/   +2020-06-13 00:03:06,413 INFO  [io.quarkus] (Quarkus Main Thread) getting-started 1.0-SNAPSHOT on JVM (powered by Quarkus 1.5.1.Final) started in 1.125s. Listening on: +2020-06-13 00:03:06,416 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated. +2020-06-13 00:03:06,416 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy] +``` + +使用 `curl` 命令访问 REST 端点: + +``` +$ curl -w "\n" http://localhost:8080/hello +hello +``` + +恭喜!通过使用 Mavan 和 Quarkus,你很快从没有安装 Java 的环境里创建了第一个 web 应用。 + +### 接下来用 Java 做什么 + +Java 是一个成熟的编程语言,通过专门为云原生cloud native应用程序开发设计的新框架,Java 的热度会一直持续下去。 + +如果你正走在这样构建未来应用的路上,你可能会对更多实用的 Quarkus 开发课程或其他现代化框架感兴趣。无论你在构建什么,下一步是配置你的文本编辑器。阅读我关于《[在 VS Code 用 Quarkus 编写 Java][26]》的教程,然后再看看你能做什么。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/install-java-mac + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://opensource.com/resources/java +[3]: https://twitter.com/search?q=%23MovedByJava&src=typed_query +[4]: https://twitter.com/grailsframework?ref_src=twsrc%5Etfw +[5]: https://twitter.com/ObjectComputing?ref_src=twsrc%5Etfw +[6]: https://twitter.com/micronautfw?ref_src=twsrc%5Etfw +[7]: https://twitter.com/groundbreakers?ref_src=twsrc%5Etfw +[8]: https://twitter.com/Java_Champions?ref_src=twsrc%5Etfw +[9]: https://twitter.com/java?ref_src=twsrc%5Etfw +[10]: https://twitter.com/hashtag/MovedByJava?src=hash&ref_src=twsrc%5Etfw +[11]: https://twitter.com/graemerocher/status/1263484918157410304?ref_src=twsrc%5Etfw +[12]: https://opensource.com/resources/what-is-kubernetes +[13]: https://opensource.com/resources/what-are-microservices +[14]: https://opensource.com/sites/default/files/uploads/javatimeline.png (Timeline of technology contributions to Java) +[15]: https://creativecommons.org/licenses/by-sa/4.0/ +[16]: https://opensource.com/article/20/1/cloud-native-java +[17]: https://quarkus.io/ +[18]: https://micronaut.io/ +[19]: https://helidon.io/#/ +[20]: https://linux.cn/article-11614-1.html +[21]: https://linux.cn/article-12338-1.html +[22]: https://openjdk.java.net/ +[23]: https://opensource.com/article/17/6/set-path-linux +[24]: https://maven.apache.org/index.html +[25]: https://maven.apache.org/install.html +[26]: https://opensource.com/article/20/4/java-quarkus-vs-code diff --git a/published/202007/20200702 Customizing my Linux terminal with tmux and Git.md b/published/202007/20200702 Customizing my Linux terminal with tmux and Git.md new file mode 100644 index 0000000000..127da8332b --- /dev/null +++ b/published/202007/20200702 Customizing my Linux terminal with tmux and Git.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12450-1.html) +[#]: subject: (Customizing my Linux terminal with tmux and Git) +[#]: via: (https://opensource.com/article/20/7/tmux-git) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +使用 tmux 和 Git 自定义我的 Linux 终端 +====== + +> 设置你的控制台,以便你能知道身处哪个目录和该做什么 + +![](https://img.linux.net.cn/data/attachment/album/202007/25/102841u8u6ns4tp9z8bnha.jpg) + +我使用 GNOME 终端,主要是因为它是我的发行版的默认设置。但是我终端内远非“默认值”。在我开始解释如何自定义它之前,它现在是这个样子: + +![Moshe Zadka's terminal][2] + +### 从底部开始 + +我使用终端多路复用技术 [tmux][4] 管理我的终端体验。 + +在上图的底部,你可以看到我的绿色 tmux 栏。底部的 `[3]` 表示它是第三个终端:每个终端都运行自己的 tmux 会话。(我创建了一个新会话来放大字体,这样可在截图中更容易看到;这是它与其他终端之间的唯一区别。) + +提示符看起来也很有趣,对吧?在提示符中塞入了太多信息后,我喜欢插上一个换行符,这样一来,如果我想即兴进行 shell 编程或编写一个传递了五次的管道,也不会超出屏幕界限。这样做的代价是简单的命令序列(新建、复制、移动)会更快地滚动出我的屏幕。 + +行末是 [阿列夫零][5]Aleph null 字符,它是最小的[无穷基数][6]。我希望内容行的结束很明显,并且当我意识到“阿列夫”和下标 0 都是 Unicode 字符时,我无法抗拒使用“阿列夫零”作为提示符的一部分的诱惑。(数学极客们,团结起来!) + +在此之前是我的用户名。由于我在不同用户名的多台计算机上使用相同的[点文件][7](保存在 Git 中),因此这个还算有用。 + +在我的用户名之前,是我所在目录的最后一部分。完整路径通常太长且无用,而当前目录对于像我这样的经常忘记在做什么人来说是很有用的。在此之前是机器的名称。我所有的机器都以我喜欢的电视节目命名。我的旧笔记本是 `mcgyver`。 + +提示符中的第一位是我最喜欢的:一个让我知道目录的 Git 状态的字母。如果目录为“不在 Git 中”,那么是 `G`。如果目录为“没有问题”(OK),且无需任何操作,那么是 `K`。如果有 Git 未知的文件需要添加或忽略,那么是 `!`。如果需要提交,那么是 `C`。如果没有上游,那么是 `U`。如果存在上游,但我没有推送,那么是 `P`。该方案不是基于当前状态,而是描述了我要做的*下一个动作*。(要回顾 Git 术语,请阅读[本文][8]。) + +终端功能是通过一个有趣的 Python 程序完成的。它运行 `python -m howsit`(在我把 [howsit][9] 安装在虚拟环境中之后)。 + +你可以在上图中看到渲染效果,但是为了完整起见,这是我的 `PS1`: + +``` +[$(~/.virtualenvs/howsit/bin/python -m howsit)]\h:\W \u ℵ₀   +$ +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/tmux-git + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/sites/default/files/uploads/terminal-tmux-moshezadka.png (Moshe Zadka's terminal) +[3]: https://creativecommons.org/licenses/by-sa/4.0/ +[4]: https://opensource.com/article/20/1/tmux-console +[5]: https://simple.wikipedia.org/wiki/Aleph_null +[6]: https://gizmodo.com/a-brief-introduction-to-infinity-5809689 +[7]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[8]: https://opensource.com/article/19/2/git-terminology +[9]: https://pypi.org/project/howsit/ diff --git a/published/202007/20200702 Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux.md b/published/202007/20200702 Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux.md new file mode 100644 index 0000000000..a8c6507f06 --- /dev/null +++ b/published/202007/20200702 Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12401-1.html) +[#]: subject: (Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux) +[#]: via: (https://itsfoss.com/serpent-os-announcement/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Solus Linux 创始人正在开发一个没有 GNU 的“真正现代”的 Linux 发行版 +====== + +曾经创建独立 Linux 发行版 Solus 的开发人员 [Ikey Doherty][1] 宣布了他的新项目:Serpent OS。 + +[Serpent OS][2] 是一个**不想**被归类为“轻量级、用户友好、注重隐私的 Linux 桌面发行版”。 + +相反,Serpent OS 具有“与主流产品不同的目标”。具体怎么样?请继续阅读。 + +### Serpent OS:制作“真正现代”的 Linux 发行版 + +![][3] + +Serpent 采用发行版优先,兼容靠后的方法。这使他们可以做出一些非常大胆的决定。 + +Ikey 表示,这个项目不会对阻碍 Linux 的负面角色容忍。例如,不会容忍 NVIDIA 在其 GPU 上缺乏对 Wayland 加速的支持,并将 NVIDIA 专有驱动加入发行版黑名单。 + +这是 Serpent Linux 项目的拟议计划(摘自[其网站][4]): + + * 不再分割 usrbin + * 100% clang 构建(包括内核) + * musl 作为 libc,依靠编译器优化而不是内联 asm + * 使用 libc++ 而不是 libstdc++ + * LLVM 的 binutils 变体(lld、as 等) + * 混合源代码/二进制分发 + * 从 x86\_64 通用基线转移到更新的 CPU,包括针对 Intel 和 AMD 的优化 + * 包管理器中基于功能的订阅(硬件/用户选择等) + * 只支持 UEFI。不支持老式启动方式 + * 完全开源,包括引导程序/重建脚本 + * 针对高工作负载进行了认真的优化 + * 第三方应用仅依赖于容器。没有兼容性修改 + * 仅支持 Wayland。将调查通过容器的 X11 兼容性 + * 完全无状态的管理工具和上游补丁 + +Ikey 大胆地宣称 Serpent Linux 不是 Serpent GNU/Linux,因为它不再依赖于 GNU 工具链或运行时。 + +Serpent OS 项目的开发将于 7 月底开始。没有确定最终稳定版本的时间表。 + +### 要求过高?但是 Ikey 过去做到了 + +你可能会怀疑 Serpent OS 是否会出现,是否能够兑现其所作的所有承诺。 + +但是 Ikey Doherty 过去已经做到了。如果我没记错的话,他首先基于 Debian 创建了 SolusOS。他于 2013 年停止了基于 [Debian 的 SolusOS][5] 的开发,甚至它还没有进入 Beta 阶段。 + +然后,他从头开始创建 [evolve OS][6],而不是使用其他发行版作为基础。由于某些命名版权问题,项目名称已更改为 Solus(是的,相同的旧名称)。[Ikey 在 2018 年退出了 Solus 项目][7],其他开发人员现在负责该项目。 + +Solus 是一个独立的 Linux 发行版,它为我们提供了漂亮的 Budgie 桌面环境。 + +Ikey 过去做到了(当然,在其他开发人员的帮助下)。他现在也应该能够做到。 + +### 看好还是不看好? + +你如何看待这个 Serpent Linux?你是否认为是时候让开发人员采取大胆的立场,并着眼于未来开发操作系统,而不是坚持过去?请分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/serpent-os-announcement/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ikey-doherty-serpent-interview/ +[2]: https://www.serpentos.com/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/serpent-linux.png?ssl=1 +[4]: https://www.serpentos.com/about/ +[5]: https://distrowatch.com/table.php?distribution=solusos +[6]: https://itsfoss.com/beta-evolve-os-released/ +[7]: https://itsfoss.com/ikey-leaves-solus/ diff --git a/published/202007/20200703 openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption.md b/published/202007/20200703 openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption.md new file mode 100644 index 0000000000..522ce76e8c --- /dev/null +++ b/published/202007/20200703 openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12425-1.html) +[#]: subject: (openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption) +[#]: via: (https://itsfoss.com/opensuse-leap-15-2-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +openSUSE Leap 15.2 发布:重点关注容器、AI 和加密 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/16/230428vklhwrzllll2eu82.jpg) + +[openSUSE][1] Leap 15.2 最终带来了一些有用的变化和改进。 + +同时,我想到 SUSE 这篇让人激动的公告《[消除 Leap 差异][2]》,openSUSE Leap 15.2 的发布使我们下一步将 SLE([SUSE Linux Enterprise][3])二进制文件集成到 openSUSE Leap 15.3 更加近了一步。 + +让我们看一下 openSUSE Leap 15.2 中发生了哪些变化和改进。 + +### openSUSE Leap 15.2:关键变化 + +![][4] + +总体而言,openSUSE Leap 15.2 发行版涉及安全更新、新的主要软件包、bug 修复以及其他改进。 + +该项目的开发人员 Marco Varlese 在新闻稿中提到: + +>“ Leap 15.2 代表了人工智能领域的巨大进步,我很高兴 openSUSE 用户现在终于可以通过我们的仓库使用机器学习/深度学习框架和应用,以享受稳定和最新的生态系统。” + +尽管这暗示了可能涉及的一些变化,以下是 openSUSE Leap 15.2 中的新功能: + +#### 添加人工智能(AI)和机器学习包 + +毫无疑问,人工智能(AI)和机器学习是最具颠覆性的技术。 + +为了向用户提供便利,openSUSE Leap 15.2 为新的开源技术添加了许多重要的软件包: + + * [Tensorflow][5] + * [PyTorch][6] + * [ONNX][7] + * [Grafana][8] + * [Prometheus][9] + +#### 引入实时内核 + +![][10] + +在 openSUSE Leap 15.2 中,将引入实时内核来管理[微处理器][11]的时序,以有效处理时间关键的事件。 + +实时内核的添加对于现实意义重大。项目委员会主席 Gerald Pfeifer 的讲话如下: + +>“将实时内核添加到 openSUSE Leap 开启了新的可能性。想想边缘计算、嵌入式设备、数据抓取,所有这些都在飞速发展。从历史上看,其中很多都是专有领域。现在,openSUSE 为有兴趣测试实时功能的开发者、研究人员和公司甚至贡献者将打开了通道。这是另一个开源帮助开放的领域!” + +#### 纳入容器技术 + +在最新版本中,你会注意到 [Kubernetes][12] 作为官方包而纳入其中。这让用户可以轻松地自动化部署、扩展和管理容器化的应用。 + +[Helm][13](Kubernetes 的包管理器)也是内置的。不仅于此,你还可以在此找到其他一些附加功能,从而可以更轻松地保护和部署容器化应用。 + +#### 更新的 openSUSE 安装程序 + +![][14] + +openSUSE 的安装程序已经非常不错。但是,在最新的 Leap 15.2 版本中,它们添加了更多信息,兼容从右至左语言(如阿拉伯语)以及一些小的更改,从而在安装时更容易选择。 + +#### YaST 改进 + +尽管 [YaST][15] 已经是一个非常强大的安装和配置工具,但是此发行版增加了创建和管理 Btrfs 文件系统以及实施高级加密技术的能力。 + +当然,你肯定知道 [openSUSE 在 WSL][16] 的可用性。因此,根据 Leap 15.2 的发行说明,YaST 与 WSL 的兼容性得到了改善。 + +#### 桌面环境改进 + +![][17] + +可用的桌面环境已更新为最新版本,包括 [KDE Plasma 5.18 LTS][18] 和 [GNOME 3.34][19]。 + +你还能发现更新的 [XFCE 4.14][20] 桌面在 openSUSE Leap 15.2 上也是可用的。 + +如果你想知道最新版本的所有详细信息,可以参考[官方发布公告][21]。 + +### 下载和可用性 + +目前,你可以找到 Leap 15.2 的 Linode 云镜像。另外,你会注意到其他云托管服务(如 AWS、Azure 和其他服务)也提供了它。 + +你还可以从官方网站获取 DVD ISO 或网络镜像文件。 + +要升级你当前的安装,我建议按照[官方说明][22]操作。 + +- [openSUSE Leap 15.2][23] + +你尝试过 openSUSE Leap 15.2 了么?请随时让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/opensuse-leap-15-2-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.opensuse.org/ +[2]: https://www.suse.com/c/sle-15-sp2-schedule-and-closing-the-opensuse-leap-gap/ +[3]: https://www.suse.com/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensuse-leap-15-2-gnome.png?ssl=1 +[5]: https://www.tensorflow.org +[6]: https://pytorch.org +[7]: https://onnx.ai +[8]: https://grafana.com +[9]: https://prometheus.io/docs/introduction/overview/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensuse-leap-15-2-terminal.png?ssl=1 +[11]: https://en.wikipedia.org/wiki/Microprocessor +[12]: https://kubernetes.io +[13]: https://helm.sh +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensuse-leap-15-2.png?ssl=1 +[15]: https://yast.opensuse.org/ +[16]: https://itsfoss.com/opensuse-bash-on-windows/ +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensue-leap-15-2-kde.png?ssl=1 +[18]: https://itsfoss.com/kde-plasma-5-18-release/ +[19]: https://itsfoss.com/gnome-3-34-release/ +[20]: https://www.xfce.org/about/news/?post=1565568000 +[21]: https://en.opensuse.org/Release_announcement_15.2 +[22]: https://en.opensuse.org/SDB:System_upgrade +[23]: https://software.opensuse.org/distributions/leap diff --git a/published/202007/20200706 Project OWL- IoT trying to hold connectivity together in disasters.md b/published/202007/20200706 Project OWL- IoT trying to hold connectivity together in disasters.md new file mode 100644 index 0000000000..bd52eec6e3 --- /dev/null +++ b/published/202007/20200706 Project OWL- IoT trying to hold connectivity together in disasters.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12435-1.html) +[#]: subject: (Project OWL: IoT trying to hold connectivity together in disasters) +[#]: via: (https://www.networkworld.com/article/3564980/project-owl-iot-trying-to-hold-connectivity-together-in-disasters.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +OWL 项目:物联网正尝试在灾难中让一切保持联络 +====== + +> 当自然灾害破坏了传统的通信连接时,配置在多跳网络mesh network的物联网设备可以迅速部署以提供基本的连接。 + +![](https://img.linux.net.cn/data/attachment/album/202007/21/135614mwr8rxr6lw5xefjs.jpg) + +OWL 项目负责人在最近的开源峰会上说,一个以多跳网络、物联网和 LoRa 连接为中心的开源项目可以帮助急救和受灾人员在自然灾害之后保持联系。 + +OWL 项目的应用场景是当在自然灾害之后频繁发生的通信中断时。无论是蜂窝网络还是有线网络,大范围的中断会频繁阻碍急救服务、供应和在暴风雨或其他重大灾难后必须解决关键问题的信息流。 + +该项目通过一大群“鸭子duck”(便宜、易于部署且不需要现有基础设施支持的小型无线模块)实现这个目的。一些“鸭子”是太阳能的,其它一些则用的是耐用电池。每只“鸭子”配备一个 LoRa 无线电,用于在网络上和其它“鸭子”进行通信,同时还配备有 Wi-Fi,而且可能配备蓝牙和 GPS 来实现其他功能。 + +这个想法是这样的,当网络瘫痪时,用户可以使用他们的智能手机或者笔记本电脑与“鸭子”建立一个 Wi-Fi 连接,这个“鸭子”可以将小块的信息传递到网络的其他部分。信息向网络后端传递,直到到达“鸭子爸爸papaduck”,“鸭子爸爸”装备了可以与云上的 OWL 数据管理系统连接的卫星系统(OWL 代表 ”组织organization位置whereabouts物流logistics”)。信息可以通过云在智能手机或者网页上进行可视化,甚至可以通过 API 插入到现有的系统中。 + +秘密在于“鸭群ClusterDuck” 协议,这是一个开源固件,即使在一些模块不能正常工作的网络中,它仍然能保持信息流通。它就是设计用来工作在大量便宜且容易获取的计算硬件上,类似树莓派的硬件,这样可以更容易且更快捷的建立一个“鸭群”网络。 + +创始人 Bryan Knouse 表示,这个项目的创建,是因为在 2017 年和 2018 年的毁灭性飓风中,要与受影响社区进行有效的通信而采取救援措施,面临着巨大的困难。 + +“我们的一些创始成员经历了这些灾难,然后我们会问‘我们该做些什么?’”,他说道。 + +在马亚圭斯,该项目有一批来自波多黎各大学的学生和教授,大多数的系统测试都在那里进行。Knouse 说,校园中目前有 17 个太阳能“鸭子”,分布在屋顶和树上,并且计划增加数量。 + +他说,“这种关系实际上创建了一个开源社区,这些学生和教授正在帮助我们开发这个项目。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3564980/project-owl-iot-trying-to-hold-connectivity-together-in-disasters.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[4]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[5]: https://www.networkworld.com/article/3250268/what-is-mu-mimo-and-why-you-need-it-in-your-wireless-routers.html +[6]: https://www.networkworld.com/article/3402316/when-to-use-5g-when-to-use-wi-fi-6.html +[7]: https://www.networkworld.com/article/3306720/mobile-wireless/how-enterprises-can-prep-for-5g.html +[8]: https://www.networkworld.com/article/3560993/what-is-wi-fi-and-why-is-it-so-important.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200707 What you need to know about hash functions.md b/published/202007/20200707 What you need to know about hash functions.md new file mode 100644 index 0000000000..062179dd21 --- /dev/null +++ b/published/202007/20200707 What you need to know about hash functions.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12408-1.html) +[#]: subject: (What you need to know about hash functions) +[#]: via: (https://opensource.com/article/20/7/hash-functions) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +关于哈希(散列)函数你应该知道的东西 +====== + +> 从输出的哈希值反推回输入,这从计算的角度是不可行的。 + +![](https://img.linux.net.cn/data/attachment/album/202007/12/145709d3ne3vee330oh3lv.jpg) + +无论安全从业人员用计算机做什么,有一种工具对他们每个人都很有用:加密哈希(散列)hash函数。这听起来很神秘、很专业,甚至可能有点乏味,但是, 在这里,关于什么是哈希函数以及它们为什么对你很重要,我会作出一个简洁的解释。 + +加密哈希函数,比如 SHA-256 或者 MD5,接受一组二进制数据(通常是字节)作为输入,并且对每个可能的输入集给出一个希望唯一hopefully unique的输出。对于任意模式的输入,给定的哈希函数的输出(“哈希值”)的长度都是一样的(对于 SHA-256,是 32 字节或者 256 比特,这从名字中就能看出来)。最重要的是:从输出的哈希值反推回输入,这从计算的角度是不可行的implausible(密码学家讨厌 “不可能impossible” 这个词)。这就是为什么它们有时候被称作单向哈希函数one-way hash function。 + +但是哈希函数是用来做什么的呢?为什么“唯一”的属性如此重要? + +### 唯一的输出 + +在描述哈希函数的输出时,“希望唯一hopefully unique”这个短语是至关重要的,因为哈希函数就是用来呈现完全唯一的输出。比如,哈希函数可以用于验证 *你* 下载的文件副本的每一个字节是否和 *我* 下载的文件一样。你下载一个 Linux 的 ISO 文件或者从 Linux 的仓库中下载软件时,你会看到使用这个验证过程。没有了唯一性,这个技术就没用了,至少就通常的目的而言是这样的。 + +如果两个不同的输入产生了相同的输出,那么这样的哈希过程就称作“碰撞collision”。事实上,MD5 算法已经被弃用,因为虽然可能性微乎其微,但它现在可以用市面上的硬件和软件系统找到碰撞。 + +另外一个重要的特性是,消息中的一个微小变化,甚至只是改变一个比特位,都可能会在输出中产生一个明显的变化(这就是“雪崩效应avalanche effect”)。 + +### 验证二进制数据 + +哈希函数的典型用途是当有人给你一段二进制数据,确保这些数据是你所期望的。无论是文本、可执行文件、视频、图像或者一个完整的数据库数据,在计算世界中,所有的数据都可以用二进制的形式进行描述,所以至少可以这么说,哈希是广泛适用的。直接比较二进制数据是非常缓慢的且计算量巨大,但是哈希函数在设计上非常快。给定两个大小为几 M 或者几 G 的文件,你可以事先生成它们的哈希值,然后在需要的时候再进行比较。 + +通常,对哈希值进行签名比对大型数据集本身进行签名更容易。这个特性太重要了,以至于密码学中对哈希值最常见的应用就是生成“数字”签名。 + +由于生成数据的哈希值很容易,所以通常不需要有两套数据。假设你想在你的电脑上运行一个可执行文件。但是在你运行之前,你需要检查这个文件就是你要的文件,没有被黑客篡改。你可以方便快捷的对文件生成哈希值,只要你有一个这个哈希值的副本,你就可以相当肯定这就是你想要的文件。 + +下面是一个简单的例子: + +``` +$ shasum -a256 ~/bin/fop +87227baf4e1e78f6499e4905e8640c1f36720ae5f2bd167de325fd0d4ebc791c  /home/bob/bin/fop +``` + +如果我知道 `fop` 这个可执行文件的 SHA-256 校验和,这是由供应商(这个例子中是 Apache 基金会)提供的: + +``` +87227baf4e1e78f6499e4905e8640c1f36720ae5f2bd167de325fd0d4ebc791c +``` + +然后我就可以确信,我驱动器上的这个可执行文件和 Apache 基金会网站上发布的文件是一模一样的。这就是哈希函数难以发生碰撞(或者至少是 *很难通过计算得到碰撞*)这个性质的重要之处。如果黑客能将真实文件用哈希值相同的文件轻易的进行替换,那么这个验证过程就毫无用处。 + +事实上,这些性质还有更技术性的名称,我上面所描述的将三个重要的属性混在了一起。更准确地说,这些技术名称是: + +1. 抗原像性pre-image resistance:给定一个哈希值,即使知道用了什么哈希函数,也很难得到用于创建它的消息。 +2. 抗次原像性second pre-image resistance:给定一个消息,很难找到另一个消息,使得这个消息可以产生相同的哈希值。 +3. 抗碰撞性collision resistance:很难得到任意两个可以产生相同哈希值的消息。 + +*抗碰撞性* 和 *抗次原像性* 也许听上去是同样的性质,但它们具有细微而显著的不同。*抗次原像性* 说的是如果 *已经* 有了一个消息,你也很难得到另一个与之哈希值相匹配的消息。*抗碰撞性* 使你很难找到两个可以生成相同哈希值的消息,并且要在哈希函数中实现这一性质则更加困难。 + +让我回到黑客试图替换文件(可以通过哈希值进行校验)的场景。现在,要在“外面”使用加密哈希算法(除了使用那些在现实世界中由独角兽公司开发的完全无 Bug 且安全的实现之外),还有一些重要且困难的附加条件需要满足。认真的读者可能已经想到了其中一些,特别需要指出的是: + +1. 你必须确保自己所拥有的哈希值副本也没有被篡改。 +2. 你必须确保执行哈希算法的实体能够正确执行并报告了结果。 +3. 你必须确保对比两个哈希值的实体确实报告了这个对比的正确结果。 + +确保你能满足这些条件绝对不是一件容易的事。这就是可信平台模块Trusted Platform Modules(TPM)成为许多计算系统一部分的原因之一。它们扮演着信任的硬件基础,可以为验证重要二进制数据真实性的加密工具提供保证。TPM 对于现实中的系统来说是有用且重要的工具,我也打算将来写一篇关于 TPM 的文章。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/hash-functions + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_OpenData_CityNumbers.png?itok=lC03ce76 +[2]: https://aliceevebob.com/2020/06/16/whats-a-hash-function/ diff --git a/published/202007/20200708 How to decipher Linux release info.md b/published/202007/20200708 How to decipher Linux release info.md new file mode 100644 index 0000000000..55a2d68d8c --- /dev/null +++ b/published/202007/20200708 How to decipher Linux release info.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12418-1.html) +[#]: subject: (How to decipher Linux release info) +[#]: via: (https://www.networkworld.com/article/3565432/how-to-decipher-linux-release-info.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何解密 Linux 版本信息 +====== + +> 显示和解释有关 Linux 版本的信息比看起来要复杂一些。 + +![christin hume / Linux / Modified by IDG Comm.][1] + +与引用一个简单的版本号不同,识别 Linux 版本有很多种方法。即使只是快速查看一下 `uname` 命令的输出,也可以告诉你一些信息。这些信息是什么,它告诉你什么? + +在本文中,我们将认真研究 `uname` 命令的输出以及其他一些命令和文件提供的版本说明。 + +### 使用 uname + +每当在 Linux 系统终端窗口中执行命令 `uname -a` 时,都会显示很多信息。那是因为这个小小的 `a` 告诉 `uname` 命令你想查看该命令能提供的*全部*输出。结果显示的内容将告诉你许多有关该系统的各种信息。实际上,显示的每一块信息都会告诉你一些关于系统的不同信息。 + +例如,`uname -a` 输出看起来像这样: + +``` +$ uname -a +Linux dragonfly 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux +``` + +尽管这可能不太重要,但你可以使用一个按适当的顺序包含 `uname` 所有选项来显示相同的信息: + +``` +$ uname -snmrvpio +Linux dragonfly 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux +``` + +要将这一长串信息分解为单独的块,可以使用类似这样的 `for` 循环来遍历每个选项: + +``` +$ for option in s n m r v p i o; do echo -n "$option: "; uname -$option; done +s: Linux +n: dragonfly +m: x86_64 +r: 5.4.0-37-generic +v: #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 +p: x86_64 +i: x86_64 +o: GNU/Linux +``` + +该循环显示了该选项提供了哪些信息。`uname` 手册页提供了每个选项的描述。以下是清单: + +- Linux –- 内核名称(选项 `s`) +- dragonfly –- 节点名(选项 `n`) +- x86_64 –- 机器硬件名(选项 `m`) +- 5.4.0-37-generic –- 内核发布版本(选项 `r`) +- #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 -- 内核版本(选项 `v`) +- x86_64 –- 处理器(选项 `p`) +- x86_64 –- 硬件平台(选项 `i`) +- GNU/Linux –- 操作系统(选项 `o`) + +要更深入地研究显示的信息,请认真查看显示的内核发行数据。第四行中的 `5.4.0-37` 不仅仅是一串任意数字。每个数字都很重要。 + + * `5` 表示内核版本 + * `4` 表示主要版本 + * `0` 表示次要版本 + * `37` 表示最新补丁 + +此外,在上面的循环中输出的第 5 行(内核版本)中的 `#41` 表示此发布版本已编译 41 次。 + +如果你只想显示所有信息中的一项,那么单个选项可能很有用。例如,命令 `uname -n` 可以仅告诉你系统名称,而 `uname -r` 仅可以告诉你内核发布版本。在盘点服务器或构建脚本时,这些和其他选项可能很有用。 + +在 Red Hat 系统时,`uname -a` 命令将提供相同种类的信息。这是一个例子: + +``` +$ uname -a +Linux fruitfly 4.18.0-107.el8.x86_64 #1 SMP Fri Jun 14 13:46:34 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux +``` + +### 发行版信息 + +如果你需要了解运行的发行版是什么,那么 `uname` 的输出不会对你有太大帮助。毕竟,内核版本与发行版不同。关于这个信息,你可以在 Ubuntu 和其他基于 Debian 的系统上使用 `lsb_release -r` 命令,而在 Red Hat 上可以显示 `/etc/redhat-release` 文件的内容。 + +对于 Debian 系统: + +``` +$ lsb_release -r +Release: 20.04 +``` + +对于 Red Hat 及相关系统: + +``` +$ cat /etc/redhat-release +Red Hat Enterprise Linux release 8.1 Beta (Ootpa) +``` + +### 使用 /proc/version + +`/proc/version` 文件还可以提供有关 Linux 版本的信息。该文件中提供的信息与 `uname -a` 输出有很多共同点。以下是例子。 + +在 Ubuntu 上: + +``` +$ cat /proc/version +Linux version 5.4.0-37-generic (buildd@lcy01-amd64-001) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 +``` + +在 RedHat 上: + +``` +$ cat /proc/version +Linux version 4.18.0-107.el8.x86_64 (mockbuild@x86-vm-09.build.eng.bos.redhat.com) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Fri Jun 14 13:46:34 UTC 2019 +``` + +### 总结 + +Linux 系统提供了很多关于内核和发行版安装的信息。你只需要知道在哪里或如何寻找并理解它的含义。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3565432/how-to-decipher-linux-release-info.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2020/07/linux_woman-with-laptop_keyboard_code_programmer_devops_by-christin-hume-via-unsplash_linux_-100850842-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200708 Program IoT systems using Python with this VSCode plugin for RTOS.md b/published/202007/20200708 Program IoT systems using Python with this VSCode plugin for RTOS.md new file mode 100644 index 0000000000..a59350cf87 --- /dev/null +++ b/published/202007/20200708 Program IoT systems using Python with this VSCode plugin for RTOS.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12463-1.html) +[#]: subject: (Program IoT systems using Python with this VSCode plugin for RTOS) +[#]: via: (https://opensource.com/article/20/7/python-rt-thread) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +通过 VSCode RTOS 插件使用 Python 为物联网系统编写程序 +====== + +> RTOS 之类的实时嵌入式操作系统使嵌入式系统的编程更简单 + +![](https://img.linux.net.cn/data/attachment/album/202007/29/001132c37u7u5qp284wef2.jpg) + +物联网(IoT)无处不在,它意味着几乎所有的产品,从冰箱到口袋手表,都可以连网。为了实现这个目标,每个产品都需要拥有一个嵌入式计算机来运行网络栈,有些产品几乎是小的不可思议。这就是嵌入式软件出现的场景:现代科技打造的非常小的计算机,硬编码到硬件芯片,不需要任何板外处理器、内存或者存储盘。 + +就传统视角而言,这种场景意味着没有操作系统可用,但是因为种种 [原因][2],开发者发现,类似于 RTOS 之类的实时嵌入式操作系统能让嵌入式系统的编程变得非常简单。 + +虽然 RT-Thread 嵌入式操作系统致力于鼓励程序员新手进入物联网领域,但并非所有的人都具备使用 C 语言硬编码微芯片的能力。幸运的是,MicroPython 通过让开发者创建运行于嵌入式系统的 Python 代码的方式,逐渐填补了这个鸿沟。为了让整个过程更简单,RT-Thread 有一个可以用于 VSCode 和 [VSCodium][4] 的插件,为开发者提供了物联网方面的开发环境。其部分特性包括: + + * 方便的连接方式,可以很容易的通过串口、网络或者 USB 连接到开发板(如果你使用过 Arduino,肯定会很熟悉这个流程)。 + * 支持上传文件或目录到开发板。 + * 支持基于 MicroPython 的代码,而且具有智能的代码补完、语法检查功能。 + * 支持 MicroPython REPL 交互式环境。 + * 丰富的示例代码和演示程序。 + * 完整的工程同步功能。 + * 快速运行内存中的程序代码。 + * 运行函数的代码片段。 + * 支持主流的 MicroPython 开发板。 + * 支持 Linux 和 Windows 操作系统,并经过充分测试。 + +### 准备 + +在开始之前,如果你使用的是 Windows 操作系统,那么必须保证 VSCode 的默认终端是 [PowerShell][5]。运行 VSCodium,从 “Terminal” 菜单项启动一个终端. 在显示在 VSCodium 窗口底部的终端界面,从下拉菜单顶端选择 “PowerShell”。 +不论你是在 [Windows][6] 还是 Linux 系统下工作,必须保证安装了 Python 3(在 Linux 上,它可能已经安装了,否则可以通过软件库安装它)。 + +还要安装的是微软提供的通用 VSCode Python 插件。安装方法是点击 “File” 菜单,找到 “Preferences” 子菜单,从中打开 “Extensions” 面板。在扩展中,搜索 “Python”,找到来自微软的 Python 插件。 + +![VSCodium Python plugin][7] + +当然,在上述操作之前,你要先正确安装 [VSCodium][9] 或 [VSCode][10]。 + +### 安装插件 + +安装 MicroPython 开发插件的方法与安装 Python 插件一样,点击 “File” 菜单,找到 “Preferences” 子菜单,选择 “Extensions”。 + +在扩展中,搜索 “MicroPython”,安装 RT-Thread 插件。 + +![MicroPython plugin for RT-Thread][11] + +### 使用插件 + +你的开发板必须能访问串口,这需要组策略的允许。你可能需要将自己的账户加入该组,通常在默认情况下你的账户可能并不在该组。首先,确认你的账户不在 “dialout” 组: + +``` +$ groups +tux users +``` + +本例中,用户“tux”只是“tux”组和“users”组的成员,所以需要将用户“tux”添加到“dialout”组: + + +``` +$ sudo usermod --append --groups dialout tux +``` + +退出登录或重启以载入你新的组权限。 + +### 创建 MicroPython 工程 + +MicroPython 开发的第一步是创建 MicroPython 工程用来编写和运行代码。使用 MicroPython 插件创建工程的方法是,点击左下方的 “Create MicroPython project” 按钮。 + +![Create MicroPython project][12] + +之后会有一些提示,让你选择创建空白工程还是包含例程的工程。 + +### 连接到开发板 + +点击 VSCodium 左下方的 “Connection” 按钮,进行 VSCodium 与开发板的连接,在弹出的列表中,选择要连接的物理设备。 + +### 查看例程 + +MicroPython 插件提供了许多例程和例库,供学习和调用。获取例程的过程是,激活 MicroPython 之后,VSCodium 左侧按钮条会出现“新建”快捷图标,点击该图标就可以了。点击“文档”快捷图标,会显示例程文件列表;点击“文件夹”快捷图标,会显示例库列表。 + +![MicroPython examples][13] + +### 直接在开发板上运行 MicroPython 文件 + +在 VSCodium 中可以通过在开发板上运行单个程序文件,很方便快捷的进行程序调试。快捷键 `Alt+Q` 会触发一个特定的插件,该插件会将当前的 Python 文件上传到开发板内存中。你还可以在当前 Python 文档界面点击右键,然后选择 “Run the MicroPython file directly on the device” 实现同样的功能。 + +![Running code on your device][14] + +如果你需要以不上传代码的方式检查一组代码,可以使用“代码片段”功能。要运行 MicroPython REPL 环境中的代码片段,在编辑器中选中要运行的片段,右键菜单中点击 “Execute the selected MicroPython code on the device” (也可以使用 `Alt+Q` 快捷键)。 + +### 加载文件和目录到开发板 + +如果需要加载文件或目录到开发板,有现成的方法可用:选中工程中要加载到开发板的文件或目录,在选中的对象上右键,点击右键菜单中的 “Download the file/folder to the device”。 + +注意,如果开发板中已有与要加载的文件或目录同名者,加载操作将导致开发板原有的内容被覆盖。 + +在 REPL 环境中运行 `os.listdir()` 命令,可以检查文件和目录是否成功加载。当然,也可以通过相应的命令删除 REPL 中的文件或目录。 + +删除文件的命令如下: + +``` +os.remove('file_to_delete') +``` + +删除目录的命令如下: + +``` +os.rmdir('folder_to_delete') +``` + +### 工程的同步 + +点击左下角“同步”按钮可以启动工程同步,该操作将把本地工程中所有的文件和目录同步到开发板的文件系统。建议在完成程序调试之后进行该操作,调试过程中不需要频繁进行同步操作。 + +工程的同步操作完成后,开发板上的文件列表可以在 “Device Files List” 列看到。 + +### 放手尝试 + +RT-Thread 以开源的方式发布 MicroPython 插件,意在为新老开发者提供帮助,它的很多特性,如代码自动补全等,与开源插件之间互有影响和促进。你如果想为嵌入式系统或物联网系统编写软件,这就是最简单的方式,没有之一。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/python-rt-thread + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software) +[2]: https://opensource.com/article/20/6/open-source-rtos +[3]: https://www.rt-thread.io/ +[4]: https://opensource.com/article/20/6/open-source-alternatives-vs-code +[5]: https://opensource.com/article/18/2/powershell-people +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/sites/default/files/uploads/vscodium-python-plugin.jpg (VSCodium Python plugin) +[8]: https://creativecommons.org/licenses/by-sa/4.0/ +[9]: http://vscodium.com +[10]: https://github.com/microsoft/vscode +[11]: https://opensource.com/sites/default/files/uploads/vscodium-micropython.jpg (MicroPython plugin for RT-Thread) +[12]: https://opensource.com/sites/default/files/uploads/vscodium-micropython-create.jpg (Create MicroPython project) +[13]: https://opensource.com/sites/default/files/uploads/vscodium-micropython-examples.jpg (MicroPython examples) +[14]: https://opensource.com/sites/default/files/uploads/vscodium-micropython-run.jpg (Running code on your device) diff --git a/published/202007/20200709 Btrfs to be the Default Filesystem on Fedora- Fedora 33 Starts Testing Btrfs Switch.md b/published/202007/20200709 Btrfs to be the Default Filesystem on Fedora- Fedora 33 Starts Testing Btrfs Switch.md new file mode 100644 index 0000000000..e360444220 --- /dev/null +++ b/published/202007/20200709 Btrfs to be the Default Filesystem on Fedora- Fedora 33 Starts Testing Btrfs Switch.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12455-1.html) +[#]: subject: (Btrfs to be the Default Filesystem on Fedora? Fedora 33 Starts Testing Btrfs Switch) +[#]: via: (https://itsfoss.com/btrfs-default-fedora/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Fedora 33 开始测试切换到 Btrfs +====== + +尽管距离 Fedora 的下一个稳定版本([Fedora 33][1])还有几个月的距离,但仍有一些值得关注的变化。 + +在所有其他 [Fedora 33 接受的系统范围的更改][1]中,最有趣的提议是将 Btrfs 作为桌面的默认文件系统,这个提议现在已经被批准了。 + +这是 Fedora 对该提案的评价: + +> 对于安装 Fedora 的笔记本电脑和工作站,我们希望以透明的方式向用户提供文件系统功能。我们希望添加新功能,同时减少处理磁盘空间不足之类的情况所需的专业知识。Btrfs 它的设计理念非常适合这个角色,让我们将其设为默认设置。 + +值得注意的是,在测试的最终投票结果出来之前,这不是系统范围内的更改。 + +但是,现在测试已经成功完成,投票结果也是赞成的 —— Fedora 33 版本已经接受了这个改动。 + +那么,为什么 Fedora 提出这一更改?这会有什么用么?这是糟糕的举动吗?对 Fedora 的发行有何影响?让我们在这里谈论下。 + +![][3] + +### 它会影响哪些 Fedora 版本? + +根据提议,如果测试成功,那么 Fedora 33 的所有桌面版本、spins 和 labs 都受此影响。 + +因此,你可以期望[工作站版本][4]将 Btrfs 作为 Fedora 33 上的默认文件系统。 + +### 实施此更改的潜在好处 + +为了改进 Fedora 在笔记本和工作站的使用,Btrfs 文件系统提供了一些好处。 + +现在 Fedora 33 将成为默认文件系统 —— 让我来指出使用 Btrfs 作为默认文件系统的好处: + + * 延长存储硬件的使用寿命 + * 提供一个简单的方案来解决用户耗尽根目录或主目录上的可用空间的情况 + * 不易造成数据损坏,易于恢复 + * 提供更好的调整文件系统大小的功能 + * 通过强制 I/O 限制来确保桌面在高内存压力下的响应能力 + * 使复杂的存储设置易于管理 + +如果你感到好奇,你可能想更深入地了解 [Btrfs][5] 及其总体优点。 + +不要忘记,Btrfs 已经是受支持的选项,它只是不是默认的文件系统而已。 + +但是,总的来说,感觉在Fedora 33上引入Btrfs作为默认文件系统是一个有用的变化。 + +### Red Hat Enterprise Linux 会不会实现它? + +很明显,Fedora 被认为是 [Red Hat Enterprise Linux][6] 的前沿版本。 + +因此,如果 Fedora 拒绝更改,那么 Red Hat 将不会实施。另一方面,如果你希望 RHEL 使用 Btrfs,那么 Fedora 应该首先同意更改。 + +为了让你更加清楚,Fedora 对其进行了详细介绍: + +> Red Hat 在许多方面都很好地支持 Fedora。但是 Fedora 已经与上游紧密合作,并依赖上游。这将是其中之一。这是该提案的重要考虑因素。社区有责任确保它得到支持。如果 Fedora 拒绝,那么 Red Hat 将永远不会支持 Btrfs。Fedora 必然需要成为第一个,并提出令人信服的理由,说明它比替代方案能解决更多的问题。它的负责人相信它确实如此,毫无疑问。 + +另外,值得注意的是,如果你不想在 Fedora 中使用 btrfs,你应该看看 [OpenSUSE][7] 和 [SUSE Linux Enterprise][8]。 + +### 总结 + +即使这个更改看起来不会影响任何升级或兼容性,你也可以在 [Fedora 项目的 Wiki 页面][9]中找到有关 Btrfs 的更改的更多信息。 + +你对针对 Fedora 33 发行版的这一更改有何看法?你是否要将 btrfs 文件系统作为默认文件系统? + +请在下面的评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/btrfs-default-fedora/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://fedoraproject.org/wiki/Releases/33/ChangeSet +[2]: https://fedoraproject.org/wiki/Test_Day:2020-07-08_Btrfs_default?rd=Test_Day:F33_btrfs_by_default_2020-07-08 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/btrfs-default-fedora.png?ssl=1 +[4]: https://getfedora.org/en/workstation/ +[5]: https://en.wikipedia.org/wiki/Btrfs +[6]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[7]: https://www.opensuse.org +[8]: https://www.suse.com +[9]: https://fedoraproject.org/wiki/Changes/BtrfsByDefault diff --git a/published/202007/20200709 What you need to know about automation testing in CI-CD.md b/published/202007/20200709 What you need to know about automation testing in CI-CD.md new file mode 100644 index 0000000000..d5b7f7dd3a --- /dev/null +++ b/published/202007/20200709 What you need to know about automation testing in CI-CD.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12458-1.html) +[#]: subject: (What you need to know about automation testing in CI/CD) +[#]: via: (https://opensource.com/article/20/7/automation-testing-cicd) +[#]: author: (Taz Brown https://opensource.com/users/heronthecli) + +CI/CD 中的自动化测试的概要知识 +====== + +> 持续集成和持续交付是由测试驱动的。以下是如何做到的。 + +![](https://img.linux.net.cn/data/attachment/album/202007/27/210026blobu65f77accbob.jpg) + +> “如果一切似乎都在控制之中,那只是你走的不够快而已。” —Mario Andretti + +测试自动化是指在软件开发过程中尽可能早、尽可能快地持续关注检测缺陷、错误和 bug。这是通过使用那些追求质量为最高价值的工具完成的,它们旨在*确保*质量,而不仅仅是追求质量。 + +持续集成/持续交付(CI/CD)解决方案(也称为 DevOps 管道)最引人注目的功能之一是可以更频繁地进行测试,而又不会给开发人员或操作人员增加更多的手动工作。让我们谈谈为什么这很重要。 + +### 为什么要在 CI/CD 中实现自动化测试? + +敏捷团队要更快的迭代,以更高的速度交付软件和客户满意度,而这些压力可能会危及质量。全球竞争制造了对缺陷的*低容忍度*,同时也增加了敏捷团队的压力,要求软件交付的*迭代更快*。减轻这种压力的行业解决方案是什么?是 [DevOps][2]。 + +DevOps 是一个大概念,有很多定义,但是对 DevOps 成功至关重要的一项技术是 CI/CD。通过软件开发流程设计一个连续的改进循环,可以为测试带来新的机会。 + +### 这对测试人员意味着什么? + +对于测试人员,这通常意味着他们必须: + + * 更早且更频繁地进行测试(使用自动化) + * 持续测试“真实世界”的工作流(自动和手动) + +更具体地说,任何形式的测试,无论是由编写代码的开发人员运行还是由质量保证工程师团队设计,其作用都是利用 CI/CD 基础架构在快速推进的同时提高质量。 + +### 测试人员还需要做什么? + +具体点说,测试人员负责: + + * 测试新的和现有的软件应用 + * 根据系统要求评估软件来验证和确认功能 + * 利用自动化测试工具来开发和维护可重复使用的自动化测试 + * 与 scrum 团队的所有成员合作,了解正在开发的功能以及实施的技术设计,以设计和开发准确、高质量的自动化测试 + * 分析记录在案的用户需求,并针对中等到高度复杂的软件或 IT 系统制定或协助设计测试计划 + * 开发自动化测试,并与功能团队一起审查和评估测试方案 + * 与技术团队合作,确定在开发环境中自动化测试的正确方法 + * 与团队合作,通过自动化测试来了解和解决软件问题,并回应有关修改或增强的建议 + * 参与需求梳理、估算和其他敏捷 scrum 仪式 + * 协助制定标准和流程,以支持测试活动和材料(例如脚本、配置、程序、工具、计划和结果) + +测试是一项艰巨的工作,但这是有效构建软件的重要组成部分。 + +### 哪些持续测试很重要? + +你可以使用多种测试。不同的类型并不是学科之间的牢固界限。相反,它们是表示如何测试的不同方式。比较测试类型不太重要,更重要的是对每一种测试类型都要有覆盖率。 + + * **功能测试:** 确保软件具有其要求的功能 + * **单元测试:** 独立测试软件的较小单元/组件以检查其功能 + * **负载测试:** 测试软件在重负载或使用期间的性能 + * **压力测试:** 确定软件承受压力(最大负载)时的断点 + * **集成测试:** 测试组合或集成的一组组件的输出 + * **回归测试:** 当修改任意组件(无论多么小),测试整个应用的功能 + +### 总结 + +任何包含持续测试的软件开发过程都将朝着建立关键反馈环路的方向发展,以实现快速和构建有效的软件。最重要的是,该实践将质量内置到 CI/CD 管道中,并意味着了解在软件开发生命周期中提高速度同时减少风险和浪费之间的联系。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/automation-testing-cicd + +作者:[Taz Brown][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [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/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds) +[2]: https://opensource.com/resources/devops diff --git a/published/202007/20200713 My Linux story- From Linux user to contributor.md b/published/202007/20200713 My Linux story- From Linux user to contributor.md new file mode 100644 index 0000000000..0d8c6d5d62 --- /dev/null +++ b/published/202007/20200713 My Linux story- From Linux user to contributor.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12438-1.html) +[#]: subject: (My Linux story: From Linux user to contributor) +[#]: via: (https://opensource.com/article/20/7/linux-user-contributor) +[#]: author: (Taz Brown https://opensource.com/users/heronthecli) + +我的 Linux 故事:从用户到贡献者 +====== + +> 开源社区欢迎来自不同背景和技能的贡献者。 + +![](https://img.linux.net.cn/data/attachment/album/202007/22/114140tfuubuvcfgujrcab.jpg) + +我是一名 IT 专业人士,拥有超过 15 年经验,担任过不同职位 —— 包括系统管理员、高级 Linux 管理员、DevOps 工程师、自动化顾问和高级敏捷专家scrum master。我开始是在 Ubuntu 上学习 Linux,但是后来作为系统管理员转到 CentOS,然后我又转到 Fedora 作为个人使用。但是我对技术的喜爱要远比我使用第一个 Linux 发行版要早的多,而且是来自于一部电影。 + +我最喜欢的电影是《黑客Hackers》。最精彩的一幕发生在电影的开头。电影一开始,一群特工冲进一所房子抓捕臭名昭著的黑客 Zero Cool。我们马上发现 Zero Cool 其实是 11 岁的 Dade Murphy,他在一天之内成功瘫痪了 1507 台计算机系统。他被指控犯罪,他的家人被处以重罚。而且,在他 18 岁之前,他都被禁止使用电脑或按键式电话。 + +劳伦斯·梅森Laurence Mason扮演的 Paul Cook,又名 Nikon 勋爵,是我最喜欢角色。其中一个主要原因是,我从没有看过一个黑客电影里面的人物长的像我,所以我被他的形象深深吸引了。他很神秘。这让我耳目一新,并且感到自豪,我对 IT 充满了热情,我也是一个和他很像的极客。 + +![Taz with astronaut][2] + +### 成为一个 Linux 贡献者 + +15 年前,我开始使用 Linux。当我成为一个 Linux 管理员的时候,Linux 就成了我的激情所在。我一直尝试找到某种方式能够为开源作出贡献,当时我还不知道该从哪开始。因为这个社区实在是太大了,我不知道自己能否真正成为一个有影响力的人,但当我发现一些人认可我的兴趣,还对我进行指导,我开始彻底打开心扉,问各种问题,并且从社区中学习。自从那以后,Fedora 社区一直是我做贡献的最主要社区。 + +我现在对于向开源做贡献还是有点稚嫩。当我意识到我可以用代码以外的方式来贡献时,我对开源的想法发生了改变。我更喜欢通过文档做一些贡献,因为我本质上不是一个软件开发人员,而且社区里面最迫切的需求正是文档。请记住:用户的技能和开发人员的技能同样重要。 + +### 我的硬件是什么? + +硬件也很重要,而且现在几乎所有东西都可以运行 Linux。现在,我家里的配置包括: + + * 联想 Thinksever TS140,64 GB 内存,4 x 1 TB SSD 和一个存储数据的 1 TB 机械硬盘 + * 使用 RAID 5 配置的 164 TB Synology NAS + * 输入输出使用罗技 MX Master 和 MX Master 2S + * 一个定制的并且符合人体工学的 Kinesis Advantage 2 键盘 + * 两个 38 寸 LG 超宽曲面显示器和一个 34 寸 LG 超宽显示器 + * 一台配备 i7 六核十二线程 CPU 和 16.1 英寸 IPS 显示器的 System76 笔记本 + +我很喜欢 Fedora 处理外置设备的方式,比如说我的鼠标和键盘。一切都完美融合。即插即用工作正常,性能从来不受影响。 + +![Fedora double monitor setup][4] + +### 软件是什么? + +使用开源软件对我的工作非常重要。我依赖于: + + * Fedora 30 作为我日常使用的 Linux 发行版 + * Wekan 作为我的项目的开源看板kanban + * [Atom][5] 作为我的文本编辑器 + * Terminator 作为我日常使用的终端,因为它的网格布局以及丰富的键盘快捷键 + * Neofetch 用来显示每次登录到终端时的系统信息 + +最后同样重要的是,我把 Powerline、Powerlevel9k 和 Vim-Powerline 搞到我的终端上来跟别人装酷。 + +![Multiple fedora screens][7] + +### Linux 让我们走到一起 + +美国是个大熔炉,我也是这么看待 Linux 和像 Fedora 项目这样的特定社区的。在每个 Linux 社区中,对于不同的贡献都有很大的空间。也有很多方式可以参与进来,而且对于新的想法,也总是有发挥的空间。通过分享我过去 15 年在开源方面的经验,我希望帮助更多在科技领域的少数族裔体会到来自开源社区对多样性和包容性的认同感。 + +*编者注:这篇文章改编自[“Taz Brown:你怎么搞 Fedora?”][8],并得到许可重新发布* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/linux-user-contributor + +作者:[Taz Brown][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [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/contributor_spotlight_penguin.jpg?itok=azJA5Cj8 (Penguin, stylized, contributor spotlight) +[2]: https://opensource.com/sites/default/files/uploads/taz_with_astronaut_0.png (Taz with astronaut) +[3]: https://getfedora.org/ +[4]: https://opensource.com/sites/default/files/uploads/fedora_double_monitor_setup.jpg (Fedora double monitor setup) +[5]: https://fedoramagazine.org/install-atom-fedora/ +[6]: https://fedoramagazine.org/add-power-terminal-powerline/ +[7]: https://opensource.com/sites/default/files/uploads/fedora_screens.jpg (Multiple fedora screens) +[8]: https://fedoramagazine.org/taz-brown-how-do-you-fedora/ diff --git a/published/202007/20200713 My feature-rich and minimal Linux terminal.md b/published/202007/20200713 My feature-rich and minimal Linux terminal.md new file mode 100644 index 0000000000..301fb64e95 --- /dev/null +++ b/published/202007/20200713 My feature-rich and minimal Linux terminal.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12439-1.html) +[#]: subject: (My feature-rich and minimal Linux terminal) +[#]: via: (https://opensource.com/article/20/7/minimal-linux-terminal) +[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) + +我的功能丰富却又保持简约的 Linux 终端 +====== + +> 这些应用和主题可以你真正拥有你的终端。 + +![](https://img.linux.net.cn/data/attachment/album/202007/22/123206g5t5mmz5ozdt5f5m.jpg) + +每个人都喜欢以特定的方式设置他们的工作区:它可以帮助你提高效率,并使生活更容易以一种感觉有机的方式组织事物,并拥有一个对你来说感觉良好的环境。这也绝对适用于终端。这可能就是为什么有这么多可用终端的原因。 + +在使用新的计算机时,我做的第一件事就是设置我的终端,让它成为我自己的终端。 + +我最喜欢的终端应用是 [Terminator][2],因为它的设计简约,并且内置了窗口选项。但从这里开始变得更加复杂。我将自己喜欢的终端风格描述为“功能丰富却又保持简约”。这种平衡是我经常在微调的。 + +我使用 zsh 作为默认 shell,并使用 Ohmyzsh 来提供额外的功能。可以下载它的安装脚本来安装 Ohmyzsh: + +``` +$ curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh --output install-zsh.sh +``` + +查看一遍脚本了解它做什么,并确保你有信心在计算机上运行该脚本。完成后,运行脚本: + +``` +$ sh ./install-zsh.sh +``` + +我最喜欢的主题/提示符是 [Powerlevel 10k][3],它是一个非常详细的环境视图。它包含了从命令的颜色高亮到运行时间的时间戳等所有内容。所有细节都集成到一个优雅的、具有上下文感知的提示符中。 + +要安装 Powerlevel10k,请先在 `.oh-my-zsh/` 自定义主题目录中下载源码。 + +``` +git clone --depth=1 https://github.com/romkatv/powerlevel10k.git +${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k +``` + +但是,为了让 Powerlevel10k 看起来如其存储库中所示,我们需要添加一些默认不包括的字体。它们是: + + * [MesloLGS NF Regular.ttf][4] + * [MesloLGS NF Bold.ttf][5] + * [MesloLGS NF Italic.ttf][6] + * [MesloLGS NF Bold Italic.ttf][7] + +这将产生一个美观且具有上下文感知的终端(如 [screenfetch][8] 所示): + +![terminator terminal shot via screenFetch][9] + +我已经习惯了这个特殊的设置,但是,把工作环境变成自己的环境固然重要,但这也并不是一个固执地尝试新事物的理由。新终端的出现,是为了满足新一代用户的需求和要求。这意味着,即使一开始不熟悉,但最近开发的一种终端可能比你的老旧备用机更适合当今的环境和职责。 + +我最近一直在考虑其他选择。我开始关注 [Starship][10] 的开发情况,它将自己描述为简约的、快速的、可无限定制的提示符,适用于任何 shell。它仍然有很多在视觉上可以身临其境的细节,而不会像 Powerlevel10k 那样使人分心。 + +你最喜欢的终端是什么?为什么?请在评论栏分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/minimal-linux-terminal + +作者:[Sumantro Mukherjee][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sumantro +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://terminator-gtk3.readthedocs.io/en/latest/ +[3]: https://github.com/romkatv/powerlevel10k +[4]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf +[5]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf +[6]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf +[7]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf +[8]: https://github.com/KittyKatt/screenFetch +[9]: https://opensource.com/sites/default/files/uploads/osdc00_edit.png (terminator terminal shot via screenFetch ) +[10]: https://starship.rs/ diff --git a/published/202007/20200713 Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings.md b/published/202007/20200713 Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings.md new file mode 100644 index 0000000000..3c7727f220 --- /dev/null +++ b/published/202007/20200713 Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: (this-is-name-right) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12453-1.html) +[#]: subject: (Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings) +[#]: via: (https://itsfoss.com/open-source-video-conferencing-tools/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +5 个流行的用于远程工作和在线会议的开源视频会议工具 +====== + +你会发现网上有一些视频会议工具。一些是为专业用户量身定制的,另一些是为了日常闲聊的。 + +然而面对着成百上千的选择,当选择视频会议应用或服务时,安全和隐私是往往是一个重要的点。在众多选择中,哪些是最好最安全的? + +所有这些(或大多数)都宣称要提供最好的安全和隐私。但是,你要知道这可不能只看表面。 + +幸运的是在这里,我们专注于开源和隐私友好的解决方案,所以,让我们看看你可以使用的开源视频会议工具列表。 + +### 顶级开源视频会议解决方案 + +![](https://img.linux.net.cn/data/attachment/album/202007/26/104947gyzs2eb5ybeneg5y.jpg) + +如果你是商企用户,大多数视频会议解决方案可以被安装在你自己的服务器上。 + +对于不是系统管理员的普通人来说,其中一些解决方案还提供了现成的、免费的、基于 Web 的视频会议服务。我将在列表中每个项目的描述中提及此信息。 + +**备注:** 列表中的排名不分先后。 + +#### 1、Jitsi Meet + +![][2] + +Jitsi Meet 是一个令人印象深刻的开源视频会议服务。你可以在我们关于 [Jitsi Meet][3] 的单独报道中轻松找到更多信息。 + +为了给你一个好的开始,Jitsi Meet 提供免费[官方公共实例][4]来测试它,只要你需要,就可以免费使用它。 + +如果你需要将其托管在你的服务器上,同时根据你的需求定制一些选项,你可以从它的[官网][5]下载到你的服务器。 + +尽管他们在 Linux 上提供了一个基于 Electron 的应用,其实你不必下载一个应用到你的桌面上来设置它。你只需要一个浏览器就足够了。在移动端,安卓和 iOS 都有应用。 + +- [Jitsi Meet][5] + +#### 2、Jami + +![][6] + +Jami 是一个基于点对点的开源视频会议解决方案。很高兴看到分布式的服务,这意味着不依靠服务器,而只是点对点的连接。 + +当然了,分布式的服务有优点也有缺点。但是它是自由而开源的,那才是最重要的。 + +Jami 之前被称为 Ring messenger,但它改了名字,现在是一个 GNU 项目。 + +Jami 有 Linux、Windows、macOS、Android 和 iOS 的版本,所以它是一个完全跨平台的安全传送信息和视频会议的解决方案。你可以看看他们的 [GitLab 页面][7]浏览更多信息。 + +- [Jami][8] + +#### 3、Nextcloud Talk + +![][9] + +[Nextcloud][10] 毫无疑问是开源远程办公工具的瑞士军刀。我们就在使用 Nextcloud。所以如果你已经配置了服务器,[Nextcloud Talk][11] 显然是一个优秀的视频会议和聊天工具。 + +当然了,如果你还没有自己的 Nextcloud 服务器,你需要一些技术知识来进行设置它,然后才能开始使用 Nextcloud Talk。 + +- [Nextcloud Talk][11] + +#### 4、Riot.im + +![][12] + +Riot.im(不久会更名)已经是 Slack [最好的开源替代品][13]之一。 + +它能让你可以创建社区、发送信息,并在一个小组/社区中开始视频会议。你可以通过任何可用的公共 [Matrix 服务器][14]来免费使用它。 + +如果你想要自己专用的去中心化的 Matrix 网络,你也可以在 [Modular.im][15] 上选择付费托管计划。 + +- [Riot.im][16] + +#### 5、BigBlueButton + +![][17] + +BigBlueButton 是一个有趣的开源视频会议方案,专门为线上学习打造。 + +如果你是老师或者经营着一个学校,你也许会想试试。虽然你可以免费试用,但免费演示使用会有一定的限制。所以,最好将其托管到自己的服务器上,并且,如果你有其他的产品/服务的话,你也可以把它整合进其中。 + +它提供了一套很好的功能,能让你很轻松的教学生。你可以浏览它的 [GitHub 页面][18]以了解更多信息。 + +- [BigBlueButton][19] + +#### 补充:Wire + +![][20] + +Wire 是一个十分流行的开源的安全消息平台,为商企用户量身打造。它也提供视频电话或者网络会议选项。 + +如果你想要一个为你的企业或团队提供的商业开源方案,你可以试试 Wire,并在试用 30 天后决定是否升级它。 + +就个人而言,我喜欢它的用户体验,但它是要付费的。所以我建议你决定之前,先试试看并浏览它的 [GitHub 页面][21]。 + +- [Wire][22] + +### 总结 + +现在你知道一些流行开源网络视频会议方案了,你更喜欢使用哪一个? + +我是否错过了任何你的最爱?请在下面的评论中告诉我你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-video-conferencing-tools/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[this-is-name-right](https://github.com/this-is-name-right) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/open-source-video-conferencing-tools.jpg?ssl=1 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-browser-screenshot.png?ssl=1 +[3]: https://itsfoss.com/jitsi-meet/ +[4]: https://meet.jit.si/ +[5]: https://jitsi.org/jitsi-meet/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/jami-screenshot.png?ssl=1 +[7]: https://git.jami.net/savoirfairelinux/ring-project +[8]: https://jami.net/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/nextcloud-talk.png?ssl=1 +[10]: https://itsfoss.com/nextcloud/ +[11]: https://nextcloud.com/talk/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/riot-communication-video.png?ssl=1 +[13]: https://itsfoss.com/open-source-slack-alternative/ +[14]: https://matrix.org/ +[15]: https://modular.im/ +[16]: https://about.riot.im/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/big-blue-button.png?ssl=1 +[18]: https://github.com/bigbluebutton/bigbluebutton +[19]: https://itsfoss.com/open-source-video-conferencing-tools/bigbluebutton.org/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/wire-video-conferencing.png?ssl=1 +[21]: https://github.com/wireapp +[22]: https://wire.com/en/ diff --git a/published/202007/20200714 My Linux story- breaking language barriers with open source.md b/published/202007/20200714 My Linux story- breaking language barriers with open source.md new file mode 100644 index 0000000000..53f2611c0a --- /dev/null +++ b/published/202007/20200714 My Linux story- breaking language barriers with open source.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12466-1.html) +[#]: subject: (My Linux story: breaking language barriers with open source) +[#]: via: (https://opensource.com/article/20/7/linux-bengali) +[#]: author: (Dr Anirban Mitra https://opensource.com/users/mitradranirban) + +我的 Linux 故事:用开源打破语言壁垒 +====== + +> 开源项目可以通过消除语言和其他障碍来帮着改变世界。 + +![](https://img.linux.net.cn/data/attachment/album/202007/29/230730e4mb18km1nwn4ibm.jpg) + +相较于我的许多同行和同事,我的开源之旅开始得着实很晚。 + +2000 年,我实现了我从高中开始的梦想 —— 买一台属于我自己的个人计算机,当时我正在攻读医学研究生学位。在那之前,我对计算机的唯一接触是偶尔在图书馆或网吧上网,当时这些地方电脑使用的收费都相当高昂。所以我省下了一部分研究生津贴,设法买了一台 Pentium III 550 Mhz、128MB 内存的电脑,并且像当时大多数印度电脑的标准配置一样,装着盗版的 Windows 98 系统。 + +我的宿舍房间上不了网。我不得不去附近的网吧,在那里下载软件,然后随身带着几十张软盘。 + +当我终于拥有了自己的计算机,我非常高兴,但有一点也让我感到困扰,那就是我无法用我的母语孟加拉语写东西。我碰到了 CDAC 提供的资源,CDAC 是一个政府机构,它提供的印度语言工具是基于 ISCII 的,ISCII 是一个较早的国家标准,而印度语的 Unicode 标准就是基于这个标准。很难学习它的键盘布局。 + +### 我的第一次贡献 + +不久后,我遇到了一款名叫 [Yudit][2] 的软件,它使用标准的 QWERTY 键盘布局来提供印地语的拼音输入。正是在通过 Yudit,我第一次遇到了诸如开源和自由软件、GNU 和 Linux 之类的术语。Yudit 也允许我把 UI 组件翻译成孟加拉语,当我将翻译提交给开发人员时,他很高兴地将它们合并到了下一个版本中,并在软件的 README 文件中称赞了我的功劳。 + +第一次看到一款应用程序的用户元素以我的母语呈现,我感到十分兴奋。此外,尽管对写代码的知识几乎为零,我依然能够为软件开发做出贡献。我继续为 Yudit 创建了一个从 ISCII 到 Unicode 的转换器,这个转换器还可以用于各种印度语言之间的直译。我还买了本 Linux 杂志,随刊附赠了一张 Knoppix 的免费 live CD,正是通过它我体验到了 Linux 桌面。 + +我面临的另一个问题是缺乏与 Unicode 兼容的 OpenType Bangla 字体。我使用的字体是共享软件,我需要为它支付许可费用。我在想,“为什么不尝试亲自开发呢?”在此过程中,我通过 bengalinux.org(后来更名为 Ankur 小组)接触到了分散在世界各地的孟加拉语使用者,他们正试图在 Linux 操作系统中使用孟加拉语。 + +我加入了他们的邮件列表,我们在内部与当局之间讨论了孟加拉语的 Unicode 和 OpenType 规范中的各种缺陷,然后在适当的时候进行了纠正。我的贡献是将传统的孟加拉字体转换为兼容 Unicode 的 OpenType 字体,翻译 UI 等。这个小组还发行了世界上第一张带有孟加拉语 UI 的 Live Linux CD。 + +2003 年,我搬家到了一个无法访问互联网的地方。我只有在周日去加尔各答时才能联系到小组。当时,Linux 的孟加拉语本地化已经成为了主流。我们的一些志愿者加入了 Red Hat 从事翻译和字体开发工作。我也忙于我的医疗工作,几乎没时间去进行开源开发。 + +如今,我觉得使用 Linux 做日常工作比其他任何操作系统都要舒服。我也为能与一个能让人们用自己的语言交流的项目联系在一起而感到自豪。它也为长期以来由于不会说英语而被认为处于“数字鸿沟digital divide”另一端的人们带来了计算能力。孟加拉语实际上是世界上使用最广泛的语言之一,这个项目消除了全球人口中很大一部分人接触数字科技的主要语言壁垒。 + +### 加入开源 + +加入到开源运动中来很容易。主动做一些对自己有用的事情,然后思索一下所做的事情如何能对他人也有帮助。关键在于使它免费可用,它可以给世界带来难以估量的价值。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/linux-bengali + +作者:[Dr Anirban Mitra][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy ) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mitradranirban +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/india-globe-map.jpg?itok=6sSEL5iO (India on the globe) +[2]: http://www.yudit.org/ diff --git a/published/202007/20200715 What-s the difference between DevSecOps and agile software development.md b/published/202007/20200715 What-s the difference between DevSecOps and agile software development.md new file mode 100644 index 0000000000..38b9f14c28 --- /dev/null +++ b/published/202007/20200715 What-s the difference between DevSecOps and agile software development.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (windgeek) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12449-1.html) +[#]: subject: (What's the difference between DevSecOps and agile software development) +[#]: via: (https://opensource.com/article/20/7/devsecops-vs-agile) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +DevSecOps 和敏捷软件开发有什么不同? +====== + +> 你更专注于安全性还是软件交付,还是可以两者兼得? + +![](https://img.linux.net.cn/data/attachment/album/202007/24/225337mb44xoe2byvz4x4o.jpg) + +技术社区中存在一种趋势,经常互换地使用 DevSecOps 和敏捷软件开发这两个术语。尽管它们有一些相似性,例如都旨在更早地检测风险,但在改变团队的[工作方式层面有很大不同][2]。 + +DevSecOps 建立在敏捷开发建立的一些原则上。但是,DevSecOps 特别专注于[集成安全功能][3],而敏捷开发则专注于交付软件。 + +知道如何保护你们的网站或应用程序免受勒索程序和其他威胁的侵害,实际上取决于你使用的软件和系统开发。这可能会影响你选择使用 DevSecOps、敏捷软件开发还是两者兼而有之。 + +### DevSecOps 和敏捷软件开发的不同之处 + +两者的主要区别可以归结为一个简单的概念:安全性。这取决于你的软件开发实践,你们公司的安全措施 —— 以及何时、何地以及由谁实施,都可能会有很大不同。 + +每个企业都[需要 IT 安全][4]来保护其重要数据。如果企业真正重视 IT 安全,一般都会采取虚拟专用网(VPN)、数字证书、防火墙保护、多因子身份验证、安全的云存储,包括向员工介绍基本的网络安全措施。 + +当你信任 DevSecOps 时,你就会把公司的安全问题,本质上使其等同于持续集成和交付。 DevSecOps 方法论在开发之初就强调安全性,并使其成为整体软件质量不可或缺的组成部分。 + +基于 DevSecOps 安全性的三大原则: + + * 平衡用户访问难易程度及数据安全性 + * 使用 VPN 和 SSL [加密数据][5]可防止数据在传输过程中受到入侵者的攻击 + * 使用可以扫描新代码的安全漏洞并能通知开发人员该漏洞的工具来预测防范未来的风险 + +尽管 DevOps 一直打算包含安全性,但并非每个实践 DevOps 的组织都牢记这一点。DevSecOps 在 DevOps 的演进形式中,可以提供更加清晰的信息。尽管它们的名称相似,但这两个[不应混淆] [6]。在 DevSecOps 模型中,安全性是团队的主要驱动力。 + +同时,敏捷开发更专注于迭代开发周期,这意味着反馈意见会不断融入到持续的软件开发中。[敏捷的关键原则][7]是拥抱不断变化的环境,为客户和使用者提供竞争优势,让开发人员和利益相关者紧密合作,并在整个过程中始终保持关注技术卓越,以提升效率。换句话说,除非敏捷团队在其定义中包括安全性,否则安全性在敏捷软件开发中算是事后思考。 + +### 国防机构面临的挑战 + +如果要说专门致力于最大程度地提高安全性的组织,美国国防部(DoD)就是其中之一。在 2018 年,美国国防部发布了针对软件开发中的“假敏捷”或“以敏捷为名”的[指南][8]。该指南旨在警告美国国防部高管注意不良编程的问题,并说明如何发现它以避免风险。 + +使用这些方法不仅可以使美国国防部受益。医疗保健和金融部门也[保存着][9]必须保证安全的大量敏感数据。 + +美国国防部通过其现代化战略(包括采用 DevSecOps)来改变防范形式至关重要。尤其在这个连美国国防部容易受到黑客攻击和数据泄露的时代,这一点在 2020 年 2 月的[大规模数据泄露][10]中已经得到了证明。 + +将网络安全最佳实践转化为现实生活中的开发仍然还存在固有的风险。事情不可能 100% 完美地进行。最好的状况是稍微有点不舒服,最坏的情况下,它们可能会带来全新的风险。 + +开发人员,尤其是那些为军用软件编写代码的开发人员,可能对[所有应该采用 DevSecOps 的情境][11]没有透彻的了解。学习曲线会很陡峭,但是为了获得更大的安全性,必须承受这些必不可少的痛苦。 + +### 自动化时代的新模式 + +为了解决对先前安全措施日益增长的担忧,美国国防部承包商已开始评估 DevSecOps 模型。关键是将该方法论部署到持续的服务交付环境中。 + +应对这个问题,出现了三个方向。第一种涉及到自动化,自动化已在大多数隐私和安全工具中[广泛使用][12],包括 VPN 和增强隐私的移动操作系统。大型云基础架构中的自动化无需依赖于人为的检查和平衡,可以自动处理持续的维护和进行安全评估。 + +第二种专注于对于过渡到 DevSecOps 很重要的安全检查点。而传统上,系统设计初期对于数据在各个组件之间移动时依旧可以访问是不做期望的。 + +第三种也是最后一种涉及将企业方式用于军用软件开发。国防部的许多承包商和雇员来自商业领域,而不是军事领域。他们的背景为他们提供了为大型企业[提供网络安全][13]的知识和经验,他们可以将其带入政府部门职位中。 + +### 值得克服的挑战 + +转向基于 DevSecOps 的方法论也提出了一些挑战。在过去的十年中,许多组织已经完全重新设计了其开发生命周期,以适应敏捷开发实践,在不久之后进行再次转换看起来令人生畏。 + +企业应该安下心来,因为即使美国国防部也遇到了这种过渡带来的麻烦,他们在应对推出新流程使得商业技术和工具广泛可用的挑战上并不孤独。 + +展望一下未来,其实切换到 DevSecOps 不会比切换到敏捷软件开发更痛苦。而且通过将[创建安全性的价值][4]添加到开发工作流程中,以及利用现有敏捷开发的优势,企业可以获得很多收益。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/devsecops-vs-agile + +作者:[Sam Bocetta][a] +选题:[lujun9972][b] +译者:[windgeek](https://github.com/windgeek) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devops_confusion_wall_questions.png?itok=zLS7K2JG (Brick wall between two people, a developer and an operations manager) +[2]: https://tech.gsa.gov/guides/understanding_differences_agile_devsecops/ +[3]: https://www.redhat.com/en/topics/devops/what-is-devsecops +[4]: https://www.redhat.com/en/topics/security +[5]: https://surfshark.com/blog/does-vpn-protect-you-from-hackers +[6]: https://www.infoq.com/articles/evolve-devops-devsecops/ +[7]: https://enterprisersproject.com/article/2019/9/agile-project-management-explained +[8]: https://www.governmentciomedia.com/defense-innovation-board-issues-guide-detecting-agile-bs +[9]: https://www.redhat.com/en/solutions/financial-services +[10]: https://www.military.com/daily-news/2020/02/25/dod-agency-suffers-data-breach-potentially-compromising-ssns.html +[11]: https://fcw.com/articles/2020/01/23/dod-devsecops-guidance-williams.aspx +[12]: https://privacyaustralia.net/privacy-tools/ +[13]: https://www.securitymagazine.com/articles/88301-cybersecurity-is-standard-business-practice-for-large-companies diff --git a/published/202007/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md b/published/202007/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md new file mode 100644 index 0000000000..a3e48b4bb3 --- /dev/null +++ b/published/202007/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12446-1.html) +[#]: subject: (Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible!) +[#]: via: (https://itsfoss.com/ubuntu-19-10-end-of-life/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Ubuntu 19.10 产品寿命结束,尽快升级到 Ubuntu 20.04! +====== + +> Ubuntu 19.10 Eoan Ermine 产品寿命结束。这意味着它不会获得任何安全或维护更新。继续使用 Ubuntu 19.10 将很危险,因为你的系统将来可能会因为缺少安全更新而变得脆弱。你应该升级到 Ubuntu 20.04。 + +[2019 年 10 月发布的 Ubuntu 19.10][1] 带来了一些为 [Ubuntu 20.04][2] 做准备的新功能。 + +作为非 LTS 版本,它有 9 个月的寿命。截至 2020 年 7 月 17 日,它的生命周期结束,并不会再收到任何更新。 + +### Ubuntu 19.10 生命周期结束 + +![][3] + +我之前已经[详细解释了 Ubuntu 的发布周期和产品寿命结束][4]。如果此后继续使用 Ubuntu 19.10,我会重申这对你和你的系统意味着什么。 + +[软件通常有预定义的生命周期][5],一旦软件版本到达生命周期结束,它将停止获取更新和支持。生命周期结束后,Ubuntu 19.10 不再会从 Ubuntu 获得系统更新、安全更新或应用更新。 + +如果你继续使用它,你的系统可能会成为潜在的网络攻击的受害者,因为黑客往往会利用脆弱的系统。 + +之后,你可能无法使用 `apt` 命令安装新软件,因为 Ubuntu 将归档 19.10 的仓库。 + +### 如果你使用的是 Ubuntu 19.10,该怎么办? + +首先,[检查你使用的 Ubuntu 版本][6]。这可以在终端中输入此命令完成: + +``` +lsb_release -a +``` + +``` +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 19.10 +Release: 19.10 +Codename: Eoan +``` + +如果你看到 Ubuntu 19.10,你应该做以下两项工作之一: + +* 如果你有良好、稳定的互联网连接,从 Ubuntu 19.10 升级到 20.04。你的个人文件和大多数软件保持不变。 +* 如果你有着缓慢或不稳定的互联网连接,你应该[全新安装的 Ubuntu 20.04][7]。你的文件和磁盘上的所有内容将被擦除,因此你应该在外部磁盘上备份重要数据。 + +#### 如何从 19.10 升级到 20.04 (如果你有良好的互联网连接) + +我之前已经详细讨论了 Ubuntu 版本升级。我会在这里快速说下步骤。 + +首先,请确保在“软件和更新”中已设置接收新版本通知。 + +进入“软件和更新”: + +![][8] + +进入“更新”选项卡,将“通知我新的 Ubuntu 版本”设置为“对于任何新版本”: + +![][9] + +现在,安装所有挂起的更新。 + +现在,再次运行更新管理器工具。你应该可以选择升级到 Ubuntu 20.04。点击升级按钮并按照说明操作。 + +它会安装大约 1.2GB 的软件包。这就是为什么你需要一个良好和稳定的互联网连接。 + +![][10] + +这样的升级会保持你的家目录。不过,仍建议在外部磁盘进行备份。 + +### 你仍在使用 Ubuntu 19.10 吗? + +如果你仍在使用 Ubuntu 19.10,那么必须为升级或全新安装做好准备。你不能忽视它。 + +如果你不喜欢这样的频繁版本升级,你应该使用支持五年的 LTS 版本。当前的 LTS 版本是 Ubuntu 20.04,你无论如何都应该升级到它。 + +你是否正在使用 Ubuntu 19.10?你是否已升级到 Ubuntu 20.04?如果你面临任何问题,或者如果你有任何问题,请让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-19-10-end-of-life/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-19-10-released/ +[2]: https://itsfoss.com/download-ubuntu-20-04/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/ubuntu-19-10-end-of-life.jpg?ssl=1 +[4]: https://itsfoss.com/end-of-life-ubuntu/ +[5]: https://en.wikipedia.org/wiki/Systems_development_life_cycle +[6]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[7]: https://itsfoss.com/install-ubuntu/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/03/upgrade-ubuntu-1.jpeg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/11/software-update-any-new-version.jpeg?resize=800%2C378&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updater-focal.jpg?ssl=1 diff --git a/published/202007/20200720 Why People Are Crazy About Arch Linux- What-s so Special About it.md b/published/202007/20200720 Why People Are Crazy About Arch Linux- What-s so Special About it.md new file mode 100644 index 0000000000..5f4ad27495 --- /dev/null +++ b/published/202007/20200720 Why People Are Crazy About Arch Linux- What-s so Special About it.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (Mikedkmilk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12445-1.html) +[#]: subject: (Why People Are Crazy About Arch Linux? What’s so Special About it?) +[#]: via: (https://itsfoss.com/why-arch-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +为什么人们对 Arch Linux 如此着迷?它有什么特别之处? +====== + +顺便说一句(利益相关),我用 Arch! + +你或许已经在 Linux 论坛、朋友相互讨论或表情包里看到过这个术语。 + +你可能想知道为什么 Arch Linux 如此受欢迎,为什么人们这么喜欢它?因为有更容易使用,甚至更好的[基于 Arch 的发行版][1]。 + +在本文中,我将列出 Linux 用户喜欢使用 [Arch Linux][2] 的一些原因。 + +### 人们喜欢使用 Arch Linux 的六个原因 + +![][3] + +这些只是我的看法,当然,为什么你应该使用 Arch Linux 并没有固定的原因。这是我在十多年里与 Linux 用户和社区打交道的经验中观察到的。 + +让我们一起看看为什么 Arch Linux 如此受欢迎。 + +#### 1、DIY 的方式可以让你掌控操作系统的各个方面 + +我一直认为 Arch Linux 是一个可以让你自己动手打造的操作系统。从安装到管理,Arch Linux 放手让你处理一切。 + +你可以自己决定使用哪种桌面环境、安装哪些组件和服务。这种精细化的控制能够赋予你一个精简的操作系统,可以让你自由选择所需的组件来构建属于你自己的系统。 + +如果你是一个 DIY 爱好者,你会喜欢 Arch Linux 的。 + +#### 2、通过 Arch Linux,可以更好地理解 Linux 的工作原理 + +![Installing Arch Linux by creating partition and making filesystem via command line][4] + +如果你曾经尝试过安装 Arch Linux,你就会知道它的复杂性。 + +但这种复杂性同时也意味着你将被迫学习一些在其他发行版中可能永远不会费心学习的东西。 + +比如说在安装 Arch Linux 过程中配置网络本身就是一个很好的学习课程。 + +如果开始你有感到有困惑不懂的时候,Arch Linux 的[维基][5]可以帮助你。它是互联网上最广泛和最棒的由社区管理的文档。仅仅只是浏览 Arch Linux 的维基,就可以学到很多东西。 + +#### 3、滚动发行模式可以为你提供最新的内核和软件 + +![System update in Arch Linux][6] + +Arch Linux 是一个滚动发行版,这意味着新的内核和应用程序版本一经发布,就会立即向你推送。 + +当大多数其他 [Linux 发行版还在提供旧的 Linux 内核版本][7]时,Arch 会迅速向你提供最新的内核。 + +而软件也是如此。如果 Arch 资源库中的软件发布了新版本,Arch 用户通常会比其他用户先获得新版本。 + +在滚动发行模式下,一切都是新鲜和前沿的。你不必把操作系统从一个版本升级到另一个版本,只要使用 [pacman 命令][8],你会始终保持最新的版本。 + +#### 4、Arch 用户资源库,即 AUR + +![][9] + +Arch Linux 的资源库中有大量的软件。AUR 扩展了 Arch Linux 的软件产品。在 Arch Linux 中,你可以通过 [AUR][10] 得到相当多的软件。 + +AUR 是采用社区驱动的方式来提供更新的应用程序。你可以在 [AUR 辅助工具][11]的帮助下搜索和安装应用程序。 + +#### 5、成就感 + +![][12] + +正如 James Clear 在他的书《原子习惯Atomic Habits》中提到的那样,**人类的大脑喜欢挑战,但前提是在一个最理想的困难区域**。 + +还记得你第一次安装成功 Linux 时的感觉吗?即便你安装的是 Linux Mint。这给了你一种成就感:你成功安装了 Linux! + +如果你已经使用 Ubuntu、Fedora 或其他发行版一段时间了,现在开始感到舒适(或厌倦),你可以尝试安装一下 Arch Linux。 + +对于一个有一定经验的 Linux 用户来说,[成功安装 Arch Linux][13]本身就会给你一种成就感。 + +这是一个挑战,但却是可以实现的。如果你建议一个新的 Linux 用户尝试 Arch Linux 或者更复杂的 Linux 发行版比如 [Linux From Scratch(LFS)][14],这个挑战就太难实现了。 + +这种成功完成挑战的感觉也是人们使用 Arch Linux 的原因之一。 + +#### 6、没有企业的参与!Arch 是由社区创建、支持和拥有的 + +Ubuntu 由 Canonical 支持,Fedora 来自 Red Hat(现在是 IBM 的一部分),openSUSE 来自 SUSE。所有这些主流发行版都是企业支持的。 + +这本身并不是坏事或过错,但是有一些人不喜欢企业参与开源项目。 + +正如 Debian 一样,Arch Linux 是为数不多的仅由社区参与的 Linux 发行项目之一。 + +你可能会指出,许多其他发行版如 Linux Mint 等不是由企业赞助的。好吧,这可能是真的,但 Linux Mint 本身就是基于 Ubuntu 的,并且使用 Ubuntu 的资源库。而 Arch Linux 不是另一个发行版的衍生物。 + +从这个意义上说,[Debian][15] 和 Arch Linux 是更纯粹的社区驱动项目。这对很多人来说可能无关紧要,但确实有一些人在意这些事情。 + +#### 对你来说,为什么 Arch Linux 如此受欢迎? + +现在你可能不同意我提出的所有观点,那没关系。我想知道你是怎么看待 Arch Linux 在 Linux 用户中如此受欢迎,并具有崇拜的地位的? + +当你写评论时,让我分享一下“我用 Arch”的表情包 :) + +![](https://scontent-fml2-1.xx.fbcdn.net/v/t1.0-0/p526x296/109618601_1759578370849589_736435313539592753_o.jpg?_nc_cat=100&_nc_sid=8024bb&_nc_ohc=MYp_pidAMBMAX8z24Mc&_nc_ht=scontent-fml2-1.xx&_nc_tp=6&oh=9c2bf18b620cf90edb2dd32625b03b41&oe=5F3E8F39) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/why-arch-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[Mikedkmilk](https://github.com/Mikedkmilk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/arch-based-linux-distros/ +[2]: https://www.archlinux.org/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/why-arch-linux.jpg?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/efi_system_partition-1.png?ssl=1 +[5]: https://wiki.archlinux.org/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-Syu.png?ssl=1 +[7]: https://itsfoss.com/why-distros-use-old-kernel/ +[8]: https://itsfoss.com/pacman-command/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/01/AUR.png?resize=800%2C451&ssl=1 +[10]: https://itsfoss.com/aur-arch-linux/ +[11]: https://itsfoss.com/best-aur-helpers/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/installed-arch-linux.png?ssl=1 +[13]: https://itsfoss.com/install-arch-linux/ +[14]: http://www.linuxfromscratch.org/ +[15]: https://www.debian.org/ diff --git a/published/202007/20200727 Getting started as an open source builder and more industry trends.md b/published/202007/20200727 Getting started as an open source builder and more industry trends.md new file mode 100644 index 0000000000..769f5a9af1 --- /dev/null +++ b/published/202007/20200727 Getting started as an open source builder and more industry trends.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12461-1.html) +[#]: subject: (Getting started as an open source builder and more industry trends) +[#]: via: (https://opensource.com/article/20/7/open-source-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:开源建设者入门,以及更多的行业趋势 +====== + +> 每周关注开源社区和行业趋势。 + +![](https://img.linux.net.cn/data/attachment/album/202007/28/175317mgsvgtvstvcggsch.jpg) + +我在一家采用开源软件开发模型的企业软件公司任高级产品营销经理,我的一部分职责是为产品营销人员、经理和其他相关人定期发布有关开源社区、市场和业界发展趋势的更新。以下是该更新中我和他们最喜欢的五篇文章。 + +### 《[开放源码建设者:入门][2]》 + +> "最后,我发现自己想要自己修改代码,"Liz 说。她的第一个贡献是为 Django 框架做了一个授权扩展。她补充说:"我记得当时我很担心维护者可能不希望一个完全陌生的人做的改动,所以当它被接受时,我感到很兴奋,也很欣慰……得到认可,甚至感谢你的贡献,这种感觉总是很好。" + +**分析:** 这一系列对开源维护者的采访(引自 [Liz Rice][3])交汇了跳入开源领域的动机和经验。这也是对天才独狼开发者神话的一个点赞,你可以自己走很远的路,但如果你知道如何与其他人很好地合作,你会走得更远,建立更好的东西。如果你知道如何说服和激励他们,你会走得更远。 + +### 《[Fluent Bit v1.5:轻量级和高性能日志处理器][4]》 + +> 本次主要版本的最大亮点之一是不同公司与 Fluent Bit 核心维护者的联合工作,为 Google、Amazon、LogDNA、New Relic 和 Sumo Logic 等公司内部提供的可观察性云服务带来了改进和新的连接器。 + +**分析:** “从不同来源收集数据/日志,统一并将其发送到多个目的地”是一项繁琐的任务,但这是超大规模企业及其客户共同的任务。证据 A:一个开源工作完全如其预期的典型例子。祝贺 Fluent Bit 团队的这次发布! + +### 《[Kubernetes 如何让 Nubank 工程师每周部署 700 次][5]》 + +> 因此,生产环境的部署时间从 90 分钟变成了 15 分钟。而 Nobre 说,这是“最主要的好处,因为它有助于开发人员的体验”。如今,Nubank 的工程师每周部署 700 次。“对于一家银行来说,你会说这太疯狂了,”Capaverde 笑着说。“但这并不疯狂,因为有了 Kubernetes 和金丝雀部署,回滚变化更容易,因为部署速度也更快。人们的出货频率更高,更有信心。” + +**分析:** 我觉得这是个赢家,也是个输家。当然,他们降低了做出改变的成本,以一种让人们更有信心去尝试的方式。但他们的开发人员不能再在等待部署完成的同时跑 10 公里,现在只能在一次 TED 演讲中凑合。 + +希望你喜欢这个列表,下周再见。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/open-source-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://idk.dev/open-source-builders-getting-started/ +[3]: https://twitter.com/lizrice +[4]: https://www.cncf.io/blog/2020/07/14/fluent-bit-v1-5-lightweight-and-high-performance-log-processor/ +[5]: https://www.cncf.io/blog/2020/07/10/how-kubernetes-empowered-nubank-engineers-to-deploy-200-times-a-week/ diff --git a/published/202007/20200730 Defining cloud native, expanding the ecosystem, and more industry trends.md b/published/202007/20200730 Defining cloud native, expanding the ecosystem, and more industry trends.md new file mode 100644 index 0000000000..d5a52e2a1b --- /dev/null +++ b/published/202007/20200730 Defining cloud native, expanding the ecosystem, and more industry trends.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12473-1.html) +[#]: subject: (Defining cloud native, expanding the ecosystem, and more industry trends) +[#]: via: (https://opensource.com/article/20/7/cloud-native-expanding-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:定义云原生、拓展生态系统,以及更多的行业趋势 +====== + +> 每周关注开源社区和行业趋势。 + +![](https://img.linux.net.cn/data/attachment/album/202007/31/235751f5zd9l3rejd2tjss.jpg) + +我在一家采用开源软件开发模型的企业软件公司任高级产品营销经理,我的一部分职责是为产品营销人员、经理和其他相关人定期发布有关开源社区、市场和业界发展趋势的更新。以下是该更新中我和他们最喜欢的几篇文章。 + +### 《随着云原生计算的兴起,它和代码一样在改变文化》 + +- [文章链接][2] + +> 现在是围绕一套云原生计算的共同原则进行行业整合的时候了,因为许多企业已经意识到,他们最初进入云计算的回报有限。国际数据公司去年的一项调查发现,[80% 的受访者曾将工作负载从公有云环境遣返到企业内部][3],平均而言,他们预计在未来两年内将一半的公有云应用转移到私有场所。 + +**分析**:在云端的第一次运行主要是大量的“提升和转移”尝试,以提取工作负载并将其投放到云端。第二次运行将涉及更多的工作,以确定转移什么以及如何转移,但随着开发人员对理所当然的事情越来越满意,最终应该会带来更多价值。 + +### 《为什么云原生基础设施的自动化是所有参与者的胜利》 + +- [文章链接][4] + +> 开发的圣杯是创建和维护安全的应用程序,产生强大的投资回报率和满意的客户。但如果这种开发不是高效、高速和可扩展的,那么这个圣杯很快就会变得遥不可及。如果你发现自己对当前的基础设施有更高的期望,那么可能是时候考虑云原生了。它不仅可以检查所有这些机器,而且为云原生基础设施进行自动化可以提高效率和结果。 + +**分析**:我还要补充一点,如果没有大量的自动化,真正采用云原生方法是不可能的;涉及的移动部件数量太多,不可能用人的头脑来处理。 + +### 《Linkerd 案例研究:满足安全要求、减少延迟和从 Istio 迁移》 + +- [文章链接][5] + +> 最后,Subspace 分享了其使用 Linkerd 提供“光速”多人游戏的经验。虽然在超低延迟环境中使用服务网状物起初似乎有悖常理,但 Subspace 发现 Linkerd 的战略使用实际上降低了总延迟 —— 服务网状物是如此轻巧,以至于它增加的最小延迟被它通过可观察性降低的延迟所掩盖。简而言之,Linkerd 的这一独特用例使 Subspace 在运营结果上获得了巨大的净收益。[阅读完整的用户故事][6]。 + +**分析**:我听说过这样一个观点:你并不能真正降低一个系统的复杂性,你只是把它抽象化,改变它的接触对象。似乎对延迟也有类似的观察:如果你仔细选择你接受延迟的地方,你可以因此减少系统中其他地方的延迟。 + +### 一位高层管理人员解释了 IBM 的“重要支点”,以赢得开发者、初创企业和合作伙伴的青睐,这是其从微软等竞争对手手中赢得混合云市场计划的一部分 + +- [文章链接][7] + +> 蓝色巨人正在转向一个新的战略,专注于建立一个由开发者、合作伙伴和初创公司组成的生态系统。“我们的服务组织无法接触到所有客户。获取这些客户的唯一方法是激活一个生态系统。” + +**分析**:越来越多的公司开始接受这样的理念:有些客户的问题,他们没有帮助就无法解决。也许这可以减少从每个单独客户身上赚到的钱,因为它扩大了更广泛地参与更多问题空间的机会。 + +希望你喜欢这个列表,下周再见。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/cloud-native-expanding-and-more-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://siliconangle.com/2020/07/18/cloud-native-computing-rises-transforming-culture-much-code/ +[3]: https://www.networkworld.com/article/3400872/uptick-in-cloud-repatriation-fuels-rise-of-hybrid-cloud.html +[4]: https://thenewstack.io/why-automating-for-cloud-native-infrastructures-is-a-win-for-all-involved/ +[5]: https://www.cncf.io/blog/2020/07/21/linkerd-case-studies-meeting-security-requirements-reducing-latency-and-migrating-from-istio/ +[6]: https://buoyant.io/case-studies/subspace/ +[7]: https://www.businessinsider.com/ibm-developers-tech-ecosystem-red-hat-hybrid-cloud-bob-lord-2020-7?r=AU&IR=T diff --git a/published/202007/20200731 Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released.md b/published/202007/20200731 Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released.md new file mode 100644 index 0000000000..c5b64697b1 --- /dev/null +++ b/published/202007/20200731 Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12471-1.html) +[#]: subject: (Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released) +[#]: via: (https://itsfoss.com/nano-5-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +适于初学者的基于终端的文本编辑器 GNU Nano 5.0 版发布 +====== + +> 开源文本编辑器 GNU nano 已经达到了 5.0 版本的里程碑。看看这个新版本带来了哪些功能。 + +Linux 上有很多[基于终端的文本编辑器][1]。像 Emacs 和 Vim 这样的编辑器需要经历陡峭的学习曲线和掌握一堆不寻常的键盘快捷键,但公认 GNU nano 更容易使用。 + +也许这就是为什么 Nano 是 Ubuntu 和许多其他发行版中默认的基于终端的文本编辑器的原因,而即将发布的 [Fedora 33 版本][2]也将把 Nano 设置为终端的默认文本编辑器。 + +### GNU nano 5.0 的新功能 + +![][3] + +在 GNU nano 5.0 的[变更日志][4]中提到的一些主要亮点是: + +* `-indicator` 选项将在屏幕右侧显示一种滚动条,以指示视口在缓冲区中的位置和覆盖范围。 +* 可以用 `Alt+Insert` 键标记行,你可以用 `Alt+Page` 和 `Alt+PageDown` 键跳转到这些标记的行。 +* 执行命令提示符现在可以直接从主菜单中访问。 +* 在支持至少 256 种颜色的终端上,有新的颜色可用。 +* 新的 `-bookstyle` 模式,任何以空格开头的行都会被认为是一个段落的开始。 +* 用 `^L` 刷新屏幕现在在每个菜单中都可以使用。它还会将行与光标居中。 +* 可绑定函数 `curpos` 已经改名为 `location`,长选项 `-tempfile` 已经改名为 `-saveonexit`,短选项 `-S` 现在是 `-softwrap` 的同义词。 +* 备份文件将保留其组的所有权(如果可能的话)。 +* 数据会在显示 “……行写入” 之前同步到磁盘。 +* 增加了 Markdown、Haskell 和 Ada 语法的支持。 + +### 获取 GNU nano 5.0 + +目前 Ubuntu 20.04 中的 nano 版本是 4.8,而在这个 LTS 版本中,你不太可能在短时间内获得新版本。如果 Ubuntu 有新版本的话,你应该会通过系统更新得到它。 + +Arch 用户应该会比其他人更早得到它,就像往常一样。其他发行版也应该迟早会提供新版本。 + +如果你是少数喜欢[从源代码安装软件][5]的人,你可以从它的[下载页面][6]中获得。 + +如果你是新手,我强烈推荐这篇 [Nano 编辑器初学者指南][1]。 + +你喜欢这个新版本吗?你期待使用 Nano 5 吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/nano-5-release/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/nano-editor-guide/ +[2]: https://itsfoss.com/fedora-33/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/09/Nano.png?ssl=1 +[4]: https://www.nano-editor.org/news.php +[5]: https://itsfoss.com/install-software-from-source-code/ +[6]: https://www.nano-editor.org/download.php diff --git a/published/20200706 Set up Vim as your Rust IDE.md b/published/20200706 Set up Vim as your Rust IDE.md new file mode 100644 index 0000000000..24d86798e8 --- /dev/null +++ b/published/20200706 Set up Vim as your Rust IDE.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12530-1.html) +[#]: subject: (Set up Vim as your Rust IDE) +[#]: via: (https://opensource.com/article/20/7/vim-rust-ide) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +将 Vim 设置为 Rust IDE +====== + +> Vim 编辑器是很好的 Rust 应用开发环境。 + +![Ferris the crab under the sea, unofficial logo for Rust programming language][1] + +[Rust][2] 语言旨在以 C++ 开发人员熟悉的方式实现具有安全并发性和高内存性能的系统编程。它也是 [Stack Overflow 的 2019 年开发人员调查][3]中最受欢迎的编程语言之一。 + +文本编辑器和[集成开发环境(IDE)工具][4]使编写 Rust 代码更加轻松快捷。有很多编辑器可供选择,但是我相信 [Vim 编辑器][5]非常适合作为 Rust IDE。在本文中,我将说明如何为 Rust 应用开发设置 Vim。 + +### 安装 Vim + +Vim 是 Linux 和 Unix 中最常用的命令行文本编辑器之一。最新版本(在编写本文时)是 [8.2][6],它在使用方式上提供了前所未有的灵活性。 + +[Vim 的下载页面][7]提供了多种二进制或软件包形式安装。例如,如果使用 macOS,那么可以安装 [MacVim][8] 项目,然后通过[安装 Vim 插件][9] 扩展 Vim 的功能。 + +要设置 Rust 进行开发,请下载 [Rustup][10],这是一个方便的 Rust 安装器工具,并在你的终端上运行以下命令(如果你使用 macOS、Linux 或任何其他类 Unix 系统): + +``` +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +在提示中选择安装选项。然后,你将看到如下输出: + +``` +stable installed - rustc 1.43.1 (8d69840ab 2020-05-04) + +Rust is installed now. Great! + +To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH +environment variable. Next time you log in this will be done +automatically. + +To configure your current shell run source $HOME/.cargo/env +``` + +### 语法高亮 + +Vim 能让你通过 `.vimrc` 文件配置你的运行时环境。要启用语法高亮,请打开 `.vimrc` 文件(如果不存在就创建一个): + +``` +$ vim ~/.vimrc +``` + +在 `.vimrc` 中添加以下内容并保存: + +``` +filetype plugin indent on +syntax on +``` + +第一行同时打开检测、插件和缩进配置。第二行启用语法高亮。这些功能将帮助你在 Rust 中管理开发流程。在 Vim 的[帮助文件][11]中了解更多信息。 + +### 在 Vim 中创建一个 Rust 应用 + +要使用 Vim 创建一个新的 Rust HelloWorld 应用(`hello.rs`),请输入: + +``` +$ vim hello.rs +``` + +输入以下 Rust 代码在控制台中打印 `Hello World!`: + +``` +fn main() { +   println!("Hello World"); +} +``` + +它看起来应该像这样: + +![Rust code with syntax highlighting][12] + +没有语法高亮的样子如下: + +![Rust code without syntax highlighting][14] + +你是否注意到 Vim 自动缩进和组织代码?那是因为你在 `.vimrc` 文件中输入了第一行。 + +很好!接下来,你将使用 Rust 的包管理器 [Cargo][15] 构建此应用。 + +### Cargo 集成 + +Cargo 使创建应用更加容易。要查看操作方法,请创建一个基于 Cargo 的 HelloWorld 应用。如果你尚未在 Linux 或 macOS 系统上安装 Cargo,请输入: + +``` +$ curl https://sh.rustup.rs -sSf | sh +``` + +然后使用 Cargo 创建包: + +``` +$ cargo new my_hello_world +``` + +如果查看目录结构,你会看到 Cargo 自动生成一些源码和目录。如果你安装了 `tree`,请运行它查看目录结构: + +``` +$ tree my_hello_world +my_hello_world +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 2 files +``` + +在 Vim 中打开 `main.rs` 源码文件: + +``` +$ vim my_hello_world/src/main.rs +``` + +它与你在上面手动创建的 HelloWorld 示例中的代码相同。用 `Rust with Vim` 代替 `World`: + +``` + fn main() { +      println!("Hello, Rust with Vim"); + } +``` + +使用 `:wq` 保存更改并退出 Vim。 + +### 编译你的应用 + +现在你可以使用 `cargo build` 编译你的第一个 Rust 应用: + + +``` +$ cd my_hello_world +$ cargo build +``` + +你的终端输出将类似于以下内容: + +``` +   Compiling my_hello_world v0.1.0 (/Users/danieloh/cloud-native-app-dev/rust/my_hello_world) + +    Finished dev [unoptimized + debuginfo] target(s) in 0.60s +``` + +你可能会看到一条警告消息,因为你重用了示例包名 `my_hello_world`,但现在可以忽略它。 + +运行应用: + +``` +$ target/debug/my_hello_world +Hello, Rust with Vim! +``` + +你也可以使用 `cargo run` 一次构建和运行应用: + +``` +$ cargo run +  +    Finished dev [unoptimized + debuginfo] target(s) in 0.00s +     Running `target/debug/my_hello_world` +Hello, Rust with Vim!! +``` + +恭喜!你在本地的 Vim 编辑器中设置了 Rust IDE,开发了第一个 Rust 应用,并使用 Cargo 包管理器工具构建、测试和运行了它。如果你想学习其他 Cargo 命令,请运行 `cargo help`。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/vim-rust-ide + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rust_programming_crab_sea.png?itok=2eWLz8A5 (Ferris the crab under the sea, unofficial logo for Rust programming language) +[2]: https://www.rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://en.wikipedia.org/wiki/Integrated_development_environment +[5]: https://opensource.com/resources/what-vim +[6]: https://github.com/vim/vim +[7]: https://www.vim.org/download.php +[8]: https://github.com/macvim-dev/macvim +[9]: https://opensource.com/article/20/2/how-install-vim-plugins +[10]: https://rustup.rs/ +[11]: http://vimdoc.sourceforge.net/htmldoc/filetype.html#:filetype-overview +[12]: https://opensource.com/sites/default/files/uploads/rust_helloworld.png (Rust code with syntax highlighting) +[13]: https://creativecommons.org/licenses/by-sa/4.0/ +[14]: https://opensource.com/sites/default/files/uploads/rust_helloworld_no-syntax.png (Rust code without syntax highlighting) +[15]: https://opensource.com/article/20/3/rust-cargo diff --git a/published/20200710 Use DNS over TLS.md b/published/20200710 Use DNS over TLS.md new file mode 100644 index 0000000000..9b55039cf6 --- /dev/null +++ b/published/20200710 Use DNS over TLS.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12483-1.html) +[#]: subject: (Use DNS over TLS) +[#]: via: (https://fedoramagazine.org/use-dns-over-tls/) +[#]: author: (Thomas Bianchi https://fedoramagazine.org/author/thobianchi/) + +使用 DNS over TLS +====== + +![][1] + +现代计算机用来在互联网种查找资源的[域名系统(DNS)][2] 是在 [35 年前][3]设计的,没有考虑用户隐私。它会面临安全风险和攻击,例如 [DNS 劫持][4]。它还能让 [ISP][5] 拦截查询。 + +幸运的是,现在有 [DNS over TLS][6] 和 [DNSSEC][7] 两种技术。DNS over TLS 和 DNSSEC 允许创建从计算机到它配置的 DNS 服务器之间的安全且加密的端到端隧道。在 Fedora 上,部署这些技术的步骤很容易,并且所有必要的工具也很容易获得。 + +本指南将演示如何使用 `systemd-resolved` 在 Fedora 上配置 DNS over TLS。有关 `systemd-resolved` 服务的更多信息,请参见[文档][8]。 + +### 步骤 1:设置 systemd-resolved + +类似于下面所示修改 `/etc/systemd/resolved.conf`。确保启用 DNS over TLS 并配置要使用的 DNS 服务器的 IP 地址。 + +``` +$ cat /etc/systemd/resolved.conf +[Resolve] +DNS=1.1.1.1 9.9.9.9 +DNSOverTLS=yes +DNSSEC=yes +FallbackDNS=8.8.8.8 1.0.0.1 8.8.4.4 +#Domains=~. +#LLMNR=yes +#MulticastDNS=yes +#Cache=yes +#DNSStubListener=yes +#ReadEtcHosts=yes +``` + +关于选项的简要说明: + + * `DNS`:以空格分隔的 IPv4 和 IPv6 地址列表,用作系统 DNS 服务器。 + * `FallbackDNS`:以空格分隔的 IPv4 和 IPv6 地址列表,用作后备 DNS 服务器。 + * `Domains`:在解析单标签主机名时,这些域名用于搜索后缀。 `~.` 代表对于所有域名,优先使用 `DNS=` 定义的系统 DNS 服务器。 + * `DNSOverTLS`:如果启用,那么将加密与服务器的所有连接。请注意,此模式要求 DNS 服务器支持 DNS-over-TLS,并具有其 IP 的有效证书。 + +> 注意:上面示例中列出的 DNS 服务器是我个人的选择。你要确定要使用的 DNS 服务器。要注意你要向谁请求 IP。 + +### 步骤 2:告诉 NetworkManager 将信息推给 systemd-resolved + +在 `/etc/NetworkManager/conf.d` 中创建一个名为 `10-dns-systemd-resolved.conf` 的文件。 + +``` +$ cat /etc/NetworkManager/conf.d/10-dns-systemd-resolved.conf +[main] +dns=systemd-resolved +``` + +上面的设置(`dns=systemd-resolved`)让 `NetworkManager` 将从 DHCP 获得的 DNS 信息推送到 `systemd-resolved` 服务。这将覆盖*步骤 1* 中配置的 DNS 设置。这在受信任的网络中没问题,但是也可以设置为 `dns=none` 从而使用 `/etc/systemd/resolved.conf` 中配置的 DNS 服务器。 + +### 步骤 3: 启动和重启服务 + +若要使上述步骤中的配置生效,请启动并启用 `systemd-resolved` 服务。然后重启 `NetworkManager` 服务。 + +注意:在 `NetworkManager` 重启时,连接会中断几秒钟。 + +``` +$ sudo systemctl start systemd-resolved +$ sudo systemctl enable systemd-resolved +$ sudo systemctl restart NetworkManager +``` + +> 注意:目前,systemd-resolved 服务默认处于禁用状态,是可选使用的。[有计划][33]在 Fedora 33 中默认启用systemd-resolved。 + +### 步骤 4:检查是否一切正常 + +现在,你应该在使用 DNS over TLS。检查 DNS 解析状态来确认这一点: + +``` +$ resolvectl status +MulticastDNS setting: yes + DNSOverTLS setting: yes + DNSSEC setting: yes + DNSSEC supported: yes + Current DNS Server: 1.1.1.1 + DNS Servers: 1.1.1.1 + 9.9.9.9 +Fallback DNS Servers: 8.8.8.8 + 1.0.0.1 + 8.8.4.4 +``` + +`/etc/resolv.conf` 应该指向 `127.0.0.53`。 + +``` +$ cat /etc/resolv.conf +# Generated by NetworkManager +search lan +nameserver 127.0.0.53 +``` + +若要查看 `systemd-resolved` 发送和接收安全查询的地址和端口,请运行: + +``` +$ sudo ss -lntp | grep '\(State\|:53 \)' +State Recv-Q Send-Q Local Address:Port Peer Address:Port Process +LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=10410,fd=18)) +``` + +若要进行安全查询,请运行: + +``` +$ resolvectl query fedoraproject.org +fedoraproject.org: 8.43.85.67 -- link: wlp58s0 + 8.43.85.73 -- link: wlp58s0 + +[..] + +-- Information acquired via protocol DNS in 36.3ms. +-- Data is authenticated: yes +``` + +### 额外步骤 5:使用 Wireshark 验证配置 + +首先,安装并运行 [Wireshark][10]: + +``` +$ sudo dnf install wireshark +$ sudo wireshark +``` + +它会询问你在哪个设备上捕获数据包。在我这里,因为我使用无线接口,我用的是 `wlp58s0`。在 Wireshark 中设置筛选器,`tcp.port == 853`(853 是 DNS over TLS 协议端口)。在捕获 DNS 查询之前,你需要刷新本地 DNS 缓存: + +``` +$ sudo resolvectl flush-caches +``` + +现在运行: + +``` +$ nslookup fedoramagazine.org +``` + +你应该会看到你的计算机和配置的 DNS 服务器之间的 TLS 加密交换: + +![][11] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-dns-over-tls/ + +作者:[Thomas Bianchi][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/thobianchi/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/use-dns-over-tls-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Domain_Name_System +[3]: https://tools.ietf.org/html/rfc1035 +[4]: https://en.wikipedia.org/wiki/DNS_hijacking +[5]: https://en.wikipedia.org/wiki/Internet_service_provider +[6]: https://en.wikipedia.org/wiki/DNS_over_TLS +[7]: https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions +[8]: https://www.freedesktop.org/wiki/Software/systemd/resolved/ +[9]: https://fedoraproject.org/wiki/Changes/systemd-resolved +[10]: https://www.wireshark.org/ +[11]: https://fedoramagazine.org/wp-content/uploads/2020/06/1-1024x651.png diff --git a/published/20200716 Summarizing your command usage on Linux.md b/published/20200716 Summarizing your command usage on Linux.md new file mode 100644 index 0000000000..ef0b331fb1 --- /dev/null +++ b/published/20200716 Summarizing your command usage on Linux.md @@ -0,0 +1,181 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12517-1.html) +[#]: subject: (Summarizing your command usage on Linux) +[#]: via: (https://www.networkworld.com/article/3567050/summarizing-your-command-usage-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +汇总你在 Linux 上的命令使用情况 +====== + +> 使用合适的命令,你可以快速了解 Linux 系统上使用的命令以及执行的频率。 + +![](https://img.linux.net.cn/data/attachment/album/202008/14/221303ln67fl62nsfb7nys.jpg) + +汇总 Linux 系统上使用的命令只需一串相对简单的命令以及几条管道将它们绑定在一起。当你的历史记录缓冲区保留了最近的 1,000 或 2,000 条命令时,总结你的命令活动可能会变得很乏味。这篇文章提供了一种方便的方法来汇总命令的使用情况,并高亮显示最常用的命令。 + +首先,请记住,典型的命令历史记录可能看起来像这样。请注意,命令是显示在命令序列号之后,并紧跟其参数。 + +``` +91 sudo apt-get install ccrypt + ^ + +-- command +``` + +请注意,`history` 命令遵循 `HISTSIZE` 的设置,这会决定保留多少条命令。可能是 500、1,000 或更多。如果你不喜欢它的设置,那么可以在 `.bashrc` 或其他启动文件中添加或更改 `HISTSIZE` 设置。 + +``` +$ echo $HISTSIZE +1000 +$ history | wc -l +1000 +$ grep HISTSIZE ~/.bashrc +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +``` + +记下大量命令的主要好处之一是,它可以让你轻松地重新运行过去使用的命令,而不必重新输入或记住它们。它还能让你轻松地查看你在一个任务中已经做了多少工作。单独使用 `history` 命令时,你会看到类似下面这样,最早的在最前面: + +``` +$ history + 7 vi tasks + 8 alias + 9 echo $HISTTIMEFORMAT + 10 history + 11 date + … +``` + +查看最新使用命令需要查看记录的命令的尾部: + +``` +$ history | tail -4 + 1007 echo $HISTSIZE + 1008 history | wc -l + 1009 history + 1010 history | tail -4 +``` + +另外,你可以使用 `tail` 命令查看 `.bash_history` 文件的尾部,但是 `history` 命令显示的数字可以让你输入如 `!1010` 这样的数字重新运行命令,这点通常更有用。 + +要提供已使用命令的汇总(例如 `vi` 和 `echo`),你可以首先使用 `awk` 将命令与 `history` 中保存的其他信息分隔开来: + +``` +$ history | awk '{print $2}' +vi +alias +echo +history +date +… +``` + +如果你将历史记录中的命令列表传递给 `sort` 命令以按字母顺序对命令进行分组,那么会得到以下内容: + +``` +$ history | awk '{print $2}' | sort +7z +7z +alias +apropos +cd +cd +… +``` + +接下来,将 `sort` 命令的输出传递给 `uniq -c` ,这将计算每个命令使用了多少次: + +``` +$ history | awk '{print $2}' | sort | uniq -c + 2 7z + 1 alias + 2 apropos + 38 cd + 21 chmod +… +``` + +最后,添加第二个 `sort` 命令按倒序对命令组计数进行排序,这将先列出最常用的命令: + +``` +$ history | awk '{print $2}' | sort | uniq -c | sort -nr + 178 ls + 95 vi + 63 cd + 53 sudo + 41 more +… +``` + +这样可以让你了解使用最多的命令,但不会包括任何你可能故意从历史记录文件中删除的命令,例如: + +``` +HISTIGNORE="pwd:clear:man:history" +``` + +### 当修改了历史记录格式时 + +对于默认的历史记录格式,`history` 命令输出中的第一个字段将是每个命令的序号,第二个字段是使用的命令。因此,上面所有 `awk` 命令都设置成显示 `$2`。 + +``` +$ alias cmds='history | awk '\''{print $2}'\'' | sort | uniq -c | sort -nr' +``` + +如果你像下面那样将日期和时间添加了到 `history` 命令中,那么你还必须修改所设置的别名: + +``` +$ echo $HISTTIMEFORMAT +%d/%m/%y %T +``` + +这个日期/时间信息有时会很有帮助,但是这意味着你必须在选择 `history` 命令的第 4 个字段而不是第 2 个字段来汇总命令,因为你的历史记录条目将如下所示: + +``` +91 05/07/20 16:37:39 sudo apt-get install ccrypt + ^ + +-- command +``` + +因此,在将 `$2` 变为 `$4` 之后,用于检查 `history` 命令的别名将改为这样: + +``` +$ alias cmds='history | awk '\''{print $4}'\'' | sort | uniq -c | sort -nr' +``` + +可将别名保存在 `.bashrc` 或其他启动文件中,请确保在 `$` 符号前面插入反斜杠,以便 bash 不会尝试解释 `$4`。 + +``` +alias cmds='history | awk '\''{print \$2}'\'' | uniq -c | sort -nr' +alias cmds='history | awk '\''{print \$4}'\'' | uniq -c | sort -nr' +``` + +请注意,日期和时间信息与命令本身保存在历史记录文件的不同行中。因此,添加此信息后,bash 历史记录文件的行数将增加一倍,尽管在 `history` 命令输出时不会: + +``` +$ wc -l .bash_history +2000 .bash_history +$ history | wc -l +1000 +``` + +### 总结 + +你可以随时决定要保留多少命令历史记录,哪些命令不值得记录,以使你的命令摘要最有用。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3567050/summarizing-your-command-usage-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world diff --git a/published/20200717 How to configure an SSH proxy server with Squid.md b/published/20200717 How to configure an SSH proxy server with Squid.md new file mode 100644 index 0000000000..5062eb7245 --- /dev/null +++ b/published/20200717 How to configure an SSH proxy server with Squid.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12476-1.html) +[#]: subject: (How to configure an SSH proxy server with Squid) +[#]: via: (https://fedoramagazine.org/configure-ssh-proxy-server/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +如何使用 Squid 配置 SSH 代理服务器 +====== + +![](https://img.linux.net.cn/data/attachment/album/202008/01/162730tx0czx60xs6wz00c.jpg) + +有时你无法从本地连接到 SSH 服务器。还有时,你可能想为 SSH 连接添加额外的安全层。在这些情况下,通过代理服务器连接到 SSH 服务器是一种解决方式。 + +[Squid][2] 是提供缓存和代理服务的全功能代理服务器应用。它通常用于在浏览过程中重用和缓存以前请求的网页来帮助缩短响应时间并减少网络带宽。 + +但是在本篇中,你将配置 Squid 作为 SSH 代理服务器,因为它是强大的受信任代理服务器,易于配置。 + +### 安装和配置 + +使用 [sudo][3] 安装 squid 软件包: + +``` +$ sudo dnf install squid -y +``` + +squid 配置文件非常庞大,但是我们只需要配置其中一些。Squid 使用访问控制列表来管理连接。 + +编辑 `/etc/squid/squid.conf` 文件,确保你有下面解释的两行。 + +首先,指定你的本地 IP 网络。默认配置文件已经列出了最常用的,但是如果没有,你需要添加你的配置。例如,如果你的本地 IP 网络范围是 192.168.1.X,那么这行会是这样: + +``` +acl localnet src 192.168.1.0/24 +``` + +接下来,添加以下行,将 SSH 端口添加为安全端口: + +``` +acl Safe_ports port 22 +``` + +保存该文件。现在启用并重启 squid 代理服务: + +``` +$ sudo systemctl enable squid +$ sudo systemctl restart squid +``` + +squid 代理默认监听 3128 端口。配置 firewalld 允许此服务: + +``` +$ sudo firewall-cmd --add-service=squid --perm +$ sudo firewall-cmd --reload +``` + +### 测试 ssh 代理连接 + +要通过 ssh 代理服务器连接到服务器,我们将使用 `netcat`。 + +如果尚未安装 `nmap-ncat`,请安装它: + +``` +$ sudo dnf install nmap-ncat -y +``` + +这是标准 ssh 连接示例: + +``` +$ ssh user@example.com +``` + +这是使用 squid 代理服务器作为网关连接到该服务器的方式。 + +此示例假定 squid 代理服务器的 IP 地址为 192.168.1.63。你还可以使用 squid 代理服务器的主机名或 FQDN: + +``` +$ ssh user@example.com -o "ProxyCommand nc --proxy 192.168.1.63:3128 %h %p" +``` + +以下是这些选项的含义: + + * `ProxyCommand` – 告诉 ssh 使用代理命令。 + * `nc` – 用于建立与代理服务器连接的命令。这是 netcat 命令。 + * `%h` – 代理服务器的主机名或 IP 地址的占位符。 + * `%p` – 代理服务器端口号的占位符。 + +有很多方法可以配置 SSH 代理服务器,但这是入门​​的简单方法。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/configure-ssh-proxy-server/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/squid_ssh_proxy-816x345.png +[2]: http://www.squid-cache.org/ +[3]: https://fedoramagazine.org/howto-use-sudo/ diff --git a/published/20200720 Balloon-powered internet service goes live in Kenya.md b/published/20200720 Balloon-powered internet service goes live in Kenya.md new file mode 100644 index 0000000000..782f7bae60 --- /dev/null +++ b/published/20200720 Balloon-powered internet service goes live in Kenya.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12485-1.html) +[#]: subject: (Balloon-powered internet service goes live in Kenya) +[#]: via: (https://www.networkworld.com/article/3566295/balloon-powered-internet-service-goes-live-in-kenya.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +气球驱动的互联网服务在肯尼亚上线 +====== + +> Alphabet 的衍生产品 [Loon][1] 使用气球创建了一个由蜂窝塔构成的漂浮网络。 + +![](https://images.idgesg.net/images/article/2020/07/loon-aerial-100852193-large.jpg) + +ISP [Telkom Kenya][2] 正在启动第一个使用气球的商业化 4G LTE 服务,气球的作用是在漂浮在平流层中作为蜂窝塔网络。 + +据 Alphabet 的衍生产品及底层技术提供商 [Loon][1] 的首席执行官 Alastair Westgarth 所说,这项服务起初将会覆盖肯尼亚接近 19000 平方英里的范围。 Westgarth 在 [Medium][3] 上的一篇文章中说,将会有大约 35 个或更多的气球组成编队,它们持续不断地移动,漂浮在地表上方大约 12 英里的平流层中。“我们将 Loon 称为漂浮的蜂窝塔网络。” Westgarth 说道。 + +Telkom Kenya 的首席执行官 Mugo Kibati 在一篇[新闻稿][4]中提到,传统互联网对肯尼亚的服务不足,这是采用这种输送装置的原因。“…… 具有互联网功能的气球能够为生活在偏远地区的许多肯尼亚人提供联系,这些地区服务不足或是完全没有服务,仍然处于不利地位。” Kibati 说道。远程医疗和在线教育是两个预期的用例。 + +在测试中, Loon 实现了 19 毫秒延迟的 18.9 Mbps 下行速度,以及 4.74 Mbps 的上行速度。 Westgarth 说,该服务能够用于“语音通话、视频通话、 YouTube、 WhatsApp、电子邮件、发短信、网页浏览”和其他应用程序。 + +从更大的角度看,从平流层提供互联网服务对于[物联网(IoT )][5]来说是一个诱人的主张。在高空,网络覆盖范围可能会更广泛,并且覆盖范围可以随着需求的变化而变化(例如,采矿区的移动)。此外,要建立或处理的地面基础设施更少。 比方说,开发人员可以避免铺设电缆所需的私有地产的纠纷。 + +可以想象,服务中断也更加可控。提供商可以发射另一台设备,而不必通过复杂的远程地面基础设施来跟踪故障。备用气球可随时备用。 + +### 基于无人机的互联网交付 + +另一家正在探索大气层互联网的组织是软银,它称其 260 英尺宽的 HAWK30 无人机是“平流层中的漂浮基站”。(参见相关故事:[软银计划到 2023 年实现无人机交付的物联网和互联网][6]) + +日本大型电信公司对平流层传输的互联网感兴趣的原因之一是,该群岛易于发生自然灾害,例如地震。与传统的基站相比,地球上空的浮动基站更容易移动,从而可以更快、更灵活地应对自然灾害。 + +实际上,Loon 的气球已经成功地用于在灾难后提供互联网服务:例如,在 2017 年波多黎各的飓风 Maria 之后,Loon 提供了连接。 + +Westgarth 说,自最初开发以来,Loon 的气球已经取得了长足的发展。现如今,发射是通过自动设备执行的,该设备可以每半小时一次将与地面站点相连的气球推到 60000 英尺高空,而不像以前那样人工进行。 + +机器学习算法会处理导航,以尝试向用户提供持续的服务。但是,这并非总是可能的,因为风(尽管在地面上没有那么大)和受限的空域都会影响覆盖范围,尽管 Westgarth 称之为“精心编排组织的气球舞蹈”。 + +此外,这些设备是太阳能供电的,这意味着它们只能够在白天工作并提供互联网(或重新定位自身,或向其他气球传输互联网)。出于上述原因和其他的一些原因, Westgarth 和 Kibati 指出,气球必须扩大现有的基础设施和计划,但这并不是一个完整的解决方案。 + +Westgarth 说:“为了连接现在和将来需要它的所有人员和事物,我们需要开阔我们的思维;我们需要在连通性生态系统中增加新的一层。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3566295/balloon-powered-internet-service-goes-live-in-kenya.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://loon.com/ +[2]: https://www.telkom.co.ke/ +[3]: https://medium.com/loon-for-all/loon-is-live-in-kenya-259d81c75a7a +[4]: https://telkom.co.ke/telkom-and-loon-announce-progressive-deployment-loon-technology-customers-july +[5]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[6]: https://www.networkworld.com/article/3405170/softbank-plans-drone-delivered-iot-and-internet-by-2023.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/published/20200721 Video Trimmer- A No-nonsense, Simple Video Trimming Application for Linux Desktop.md b/published/20200721 Video Trimmer- A No-nonsense, Simple Video Trimming Application for Linux Desktop.md new file mode 100644 index 0000000000..1be71f5264 --- /dev/null +++ b/published/20200721 Video Trimmer- A No-nonsense, Simple Video Trimming Application for Linux Desktop.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12480-1.html) +[#]: subject: (Video Trimmer: A No-nonsense, Simple Video Trimming Application for Linux Desktop) +[#]: via: (https://itsfoss.com/video-trimmer/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Video Trimmer:Linux 桌面中的傻瓜级的视频修剪应用 +====== + +> 一个非常简单的工具,无需重新编码即可快速修剪视频。我们来看看它提供了什么。 + +你可能已经知道 Linux 的一些[最佳免费视频编辑器][1],但并不是每个人都需要它们提供的所有功能。 + +有时,你只想快速执行一项操作,例如修剪视频。你是选择探索功能完善的视频编辑器但只是执行简单的修剪操作,还是希望使用便捷工具来修剪视频? + +当然,这取决于你的个人喜好以及处理视频的方式。但是,对于大多数用户而言,首选是使用非常容易使用的修剪工具。 + +因此,我想重点介绍一个傻瓜级的开源工具,即 “[Video Trimmer][2]”,它可以快速修剪视频。 + +![][3] + +### Video Trimmer:一个用于快速修剪视频的傻瓜应用 + +Video Trimmer 是一个开源应用,它可帮助你修剪视频片段而无需重新编码。因此,基本上,你可以能够修剪视频而不会失去原始质量。 + +你要做的就是使用 Video Trimmer 打开视频文件,然后使用鼠标选择要修剪的时间区域。 + +你可以手动设置要修剪的时间范围,也可以仅使用鼠标拖动区域进行修剪。当然,如果视频文件很长,而且你不知道从哪里看,手动设置时间戳可能需要一段时间。 + +为了让你有个印象,请看下面的截图,看看在使用 Video Trimmer 时可用的选项: + +![][4] + +### 在 Linux 上安装 Video Trimmer + +Video Trimmer 仅作为 [Flathub][5] 上的 Flatpak 软件包提供。因此,你应该能够在 Flatpak 支持的任何 Linux 发行版上安装它,而不会出现任何问题。 + +以防你不了解 Flatpak,你可能想要参考我们的[使用和安装 Flatpak][6] 指南。 + +- [下载 Video Trimmer(Flathub)][5] + +### 总结 + +Video Trimmer 底层使用 [ffmpeg][7]。它所做的可以在终端中轻松[使用 ffmpeg 命令][8]完成。但是,并非所有人都希望使用终端来剪辑视频的一部分。Video Trimmer 之类的工具可以帮助像我这样的人。 + +由于某些原因,如果你想寻找一种替代方法,也可以尝试使用 [VidCutter][9]。当然,你始终可以依靠 [Linux 中的顶级视频编辑器][10](例如 [OpenShot][11]) 来修剪视频以及执行一些高级操作的能力。 + +你认为在 Linux 中使用 Video Trimmer 如何?你是否有其他喜欢的视频修剪工具?在下面的评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/video-trimmer/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/open-source-video-editors/ +[2]: https://gitlab.gnome.org/YaLTeR/video-trimmer +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/video-trimmer.jpg?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/video-trimmer-screenshot.jpg?ssl=1 +[5]: https://flathub.org/apps/details/org.gnome.gitlab.YaLTeR.VideoTrimmer +[6]: https://itsfoss.com/flatpak-guide/ +[7]: https://ffmpeg.org/ +[8]: https://itsfoss.com/ffmpeg/ +[9]: https://itsfoss.com/vidcutter-video-editor-linux/ +[10]: https://linux.cn/article-10185-1.html +[11]: https://itsfoss.com/openshot-video-editor-release/ diff --git a/published/20200722 The feature that makes D my favorite programming language.md b/published/20200722 The feature that makes D my favorite programming language.md new file mode 100644 index 0000000000..74ecc7473c --- /dev/null +++ b/published/20200722 The feature that makes D my favorite programming language.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12489-1.html) +[#]: subject: (The feature that makes D my favorite programming language) +[#]: via: (https://opensource.com/article/20/7/d-programming) +[#]: author: (Lawrence Aberba https://opensource.com/users/aberba) + +我最喜欢的 D 语言功能 +====== + +> UFCS 能让你能够编写自然的可重用代码而不会牺牲便利性。 + +![](https://img.linux.net.cn/data/attachment/album/202008/05/215524d9j62oui7mgm7ms9.jpg) + +早在 2017 年,我就写过为什么 [D 语言是开发的绝佳选择][2]的文章。但是 D 语言中有一个出色的功能我没有充分的展开介绍:[通用函数调用语法][3]Universal Function Call Syntax(UFCS)。UFCS 是 D 语言中的一种[语法糖][4],它可以在类型(字符串、数字、布尔值等)上链接任何常规函数,就像该类型的成员函数一样。 + +如果你尚未安装 D 语言,请[安装 D 语言编译器][5],以便你可以自己[运行 D 代码][6]。 + +看一下以下示例代码: + +``` +// file: ufcs_demo.d + +module ufcs_demo; + +import std.stdio : writeln; + +int[] evenNumbers(int[] numbers) +{ + import std.array : array; + import std.algorithm : filter; + + return numbers.filter!(n => n % 2 == 0).array; +} + +void main() +{ + writeln(evenNumbers([1, 2, 3, 4])); +} +``` + +使用你喜欢的 D 语言编译器进行编译,查看这个简单示例应用做了什么: + +``` +$ dmd ufcs_demo.d +$ ./ufcs_demo +[2, 4] +``` + +但是,使用作为 D 语言的内置功能的 UFCS ,你还可以自然方式编写代码: + +``` +... +writeln([1, 2, 3, 4].evenNumbers()); +... +``` + +或完全删除现在多余的括号,使 `evenNumbers` 看起来像是一个属性: + +``` +... +writeln([1, 2, 3, 4].evenNumbers); // prints 2, 4 +... +``` + +因此,完整的代码现在变为: + +``` +// file: ufcs_demo.d + +module ufcs_demo; + +import std.stdio : writeln; + +int[] evenNumbers(int[] numbers) +{ + import std.array : array; + import std.algorithm : filter; + + return numbers.filter!(n => n % 2 == 0).array; +} + +void main() +{ + writeln([1, 2, 3, 4].evenNumbers); +} +``` + +使用你最喜欢的 D 语言编译器进行编译,然后尝试一下。 如预期的那样,它产生相同的输出: + +``` +$ dmd ufcs_demo.d +$ ./ufcs_demo +[2, 4] +``` + +在编译过程中,编译器*自动地*将数组作为函数的第一个参数。这是一个常规模式,使得使用 D 语言成为一种乐趣,因此,它与你自然而然考虑代码的感觉非常相似。结果就是函数式编程。 + +你可能会猜出这打印的是什么: + +``` +//file: cool.d +import std.stdio : writeln; +import std.uni : asLowerCase, asCapitalized; + +void main() +{ +    string mySentence = "D IS COOL"; +    writeln(mySentence.asLowerCase.asCapitalized); +} +``` + +确认一下: + + +``` +$ dmd cool.d +$ ./cool +D is cool +``` + +结合[其他 D 语言的功能][7],UFCS 使你能够编写可重用的代码,并在不牺牲便利性的情况下自然地进行编写。 + +### 是时候尝试 D 语言了 + +就像我之前写的那样,D 语言是一种很棒的开发语言。从 [D 语言的下载页面][8]可以很容易地进行安装,因此请下载编译器,查看示例,并亲自体验 D 语言。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/d-programming + +作者:[Lawrence Aberba][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/aberba +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://opensource.com/article/17/5/d-open-source-software-development +[3]: http://ddili.org/ders/d.en/ufcs.html +[4]: https://en.wikipedia.org/wiki/Syntactic_sugar +[5]: https://tour.dlang.org/tour/en/welcome/install-d-locally +[6]: https://tour.dlang.org/tour/en/welcome/run-d-program-locally +[7]: https://dlang.org/comparison.html +[8]: https://dlang.org/download.html diff --git a/published/20200722 Tiny Yet Useful- 13 Raspberry Pi Zero Alternatives That Cost Less Than -20.md b/published/20200722 Tiny Yet Useful- 13 Raspberry Pi Zero Alternatives That Cost Less Than -20.md new file mode 100644 index 0000000000..ee522608b8 --- /dev/null +++ b/published/20200722 Tiny Yet Useful- 13 Raspberry Pi Zero Alternatives That Cost Less Than -20.md @@ -0,0 +1,355 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12502-1.html) +[#]: subject: (Tiny Yet Useful: 13 Raspberry Pi Zero Alternatives That Cost Less Than $20) +[#]: via: (https://itsfoss.com/raspberry-pi-zero-alternatives/) +[#]: author: (Chinmay https://itsfoss.com/author/chinmay/) + +个头小本事大:13 种 20 美元以下的树莓派 Zero 替代品 +====== + +最近两年,[树莓派 Zero][1] 和 [树莓派 Zero W][2] 作为新成员出现在树莓派产品线中。这些超小型的单板计算机大受欢迎,而且会在相当长的一段时间内成为创客和 DIY 社区的 [树莓派项目][3] 的一部分。 + +为了实现更小尺寸和有效地控制价位,它们不得不在许多特性上做出让步,如放弃专用网口、采用更慢的处理器等(与其它们同族的全功能版相比)。 + +早先的一篇文章中,我们罗列了 [树莓派的最佳替代品][4]。这里,我将给出树莓派 Zero 和树莓派 Zero W 的一些替代品。 + +### 树莓派 Zero 替代品:应用于物联网和嵌入式项目的超小单板计算机 + +![][9] + +受益于开源设计和开源软件栈,我们有为不同项目提供的具有各种功能集的优秀替代品。所有这些板子运行的都是嵌入式 Linux 的各种变体。 + +尽管树莓派 Zero 和树莓派 Zero W 的发布价格分别是 5 美元和 10 美元,但即使是在美国境内,也很难按这个价格买到。在美国之外,更是要花 12 和 20 美元才有可能买到。 + +知道了这些,让我们看看一些 20 美元以下的树莓派 Zero 替代品。 + +#### 1、香蕉派 BPI M2 Zero + +![][10] + +香蕉派 M2 Zero 售价 **18 美元**,与树莓派 Zero W 拥有相同的布局。它看起来像是树莓派 Zero W 的复制品,但也仅仅是外形像而已。它使用的是更快的全志 H2+ SOC 芯片,而且可以外接网络模块。它还可以运行多种基于 Linux 的操作系统。 + +**主要参数** + + * 全志 H2+ 四核 Cortex-A7 处理器,Mali400MP2 GPU,H265/HEVC 1080P + * 512M DDR3 内存(与 GPU 共享) + * 40 针接口,与树莓派 3 兼容 + * 板载 WiFi(AP6212)、蓝牙,外部天线连接口 + * CSI 摄像头输入接口 + * 电源及复位按钮 + * Mini HDMI 视频输出 + +详情可参阅 [Banana Pi Wiki][11]。 + +#### 2、香蕉派 BPI-M2 Magic(BPi-M2M) + +![][13] + +这个型号有 2 个变体,无板载 eMMC 闪存的标价 **20 美元**。这是相对其尺寸而言拥有更大处理能力的小型单板计算机。我觉得毫无疑问它很适合作为物联网和自动家居中的触控面板和显示面板。其板载电源管理系统也很有吸引力。 + +**主要参数** + + * 全志 A33/R16 四核 ARM Cortex-A7 处理器,MALI 400 MP2 GPU + * 板载 802.11 b/g/n 2.4GHz WiFi(AP6212),蓝牙 4.0,支持 BLE + * 512MB DDR3(与 GPU 共享) + * MIPI 串行显示接口(DSI),4 数据通道 + * CSI 摄像头输入接口,最大分辨率 1080p 时可达 30 帧/秒 + * 板载话筒和电池管理 + * 无 HDMI 输出 + +详情可参阅 [Banana Pi Wiki][14]。 + +#### 3、香蕉派 BPI-P2 Maker + +![][16] + +它是带有板载网络模块及支持网口供电(POE)的最小的单板计算机之一,此板售价 **13 美元**(带有 POE 模块的版本售价 **19 美元**)。和香蕉派 M2 Zero 一样,使用的是全志 H2+ SOC 芯片,是块非常有趣的板子。它具有板载 8 GB eMMC 存储空间及摄像头接口,同时具有 POE 功能,可用于 DIY 监控摄像,也可以作为基本的机器学习处理器使用。 + +**主要参数** + + * 处理器:全志 H2+,四核,Cortex-A7 架构 + * 512MB DDR 3 同步动态随机存取内存 + * 板载 WiFi(AP6212)和蓝牙 + * 板载 8G eMMC 闪存 + * 100M 网络 + * Mini HDMI + * CSI 摄像头接口 + * 具有 POE 模块,支持 IEEE 802.3af PoE 标准 + +详情可参阅 [Banana Pi Wiki][17]。 + +#### 4、桔子派 Zero LTS + +![][19] + +当前支持板载网络及 POE 的最小且最便宜的单板计算机,售价仅为 **11.49 美元**(256 MB 内存版本售价 **9.49 美元**)。其采用非常常见的全志 H2+ 处理器,并通过 GPIO 和 13 针功能头提供可靠的扩展方式。 + +**主要参数** + + * 全志 H2+ 四核 Cortex-A7 架构处理器,视频支持 H.265/HEVC 1080P + * Mali400MP2 GPU @600MHz + * 256MB/512MB DDR3 SDRAM(与 GPU 共用)(256 MB 版为标准版) + * 10/100M 自适应网络,RJ45 网口,POE 功能默认关闭 + * WiFi 使用 XR819 方案,支持 IEEE 802.11 b/g/n + * 26 针 GPIO 连接头 + * 13 针连接头,包含 2 路 USB、红外线接口和声音端口(MIC、AV) + +详情可参阅 [官方网站][20]。 + +#### 5、桔子派 i96 + +![][24] + +尺寸仅有 6×3 平方厘米,个头最小的型号之一,售价 **8.8 美元**。该板使用 [RDA8810PL 处理器][25],可作为相当先进的功能手机,(据厂商称)适合摄像应用,最高可以 30 帧/秒的速率采集 1080p 分辨率的图像。在同等价位产品中,输入输出功能出色。 + +**主要参数** + + * RDA8810PL ARM Cortex-A5 32 位单核处理器 + * Vivante 出品 GC860 GPU + * 集成 256MB LPDDR2 SDRAM + * RDA5991 方案的 WiFi 和蓝牙 + * CSI 摄像头输入接口 + * 40 针 GPIO 头 + +详情可参阅 [官方网站][26]。 + +#### 6、桔子派 PC + +![][28] + +该板售价 **15 美元**,包含了很多功能。是在同等价位板子中少有的集成了 1 GB 内存的型号之一。采用全志 H3 SoC 芯片,可解码 4K HEVC/H.265 视频。具有 HDMI 输出口并支持 HDCP 和 CEC。该单板计算机可以通过安装软件成为一个很好用的媒体盒子。它竟然还配备了板载红外接收器和话筒。 + +**主要参数** + + * 全志 H3 四核 Cortex-A7 架构处理器,主频 1.6 GHz + * 1GB DDR3 内存(与 GPU 共享) + * 支持 4K 输出的 HDMI + * CSI 摄像头接口,板载话筒 + * SD 卡槽 + * IR 接收器 + * 3.5mm 音频接口 + * 网络接口 + * 板上无 WiFi 和蓝牙 + +桔子派 PC 还有一种减配版,使用的是同样的处理器,只是内存容量要小。 + +详情可参阅 [官方网站][29]。 + +#### 7、桔子派 One 和桔子派 Lite + +这两种板子与桔子派 PC 一样,使用的是全志 H3 处理器,但配备的是 512MB 内存。 + +**主要参数** + + * 全志 H3 四核处理器 + * HDMI 输出,支持 4K 高清 + * SD 卡槽 + * 512 MB DDR3 内存 + * CSI 摄像头接口 + +![Orange Pi Lite][31] + +![Orange Pi One][32] + +桔子派 Lite 售价 **12 美元**,不支持板载有线网络,但提供了 WiFi 联网功能。其具有板载话筒和红外接收器。详情可参阅 [官方网站][33]。 + +桔子派 One 售价 **11 美元**,具有板载有线网络,但不支持 WiFi。详情可参阅 [官方网站][35]。 + +在桔子派相关内容的最后,我想简单提一下他们提供的几种适合自定义应用的板子。 + + * 桔子派 R1 – 具有双有线网口的小板子,可用于构建网络设备。 + * Orange Pi 2G IOT 和 Orange Pi 3G IOT - 这些板子分别提供了 2G 和 3G 蜂窝网络连接能力,适合作为物联网设备。 + +这些板子都不超过 **20 美元**,详情可参阅 [官方网站][37]。 + +#### 8、NanoPi Neo LTS + +![][38] + +起步价 **9.99 美元**,该板非常袖珍(4x4 平方厘米),与桔子派 Zero 规格相似。不同的是,它使用的是更为强悍的全志 H3 SoC 芯片和高达 512MB 的内存。虽然无任何板载 WiFi 和蓝牙芯片,但可以通过 USB 接口外接相关器件获得相应功能。该板非常适合作为无显示器的 Linux 服务器、DNS 过滤器(如 Pi-Hole),同时也很适合作为物联网应用的边缘设备使用。通过 GPIO 可以扩展出你需要的很多功能。 + +**主要参数** + + * 全志 H3 四核处理器,Cortex A7 内核,主频 1.2 GHz + * 512 MB 内存 + * Micro SD 卡槽(最高支持 128 GB) + * 10/100 Mbps 网口 + * 冗余 GPIO 针可实现其它所需功能 + +可从 [官方网站][39] 了解详情及购买。 + +![][40] + +NanoPi NEO 的极简版称为 NanoPi NEO Core LTS,该极简版为满足工业应用需求增加了 eMMC 存储,且通过扩展 GPIO 提供了板载 USB 接口和板载网络接口。详情参阅 [这里][41]。 + +![][42] + +Nano NEO Air 的 WiFi/蓝牙版称为 NanoPi NEO Air,提供了 eMMC 存储和摄像头输入接口,提供了板载 USB 接口和板载网络接口。详情参阅 [这里][43]. + +#### 9、Zero Pi + +![][44] + +这是所有这里提到的板子中,我最感兴趣的板子之一,售价 **9.99 美元**,具有板载千兆网口,使用全志 H3 处理器,小而强悍,适合应用于网络相关场景。它可以运行 OpenWRT,和其配备的千兆网络相得益彰。在作为 DNS 服务器运行的同时,还可以运行 Pi-Hole 的多个实例。 + +**主要参数** + + * 全志 H3 四核处理器,Cortex A7 架构,主频最高 1.2GHz + * 512MB 内存 + * USB 2.0 接口 + * 可运行 OpenWRT + +可从 [官方网站][45] 了解详情及下单购买。 + +#### 10、NanoPi NEO 2 + +![][46] + +NanoPi NEO 2 售价 **19.99 美元**,是 NanoPi NEO 的 2 倍。其外形尺寸与 NanoPi Neo 相同,但使用的是全志 H5 处理器,并配备了千兆网功能。这使得该板子个头小而性能强。 + +**主要参数** + + * 全志 H5 处理器,四核 64 位,高性能 Cortex A53 架构 + * Hexacore Mali450 GPU + * 512MB 内存 + * 1Gbps 板载网络 + * 24 针 GPIO + * 包含音频及红外之类功能的外接口 + +可从 [官方网站][47] 了解详情及下单购买。 + +上面的链接是关于 NanoPi 系列板子的。除此之外,还有一些其它有趣的板子,如配备双千兆网口的,以及针对摄像头应用的。 + +#### 11、La Frite + +![][48] + +出品商是 [Le Potato][49],售价 **20 美元**,主要面向媒体消费及流媒体。它通过 HDMI 2.0 接口以 HDR 方式实现 1080p 视频播放,支持最新的安卓 9 /电视、上游的 Linux、u-boot、Kodi 等。 + +**主要参数** + + * Amlogic S805X 处理器,四核,Cortex-A53 架构,主频 1.2GHz + * 最大 1GB DDR4 SDRAM + * Amlogic 视频引擎 10,支持 H.264、H.265 和 VP9 解码,最高能以 60 帧/秒的速率实现 1080p 高清 + * 百兆网 + * 红外接器 + * 40 针 GPIO + +详情可参阅 [官方网站][50]。 + +#### 12、Onion Omega2+ + +![][51] + +如果你需要的是应用于物联网场景的单板计算机,那么 [Onion Omega][52] 2+ 是替代树莓派 Zero 的很好选择。它是针对物联网的开发平台,运行的是基于 [OpenWRT][53] 的嵌入式 Linux 开发环境。 + +**主要参数** + + * MT7688 SoC 芯片 + * 2.4 GHz WiFi,支持 IEEE 802.11 b/g/n + * 128 MB DDR2 内存 + * 32 MB 板载闪存 + * MicroSD 卡槽 + * USB 2.0 + * 12 个 GPIO 引针 + +你可以 **13 美元** 的单价从 [官方网站][54] 购买其极简版,并可以选配各种附件。 + +#### 13、VoCore2 + +![][55] + +VoCore2 肯定是类似产品中最小的一款,极简版尺寸只有 1 英寸见方,售价 **17.99 美元**。小巧的尺寸使得其能方便的嵌入到不同的应用场合,而且允许根据需要扩充不同的特性。该板使用过的是联发科针对中低端路由器的处理器 MT7628 处理器。生产商声明将持续供应至 2025 年,这是个不错的消息。 + +**主要参数** + + * 联发科 MT7628 处理器,主频 580 MHz,MIPS 24K + * 128MB DDR2 内存, 内存刷新率 166 MHz + * 1 或 5 网口,100 Mbps 网络 + * 无线网,支持 802.11n,双收双发,网速最高 300Mbps + * 板载 16M NOR 存储器,支持最大 2TB SDXC 卡 + * 一个板载 U.FL 槽(天线接口) + +你可以从 [此处][56] 了解更多细节。 + +### 结束语 + +无可否认,不同规格和特性的各种单板计算机可以满足千变万化的使用需求。另外,绝大部分此类产品都基于开源设计,运行着开源软件。这绝对是硬核玩家不可多得的乐园。 + +由于新冠病毒的肆虐,要上手这些板子可能要稍费周折,期待情况能尽快好转! + +如果各位知道树莓派 Zero 和树莓派 Zero W 的其它有趣的替代型号,请留言。我们根据情况检查充实。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-zero-alternatives/ + +作者:[Chinmay][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/chinmay/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/products/raspberry-pi-zero/ +[2]: https://itsfoss.com/raspberry-pi-zero-w/ +[3]: https://itsfoss.com/raspberry-pi-projects/ +[4]: https://linux.cn/article-10823-1.html +[5]: https://i1.wp.com/m.media-amazon.com/images/I/517BwcAPmTL._SL160_.jpg?ssl=1 +[6]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 +[7]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[8]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon) +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/raspberry-pi-zero-alterantives.png?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/banana-pi-zero-1.png?ssl=1 +[11]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#Hardware_interfaces +[12]: https://www.aliexpress.com/item/32839074880.html?spm=2114.12010612.8148356.2.258c72dbKctWv3 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Banana-Pi-M2M-2-1.jpg?ssl=1 +[14]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2M +[15]: https://www.aliexpress.com/item/32836172813.html?spm=2114.12010612.8148356.2.25ac76c2BKPl43 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Banana-Pi-P2-Zero-1.png?ssl=1 +[17]: http://wiki.banana-pi.org/Banana_Pi_BPI-P2_Zero +[18]: https://www.aliexpress.com/item/32953609399.html?spm=2114.12010612.8148356.6.6d4070a9ktu2qs +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-Zero-LTS.png?ssl=1 +[20]: http://www.orangepi.org/orangepizerolts/ +[21]: https://i0.wp.com/m.media-amazon.com/images/I/51wOvNrzHkL._SL160_.jpg?ssl=1 +[22]: https://www.amazon.com/dp/B07ZYJGPF8?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Orange Pi Zero Single Board Computer Quad Core Open-Source Development Board 512MB with WiFi Antenna) +[23]: https://www.amazon.com/dp/B07ZYJGPF8?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon) +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-i96.png?ssl=1 +[25]: https://www.openhacks.com/uploadsproductos/2016030304473558.pdf +[26]: http://www.orangepi.org/OrangePii96/ +[27]: https://www.aliexpress.com/item/32819068354.html?spm=2114.12010612.8148356.2.7cb16aa1JdhlzK +[28]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/opipc.png?ssl=1 +[29]: http://www.orangepi.org/orangepipc/ +[30]: https://www.aliexpress.com/item/32448079125.html +[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-Lite.png?ssl=1 +[32]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-One.png?ssl=1 +[33]: http://www.orangepi.org/orangepilite/ +[34]: https://www.aliexpress.com/item/32662738571.html?spm=2114.12010612.8148356.16.222f4f44KYIA5v +[35]: http://www.orangepi.org/orangepione/ +[36]: https://www.aliexpress.com/item/32603308880.html?spm=a2g0o.detail.1000060.1.4fb86a5eWkGEex&gps-id=pcDetailBottomMoreThisSeller&scm=1007.13339.146401.0&scm_id=1007.13339.146401.0&scm-url=1007.13339.146401.0&pvid=9042001e-bc4a-471b-a3a0-9f0d276d0c3f&_t=gps-id:pcDetailBottomMoreThisSeller,scm-url:1007.13339.146401.0,pvid:9042001e-bc4a-471b-a3a0-9f0d276d0c3f,tpp_buckets:668%230%23131923%2358_668%23808%237756%23236_668%23888%233325%232_668%232846%238111%23464_668%232717%237564%23664_ +[37]: http://www.orangepi.org +[38]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/NanoPi-NEO_04-900x630-1.jpg?ssl=1 +[39]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=132&sort=p.price&order=ASC +[40]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/Core_04-900x630-1.jpg?ssl=1 +[41]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=212&sort=p.price&order=ASC +[42]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/air_03-900x630-1.jpg?ssl=1 +[43]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=151&sort=p.price&order=ASC +[44]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/ZeroPi_03-900x630-1.jpg?ssl=1 +[45]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=266&sort=p.price&order=ASC +[46]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/NEO2_04-900x630-1.jpg?ssl=1 +[47]: https://www.friendlyarm.com/index.php?route=product/product&product_id=180 +[48]: https://i0.wp.com/cdn.shopify.com/s/files/1/1098/4826/products/84988b14aa58054c0a4cbf8c03466fa9_original_1024x1024.jpg?resize=544%2C306&ssl=1 +[49]: https://libre.computer/products/boards/aml-s905x-cc/ +[50]: https://libre.computer/products/boards/aml-s805x-ac/ +[51]: https://i0.wp.com/onion.io/wp-content/uploads/2019/08/OM-O2P.jpg?resize=424%2C424&ssl=1 +[52]: https://itsfoss.com/onion-omega-2/ +[53]: https://openwrt.org/ +[54]: https://onion.io/ +[55]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/VoCore2.png?resize=719%2C319&ssl=1 +[56]: https://vocore.io/v2.html +[57]: https://vocore.io/ diff --git a/published/20200727 Analyze your web server log files with this Python tool.md b/published/20200727 Analyze your web server log files with this Python tool.md new file mode 100644 index 0000000000..8143e4acb1 --- /dev/null +++ b/published/20200727 Analyze your web server log files with this Python tool.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12512-1.html) +[#]: subject: (Analyze your web server log files with this Python tool) +[#]: via: (https://opensource.com/article/20/7/python-lars) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +使用这个 Python 工具分析你的 Web 服务器日志文件 +====== + +> 这个 Python 模块可以以多种格式收集网站使用日志并输出良好结构化数据以进行分析。 + +![](https://img.linux.net.cn/data/attachment/album/202008/13/155936kpaay0ypkmyk9qd0.jpg) + +是否想知道有多少访问者访问过你的网站?或哪个页面、文章或下载最受欢迎?如果你是自托管的博客或网站,那么无论你使用的是 Apache、Nginx 还是 Microsoft IIS(是的,没错),[lars][2]都可以为你提供帮助。 + +Lars 是 [Python][3] 写的 Web 服务器日志工具包。这意味着你可以使用 Python 通过简单的代码来回溯(或实时)解析日志,并对数据做任何你想做的事:将它存储在数据库中、另存为 CSV 文件,或者立即使用 Python 进行更多分析。 + +Lars 是 [Dave Jones][4] 写的另一个隐藏的宝石。我最初是在本地 Python 用户组中看到 Dave 演示 lars。几年后,我们开始在 [piwheels][5] 项目中使用它来读取 Apache 日志并将行插入到我们的 Postgres 数据库中。当树莓派用户从 [piwheels.org][6] 下载 Python 包时,我们会记录文件名、时间戳、系统架构(Arm 版本)、发行版名称/版本,Python 版本等。由于它是一个关系数据库,因此我们可以将这些结果加入其他表中以获得有关文件的更多上下文信息。 + +你可以使用以下方法安装lars: + +``` +$ pip install lars +``` + +在某些系统上,正确的方式是 `sudo` `pip3 install lars`。 + +首先,找到一个 Web 访问日志并制作一个副本。你需要将日志文件下载到计算机上进行操作。我在示例中使用的是 Apache 日志,但是经过一些小(且直观)的更改,你可以使用 Nginx 或 IIS。在典型的 Web 服务器上,你会在 `/var/log/apache2/` 中找到 Apache 日志,通常是 `access.log`、`ssl_access.log`(对于 HTTPS)或 gzip 压缩后的轮转日志文件,如 `access-20200101.gz` 或者 `ssl_access-20200101.gz` 。 + +首先,日志是什么样的? + +``` +81.174.152.222 - - [30/Jun/2020:23:38:03 +0000] "GET / HTTP/1.1" 200 6763 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0" +``` + +这是一个显示了请求源 IP 地址、时间戳、请求文件路径(在本例中是主页 `/`)、HTTP 状态代码,用户代理(Ubuntu 上的 Firefox)等的请求。 + +你的日志文件将充满这样的条目,不仅是每个打开的页面,还包括返回的每个文件和资源:每个 CSS 样式表、JavaScript 文件和图像,每个 404 请求、每个重定向、每个爬虫。要从日志中获取有意义的数据,你需要对条目进行解析、过滤和排序。这就是 Lars 的用处。本示例将打开一个日志文件并打印每一行的内容: + +``` +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            print(row) +``` + +它会为每条日志显示如下结果: + +``` +Row(remote_host=IPv4Address('81.174.152.222'), ident=None, remote_user=None, time=DateTime(2020, 6, 30, 23, 38, 3), request=Request(method='GET', url=Url(scheme='', netloc='', path_str='/', params='', query_str='', fragment=''), protocol='HTTP/1.1'), status=200, size=6763) +``` + +它解析了日志条目,并将数据放入结构化格式中。该条目已成为具有与条目数据相关属性的[命名元组][7]namedtuple,因此,例如,你可以使用 `row.status` 访问状态代码,并使用 `row.request.url.path_str` 访问路径: + +``` +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            print(f'hit {row.request.url.path_str} with status code {row.status}') +``` + + +如果你只想显示 404 请求,可以执行以下操作: + +``` +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            if row.status == 404: +                print(row.request.url.path_str) + +``` + +你可能要对这些数据去重,并打印独立的 404 页面数量: + +``` +s = set() +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            if row.status == 404: +                s.add(row.request.url.path_str) +print(len(s)) +``` + +我和 Dave 一直在努力扩展 piwheel 的日志记录器,使其包含网页点击量、软件包搜索等内容,归功于 lars,这些并不难。它不会告诉我们有关用户的任何答案。我们仍然需要进行数据分析,但它去掉了复杂不便的文件格式,并以我们可以利用的方式将它放入我们的数据库。 + +查阅 lars 的文档,以了解如何读取 Apache、Nginx 和 IIS 日志,并了解你还可以使用它做什么。再次感谢 Dave 提供的出色工具! + +最初发布在 Ben Nuttall 的 Tooling Blog 中,并获许重新发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/python-lars + +作者:[Ben Nuttall][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://lars.readthedocs.io/en/latest/ +[3]: https://opensource.com/resources/python +[4]: https://twitter.com/waveform80/ +[5]: https://opensource.com/article/18/10/piwheels-python-raspberrypi +[6]: http://piwheels.org +[7]: https://docs.python.org/3/library/collections.html#collections.namedtuple \ No newline at end of file diff --git a/published/20200728 BigBlueButton- Open Source Software for Online Teaching.md b/published/20200728 BigBlueButton- Open Source Software for Online Teaching.md new file mode 100644 index 0000000000..846d64ff0a --- /dev/null +++ b/published/20200728 BigBlueButton- Open Source Software for Online Teaching.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12492-1.html) +[#]: subject: (BigBlueButton: Open Source Software for Online Teaching) +[#]: via: (https://itsfoss.com/bigbluebutton/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +BigBlueButton:开源在线教学软件 +====== + +> BigBlueButton 是一个为在线教学量身定制的开源视频会议工具。让我们来看看它提供了什么。 + +在 2020 年,在家远程工作是一种新常态。当然,你不可能远程完成所有事情,但是在线教学是可以的。 + +尽管许多老师和学校组织不熟悉那些所有的出色工具,但某些[最好的开源视频会议工具][1]在一定程度上满足了要求。 + +在我提到的视频通话软件中,[BigBlueButton][2] 引起了我的注意。在这里,我将为你简单介绍。 + +### BigBlueButton:用于在线教学的开源 Web 会议系统 + +![][3] + +BigBlueButton 是一个开源的网络会议方案,它旨在简化在线学习。 + +它是完全免费的,但是需要你在自己的服务器上安装才能将其用作成熟的在线学习解决方案。 + +BigBlueButton 提供了非常好的一组功能。你可以轻松地尝试[演示实例][4],并在学校的服务器上进行安装。 + +开始之前,请先了解以下功能: + +### BigBlueButton 的功能 + +BigBlueButton 为教师和学校的量身定制了一系列在线课堂的有用功能,你可以获得: + + * 现场白板 + * 给公共和私人发消息 + * 支持网络摄像头 + * 支持会话记录 + * 支持表情符号 + * 能够将用户分组以进行团队协作 + * 支持投票 + * 屏幕共享 + * 支持多用户白板 + * 能够自行托管 + * 提供用于轻松集成到 Web 应用中的 API + +除了提供的功能外,你还能看到易于使用的 UI,即 [Greenlight][5] (BigBlueButton 的前端界面),当你在服务器上配置时可以安装它。 + +你可以尝试演示实例来临时免费地教你的学生。但是,考虑到使用[演示实例][4]来尝试 BigBlueButton 的局限性(限制为 60 分钟),建议你将它托管在服务器上,以探索其提供的所有功能。 + +为了更清楚地了解这些功能是如何工作的,你可能需要看下它的[官方教程](https://www.youtube.com/embed/Q2tG2SS4gXA)。 + +### 在你的服务器上安装 BigBlueButton + +他们提供了[详细文档][6],它对每个开发人员都会有用。安装它最简单、最快捷的方法是使用 [bbb-install 脚本][7],但是如果不成功,你也可以探索其他选项。 + +对于刚接触的人,你需要一台至少运行 Ubuntu 16.04 LTS 的服务器。在为 BigBlueButton 部署服务器之前,你应该查看[最低要求][8]。 + +你可以在它的 [GitHub 页面][9]中进一步了解该项目。 + +- [试用 BigBlueButton][2] + +如果你正在为在线教学寻求解决方案,那么 BigBlueButton 是一个不错的选择。 + +它可能不提供原生的智能手机应用,但你肯定可以用手机上的网络浏览器来访问它。当然,最好找一台笔记本电脑/计算机来访问在线教学平台,但它也可以在移动设备上使用。 + +你认为 BigBlueButton 的在线教学如何?有没有更好的开源项目可以替代?在下面的评论中让我知道! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bigbluebutton/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12453-1.html +[2]: https://bigbluebutton.org/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/big-blue-button.png?ssl=1 +[4]: http://demo.bigbluebutton.org/ +[5]: https://bigbluebutton.org/2018/07/09/greenlight-2-0/ +[6]: https://docs.bigbluebutton.org/ +[7]: https://github.com/bigbluebutton/bbb-install +[8]: https://docs.bigbluebutton.org/2.2/install.html#minimum-server-requirements +[9]: https://github.com/bigbluebutton diff --git a/published/20200728 Digging for DNS answers on Linux.md b/published/20200728 Digging for DNS answers on Linux.md new file mode 100644 index 0000000000..c958e7dfb4 --- /dev/null +++ b/published/20200728 Digging for DNS answers on Linux.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12509-1.html) +[#]: subject: (Digging for DNS answers on Linux) +[#]: via: (https://www.networkworld.com/article/3568488/digging-for-dns-answers-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上挖掘 DNS 应答中的秘密 +====== + +> dig 是一个强大而灵活的工具,用于查询域名系统(DNS)服务器。在这篇文章中,我们将深入了解它的工作原理以及它能告诉你什么。 + +![](https://img.linux.net.cn/data/attachment/album/202008/11/235200wlyytlaymlylfdff.jpg) + +`dig` 是一款强大而灵活的查询 DNS 名称服务器的工具。它执行 DNS 查询,并显示参与该过程的名称服务器返回的应答以及与搜索相关的细节。系统管理员和 [DNS][3] 管理员经常使用 `dig` 来帮助排除 DNS 问题。在这篇文章中,我们将深入了解它的工作原理,看看它能告诉我们什么。 + +开始之前,对 DNS(域名系统)的工作方式有一个基本的印象是很有帮助的。它是全球互联网的关键部分,因为它提供了一种查找世界各地的服务器的方式,从而可以与之连接。你可以把它看作是互联网的地址簿,任何正确连接到互联网的系统,都应该能够使用它来查询任何正确注册的服务器的 IP 地址。 + +### dig 入门 + +Linux 系统上一般都默认安装了 `dig` 工具。下面是一个带有一点注释的 `dig` 命令的例子: + +``` +$ dig www.networkworld.com + +; <<>> DiG 9.16.1-Ubuntu <<>> www.networkworld.com <== 你使用的 dig 版本 +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6034 +;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 65494 +;; QUESTION SECTION: <== 你的查询细节 +;www.networkworld.com. IN A + +;; ANSWER SECTION: <== 结果 + +www.networkworld.com. 3568 IN CNAME idg.map.fastly.net. +idg.map.fastly.net. 30 IN A 151.101.250.165 + +;; Query time: 36 msec <== 查询用时 +;; SERVER: 127.0.0.53#53(127.0.0.53) <== 本地缓存解析器 +;; WHEN: Fri Jul 24 19:11:42 EDT 2020 <== 查询的时间 +;; MSG SIZE rcvd: 97 <== 返回的字节数 +``` + +如果你得到了一个这样的应答,是好消息吗?简短的回答是“是”。你得到了及时的回复。状态字段(`status: NOERROR`)显示没有问题。你正在连接到一个能够提供所要求的信息的名称服务器,并得到一个回复,告诉你一些关于你所查询的系统的重要细节。简而言之,你已经验证了你的系统和域名系统相处得很好。 + +其他可能的状态指标包括: + +- `SERVFAIL`:被查询的名称存在,但没有数据或现有数据无效。 +- `NXDOMAIN`:所查询的名称不存在。 +- `REFUSED`:该区域的数据不存在于所请求的权威服务器中,并且在这种情况下,基础设施没有设置为提供响应服务。 + +下面是一个例子,如果你要查找一个不存在的域名,你会看到什么? + +``` +$ dig cannotbe.org + +; <<>> DiG 9.16.1-Ubuntu <<>> cannotbe.org +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 35348 +;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 +``` + +一般来说,`dig` 比 `ping` 会提供更多的细节,如果域名不存在,`ping` 会回复 “名称或服务未知”。当你查询一个合法的系统时,你可以看到域名系统对该系统知道些什么,这些记录是如何配置的,以及检索这些数据需要多长时间。 + +(LCTT 译注:`dig` 也比 `nslookup` 提供的数据更多。此外,`dig` 采用的是操作系统的解析库,而 `nslookup` 采用的是自己提供的解析库,这有时候会带来不同的行为。最后,有趣的一点是,`dig` 的返回的格式是符合 BIND 区域文件格式的。) + +事实上,有时 `dig` 可以在 `ping` 完全不能响应的时候进行响应,当你试图确定一个连接问题时,这种信息是非常有用的。 + +### DNS 记录类型和标志 + +在上面的第一个查询中,我们可以看到一个问题,那就是同时存在 `CNAME` 和 `A` 记录。`CNAME`(规范名称canonical name)就像一个别名,把一个域名指向另一个域名。你查询的大多数系统不会有 `CNAME` 记录,而只有 `A` 记录。如果你运行 `dig localhost` 命令,你会看到一个 `A` 记录,它就指向 `127.0.0.1` —— 这是每个系统都使用的“回环”地址。`A` 记录用于将一个名字映射到一个 IP 地址。 + +DNS 记录类型包括: + +* `A` 或 `AAAA`:IPv4 或 IPv6 地址 +* `CNAME`:别名 +* `MX`:邮件交换器 +* `NS`:名称服务器 +* `PTR`:一个反向条目,让你根据 IP 地址找到系统名称 +* `SOA`:表示授权记录开始 +* `TXT` 一些相关文本 + +我们还可以在上述输出的第五行看到一系列的“标志”。这些定义在 [RFC 1035][4] 中 —— 它定义了 DNS 报文头中包含的标志,甚至显示了报文头的格式。 + +``` + 1 1 1 1 1 1 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| ID | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +|QR| Opcode |AA|TC|RD|RA| Z | RCODE | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| QDCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| ANCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| NSCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| ARCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +``` + +在上面的初始查询中,第五行显示的标志是: + +* `qr` = 查询 +* `rd` = 进行递归查询 +* `ra` = 递归数据可用 + +RFC 中描述的其他标志包括: + +* `aa` = 权威答复 +* `cd` = 检查是否禁用 +* `ad` = 真实数据 +* `opcode` = 一个 4 位字段 +* `tc` = 截断 +* `z`(未使用) + +### 添加 +trace 选项 + +如果你添加 `+trace` 选项,你将从 `dig` 得到更多的输出。它会添加更多信息,显示你的 DNS 查询如何通过名称服务器的层次结构找到你要找的答案。 + +下面显示的所有 `NS` 记录都反映了名称服务器 —— 这只是你将看到的数据的第一部分,因为查询通过名称服务器的层次结构来追踪你要找的东西: + +``` +$ dig +trace networkworld.com + +; <<>> DiG 9.16.1-Ubuntu <<>> +trace networkworld.com +;; global options: +cmd +. 84895 IN NS k.root-servers.net. +. 84895 IN NS e.root-servers.net. +. 84895 IN NS m.root-servers.net. +. 84895 IN NS h.root-servers.net. +. 84895 IN NS c.root-servers.net. +. 84895 IN NS f.root-servers.net. +. 84895 IN NS a.root-servers.net. +. 84895 IN NS g.root-servers.net. +. 84895 IN NS l.root-servers.net. +. 84895 IN NS d.root-servers.net. +. 84895 IN NS b.root-servers.net. +. 84895 IN NS i.root-servers.net. +. 84895 IN NS j.root-servers.net. +;; Received 262 bytes from 127.0.0.53#53(127.0.0.53) in 28 ms +... +``` + +最终,你会得到与你的要求直接挂钩的信息: + +``` +networkworld.com. 300 IN A 151.101.2.165 +networkworld.com. 300 IN A 151.101.66.165 +networkworld.com. 300 IN A 151.101.130.165 +networkworld.com. 300 IN A 151.101.194.165 +networkworld.com. 14400 IN NS ns-d.pnap.net. +networkworld.com. 14400 IN NS ns-a.pnap.net. +networkworld.com. 14400 IN NS ns0.pcworld.com. +networkworld.com. 14400 IN NS ns1.pcworld.com. +networkworld.com. 14400 IN NS ns-b.pnap.net. +networkworld.com. 14400 IN NS ns-c.pnap.net. +;; Received 269 bytes from 70.42.185.30#53(ns0.pcworld.com) in 116 ms +``` + +### 挑选响应者 + +你可以使用 `@` 符号来指定一个特定的名称服务器来处理你的查询。在这里,我们要求 Google 的主名称服务器响应我们的查询: + +``` +$ dig @8.8.8.8 networkworld.com + +; <<>> DiG 9.16.1-Ubuntu <<>> @8.8.8.8 networkworld.com +; (1 server found) +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43640 +;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 512 +;; QUESTION SECTION: +;networkworld.com. IN A + +;; ANSWER SECTION: +networkworld.com. 299 IN A 151.101.66.165 +networkworld.com. 299 IN A 151.101.194.165 +networkworld.com. 299 IN A 151.101.130.165 +networkworld.com. 299 IN A 151.101.2.165 + +;; Query time: 48 msec +;; SERVER: 8.8.8.8#53(8.8.8.8) +;; WHEN: Sat Jul 25 11:21:19 EDT 2020 +;; MSG SIZE rcvd: 109 +``` + +下面所示的命令对 `8.8.8.8` IP 地址进行反向查找,以显示它属于 Google 的 DNS 服务器。 + +``` +$ nslookup 8.8.8.8 +8.8.8.8.in-addr.arpa name = dns.google. +``` + +### 总结 + +`dig` 命令是掌握 DNS 工作原理和在出现连接问题时排除故障的重要工具。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568488/digging-for-dns-answers-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.techhive.com/images/article/2017/01/05_tools-100704412-large.jpg +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html +[4]: https://tools.ietf.org/html/rfc1035 +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/20200729 Bypass your Linux firewall with SSH over HTTP.md b/published/20200729 Bypass your Linux firewall with SSH over HTTP.md new file mode 100644 index 0000000000..5f66d24517 --- /dev/null +++ b/published/20200729 Bypass your Linux firewall with SSH over HTTP.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12504-1.html) +[#]: subject: (Bypass your Linux firewall with SSH over HTTP) +[#]: via: (https://opensource.com/article/20/7/linux-shellhub) +[#]: author: (Domarys https://opensource.com/users/domarys) + +借助 HTTP 通过 SSH 绕过 Linux 防火墙 +====== + +> 需要远程工作的看一下。使用这个有用的开源解决方案,从任何地方快速地连接和访问你的所有设备。 + +![](https://img.linux.net.cn/data/attachment/album/202008/10/231746xs4363yc03cptzbc.jpg) + +随着对连接和远程工作的需求的增长,访问远程计算资源变得越来越重要。但是,提供对设备和硬件的外部访问的要求使此任务变得复杂而有风险。旨在减少此类麻烦的 [ShellHub][2] 是一个云服务器,允许从任何外部网络常规访问这些设备。 + +ShellHub 是一个 Apache 2.0 许可的开源解决方案,它可满足所有这些需求,并允许用户通过一个帐户连接和管理多个设备。它的开发是为了方便开发者和程序员的工作,使得任何硬件架构的 Linux 设备的远程访问成为可能。 + +仔细观察,ShellHub 方案使用 HTTP 传输层来封装 SSH 协议。这种传输层的选择可以在大多数网络上无缝使用,因为大多数公司的防火墙规则和策略通常都可以使用并接受它。 + +下面这些示例使用 2020 年 6 月 10 日发布的 ShellHub 版本 0.3.2。 + +### 使用 ShellHub + +要访问该平台,只需进入 [shellhub.io][3] 并注册一个自己的帐户。你的注册数据将帮助开发团队了解用户资料并提供有关如何改进平台的更多信息。 + +![ShellHub registration form][4] + +*图 1:[shellhub.io][5] 中的注册表格* + +ShellHub 有直观、简洁的界面,这让所有的信息和功能都能以最快的方式呈现。注册后,你会看到一块仪表板,这时可以注册你的第一台设备。 + +### 添加设备 + +要启用通过 ShellHub 连接设备,你需要生成一个标识符,它用于在设备连接到服务器时对你的设备进行身份验证。 + +此标识必须配置在代理(ShellHub 客户端)内部,该代理必须与镜像一起保存在设备中,或者必须添加为 Docker 容器。 + +ShellHub 默认使用 Docker 运行代理,这非常方便,因为它在现有系统上提供了一种无痛的添加方式,支持 Docker 是唯一的要求。要添加设备,你需要粘贴命令行,它显示在 ShellHub Cloud 的对话框中(请参见图 2)。 + +![Figure 2: Adding a device to the ShellHub Cloud][6] + +*图 2:将设备添加到 ShellHub Cloud* + +设备默认使用它的 MAC 地址作为其主机名。在内部,该设备由其密钥标识,这是在设备注册期间生成的,用于与服务器进行身份验证。 + +### 访问设备 + +要访问你的设备,只需进入仪表板中的“查看所有设备”,或单击左侧菜单上的“设备”。这将列出你所有已注册的设备。 + +设备状态可在页面上轻松看到。在线设备旁边会显示一个绿色图标,可以单击终端图标进行连接。你接着输入密码,最后单击”连接“按钮,请参见(图 3)。 + +![Figure 3: Accessing a device using the terminal on the web][7] + +*图 3:使用网络上的终端访问设备* + +另一种访问设备的方法是从类似 [PuTTY][8]、[Termius][9] 之类的 SSH 客户端,甚至 Linux 终端访问。我们可以使用称为 SSHID 的 ShellHub 标识作为连接的目的地址(例如 `ssh username@SSHID`)。图 4 说明了如何使用在终端中使用 Linux SSH 客户端连接到我们的计算机。 + +![Figure 4: Connecting to a device using the Linux terminal][11] + +*图 4:使用 Linux 终端连接到设备* + +无论你何时登录 ShellHub Cloud 平台,你都可以访问仪表板上的所有已注册设备,这样你可以随时随地访问它们。ShellHub 通过一个开源平台,以透明的方式为您与远程机器保持通信安全的过程增加了简单性。 + +在 [GitHub][2] 上加入 ShellHub 社区,或随时通过 [Gitter][12] 或通过电子邮件 [contato@ossystems.com.br][13] 向开发团队发送你的建议或反馈。我们很乐意收到社区成员的贡献! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/linux-shellhub + +作者:[Domarys][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/domarys +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://github.com/shellhub-io/shellhub +[3]: https://www.shellhub.io/ +[4]: https://opensource.com/sites/default/files/uploads/shellhub_registration_form_0.png (ShellHub registration form) +[5]: https://opensource.com/article/20/7/www.shellhub.io +[6]: https://opensource.com/sites/default/files/figure2.gif +[7]: https://opensource.com/sites/default/files/figure3.gif +[8]: https://www.putty.org/ +[9]: https://termius.com/ +[10]: mailto:username@SSHID +[11]: https://opensource.com/sites/default/files/figure4.gif +[12]: https://gitter.im/shellhub-io/community?at=5e39ad8b3aca1e4c5f633e8f +[13]: mailto:contato@ossystems.com.br diff --git a/published/20200730 10 cheat sheets for Linux sysadmins.md b/published/20200730 10 cheat sheets for Linux sysadmins.md new file mode 100644 index 0000000000..53e7766a2d --- /dev/null +++ b/published/20200730 10 cheat sheets for Linux sysadmins.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12490-1.html) +[#]: subject: (10 cheat sheets for Linux sysadmins) +[#]: via: (https://opensource.com/article/20/7/sysadmin-cheat-sheets) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 系统管理员的 10 份速查表 +====== + +> 这些快速参考指南让系统管理员的生活和日常工作变得更轻松,而且它们都是免费提供的。 + +![](https://img.linux.net.cn/data/attachment/album/202008/05/222202qildlyr1lnqwq0o4.jpg) + +作为一名系统管理员,你做所的不是一件工作,而是**全部**工作,而且往往每一件工作都是随时随地出现,毫无预兆。除非你每天都只做一项任务,否则当需要的时候,你可能并不总是都能将所有的命令和选项都记在脑海里。这就是为什么我喜欢速查表的原因。 + +速查表可以帮助你避免愚蠢的错误,它们可以让你不必翻阅数页的文档,并让你高效地完成任务。我为每位系统管理员挑选了我最喜欢的 10 个速查表,无论他的经验水平如何。 + +### 网络 + +我们的《[Linux 网络][2]》速查表是速查表界的的瑞士军刀,它包含了最常见的网络命令的简单提醒,包括 `nslookup`、`tcpdump`、`nmcli`、`netstat`、`traceroute` 等。最重要的是,它用了 `ip` 命令,所以你终于可以不用再默认使用 `ifconfig` 命令了! + +### 防火墙 + +系统管理员有两种:了解 `iptables` 的和使用前一类人编写的 `iptables` 配置文件的。如果你是第一类人,你可以继续使用你的 `iptables` 配置,有没有 [firewalld][3] 都无所谓。 + +如果你是第二类人,你终于可以放下你的 iptables 焦虑,拥抱 firewalld 的轻松。阅读《[用 firewall-cmd 保护你的 Linux 网络][4]》,然后下载我们的《[firewalld 速查表][5]》来记住你所学到的东西,保护你的网络端口从未如此简单。 + +### SSH + +许多系统管理员都用的是 [POSIX][6] shell,所以可以在别人的计算机上运行的远程 shell 是 Linux 上最重要的工具之一也就不足为奇了。任何学习服务器管理的人通常很早就学会了使用 SSH,但我们中的许多人只学习了基础知识。 + +当然,SSH 可以在远程机器上打开一个交互式的 shell,但它的功能远不止这些。比如说,你需要在远程机器上进行图形化登录。远程主机的用户要么不在键盘旁边,要么无法理解你启用 VNC 的指令。只要你有 SSH 权限,就可以为他们打开端口。 + +``` +$ ssh -L 5901:localhost:5901 +``` + +通过我们的《[SSH 速查表][7]》了解更多。 + +### Linux 用户和权限 + +传统的大型机和 UNIX 超级计算机风格的用户账户现在基本上已经被 Samba、LDAP 和 OpenShift等系统所取代。然而,这并没有改变对管理员和服务账户仔细管理的需求。为此,你仍然需要熟悉`useradd`、`usermod`、`chown`、`chmod`、`passwd`、`gpasswd`、`umask` 等命令。 + +把我的《[用户和权限速查表][8]》放在手边,你就可以随时对与用户管理有关的任务进行合理的概览,并有实例命令演示你需要做的任何事情的正确语法。 + +### 基本的 Linux 命令 + +并不是所有的系统管理员都会把所有的时间花在终端上。无论你是否喜欢在桌面上工作,还是刚开始使用 Linux,有时为常用的终端命令提供一个任务导向的参考是很好的。 + +对于一个为灵活性和即兴性而设计的界面来说,找到所有你可能需要的东西是很困难的,但我的《[常用命令速查表][9]》是相当全面的。这张速查表以任何技术型桌面用户的典型生活为蓝本,涵盖了用命令在计算机内导航、寻找文件的绝对路径、复制和重命名文件、建立目录、启动系统服务等内容。 + +### Git + +在计算机的历史上,版本控制曾经是只有开发者才需要的东西。但那是过去,而 Git 是现在。对于任何希望跟踪从 Bash 脚本到配置文件、文档和代码的变化的人来说,版本控制是一个重要的工具。Git 适用于每个人,包括程序员、网站可靠性工程师(SRE),甚至系统管理员。 + +获取我们的《[Git 速查表][10]》来学习要领、基本工作流程和最重要的 Git 标志。 + +### Curl + +Curl 不一定是系统管理员专用的工具,从技术上讲,它“只是”一个用于终端的非交互式 Web 浏览器。你可能几天都不用它一次。然而,你很有可能会发现 Curl 对你每天要做的事情很有用,不管是快速参考网站上的一些信息,还是排除网络主机的故障,或者是验证你运行或依赖的一个重要 API。 + +Curl 是一个向服务器传输数据的命令,它支持的协议包括 HTTP、FTP、IMAP、LDAP、POP3、SCP、SFTP、SMB、SMTP 等。它是一个重要的网络工具,所以下载我们的《[Curl 速查表][11]》,开始探索 Curl 吧。 + +### SELinux + +Linux 的安全策略在默认情况下是很好的,root 权限和用户权限之间有很强的分离,但 SELinux 使用标签系统对其进行了改进。在配置了 SELinux 的主机上,每个进程和每个文件对象(或目录、网络端口、设备等)都有一个标签。SELinux 提供了一套规则来控制进程标签对对象(如文件)标签的访问。 + +有时候你需要调整 SELinux 策略,或者调试一些安装时没有正确设置的东西,或者深入了解当前的策略。我们的《[SELinux 速查表][12]》可以提供帮助。 + +### Kubectl + +无论你是已经迁移到了开放的混合云、封闭的私有云,还是你还在研究这样的迁移需要准备什么,你都需要了解 Kubernetes。虽然云确实还需要人去摆弄物理服务器,但作为一个系统管理员,你的未来肯定会涉及到容器,而没有什么比 Kubernetes 更能做到这一点。 + +虽然 [OpenShift][13] 为 Kubernetes 提供了流畅的“仪表盘”体验,但有时需要一种直接的方法,这正是 `kubectl` 提供的。下一次当你不得不到处推送容器时,请确保你手头有我们的《[kubectl 速查表][14]》。 + +### awk + +近几年来,Linux 经历了很多创新,有虚拟机、容器、新的安全模型、新的初始化系统、云等等。然而有些东西似乎永远不会改变。尤其是,系统管理员需要从日志文件和其它无尽的数据流中解析和隔离信息。仍然没有比 Aho、Weinberger 和 Kernighan 的经典 `awk` 命令更适合这项工作的工具。 + +当然,自从 1977 年它被编写出来后,`awk` 已经走过了很长的路,新的选项和功能使它更容易使用。但如果你不是每天都在使用 `awk`,那么多的选项和语法可能会让你有点不知所措。下载我们的《[awk 速查表][15]》,了解 GNU awk 的工作原理。 + +### 赠品:Bash 脚本编程 + +速查表是有用的,但如果你想找更全面的东西,你可以下载我们的《[Bash 脚本编程手册][16]》。这本指南教你如何将你从速查表中了解到的所有命令和经验结合到脚本中,帮助你建立一个随时能用的自动化解决方案库来解决你的日常问题。本书内容丰富,详细讲解了 Bash 的工作原理、脚本与交互式命令的区别、如何捕捉错误等。 + +### 赋能系统管理员 + +你是一名系统管理员吗? + +你正在成为一名系统管理员的路上吗? + +你是否对系统管理员一天都在做什么感到好奇? + +如果是的话,请查看《[赋能系统管理员][17]》,这里有来自业界最勤奋的系统管理员的新文章,讲述他们的工作,以及 Linux 和开源如何让这一切成为可能。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/sysadmin-cheat-sheets + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices) +[2]: https://opensource.com/downloads/cheat-sheet-networking +[3]: https://firewalld.org/ +[4]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd +[5]: https://opensource.com/downloads/firewall-cheat-sheet +[6]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[7]: https://opensource.com/downloads/advanced-ssh-cheat-sheet +[8]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[9]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[10]: https://opensource.com/downloads/cheat-sheet-git +[11]: https://opensource.com/downloads/curl-command-cheat-sheet +[12]: https://opensource.com/downloads/cheat-sheet-selinux +[13]: https://opensource.com/tags/openshift +[14]: https://opensource.com/downloads/kubectl-cheat-sheet +[15]: https://opensource.com/downloads/cheat-sheet-awk-features +[16]: https://opensource.com/downloads/bash-scripting-ebook +[17]: http://redhat.com/sysadmin diff --git a/published/20200801 How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions -Quick Tip.md b/published/20200801 How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions -Quick Tip.md new file mode 100644 index 0000000000..f29ae37c39 --- /dev/null +++ b/published/20200801 How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions -Quick Tip.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12515-1.html) +[#]: subject: (How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions [Quick Tip]) +[#]: via: (https://itsfoss.com/install-handbrake-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 上安装最新版本的 Handbrake +====== + +> 此快速教程介绍了如何使用在基于 Ubuntu 的发行版上使用官方 PPA 安装最新版本的 HandBrake。 + +![](https://img.linux.net.cn/data/attachment/album/202008/13/223818yghmgmagqggm2pa0.jpg) + +[HandBrake][1] 是可用于 Linux、Windows 和 macOS 的最受欢迎的开源视频转换器之一。 + +此 GUI 应用让你只需单击几下即可将视频从一种格式转换为另一种格式。你还可以根据需要自定义输出视频。 + +[HandBrake][2] 存在于 [Ubuntu 的通用存储库][3]中,但它可能并不总是最新版本。让我向你展示如何在 Ubuntu 和其他基于 Ubuntu 的发行版(如 Linux Mint、Linux Lite、elementray OS 等)上获得最新的 HandBrake。 + +### 在基于 Ubuntu 的 Linux 发行版上安装最新的 HandBrake + +HandBrake 的开发人员维护着一个[官方的 PPA][4]。[使用此 PPA][5],你可以轻松地在基于 Ubuntu 的发行版中安装最新版本的 HandBrake。 + +打开终端,然后使用以下命令添加 PPA 仓库。需要时按下回车键: + +``` +sudo add-apt-repository ppa:stebbins/handbrake-releases +``` + +你可能需要更新本地软件包缓存(在 Ubuntu 18.04 和更高版本中不是必需的): + +``` +sudo apt update +``` + +现在,使用以下命令安装最新版本的 HandBrake: + +``` +sudo apt-get install handbrake-gtk +``` + +这个方法最好的地方是会删除旧的 handbrake 软件包,从而避免安装两个不同版本的 handbrake。 + +![][6] + +在你的 Linux 系统上享受最新最好的 HandBrake 并转换视频。 + +### 从系统中卸载 HandBrake + +由于某些原因,如果你不喜欢 HandBrake 并希望将它删除,那么需要执行以下操作。 + +打开终端并使用以下命令卸载 HandBrake: + +``` +sudo apt remove handbrake-gtk +``` + +现在,你已经删除了该应用,如果你不再需要它,那么[删除它的 PPA][7] 是一个好主意。 + +``` +sudo add-apt-repository -r ppa:stebbins/handbrake-releases +``` + +在询问时确认。 + +在这篇快速 Ubuntu 教程中,你学习了使用 PPA 安装最新的 HandBrake 的步骤。你还了解了正确删除它的步骤。 + +我希望你觉得这篇快速教程有用。如果你有任何问题或建议,请在下面发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-handbrake-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://handbrake.fr/ +[2]: https://itsfoss.com/handbrake/ +[3]: https://itsfoss.com/ubuntu-repositories/ +[4]: https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases +[5]: https://itsfoss.com/ppa-guide/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/install-handbrake-ubuntu.png?resize=800%2C498&ssl=1 +[7]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ diff --git a/published/20200802 Manjaro vs Arch Linux- What-s the Difference- Which one is Better.md b/published/20200802 Manjaro vs Arch Linux- What-s the Difference- Which one is Better.md new file mode 100644 index 0000000000..a16f98b07a --- /dev/null +++ b/published/20200802 Manjaro vs Arch Linux- What-s the Difference- Which one is Better.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12527-1.html) +[#]: subject: (Manjaro vs Arch Linux: What’s the Difference? Which one is Better?) +[#]: via: (https://itsfoss.com/manjaro-vs-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Manjaro 和 Arch Linux 有何不同,哪个更好? +====== + +> Manjaro 还是 Arch Linux?如果说 Manjaro 是基于 Arch 的,那么它和 Arch 又有什么不同呢?请在这篇比较文章中阅读 Arch 和 Manjaro 的不同之处吧。 + +大多数[适合初学者的 Linux 发行版][1]都是基于 Ubuntu 的。随着 Linux 用户经验的增加,一些人开始尝试使用更高级的发行版,主要是在“Arch 领域”。 + +这个所谓的 “Arch 领域”以两个发行版为主。[Arch Linux][2] 本身和 [Manjaro][3]。还有其他[基于 Arch 的 Linux 发行版][4],但都没有这两个发行版受欢迎。 + +如果你在 Arch 和 Manjaro 之间感到困惑,那么这个比较应该能帮助你。 + +### Manjaro 和 Arch Linux:它们有什么不同或相似之处? + +![][5] + +我试图在各个方面比较这两种发行版。请记住,我并没有只关注差异,我还指出了它们的相似之处。 + +#### 两者都是滚动发布的版本,但不是同一种类型 + +在 Arch 和 Manjaro 中,没有像 Ubuntu 或 Fedora 那样每隔几个月或几年就会有一次“发布”。只要[保持你的 Arch 或 Manjaro 系统的更新][6],你将永远拥有最新版本的操作系统和软件包。你不需要像以往一样担心升级你的安装版本。 + +如果你打算在某个时候进行全新安装,请记住,Manjaro 和 Arch 都会定期更新它的安装 ISO。这被称为 ISO 刷新,它确保新安装的系统不必安装过去几个月中所有可用的新系统更新。 + +但 Arch 和 Manjaro 的滚动发布模式是有区别的。 + +除了社区维护的 Arch 用户软件库Arch User Repository(AUR)之外,Manjaro 也维护着自己的独立软件库,这些软件库也包含了非 Arch 提供的软件包。那些原本由 Arch 官方软件库提供的流行软件包将首先进行彻底的测试(必要时打上补丁),然后 Manjaro 再次发布,这通常比 Arch 晚两周左右,发布到 Manjaro 自己的稳定软件库供公众使用。 + +![][7] + +适应这个测试过程的一个后果是,Manjaro 永远不会像 Arch 一样那么激进尝鲜。但这样一来,就使得 Manjaro 比 Arch 稍微稳定一些,也不容易破坏你的系统。 + +#### 包管理 - Pacman 和 Pamac + +Arch 和 Manjaro 都提供了基于命令行的软件包管理工具 Pacman,它是用 C 语言编写的,使用 `tar` 来打包应用程序。换句话说,你可以[使用相同的 pacman 命令][8]来管理两个发行版的软件包。 + +除了 Pacman,Manjaro 还开发了一个名为 Pamac 的 GUI 应用程序,用于在 Manjaro 上轻松安装软件。这使得使用 Manjaro 比使用 Arch 更容易。 + +![Manjaro 的 Pamac GUI 包管理器][9] + +请注意,你也可以在 Arch Linux 中从 AUR 安装 Pamac,但该工具是 Manjaro 的组成部分。 + +#### Manjaro 硬件检测工具(MHWD) + +Pamac 并不是 Manjaro 团队开发的唯一帮助用户的 GUI 工具。Manjaro 还有一个专门的工具,用于检测硬件并为其推荐驱动程序。 + +![Manjaro 硬件配置 GUI 工具][10] + +这个硬件检测工具非常有用,可以说是 [Manjaro 受到社区喜爱的主要原因][11]之一。它使得检测、安装、使用或从一个驱动切换到另一个驱动都非常简单,让硬件兼容性成为了过去。 + +#### 驱动程序支持 + +Manjaro 为 GPU 驱动提供了极大的支持。我们都知道多年来 Linux 在安装驱动程序(特别是 Nvidia)方面存在问题。 + +当[安装 Manjaro][12] 时,它给出了从开源(自由)或非开源(非自由)图形驱动安装开始的选项。当你选择“非自由”时,它会自动检测你的显卡,并为其安装最合适的驱动程序,因此 GPU 可以开箱即用。 + +由于有了上一节中看到的硬件检测工具,甚至在安装 Manjaro 时,安装显卡驱动会更加容易。 + +如果你有一个带有 Nvidia Optimus 卡(混合 GPU)的系统,它与 Manjaro 配合良好。你会有很多方式来让它工作。 + +在 Arch Linux 中,你必须为你的机器安装(如果你能找到)合适的驱动程序。 + +#### 访问 Arch 用户软件库(AUR) + +[Arch 用户软件库][13](AUR)是一个面向基于 Arch 的 Linux 发行版用户的社区驱动的软件库。AUR 的创建是为了组织和分享来自社区的新软件包,并帮助加快流行软件包被纳入[社区软件库][14]。 + +大量进入官方软件库的新软件包都是从 AUR 开始的。在 AUR 中,用户能够贡献自己的软件包构建(`PKGBUILD` 和相关文件)。 + +你可以在 Arch 和 Manjaro 中使用 AUR。 + +#### 桌面环境 + +好吧!你可以在任何 Linux 发行版上使用几乎所有的桌面环境。Arch 和 Manjaro 也不例外。 + +然而,一个专门的桌面风格或版本可以让用户更容易地在桌面环境里获得顺畅的体验。 + +默认的 Arch ISO 并不包含任何桌面环境。例如,你想[在 Arch Linux 上安装 KDE][15],你必须在[安装 Arch Linux][16] 时或在之后下载安装它。 + +而 Manjaro 则为 Xfce、KDE 和 GNOME 等桌面环境提供了不同的 ISO。Manjaro 社区还维护着 MATE、Cinnamon、LXDE、LXQt、OpenBox 等桌面环境的 ISO。 + +#### 安装程序 + +![Arch 即用启动][17] + +Manjaro 是基于 Arch Linux 的,它是兼容 Arch 的,但**它不是 Arch**。它甚至不是只有一个图形安装程序的预配置版本的 Arch。Arch 并不具备通常的舒适的开箱即用,这也是为什么大多数人喜欢更简单的东西。Manjaro 为你提供了简单的入口,但支持你成为经验丰富的用户或资深用户。 + +#### 文档和支持 + +Arch 和 Manjaro 都有自己的维基页面和支持论坛来帮助各自的用户。 + +虽然 Manjaro 有一个不错的[维基][18]文档,但 [Arch 维基][19]则不可同日而语。你可以在 Arch 维基中找到关于 Arch Linux 各方面的详细信息。 + +#### 目标受众 + +关键的区别在于 [Arch 针对的是抱着自己动手的态度的用户][20],他们愿意阅读文档,自己解决问题。 + +而 Manjaro 则是针对那些没有那么多经验或者不想花时间组装操作系统的 Linux 用户。 + +### 结论 + +有些人经常说 Manjaro 是给那些不会安装 Arch 的人用的。但我认为这是不对的。不是每个人都想从头配置 Arch,或者没有太多时间。 + +Manjaro 绝对是一只野兽,但与 Arch 截然不同。**快速、强大,并总是保持更新**,Manjaro 提供了 Arch 操作系统的所有优点,但特别强调**稳定性、用户友好性和可访问性**,既适合新手,也适合有经验的用户。 + +Manjaro 并不像 Arch Linux 那样极简主义。在 Arch 中,你从一个空白的画布开始,手动调整每个设置。当默认的 Arch 安装完成后,你在命令行就有了一个正在运行的 Linux 实例。想要一个[图形化桌面环境][21]?那就自己来吧 —— 有很多选择。选择一个,安装,然后配置它。你可以从中学到很多东西,特别是如果你是 Linux 新手的话。你会对系统是如何组合在一起的,以及为什么要以这样的方式安装东西有很好的理解。 + +我希望你现在对 Arch 和 Manjaro 有了更好的理解。现在,你明白了它们是相似而不同的了吧。 + +我已经发表了我的看法。不要犹豫,请在评论区分享你的观点。在 Arch 和 Manjaro 之间,你更喜欢哪一个,为什么。 + +Abhishek Prakash 也此文补充了内容。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/manjaro-vs-arch-linux/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-beginners/ +[2]: https://www.archlinux.org/ +[3]: https://manjaro.org/ +[4]: https://itsfoss.com/arch-based-linux-distros/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/arch-vs-manjaro.png?ssl=1 +[6]: https://itsfoss.com/update-arch-linux/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/repositories.png?ssl=1 +[8]: https://itsfoss.com/pacman-command/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Pamac.png?resize=800%2C534&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/hardware-detection.png?ssl=1 +[11]: https://itsfoss.com/why-use-manjaro-linux/ +[12]: https://itsfoss.com/install-manjaro-linux/ +[13]: https://linux.cn/article-12107-1.html +[14]: https://wiki.archlinux.org/index.php/Community_repository +[15]: https://linux.cn/article-12258-1.html +[16]: https://itsfoss.com/install-arch-linux/ +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-live-boot.jpg?ssl=1 +[18]: https://wiki.manjaro.org/index.php?title=Main_Page +[19]: https://wiki.archlinux.org/ +[20]: https://linux.cn/article-12445-1.html +[21]: https://itsfoss.com/best-linux-desktop-environments/ diff --git a/published/20200802 Why making mistakes makes me a better sysadmin.md b/published/20200802 Why making mistakes makes me a better sysadmin.md new file mode 100644 index 0000000000..af4d719498 --- /dev/null +++ b/published/20200802 Why making mistakes makes me a better sysadmin.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (Starryi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12521-1.html) +[#]: subject: (Why making mistakes makes me a better sysadmin) +[#]: via: (https://opensource.com/article/20/8/sysadmin-mistakes) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +为什么犯错让我成为一个更好的系统管理员 +====== + +> 诀窍就是同一个错误不要犯两次。 + +![](https://img.linux.net.cn/data/attachment/album/202008/16/001203jeyztczb8t6q8egc.jpg) + +到目前为止,我已做了十多年 [Fedora][2] 贡献者。 Fedora 有一个由开发者和用户组成的大型社区,其中每一个人,不管是极富洞察力的用户还是出色的程序员,都有一些独有的技能。我喜欢这样的社区,因为它能激励我培养自己的新技能。 + +对我来说,培养技能最好的方法就是犯错,比如把事情搞得一团糟。犯什么样的错误不重要,因为相比错误本身,我在脱离困境的过程里学习到了什么更重要。 + +### 为什么犯错误是好事 + +我依然记得我犯的第一个计算机错误。我家的第一台电脑是我叔叔升职后送个我们的爱普生笔记本电脑,它有一个特别快的 10 MHz 处理器,因为太重了,所以还有一个手提把手。我很喜欢它。 + +它运行 DOS,但有一个基于文本的菜单应用,所以对新手用户比较友好。硬盘菜单有十个“页面”,每个“页面”可以配置十个命令。我们有一个游戏页面,还有一个页面放些“无聊的东西”,比如文字处理程序和电子表格等等。 + +硬盘菜单还有一些其他功能,当我玩腻了游戏,就会去探索它们。有一天,我决定使用菜单的账户功能。账户不会改变出现的应用程序,但在某种程度上,可以防止对应用程序未经授权的访问。你可以直接跳到 DOS 中取代它,但使用账户仍然是一个不错的尝试。 + +我为自己、父母和妹妹创建了账户。虽然我父母有点不开心,但他们最终迁就了我。万事顺遂了一段时间后,妹妹忘记了她的账户密码。于是,我父母让我删掉她的密码,但是没有妹妹的密码去登录账户,我就无法删除她的密码(那是在 90 年代初,一个比现在简单得多的时代)。要怎么办?要怎么办? + +那以后一段时间,我们一直试着猜测密码,直到有一天,我决定尝试做一些我还没有做过的事情。当我第一次创建帐户时,我设置了一个主密码。如果我输入主密码来代替我妹妹的密码,会发生什么呢? + +如果你在想,“这当然不会有用的”,那么显然你不熟悉 90 年代安全策略的天真幼稚。有了主密码(顺便说一下,主密码是 “worf” ,指的是企业号星舰的克林贡人安全主管,如果你不是《星际迷航:下一代》粉丝的话),我可以删除所有密码。于是,家里的每个人又都可以毫无障碍地使用电脑了。 + +### 试运行的重要性 + +在那之后,我又犯了更大更有益的错误。比如,在我第一次做系统管理员时,当时我正整理一些数据以重新配置存储阵列。有一次,我意外地颠倒了源路径和目标路径,而且那是一个带有 `——delete` 标志的 `rsync` 命令。真的是太糟糕了! + +幸运的是,我自己的账户也崩溃了,这让我的道歉更容易被其他受影响的用户接受。对我们所有人来说更幸运的是,我们有备份。所以那天结束的时候,每个人的文件都找回来了,我还学到了一个宝贵的教训,那就是在进行破坏性同步之前,先使用 `--dry-run` 标志试运行。 + +### 以正确的方式处理错误 + +我不介意犯错误。这些年来,我积累了很多实践经验,学到的诀窍就是不要犯同样的错误。从错误中学习能让我在技能和事业上取得进步,并发现新的会犯的错误。作为 Linux 系统管理员,我总是试图在一个安全的环境(测试平台就很好)中犯错误,确保我可以从错误中恢复(备份真的非常非常重要!),并给以后的我留个笔记,这样他就不会重复犯错(文档是你的朋友)。当然,还要勇于承认自己的错误,并在出现问题时清楚地与用户沟通。如果我一直这样做,也许有一天我就会觉得我很清楚我在做什么! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/sysadmin-mistakes + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[Starryi](https://github.com/Starryi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) +[2]: http://getfedora.org diff --git a/published/20200803 Do math in the Linux shell with GNU bc.md b/published/20200803 Do math in the Linux shell with GNU bc.md new file mode 100644 index 0000000000..c0b41ddb60 --- /dev/null +++ b/published/20200803 Do math in the Linux shell with GNU bc.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12506-1.html) +[#]: subject: (Do math in the Linux shell with GNU bc) +[#]: via: (https://opensource.com/article/20/7/bc-math) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 GNU bc 在 Linux Shell 中进行数学运算 +====== + +> 在 shell 中使用 bc 更好地做算数,它是一种用于高级计算的数学语言。 + +![](https://img.linux.net.cn/data/attachment/album/202008/11/105133c86k08rf028jjd6a.jpg) + +大多数 [POSIX][2] 系统带有 [GNU bc][3],这是一种任意精度的数字处理语言。它的语法类似于 C,但是它也支持交互式执行语句和处理来自标准输入(`stdin`)的数据。因此,它通常是以下问题的答案:“我如何在 Linux shell 中进行数学运算?”这种回应方式在网上很常见: + +``` +$ echo "1+1" | bc +2 +``` + +尽管这是完全正确的,但很少有用户认为,与更直观的方式相比,它很优雅,例如: + +``` +$ 1+1  # 这不能工作 +2 +``` + +交互模式要容易一些: + +``` +$ bc +1+1 +2 +quit +$ +``` + +但是交互模式并不总是适合简单计算想要的直观工作流,比如直接输入你想要的计算。因此我推荐 Bluebat 的[纯 Bash 计算器][4]。 + +`bc` 实际上提供了一种用于高级计算的数学语言。 + +### 含高级函数的 mathlib + +`bc` 本身提供了基本的数学函数。你可以在交互式模式下测试它们: + +``` +$ bc +3^2 +9 +(3^2)*(9)/3 +27 +``` + +使用 `--mathlib` 选项获取高级函数,包括正弦、余弦、正切等。在交互式模式下,你可以测试其中一些。下面是 90 度的余弦: + +``` +c(90) +-.44807361612917015236 +``` + +9 的正弦: + +``` +s(9) +.41211848524175656975 +``` + +### 创建你自己的 bc 函数 + +你还可以在 `bc` 中创建自己的函数。函数定义以 `define` 关键字开始,并用大括号括起来。下面是一个输入到交互式会话中的简单函数,它返回给它的任意数字: + +``` +$ bc +define echo(n) { +  return (n); +} +``` + +在同一个交互式会话中,测试一下: + +``` +echo(2) +2 +echo(-2) +-2 +``` + +### bc 中的 if 语句 + +`bc` 语言还有各种控制语句,其中最简单的是 `if`/`else`。语法乍一看可能很熟悉,但在如何处理大括号方面有些不同。请注意,`if` 语句的 `else` 子句包含在大括号中,而 `then` 子句不是,但两者都用分号终止。下面是一个返回数字 `n` 的绝对值的函数: + +``` +define abso(n) { +  if ( n > 0 ) return (n); +  { return (-n); } +} +``` + +在同一个交互式会话中,测试一下: + +``` +abso(-5) +5 +abso(5) +5 +``` + +### 将数据导入 bc + +使用交互式会话对于快速计算和实验是可以容忍的,但在退出时会丢失数据,并且在出错时很难编辑。幸运的是,`bc` 可以从外部文件加载变量和函数。 + +下面是一个包含两个变量(`sol` 和 `foo`)的文件,以及一个用于查找绝对值的自定义 `abso` 函数: + +``` +sol=299792458 + +foo=42 + +define abso(n) { +  if ( n > 0 ) return (n); +  { return (-n); } +} +``` + +将它保存到名为 `bcvars.bc` 的文件中,以便导入 `bc` 交互式会话: + +``` +$ bc bcvars.bc +foo +42 +sol +299792458 +abso(-23) +23 +``` + +### 使用 bc 助力你的数学 + +`bc` 语言相对简单,前提是你知道足够的数学知识来构造任何你想完成的方程。虽然 `bc` 默认提供了有用的基本函数,并允许你创建自己的函数,但你可以通过站在巨人的肩膀上来减少工作量。加载了用于数学基础知识和特定任务(例如,计算复利)的新函数的文件可从 [GNU bc 页][5]获得,同时也可获得 `bc` [完整文档][6]。 + +如果你有兴趣在 shell 里更好地处理数学,试试 `bc` 。它不会使你成为数学天才,但它可能会让过程更简单。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/bc-math + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1 (old school calculator) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://www.gnu.org/software/bc/ +[4]: https://raw.githubusercontent.com/bluebat/.bash/master/bashbc.sh +[5]: http://phodd.net/gnu-bc/ +[6]: https://www.gnu.org/software/bc/manual/html_mono/bc.html diff --git a/published/20200805 How to Install Itch on Ubuntu and Other Linux Distributions.md b/published/20200805 How to Install Itch on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..73289b3d7d --- /dev/null +++ b/published/20200805 How to Install Itch on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12526-1.html) +[#]: subject: (How to Install Itch on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/install-itch-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 和其它的 Linux 发行版上安装 Itch +====== + +![][7] + +[Itch][1] 是独立数字创造者的平台,主要专注于独立游戏。它最初是一个托管、销售和下载独立视频游戏的网站。但是现在,Itch 也提供书籍、漫画、工具、棋类游戏、原声带等来自独立创造者的数字内容。 + +作为一名用户,你或者能够免费下载这些数字内容,或者按照创造者设定的价格下载。你所有下载和购买的东西都同步到你的账户,以便你可以在任何你想的时间内下载它们。 + +它有点像 Steam,但是更专注于独立开发者和创作者。 + +你可以从它的网站浏览 Itch ,但是 Itch 也提供了一个 [开源的桌面客户端][2],有一些额外的优势。使用桌面客户端: + + * 你可以浏览游戏和其它的内容,并下载它们到你的系统上。 + * 桌面客户端会自动更新所有新功能。 + * 你下载的游戏也自动更新。 + * 如果你在 Itch 玩基于浏览器的游戏, 那么你可以使用 Itch 桌面客户端离线玩。 + +在这篇教程中,我将向你展示在 Ubuntu 或其它任何 Linux 发行版上安装 Itch 的步骤。 + +### 在 Linux 桌面上安装 Itch + +Itch 提供一个名称为 itch-setup 的安装器。你可以从它的下载网页下载这个文件。 + +- [下载 Linux 版 Itch][3] + +这个 itch-setup 文件可以工作在任何的 Linux 发行版上,只要它已经安装有 GTK 3 (libgtk-3-0)。大多数当前的 Linux 发行版应该已经有它了。 + +在你下载安装文件后,在其上面右击并给予它可执行权限。 + +![右击并给予文件可执行权限][4] + +现在在这个安装文件上通过双击来运行。它将下载 Itch 的最新版本。 + +![][5] + +实际花费的时间取决于你的网速。几分钟后,你应该会看到这个屏幕,要求你登录你的 Itch 账号。 + +![][6] + +在你登录后,你可以浏览游戏和其它的内容,并下载/购买它们。 + +整个安装过程类似于 [在 Ubuntu 上安装 Steam][8]。 + +你可以在 `~/.itch` 文件夹中找到 Itch 的文件。你从 Itch 下载的内容通常位于 `~/.config/itch` 。补充一句,`~` 意味着你的家目录。 + +### 从你的系统中移除 Itch 桌面应用程序 + +出于某些原因,如果你不想再使用 Itch ,你可以从你的系统中移除它。为此,麻烦的是,你需要使用终端。 + +打开一个终端,并使用下面的命令: + +``` +~/.itch/itch-setup --uninstall +``` + +它不会移除你的内容库。如果你想移除下载的游戏和材料,你可以手动删除 `~/.config/itch` 文件夹。 + +``` +rm -r ~/.config/itch +``` + +### 你用 Itch 吗? + +Itch 是一个独立创作者的道德平台,也是这种模式的支持者。Itch 使用 “你想付多少钱就付多少钱”,买家可以支付大于或相等内容创作者设置的任何金额。 + +Itch 也有开放收益分享模式。创作者可以与 Itch 分享部分他们产生的收入,也可以不分享。 + +就我个人而言,我更喜欢像 Itch 和 Humble Bundle 这些有道德的商店。像 Humble Bundle 一样,Itch 也时不时地进行销售和捆绑销售。这有助于你节省资金,并支持独立开发者和创作者。 + +你使用 Itch ,还是 Humble Bundle ?你还使用哪种类似的平台? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-itch-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itch.io/?ac=ywUpyBMGXvG +[2]: https://github.com/itchio/itch +[3]: https://itch.io/app +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/itch-installer-linux.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/installing-itch-linux.jpg?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/itch-running-linux.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/itch-game-page.png?resize=800%2C441&ssl=1 +[8]: https://itsfoss.com/install-steam-ubuntu-linux/ +[9]: https://itsfoss.com/affiliate-policy/ diff --git a/published/20200807 install Fedora on a Raspberry Pi 3.md b/published/20200807 install Fedora on a Raspberry Pi 3.md new file mode 100644 index 0000000000..a6d54a8de3 --- /dev/null +++ b/published/20200807 install Fedora on a Raspberry Pi 3.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12520-1.html) +[#]: subject: (install Fedora on a Raspberry Pi 3) +[#]: via: (https://fedoramagazine.org/install-fedora-on-a-raspberry-pi/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +在树莓派 3 上安装 Fedora +====== + +![][1] + +> 在树莓派上运行 Fedora。 + +[树莓派基金会][2]这几年来生产了很多型号。本文的安装过程已经在第三代树莓派上进行了测试:[3B v1.2][3] 和 [B+][4](较旧的 [树莓派 2][5] 和新的 [树莓派 4][6] 都还没有测试)。这些是已经发布了几年的信用卡大小的树莓派。 + +### 获取硬件 + +你需要一些硬件组件,包括树莓派。你不需要任何 [HaT(安装在顶部的硬件)][7] 板或 USB 天线。如果你使用过树莓派,那么可能会有这些。 + + * **当前网络**。也许是你的家庭实验室。 + * **网线**。连接当前网络到树莓派 + * **树莓派 3**,型号 B 或 B+。 + * **电源**。 + * **8 GB 或更大容量的 micro-SD 卡**。 + * **键盘**和**显示器**。 + +键盘和显示器共同组成本地控制台。即使没有控制台,也能进行操作(尽管很复杂),例如设置自动安装然后通过网络连接。在 Fedora 首次启动时,本地控制台可轻松回应配置问题。同样,在 AP 配置期间出错可能会破坏网络配置,从而阻止远程用户连入。 + +### 下载 Fedora Minimal + + * 查找 Fedora 的[其他可选架构镜像][8]。 + * 下载 [ARM® aarch64 架构镜像][9]。 + +Fedora Minimal 镜像是 [Fedora 的其他可选下载之一][10],它有所有必需的核心软件包和网络软件包(嗯,是几乎,注意下面的 dnsmasq)。该镜像包含一个现成的文件系统,它已经安装了 400 多个软件包。此最小镜像不包括流行的软件包,像开发环境、互联网服务或桌面。这些类型的软件不是这里所必需的,如果安装它们,可能会占用过多的内存。 + +Fedora Minimal 原始镜像可安装在小型 SD 卡上,并在少于 1GB 的内存中运行(这些旧的树莓派有 1GB 的内存)。 + +下载文件的名称类似于 `Fedora-Minimal-32-1.6.aarch64.raw.xz`。该文件已压缩,大小约为 700MB。文件解压缩后为 5GB。这是一个 ext4 文件系统,它大部分是空的:已使用约 1GB,空余 4GB。这些空的空间是压缩文件比未压缩的原始文件小得多的原因。 + +### 复制到 micro-SD 卡 + + * 将镜像复制到 micro-SD 卡。 + +这可能比听起来更复杂,而且会带来痛苦的体验。找到一个[良好的 micro-SD 卡][11]需要花费精力。然后是将卡插到计算机的挑战。也许你的笔记本电脑有全尺寸的 SD 卡插槽,你还需要卡适配器,或者你需要一个 USB 适配器。然后,在进行复制时,操作系统可能会帮助你,也可能会妨碍你。你可能很幸运有 [Fedora Media Writer][12],或使用这些 Linux 命令: + +``` +unxz ./Fedora-Minimal-32-1.6.aarch64.raw.xz +dd if=./Fedora-Minimal-32-1.6.aarch64.raw of=/dev/mmcblk0 bs=8M status=progress oflag=direct +``` + +### 安装 Fedora + + * 连接树莓派、电源线、网线和 micro-SD 卡。 + * 打开电源。 + * 当图形芯片通电时,看见彩色框。 + * 等待 [anaconda 安装程序][13]启动。 + * 回答 anaconda 的设置问题。 + +操作系统的初始配置需要几分钟的时间。等待启动需要花费几分钟,还需要花费一些时间填写 anaconda 的文本安装程序的问题。在下面的例子中,用户名为 `nick`,并且还是管理员(`wheel` 组的成员)。 + +恭喜你!你的树莓派已启动并可运行。 + +### 更新软件 + + * 用 `dnf update` 更新软件包。 + * 通过 `systemctl reboot` 重启。 + +多年来,很多人为使树莓派正常工作付出了很多工作。使用最新的软件,以确保你从他们的辛勤工作中受益。如果你跳过此步骤,你可能会发现有些东西无法正常工作。 + +此次更新下载并安装了约一百个软件包。由于存储设备是 micro-SD 卡,因此写入新软件的过程很慢。这就是 90 年代使用存储器的感觉。 + +### 可以摆弄的东西 + +如果你想摆弄的话,此时可以设置其他一些内容。这都是可选的。试试这些。 + + * `sudo hostnamectl set-hostname raspi` 替换 `localhost` 主机名。 + * 用 `ip addr` 查找 IP 地址。 + * 尝试 SSH 登录,甚至使用 `ssh-copy-id` 设置基于密钥的登录。 + * 使用 `systemctl poweroff` 关机。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/install-fedora-on-a-raspberry-pi/ + +作者:[Nick Hardiman][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/fedora-on-rpi-816x346.png +[2]: https://www.raspberrypi.org/about/ +[3]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b/ +[4]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/ +[5]: https://www.raspberrypi.org/products/raspberry-pi-2-model-b/ +[6]: https://www.raspberrypi.org/products/raspberry-pi-4-model-b/ +[7]: https://www.raspberrypi.org/blog/introducing-raspberry-pi-hats/ +[8]: https://alt.fedoraproject.org/alt/ +[9]: https://download.fedoraproject.org/pub/fedora-secondary/releases/32/Spins/aarch64/images/Fedora-Minimal-32-1.6.aarch64.raw.xz +[10]: https://alt.fedoraproject.org/ +[11]: https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-card-performance-comparison-2019 +[12]: https://fedoramagazine.org/make-fedora-usb-stick/ +[13]: https://fedoraproject.org/wiki/Anaconda diff --git a/published/20200809 Open Source Drawing App Pinta Sees New Release After 5 Years. Here-s How to Get it.md b/published/20200809 Open Source Drawing App Pinta Sees New Release After 5 Years. Here-s How to Get it.md new file mode 100644 index 0000000000..f9c356010c --- /dev/null +++ b/published/20200809 Open Source Drawing App Pinta Sees New Release After 5 Years. Here-s How to Get it.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12501-1.html) +[#]: subject: (Open Source Drawing App Pinta Sees New Release After 5 Years. Here’s How to Get it!) +[#]: via: (https://itsfoss.com/pinta-new-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +开源绘画应用 Pinta 在 5 年后迎来新版本 +====== + +> 开源绘画应用 Pinta 时隔 5 年多迎来新版本。新版本修复了众多 BUG,并增加了新功能。 + +[Pinta][1] 是一款[开源绘画应用,适用于 Linux][2]、Windows 和 macOS。你可以用它来进行自由手绘/素描。你也可以用它在现有的图片上添加箭头、方框、文字等。 + +![][3] + +日前,Pinta 1.7 版本在时隔近 5 年后发布。让我们来看看新版本中都有哪些功能。 + +### Pinta 1.7 的新功能 + +以下是最新版本的 Pinta 带来的新功能: + + * 可以在图片之间切换的标签视图 + * 增加了一个平滑擦除工具 + * 拖放 URL 以在 Pinta 中下载并打开图像进行编辑 + * 铅笔工具可以在不同的混合模式之间切换 + * 按住 Ctrl 键可以缩放“选定移动”工具 + * 矩形选择工具现在在选区的每个角落显示不同的箭头光标 + * 提高了与选区互动时的性能,特别是对大图像而言 + +还有许多 bug 修复,这应该会改善整个 Pinta 的体验。你可以在[官方发布说明][4]中了解更多变化。 + +### 在 Ubuntu 和其他 Linux 发行版上安装 Pinta 1.7 + +对于 Ubuntu 和基于 Ubuntu 的 Linux 发行版,有一个[官方 PPA 可用][5]。如果你使用的是 Ubuntu 18.04 或 20.04,可以使用这个 PPA。 + +打开一个终端,使用下面的命令来添加新的仓库。你会被要求输入你的密码。你可能已经知道,当你在终端中输入密码时,不会有任何显示。只要输入密码,然后按回车键就可以了。 + +``` +sudo add-apt-repository ppa:pinta-maintainers/pinta-stable +``` + +在 Ubuntu 18.04 和更高版本上已不再需要,但其他一些发行版可能需要更新缓存: + +``` +sudo apt update +``` + +现在用这个命令安装最新版本的 Pinta: + +``` +sudo apt install pinta +``` + +好的是,如果你之前安装了 Pinta 1.6,它就会更新到新版本。 + +#### 移除 Pinta + +要删除通过 PPA 安装的 Pinta,请使用此命令: + +``` +sudo apt remove pinta +``` + +你还应该[删除此 PPA][6]: + +``` +sudo add-apt-repository -r ppa:pinta-maintainers/pinta-stable +``` + +#### 在其他发行版上安装 Pinta + +在我上次检查时,Pinta 1.7 还没有在 Fedora 或 AUR 上出现。你可以等待一段时间,或者下载源码自己试试。 + +- [下载 Pinta 1.7][7] + +Pinta 团队也更新了用户指南,提供了详细的文档。如果你是新手或者想深入使用 Pinta,可以参考[本用户指南][8]进行参考。 + +### 结束语 + +我很高兴能看到 Pinta 的新版本。它是我编辑图像的常用工具,可以为教程添加箭头、方框和文字。最近我使用 [Shutter][9] 来达到这个目的,但有了这个新版本,我也许会再次改用 Pinta。 + +你呢?你使用 Pinta 吗,或者你过去用过它吗?你期待使用新版本吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pinta-new-release/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.pinta-project.com/ +[2]: https://itsfoss.com/open-source-paint-apps/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/pinta-1-7.png?resize=800%2C517&ssl=1 +[4]: https://www.pinta-project.com/releases/1-7 +[5]: https://launchpad.net/~pinta-maintainers/+archive/ubuntu/pinta-stable +[6]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[7]: https://www.pinta-project.com/releases/ +[8]: https://www.pinta-project.com/user-guide/ +[9]: https://itsfoss.com/install-shutter-ubuntu/ diff --git a/published/20200811 Don-t ignore .gitignore.md b/published/20200811 Don-t ignore .gitignore.md new file mode 100644 index 0000000000..7e1b1bc47a --- /dev/null +++ b/published/20200811 Don-t ignore .gitignore.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12524-1.html) +[#]: subject: (Don't ignore .gitignore) +[#]: via: (https://opensource.com/article/20/8/dont-ignore-gitignore) +[#]: author: (Rajeev Bera https://opensource.com/users/acompiler) + +不要忽视 .gitignore +====== + +> 使用 .gitignore 文件是提高代码和 Git 仓库质量的最佳实践之一。 + +![](https://img.linux.net.cn/data/attachment/album/202008/16/211643mahzp0zthbh0z55w.jpg) + +我注意到很多开发者没有使用 `.gitignore` 文件,尽管使用 `.gitignore` 文件来指定你不希望 Git 在版本控制中跟踪的文件是[最佳实践][2]之一。`.gitignore` 可以提高代码质量,所以你不应该忽略版本库中的 [.gitignore][3]。 + +### 什么是 .gitignore? + +Git 仓库中的文件可以是: + + 1. **未跟踪的**:未被暂存或提交的变更。 + 2. **跟踪的**:已暂存或提交的变更。 + 3. **忽略的**:你让 Git 忽略的文件。 + +有些文件你希望 Git 忽略,不要在你的版本库中跟踪它,这些文件包括许多自动生成的或特定于平台的文件,以及其他本地配置文件,如: + + 1. 含有敏感信息的文件 + 2. 编译出的代码,如 `.dll` 或 `.class`。 + 3. 系统文件,如 `.DS_Store` 或 `Thumbs.db`。 + 4. 含有临时信息的文件,如日志、缓存等。 + 5. 生成的文件,如 `dist` 文件夹。 + +如果你不想让 Git 跟踪版本库中的某些文件,不过这不能通过 [Git 命令][4]做到。(虽然你可以用 `git rm` 命令停止跟踪一个文件,比如 `git rm --cached`。)相反,你需要使用 `.gitignore` 文件,这是一个告诉 Git 不要跟踪哪些文件的文本文件。 + +创建 `.gitignore` 文件很简单,只需创建一个文本文件并命名为 `.gitignore`。记得在文件名的开头有一个点(`.`)。就这样就完成了。 + +### 编写 .gitignore 文件的规则 + +根据[文档][3],“`.gitignore` 文件中的每一行都指定了一个模式。” + +在此上下文中,“模式”可以指一个特定的文件名,或者指文件名的某些部分结合上通配符。换句话说,`example.txt` 是匹配名为 `example.txt` 的文件的有效模式,而 `ex*txt` 是匹配名为 `example.txt` 以及 `export.txt` 的文件的有效模式。 + +以下是一些帮助你正确设置 `.gitignore` 文件的基本规则: + + 1. 任何以哈希(`#`)开头的行都是注释。 + 2. `\` 字符可以转义特殊字符。 + 3. `/` 字符表示该规则只适用于位于同一文件夹中的文件和文件夹。 + 4. 星号(`*`)表示任意数量的字符(零个或更多)。 + 5. 两个星号(`**`)表示任意数量的子目录。 + 6. 一个问号(`?`)代替零个或一个字符。 + 7. 一个感叹号(`!`)会反转特定的规则(即包括了任何被前一个模式排除的文件)。 + 8. 空行会被忽略,所以你可以用它们来增加空间,使你的文件更容易阅读。 + 9. 在末尾添加 `/` 会忽略整个目录路径。 + +### 本地与全局 .gitignore 文件的比较 + +有两种类型的 `.gitignore` 文件: + + * **本地**:放在 Git 仓库的根目录下,只在该仓库中工作,并且必须提交到该仓库中。 + * **全局**:放在你的主目录根目录下,影响你在你的机器上使用的每个仓库,不需要提交。 + +很多开发者在项目仓库中使用本地的 `.gitignore` 文件,但很少有人使用全局的 `.gitignore` 文件。使用全局文件最显著的优势是,你不需要提交就可以使用它,而且做一个改动会影响你所有的版本库。 + +### Git 忽略的优势 + +除了确保特定的文件不被 Git 追踪之外,使用 `.gitignore` 文件还有其他好处。 + + 1. 通过忽略不需要的文件,它可以帮助你保持代码库的干净。 + 2. 它可以控制代码库的大小,这在你正在做一个大项目的时候特别有用。 + 3. 你的每一次提交、推送和拉取请求都将是干净的。 + +### 结束语 + +Git 很强大,但归根结底,它只是一个计算机程序而已。使用最佳实践并保持你的代码仓库稳定是一个团队的努力,其中要做到一件事就是使用 `.gitignore` 文件。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/dont-ignore-gitignore + +作者:[Rajeev Bera][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/acompiler +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://opensource.com/article/20/7/git-repos-best-practices +[3]: https://git-scm.com/docs/gitignore +[4]: https://acompiler.com/git-commands/ diff --git a/sources/news/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md b/sources/news/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md deleted file mode 100644 index 7badbfc8a2..0000000000 --- a/sources/news/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md +++ /dev/null @@ -1,91 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Remember Unity8 from Ubuntu? UBports is Renaming it to Lomiri) -[#]: via: (https://itsfoss.com/unity8-lomiri/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Remember Unity8 from Ubuntu? UBports is Renaming it to Lomiri -====== - -Ever since Ubuntu abandoned the Unity project, UBports continued the maintenance and development of Unity. On February 27th 2020, [UBports][1] announced that they are giving Unity8 a new branding in the form of Lomiri. - -### Unity8 is now Lomiri - -![Unity8 in action | Image Credit: UBports][2] - -[UBports announced][3] that the Unity8 desktop environment would be renamed as Lomiri. They gave three reasons for this fairly drastic announcement. - -First, they want to avoid confusion with the [Unity game engine][4]. Quite a few people confused the two. UBports noted that they are frequently receiving questions regarding “how to import 3D models and meshes into our shell”. When you search “Unity” in your favorite search engine, most of the top links are for the game engine. - -The second reason for the name change has to do with the new effort to package Unity8 for Debian. Unfortunately, many of the Unity8’s dependencies have Ubuntu in the name, for example, _**ubuntu-ui-toolkit**_. Debian packagers warned that packages that have Ubuntu in the name may not be accepted into [Debian][5]. - -Finally, UBports said the name change would improve verbal communications. Saying Unity8 repeatedly can be a mouthful. People would not have to worry about confusing “users of Ubuntu Unity and Unity (the game engine)”. - -UBports went on to stress that the name change was not “triggered by any action from Canonical or the Ubuntu community, legal or otherwise”. - -They noted that this name change was the perfect time for them to switch to [GitHub alternative GitLab][6] for their development. - -Interestingly, the announcement did not explain how they picked Lomiri as the new name. All they said is that “We went through many different names before settling on Lomiri. All of them had problems with pronunciation, availability, or other related issues.” - -UBports noted that most Ubuntu Touch users would be unaffected by the name change. Developers and power users might notice some changes, but UBports “will strive to maintain backwards compatibility within Ubuntu Touch for the foreseeable future”. - -### What Exactly is Being Renamed? - -![][7] - -According to the announcement, packages that have either Ubuntu or Unity in the title will be affected. For example, - - * **unity8**, containing the shell, will become **lomiri** - * **ubuntu-ui-toolkit** will become **lomiri-ui-toolkit** - * **ubuntu-download-manager** will become **lomiri-download-manager** - - - -On top of this, interfaces call will change, as well. “For example, the **Ubuntu.Components** QML import will change to **Lomiri.Components**.” For the sake of backwards compatibility, Ubuntu Touch images will not change too much. “Developers will only need to update to the new API when they’d like to package their apps for other distributions.” - -### What Will Stay the Same? - -Since renaming packages can cause quite a few cascading problems, UBports wants to limit the number of packages they change. They don’t expect the following things to change. - - * Packages that don’t use the “Ubuntu” or “Unity” names - * Ubuntu Touch will remain the same - * Any components which are already used by other projects and accepted into other distributions - - - -### Final Thoughts - -![][8] - -Overall, I think this change will be good for Ubuntu Touch in the long run. I understand why [Canonical][9] picked the Unity name for their convergence desktop, but I think the desktop environment was overshadowed by the game engine from the beginning. This will give them room to breathe and also free up valuable coding time. The less time spent replying to questions about 3D models the more time that can be spent creating a convergent desktop. - -If you have any further questions or concerns about the name change, you visit the [UBports forms][10]. They have set up a thread specifically for this topic. - -Don’t hesitate to share our views on it in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/unity8-lomiri/ - -作者:[John Paul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/john/ -[b]: https://github.com/lujun9972 -[1]: https://ubports.com/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/unity8_ubports.png?ssl=1 -[3]: https://ubports.com/blog/ubports-blog-1/post/lomiri-new-name-same-great-unity8-265 -[4]: https://en.wikipedia.org/wiki/Unity_(game_engine) -[5]: https://www.debian.org/ -[6]: https://itsfoss.com/github-alternatives/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/Unity8-lomiri.png?ssl=1 -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/ubports.jpeg?ssl=1 -[9]: https://canonical.com/ -[10]: https://forums.ubports.com/topic/3874/unity8-is-now-lomiri diff --git a/sources/news/20200314 Linux Foundation prepares for disaster, new anti-tracking data set, Mozilla goes back to mobile OSes, and more open source news.md b/sources/news/20200314 Linux Foundation prepares for disaster, new anti-tracking data set, Mozilla goes back to mobile OSes, and more open source news.md deleted file mode 100644 index 0f3aa9a0a3..0000000000 --- a/sources/news/20200314 Linux Foundation prepares for disaster, new anti-tracking data set, Mozilla goes back to mobile OSes, and more open source news.md +++ /dev/null @@ -1,82 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Foundation prepares for disaster, new anti-tracking data set, Mozilla goes back to mobile OSes, and more open source news) -[#]: via: (https://opensource.com/article/20/3/news-march-14) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Linux Foundation prepares for disaster, new anti-tracking data set, Mozilla goes back to mobile OSes, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![][1] - -In this edition of our open source news roundup, we take a look at the Linux Foundation's disaster relief project, DuckDuckGo's anti-tracking tool, open textbooks, and more! - -### Linux Foundation unveils Project OWL - -When a disaster happens, it's vital to keep communications links up and running. One way to do that is with [mesh networks][2]. The Linux Foundation [has unveiled][3] Project OWL to "help build mesh network nodes for global emergency communications networks." - -Short for _Organisation, Whereabouts, and Logistics_, OWL is firmware for Internet of Things (IoT) devices that "can quickly turn a cheap wireless device into a ‘DuckLink’, a mesh network node". Those devices can connect to other, similar devices around them. OWL also provides an analytics tool that responders can use for "coordinating resources, learning about weather patterns, and communicating with civilians who would otherwise be cut off." - -### New open source tool to block web trackers - -It's no secret that sites all over the web track their visitors. Often, it's shocking how much of that goes on and what a threat to your privacy that is. To help web browser developers better protect their users, the team behind search engine DuckDuckGo is "[sharing data it's collected about online trackers with other companies so they can also protect your privacy][4]." - -That dataset is called Tracker Radar and it "details 5,326 internet domains used by 1,727 companies and organizations that track you online". Browser Radar is different from other tracker databases in that it "annotates data with other information, like whether blocking a tracker is likely to break a website, so anyone using it can pick the best balance of privacy and convenience." - -Tracker Radar's dataset is [available on GitHub][5]. The repository also links to the code for the [crawler][6] and [detector][7] that work with the data. - -### Oregon Tech embracing open textbooks - -With the cost of textbooks taking an increasingly large bite out of the budgets of university students, more and more schools are turning to open textbooks to cut those costs. By embracing open textbooks, the Oregon Institute of Technology has [save students $400,000][8] over the last two years. - -The school offers open textbooks for 26 courses, ranging "from chemistry and biology, to respiratory care, sociology and engineering." Although the textbooks are free, university librarian John Schoppert points out that the materials are of a high quality and that faculty members have been "developing lab manuals and open-licensed textbooks where they hadn’t existed before and improved on others’ materials." - -### Mozilla to help update feature phone OS - -A few years ago, Mozilla tried to break into the world of mobile operating systems with Firefox OS. While that effort didn't pan out, Firefox OS found new life powering low-cost feature phones under the name KaiOS. Mozilla's [jumping back into the game][9] by helping "modernize the browser engine that's core to the software." - -KaiOS is built upon a four-year-old version of Mozilla's Gecko browser engine. Updating Gecko will "improve security, make apps run faster and more smoothly, and open [KaiOS to] more-sophisticated apps and WebGL 2.0 for better games graphics." Mozilla said its collaboration will include "Mozilla's help with test engineering and adding new low-level Gecko abilities." - -#### In other news - - * [CERN adopts Mattermost, an open source messaging app][10] - * [Open-source software analyzes economics of biofuels, bioproducts][11] - * [Netflix releases Dispatch for crisis management orchestration][12] - * [FreeNAS and TrueNAS are merging][13] - * [Smithsonian 3D Scans NASA Space Shuttle Discovery And Makes It Open Source][14] - - - -Thanks, as always, to Opensource.com staff members and [Correspondents][15] for their help this week. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/news-march-14 - -作者:[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/weekly_news_roundup_tv.png?itok=tibLvjBd -[2]: https://en.wikipedia.org/wiki/Mesh_networking -[3]: https://www.smartcitiesworld.net/news/news/linux-announces-open-source-project-to-aid-disaster-relief-5102 -[4]: https://www.cnet.com/news/privacy-focused-duckduckgo-launches-new-effort-to-block-online-tracking/ -[5]: https://github.com/duckduckgo/tracker-radar -[6]: https://github.com/duckduckgo/tracker-radar-collector -[7]: https://github.com/duckduckgo/tracker-radar-detector -[8]: https://www.heraldandnews.com/news/local_news/oregon-tech-turns-to-open-source-materials-to-save-students/article_ba641e79-3034-5b9a-a8f7-b5872ddc998e.html -[9]: https://www.cnet.com/news/mozilla-helps-modernize-feature-phones-powered-by-firefox-tech/ -[10]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/cern-uses-mattermost -[11]: http://www.biomassmagazine.com/articles/16848/open-source-software-analyzes-economics-of-biofuels-bioproducts -[12]: https://jaxenter.com/netflix-dispatch-crisis-management-orchestration-169381.html -[13]: https://liliputing.com/2020/03/freenas-and-turenas-are-merging-open-source-operating-systems-for-network-attached-storage.html -[14]: https://www.forbes.com/sites/tjmccue/2020/03/04/smithsonian-3d-scans-the-nasa-space-shuttle-discovery-and-makes-it-open-source/#39aa0f243ecd -[15]: https://opensource.com/correspondent-program diff --git a/sources/news/20200319 Tools for monitoring, introvert inclusion, and more industry trends.md b/sources/news/20200319 Tools for monitoring, introvert inclusion, and more industry trends.md deleted file mode 100644 index 838a4e2c23..0000000000 --- a/sources/news/20200319 Tools for monitoring, introvert inclusion, and more industry trends.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tools for monitoring, introvert inclusion, and more industry trends) -[#]: via: (https://opensource.com/article/20/3/monitoring-introvert-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Tools for monitoring, introvert inclusion, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Top six open source tools for monitoring][2] - -> These tools are widely used in the tech industry, and they all have their benefits. Most of these solutions, however, require skilled implementation and ongoing manual maintenance that can be a burden for DevOps teams and a distraction from the business. There’s no one solution that can cater to all of your requirements, since each tool focuses on one or two specific aspects of observability and analysis. By mixing these tools together, you can derive a unique solution for your individual business needs.  - -**The impact**: If a container falls over in the cluster and there is no open source monitoring tool to see it, did it really happen? - -## [Introvert environment: What can we do?][3] - -> An example is its inclusive team dynamics programme, which consists of both information and guidance on everyday practices. Each team is required to appoint an inclusion champion, who ensures all members are given the space to contribute to discussions. Leaders are also encouraged not to speak first during meetings. - -**The impact**: If it is hard for you not to speak for a while in a meeting, that probably indicates you should be doing it more often. Will new WFH policies make this harder, or easier? Only time will tell. - -## [The difference between API Gateways and service mesh][4] - -> The service connectivity capabilities that service mesh provides are conflicting with the API connectivity features that an API gateway provides. However, because the ones provided by service mesh are more inclusive (L4 + L7, all TCP traffic, not just HTTP and not just limited to APIs but to every service), they are in a way more complete. But as we can see from the diagram above, there are also use cases that service mesh does not provide, and that is the “API as a product” use case as well as the full API management lifecycle, which still belong to the API gateway pattern. - -**The impact**: Another way of saying this is you can't make money from your service mesh directly, unlike your APIs. - -## [Open Policy Agent’s mission to secure the cloud][5] - -> While the cost of implementing OPA is a little high today, the technology pays for itself by providing more control and helping to secure systems. As OPA continues to be refined, we can expect implementation costs to fall, making an investment in OPA easier to justify. - -**The impact**: Compliance is expensive; large investments in it only make sense if non-compliance is even more so. - -_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/monitoring-introvert-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://devops.com/top-six-open-source-tools-for-monitoring-kubernetes-and-docker/ -[3]: https://www.raconteur.net/hr/introverts-workplace -[4]: https://www.cncf.io/blog/2020/03/06/the-difference-between-api-gateways-and-service-mesh/ -[5]: https://thenewstack.io/open-policy-agents-mission-to-secure-the-cloud/ diff --git a/sources/news/20200319 With npm Acquisition, Microsoft is Set to Own the Largest Software Registry in the World.md b/sources/news/20200319 With npm Acquisition, Microsoft is Set to Own the Largest Software Registry in the World.md deleted file mode 100644 index 7e2d898bfe..0000000000 --- a/sources/news/20200319 With npm Acquisition, Microsoft is Set to Own the Largest Software Registry in the World.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (With npm Acquisition, Microsoft is Set to Own the Largest Software Registry in the World) -[#]: via: (https://itsfoss.com/microsoft-npm-acquisition/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -With npm Acquisition, Microsoft is Set to Own the Largest Software Registry in the World -====== - -Microsoft has been betting big on open source for past few years. Apart from open sourcing a few things here and there, Microsoft is contributing a lot to Linux kernel (for its Azure cloud platform). - -To further strengthen its position in the open source world, [Microsoft acquired the popular open source code hosting platform GitHub for $7.5 billion][1]. - -Now Microsoft owned GitHub [has acquired][2] [npm][3] ( short for Node Package Manager). npm is the [world’s largest software registry][4] with [more than 1.3 million packages that have 75 billion downloads a month][5]. - -![][6] - -If you are not familiar, npm is a package manager for JavaScript programming language, primarily the hugely popular open source [Node.js][7]. - -Though npm has scope of private repository for enterprises, most of the 1.3 million packages are open source and/or used in various open source projects. - -Both node.js and npm are used by big software and IT companies like IBM, Yahoo and big corporations like Netflix and PayPal. - -In case you are wondering, the acquisition amount has not been disclosed by either party. - -### Microsoft’s proposed plan for npm - -![][8] - -GitHub CEO Nat Friedman assured that Microsoft intends to keep the npm registry available as open-source and free to developers. - -Once the acquisition is complete, Microsoft is going to invest in the registry infrastructure and platform. It plans to improve the core experience of npm by adding new features like Workspaces, as well as bringing improvements to publishing and multi-factor authentication. - -Microsoft also intends to integrate GitHub and npm so that developers could trace a change from a GitHub pull request to the npm package version that fixed it. - -### Part of a larger plan - -First, [Microsoft bought GitHub][1], the platform that had the largest open source repositories and now npm, the largest software registry. Clearly, Microsoft is tightening its grip around open source projects. This could allow Microsoft to dictate the policies around these open source projects in future. - -When Microsoft acquired GitHub, several open source developers moved to [alternate platforms like GitLab][9] but GitHub remained the first choice for the developers. Microsoft did introduce some innovative features like security advisories, [package registry][10], [sponsorship][11] etc. Microsoft is expanding GitHub by forming communities around it specially in developing countries. Recently, [GitHub announced its Indian subsidiary][12] to specially attract young developers to its platform. - -So now Microsoft owns the professional social network [LinkedIn][13], developer oriented GitHub and npm. This indicates that Microsoft will continue its shopping spree and will acquire more open source related projects that have substantial developer population. - -What could be next then? WordPress because it is the [most popular open source CMS][14] and [runs 33% of the websites][15] on the internet? - -While we wait and watch for Microsoft’s next move, why not share your views on this development? Comment section is all yours. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/microsoft-npm-acquisition/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/microsoft-github/ -[2]: https://github.blog/2020-03-16-npm-is-joining-github/ -[3]: https://www.npmjs.com/ -[4]: https://www.linux.com/news/state-union-npm/ -[5]: https://www.zdnet.com/article/microsoft-buys-javascript-developer-platform-npm-plans-to-integrate-it-with-github/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/microsoft-github-npm.jpg?ssl=1 -[7]: https://nodejs.org/en/ -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/github-npm.jpg?ssl=1 -[9]: https://itsfoss.com/github-alternatives/ -[10]: https://github.blog/2019-05-10-introducing-github-package-registry/ -[11]: https://itsfoss.com/github-sponsors-program/ -[12]: https://github.blog/2020-02-12-announcing-github-india/ -[13]: https://www.linkedin.com/ -[14]: https://itsfoss.com/open-source-cms/ -[15]: https://wordpress.org/news/2019/03/one-third-of-the-web/ diff --git a/sources/news/20200322 OBS Studio 25.0 is Here With Vulkan-based Games Capture Feature and More.md b/sources/news/20200322 OBS Studio 25.0 is Here With Vulkan-based Games Capture Feature and More.md deleted file mode 100644 index afd9891678..0000000000 --- a/sources/news/20200322 OBS Studio 25.0 is Here With Vulkan-based Games Capture Feature and More.md +++ /dev/null @@ -1,98 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (OBS Studio 25.0 is Here With Vulkan-based Games Capture Feature and More) -[#]: via: (https://itsfoss.com/obs-studio-25-release/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -OBS Studio 25.0 is Here With Vulkan-based Games Capture Feature and More -====== - -_**Brief: Open source screen recording and streaming software OBS Studio 25.0 has just been released and it brings the ability to capture Vulkan-based games with game capture among other new features.**_ - -![][1] - -If you are into recording your desktop or streaming it, you might have heard of [OBS][2] (Open Broadcaster Software) Studio. It’s one of the [best screen recorder tools on Linux][3] and other operating systems. - -But OBS is more than just a simple screen recorder. It also provides all the stuff you need for streaming your recordings. - -### New features in OBS Studio 25.0 - -![OBS 25.0][4] - -OBS Studio has released it’s latest version 25.0 with plenty of new features to make your recording and streaming experience better. Let’s take a look at some of the main new features: - - * Capture Vulkan-based games with game capture - * New capture method to window capture which allows capturing browsers, browser-based windows, and UWP programs - * Advanced scene collection importing allows you to import from other common streaming programs - * Media source hotkeys to allow control of playback - * Ability to drag and drop URLs to create browser sources - * Support for the [SRT protocol][5] - * Ability to lock volume values of audio sources in the mixer - * Support for certain devices that can automatically rotate their camera output such as the Logitech StreamCam - * System tray icon to show when the recording is paused - * Help icons when an property has a tooltip associated with it - - - -Apart from there, there are plenty of bug features and minor changes that you may follow in the [release notes][6]. - -### Install OBS Studio 25.0 on Linux - -OBS Studio is a cross-platform software and is also available for Windows and macOS in addition to Linux. You can download it from its official website. - -[Download OBS Studio 25.0][7] - -For Linux, you can grab the source code and build it your self. I know that’s not very convenient for everyone. The good news is that you can install the latest OBS version using Snap or Flatpak packages. - -On Ubuntu or any other [Linux distribution with Snap support][8], you can use the following command: - -``` -sudo snap install obs-studio -``` - -If your distribution supports Fltapak packages, you can get it from Flathub website: - -[OBS Studio on Flathub][9] - -For Ubuntu users, there is also the official PPA for easily installing it. In a terminal, you can enter the following command one by one: - -``` -sudo add-apt-repository ppa:obsproject/obs-studio -sudo apt update -sudo apt install obs-studio -``` - -You can [learn about deleting PPA here][10]. - -Personally, I haven’t used OBS much though I have heard great stuff about it. I don’t live stream but I do record my desktop to create tutorial and information Linux videos on I[t’s FOSS YouTube channel][11] (you should subscribe to it if you haven’t already). For that, I [use Kazam][12] which I find simpler to use. - -Do you use OBS Studio? Which features you like the most? Do share your views. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/obs-studio-25-release/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/obs_logo_icon_small.png?resize=150%2C150&ssl=1 -[2]: https://obsproject.com/ -[3]: https://itsfoss.com/best-linux-screen-recorders/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/obs-25-ubuntu.png?ssl=1 -[5]: https://en.wikipedia.org/wiki/Secure_Reliable_Transport -[6]: https://github.com/obsproject/obs-studio/releases/tag/25.0.0 -[7]: https://obsproject.com/download -[8]: https://itsfoss.com/install-snap-linux/ -[9]: https://flathub.org/apps/details/com.obsproject.Studio -[10]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ -[11]: https://www.youtube.com/channel/UCEU9D6KIShdLeTRyH3IdSvw -[12]: https://itsfoss.com/kazam-screen-recorder/ diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index 78abc6b9f1..a63121e30f 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hongcha8385) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20190222 Developer happiness- What you need to know.md b/sources/talk/20190222 Developer happiness- What you need to know.md deleted file mode 100644 index 8ef7772193..0000000000 --- a/sources/talk/20190222 Developer happiness- What you need to know.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Developer happiness: What you need to know) -[#]: via: (https://opensource.com/article/19/2/developer-happiness) -[#]: author: (Bart Copeland https://opensource.com/users/bartcopeland) - -Developer happiness: What you need to know -====== -Developers need the tools and the freedom to code quickly, without getting bogged down by compliance and security. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_happy_sad_developer_programming.png?itok=72nkfSQ_) - -A person needs the right tools for the job. There's nothing as frustrating as getting halfway through a car repair, for instance, only to discover you don't have the specialized tool you need to complete the job. The same concept applies to developers: you need the tools to do what you are best at, without disrupting your workflow with compliance and security needs, so you can produce code faster. - -Over half—51%, to be specific—of developers spend only one to four hours each day programming, according to ActiveState's recent [Developer Survey 2018: Open Source Runtime Pains][1]. In other words, the majority of developers spend less than half of their time coding. According to the survey, 50% of developers say security is one of their biggest concerns, but 67% of developers choose not to add a new language when coding because of the difficulties related to corporate policies. - -The result is developers have to devote time to non-coding activities like retrofitting software for security and compliance criteria checked after software and languages have been built. And they won't choose the best tool or language for the job because of corporate policies. Their satisfaction goes down and risk goes up. - -So, developers aren't able to devote time to high-value work. This creates additional business risk because their time-to-market is slowed, and the organization increases tech debt by not empowering developers to decide on "the best" tech, unencumbered by corporate policy drag. - -### Baking in security and compliance workflows - -How can we solve this issue? One way is to integrate security and compliance workflows into the software development process in four easy steps: - -#### 1\. Gather your forces - -Get support from everyone involved. This is an often-forgotten but critical first step. Make sure to consider a wide range of stakeholders, including: - - * DevOps - * Developers - * InfoSec - * Legal/compliance - * IT security - - - -Stakeholders want to understand the business benefits, so make a solid case for eliminating the security and compliance checkpoints after software builds. You can consider any (or all) of the following in building your business case: time savings, opportunity cost, and developer productivity. By integrating security and compliance workflows into the development process, you also avoid retrofitting of languages. - -#### 2\. Find trustworthy sources - -Next, choose the trusted sources that can be used, along with their license and security requirements. Consider including information such as: - - * Restrictions on usage based on environment or application type and version controls per language - * Which open source components are allowable, e.g., specific packages - * Which licenses can be used in which types of environments (e.g., research vs. production) - * The definition of security levels, acceptable vulnerability risk levels, what risk levels trigger an action, what that action would be, and who would be responsible for its implementation - - - -#### 3\. Incorporate security and compliance from day one - -The upshot of incorporating security and compliance workflows is that it ultimately bakes security and compliance into the first line of code. It eliminates the drag of corporate policy because you're coding to spec versus having to fix things after the fact. But to do this, consider mechanisms for automatically scanning code as it's being built, along with using agentless monitoring of your runtime code. You're freeing up your time, and you'll also be able to programmatically enforce policies to ensure compliance across your entire organization. - -New vulnerabilities arise, and new patches and versions become available. Consequently, security and compliance need to be considered when deploying code into production and also when running code. You need to know what, if any, code is at risk and where that code is running. So, the process for deploying and running code should include monitoring, reporting, and updating code in production. - -By integrating security and compliance into your software development process from the start, you can also benefit by tracking where your code is running once deployed and be alerted of new threats as they arise. You will be able to track when your applications were vulnerable and respond with automatic enforcement of your software policies. - -If your software development process has security and compliance workflows baked in, you will improve your productivity. And you'll be able to measure value through increased time spent coding; gains in security and stability; and cost- and time-savings in maintenance and discovery of security and compliance threats. - -### Happiness through integration - -If you don't develop and update software, your organization can't go forward. Developers are a linchpin in the success of your company, which means they need the tools and the freedom to code quickly. You can't let compliance and security needs—though they are critical—bog you down. Developers clearly worry about security, so the happy medium is to "shift left" and integrate security and compliance workflows from the start. You'll get more done, get it right the first time, and spend far less time retrofitting code. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/developer-happiness - -作者:[Bart Copeland][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bartcopeland -[b]: https://github.com/lujun9972 -[1]: https://www.activestate.com/company/press/press-releases/activestate-developer-survey-examines-open-source-challenges/ diff --git a/sources/talk/20190225 Teaching scientists how to share code.md b/sources/talk/20190225 Teaching scientists how to share code.md index 074da27476..541cce2719 100644 --- a/sources/talk/20190225 Teaching scientists how to share code.md +++ b/sources/talk/20190225 Teaching scientists how to share code.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( jiangyaomin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -56,7 +56,7 @@ via: https://opensource.com/article/19/2/open-science-git 作者:[Jon Tennant][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/jiangyaomin) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/talk/20190329 9 open source tools for building a fault-tolerant system.md b/sources/talk/20190329 9 open source tools for building a fault-tolerant system.md index 78282fb853..9db89d63ce 100644 --- a/sources/talk/20190329 9 open source tools for building a fault-tolerant system.md +++ b/sources/talk/20190329 9 open source tools for building a fault-tolerant system.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( chenmu-kk ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -8,19 +8,25 @@ [#]: author: (Bryant Son (Red Hat, Community Moderator) https://opensource.com/users/brson) 9 open source tools for building a fault-tolerant system +九个用来构建容错系统的开源工具 ====== Maximize uptime and minimize problems with these open source tools. +这些开源工具可以最大化延长运行时间并且在最大程度上减少问题。 ![magnifying glass on computer screen, finding a bug in the code][1] I've always been interested in web development and software architecture because I like to see the broader picture of a working system. Whether you are building a mobile app or a web application, it has to be connected to the internet to exchange data among different modules, which means you need a web service. +我总是对web开发和软件体系结构很感兴趣,因为我喜欢看到一个工作系统的更广阔的前景。无论是构建一个移动应用程序还是一个web应用程序,都必须连接到internet才能在不同的模块中交换数据,这意味着你需要web服务。 If you use a cloud system as your application's backend, you can take advantage of greater computing power, as the backend service will scale horizontally and vertically and orchestrate different services. But whether or not you use a cloud backend, it's important to build a _fault-tolerant system_ —one that is resilient, stable, fast, and safe. +如果选择云系统作为应用程序的后端,则可以利用更优秀的计算能力,因为后端服务将会在水平和垂直方向上进行扩展并编排不同的服务。但无论你是否使用云后端,建造一个灵活、稳定、快速又安全的容错系统是必不可少的。 -To understand fault-tolerant systems, let's use Facebook, Amazon, Google, and Netflix as examples. Millions and billions of users access these platforms simultaneously while transmitting enormous amounts of data via peer-to-peer and user-to-server networks, and you can be sure there are also malicious users with bad intentions, like hacking or denial-of-service (DoS) attacks. Even so, these platforms can operate 24 hours a day and 365 days a year without downtime. +To understand fault-tolerant systems, let's use Facebook, Amazon, Google, and Netflix as examples. Millions and billions of users access these platforms simultaneously while transmitting enormous amounts of data via peer-to-peer and user-to-server networks, and you can be sure there are also malicious users with bad intentions, like hacking or denial-of-service (DoS) attacks. Even so, these platforms can operate 24 hours a day and 365 days a year without downtime. +要了解容错系统,让我们以脸书、亚马逊、谷歌和奈飞为例。数以亿计的用户会同时接入这些平台并通过对等网络和用户-服务器网络传输大量数据,你可以肯定这其中还存在许多的带有不法目的的恶意用户,例如黑客攻击和拒绝服务(DoS)攻击。即使如此,这些平台无需停机也可以全年无休地运转。 Although machine learning and smart algorithms are the backbones of these systems, the fact that they achieve consistent service without a single minute of downtime is praiseworthy. Their expensive hardware and gigantic datacenters certainly matter, but the elegant software designs supporting the services are equally important. And the fault-tolerant system is one of the principles to build such an elegant system. +尽管机器学习和智能算法是这些系统的基础,但它们实现一致服务而不需要一分钟停机的事实值得称赞。它们昂贵的硬件设备和巨大的数据中心当然十分重要,但是支持服务的精密软件设计也同样重要。而且容错系统是一个构建如此精密系统的法则之一。 ### Two behaviors that cause problems in production diff --git a/sources/talk/20190331 Codecademy vs. The BBC Micro.md b/sources/talk/20190331 Codecademy vs. The BBC Micro.md new file mode 100644 index 0000000000..a85aadad46 --- /dev/null +++ b/sources/talk/20190331 Codecademy vs. The BBC Micro.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Codecademy vs. The BBC Micro) +[#]: via: (https://twobithistory.org/2019/03/31/bbc-micro.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +Codecademy vs. The BBC Micro +====== + +In the late 1970s, the computer, which for decades had been a mysterious, hulking machine that only did the bidding of corporate overlords, suddenly became something the average person could buy and take home. An enthusiastic minority saw how great this was and rushed to get a computer of their own. For many more people, the arrival of the microcomputer triggered helpless anxiety about the future. An ad from a magazine at the time promised that a home computer would “give your child an unfair advantage in school.” It showed a boy in a smart blazer and tie eagerly raising his hand to answer a question, while behind him his dim-witted classmates look on sullenly. The ad and others like it implied that the world was changing quickly and, if you did not immediately learn how to use one of these intimidating new devices, you and your family would be left behind. + +In the UK, this anxiety metastasized into concern at the highest levels of government about the competitiveness of the nation. The 1970s had been, on the whole, an underwhelming decade for Great Britain. Both inflation and unemployment had been high. Meanwhile, a series of strikes put London through blackout after blackout. A government report from 1979 fretted that a failure to keep up with trends in computing technology would “add another factor to our poor industrial performance.”[1][1] The country already seemed to be behind in the computing arena—all the great computer companies were American, while integrated circuits were being assembled in Japan and Taiwan. + +In an audacious move, the BBC, a public service broadcaster funded by the government, decided that it would solve Britain’s national competitiveness problems by helping Britons everywhere overcome their aversion to computers. It launched the _Computer Literacy Project_, a multi-pronged educational effort that involved several TV series, a few books, a network of support groups, and a specially built microcomputer known as the BBC Micro. The project was so successful that, by 1983, an editor for BYTE Magazine wrote, “compared to the US, proportionally more of Britain’s population is interested in microcomputers.”[2][2] The editor marveled that there were more people at the Fifth Personal Computer World Show in the UK than had been to that year’s West Coast Computer Faire. Over a sixth of Great Britain watched an episode in the first series produced for the _Computer Literacy Project_ and 1.5 million BBC Micros were ultimately sold.[3][3] + +[An archive][4] containing every TV series produced and all the materials published for the _Computer Literacy Project_ was put on the web last year. I’ve had a huge amount of fun watching the TV series and trying to imagine what it would have been like to learn about computing in the early 1980s. But what’s turned out to be more interesting is how computing was _taught_. Today, we still worry about technology leaving people behind. Wealthy tech entrepreneurs and governments spend lots of money trying to teach kids “to code.” We have websites like Codecademy that make use of new technologies to teach coding interactively. One would assume that this approach is more effective than a goofy ’80s TV series. But is it? + +### The Computer Literacy Project + +The microcomputer revolution began in 1975 with the release of [the Altair 8800][5]. Only two years later, the Apple II, TRS-80, and Commodore PET had all been released. Sales of the new computers exploded. In 1978, the BBC explored the dramatic societal changes these new machines were sure to bring in a documentary called “Now the Chips Are Down.” + +The documentary was alarming. Within the first five minutes, the narrator explains that microelectronics will “totally revolutionize our way of life.” As eerie synthesizer music plays, and green pulses of electricity dance around a magnified microprocessor on screen, the narrator argues that the new chips are why “Japan is abandoning its ship building, and why our children will grow up without jobs to go to.” The documentary goes on to explore how robots are being used to automate car assembly and how the European watch industry has lost out to digital watch manufacturers in the United States. It castigates the British government for not doing more to prepare the country for a future of mass unemployment. + +The documentary was supposedly shown to the British Cabinet.[4][6] Several government agencies, including the Department of Industry and the Manpower Services Commission, became interested in trying to raise awareness about computers among the British public. The Manpower Services Commission provided funds for a team from the BBC’s education division to travel to Japan, the United States, and other countries on a fact-finding trip. This research team produced a report that cataloged the ways in which microelectronics would indeed mean major changes for industrial manufacturing, labor relations, and office work. In late 1979, it was decided that the BBC should make a ten-part TV series that would help regular Britons “learn how to use and control computers and not feel dominated by them.”[5][7] The project eventually became a multimedia endeavor similar to the _Adult Literacy Project_, an earlier BBC undertaking involving both a TV series and supplemental courses that helped two million people improve their reading. + +The producers behind the _Computer Literacy Project_ were keen for the TV series to feature “hands-on” examples that viewers could try on their own if they had a microcomputer at home. These examples would have to be in BASIC, since that was the language (really the entire shell) used on almost all microcomputers. But the producers faced a thorny problem: Microcomputer manufacturers all had their own dialects of BASIC, so no matter which dialect they picked, they would inevitably alienate some large fraction of their audience. The only real solution was to create a new BASIC—BBC BASIC—and a microcomputer to go along with it. Members of the British public would be able to buy the new microcomputer and follow along without worrying about differences in software or hardware. + +The TV producers and presenters at the BBC were not capable of building a microcomputer on their own. So they put together a specification for the computer they had in mind and invited British microcomputer companies to propose a new machine that met the requirements. The specification called for a relatively powerful computer because the BBC producers felt that the machine should be able to run real, useful applications. Technical consultants for the _Computer Literacy Project_ also suggested that, if it had to be a BASIC dialect that was going to be taught to the entire nation, then it had better be a good one. (They may not have phrased it exactly that way, but I bet that’s what they were thinking.) BBC BASIC would make up for some of BASIC’s usual shortcomings by allowing for recursion and local variables.[6][8] + +The BBC eventually decided that a Cambridge-based company called Acorn Computers would make the BBC Micro. In choosing Acorn, the BBC passed over a proposal from Clive Sinclair, who ran a company called Sinclair Research. Sinclair Research had brought mass-market microcomputing to the UK in 1980 with the Sinclair ZX80. Sinclair’s new computer, the ZX81, was cheap but not powerful enough for the BBC’s purposes. Acorn’s new prototype computer, known internally as the Proton, would be more expensive but more powerful and expandable. The BBC was impressed. The Proton was never marketed or sold as the Proton because it was instead released in December 1981 as the BBC Micro, also affectionately called “The Beeb.” You could get a 16k version for £235 and a 32k version for £335. + +In 1980, Acorn was an underdog in the British computing industry. But the BBC Micro helped establish the company’s legacy. Today, the world’s most popular microprocessor instruction set is the ARM architecture. “ARM” now stands for “Advanced RISC Machine,” but originally it stood for “Acorn RISC Machine.” ARM Holdings, the company behind the architecture, was spun out from Acorn in 1990. + +![Picture of the BBC Micro.][9] _A bad picture of a BBC Micro, taken by me at the Computer History Museum +in Mountain View, California._ + +### The Computer Programme + +A dozen different TV series were eventually produced as part of the _Computer Literacy Project_, but the first of them was a ten-part series known as _The Computer Programme_. The series was broadcast over ten weeks at the beginning of 1982. A million people watched each week-night broadcast of the show; a quarter million watched the reruns on Sunday and Monday afternoon. + +The show was hosted by two presenters, Chris Serle and Ian McNaught-Davis. Serle plays the neophyte while McNaught-Davis, who had professional experience programming mainframe computers, plays the expert. This was an inspired setup. It made for [awkward transitions][10]—Serle often goes directly from a conversation with McNaught-Davis to a bit of walk-and-talk narration delivered to the camera, and you can’t help but wonder whether McNaught-Davis is still standing there out of frame or what. But it meant that Serle could voice the concerns that the audience would surely have. He can look intimidated by a screenful of BASIC and can ask questions like, “What do all these dollar signs mean?” At several points during the show, Serle and McNaught-Davis sit down in front of a computer and essentially pair program, with McNaught-Davis providing hints here and there while Serle tries to figure it out. It would have been much less relatable if the show had been presented by a single, all-knowing narrator. + +The show also made an effort to demonstrate the many practical applications of computing in the lives of regular people. By the early 1980s, the home computer had already begun to be associated with young boys and video games. The producers behind _The Computer Programme_ sought to avoid interviewing “impressively competent youngsters,” as that was likely “to increase the anxieties of older viewers,” a demographic that the show was trying to attract to computing.[7][11] In the first episode of the series, Gill Nevill, the show’s “on location” reporter, interviews a woman that has bought a Commodore PET to help manage her sweet shop. The woman (her name is Phyllis) looks to be 60-something years old, yet she has no trouble using the computer to do her accounting and has even started using her PET to do computer work for other businesses, which sounds like the beginning of a promising freelance career. Phyllis says that she wouldn’t mind if the computer work grew to replace her sweet shop business since she enjoys the computer work more. This interview could instead have been an interview with a teenager about how he had modified _Breakout_ to be faster and more challenging. But that would have been encouraging to almost nobody. On the other hand, if Phyllis, of all people, can use a computer, then surely you can too. + +While the show features lots of BASIC programming, what it really wants to teach its audience is how computing works in general. The show explains these general principles with analogies. In the second episode, there is an extended discussion of the Jacquard loom, which accomplishes two things. First, it illustrates that computers are not based only on magical technology invented yesterday—some of the foundational principles of computing go back two hundred years and are about as simple as the idea that you can punch holes in card to control a weaving machine. Second, the interlacing of warp and weft threads is used to demonstrate how a binary choice (does the weft thread go above or below the warp thread?) is enough, when repeated over and over, to produce enormous variation. This segues, of course, into a discussion of how information can be stored using binary digits. + +Later in the show there is a section about a steam organ that plays music encoded in a long, segmented roll of punched card. This time the analogy is used to explain subroutines in BASIC. Serle and McNaught-Davis lay out the whole roll of punched card on the floor in the studio, then point out the segments where it looks like a refrain is being repeated. McNaught-Davis explains that a subroutine is what you would get if you cut out those repeated segments of card and somehow added an instruction to go back to the original segment that played the refrain for the first time. This is a brilliant explanation and probably one that stuck around in people’s minds for a long time afterward. + +I’ve picked out only a few examples, but I think in general the show excels at demystifying computers by explaining the principles that computers rely on to function. The show could instead have focused on teaching BASIC, but it did not. This, it turns out, was very much a conscious choice. In a retrospective written in 1983, John Radcliffe, the executive producer of the _Computer Literacy Project_, wrote the following: + +> If computers were going to be as important as we believed, some genuine understanding of this new subject would be important for everyone, almost as important perhaps as the capacity to read and write. Early ideas, both here and in America, had concentrated on programming as the main route to computer literacy. However, as our thinking progressed, although we recognized the value of “hands-on” experience on personal micros, we began to place less emphasis on programming and more on wider understanding, on relating micros to larger machines, encouraging people to gain experience with a range of applications programs and high-level languages, and relating these to experience in the real world of industry and commerce…. Our belief was that once people had grasped these principles, at their simplest, they would be able to move further forward into the subject. + +Later, Radcliffe writes, in a similar vein: + +> There had been much debate about the main explanatory thrust of the series. One school of thought had argued that it was particularly important for the programmes to give advice on the practical details of learning to use a micro. But we had concluded that if the series was to have any sustained educational value, it had to be a way into the real world of computing, through an explanation of computing principles. This would need to be achieved by a combination of studio demonstration on micros, explanation of principles by analogy, and illustration on film of real-life examples of practical applications. Not only micros, but mini computers and mainframes would be shown. + +I love this, particularly the part about mini-computers and mainframes. The producers behind _The Computer Programme_ aimed to help Britons get situated: Where had computing been, and where was it going? What can computers do now, and what might they do in the future? Learning some BASIC was part of answering those questions, but knowing BASIC alone was not seen as enough to make someone computer literate. + +### Computer Literacy Today + +If you google “learn to code,” the first result you see is a link to Codecademy’s website. If there is a modern equivalent to the _Computer Literacy Project_, something with the same reach and similar aims, then it is Codecademy. + +“Learn to code” is Codecademy’s tagline. I don’t think I’m the first person to point this out—in fact, I probably read this somewhere and I’m now ripping it off—but there’s something revealing about using the word “code” instead of “program.” It suggests that the important thing you are learning is how to decode the code, how to look at a screen’s worth of Python and not have your eyes glaze over. I can understand why to the average person this seems like the main hurdle to becoming a professional programmer. Professional programmers spend all day looking at computer monitors covered in gobbledygook, so, if I want to become a professional programmer, I better make sure I can decipher the gobbledygook. But dealing with syntax is not the most challenging part of being a programmer, and it quickly becomes almost irrelevant in the face of much bigger obstacles. Also, armed only with knowledge of a programming language’s syntax, you may be able to _read_ code but you won’t be able to _write_ code to solve a novel problem. + +I recently went through Codecademy’s “Code Foundations” course, which is the course that the site recommends you take if you are interested in programming (as opposed to web development or data science) and have never done any programming before. There are a few lessons in there about the history of computer science, but they are perfunctory and poorly researched. (Thank heavens for [this noble internet vigilante][12], who pointed out a particularly egregious error.) The main focus of the course is teaching you about the common structural elements of programming languages: variables, functions, control flow, loops. In other words, the course focuses on what you would need to know to start seeing patterns in the gobbledygook. + +To be fair to Codecademy, they offer other courses that look meatier. But even courses such as their “Computer Science Path” course focus almost exclusively on programming and concepts that can be represented in programs. One might argue that this is the whole point—Codecademy’s main feature is that it gives you little interactive programming lessons with automated feedback. There also just isn’t enough room to cover more because there is only so much you can stuff into somebody’s brain in a little automated lesson. But the producers at the BBC tasked with kicking off the _Computer Literacy Project_ also had this problem; they recognized that they were limited by their medium and that “the amount of learning that would take place as a result of the television programmes themselves would be limited.”[8][13] With similar constraints on the volume of information they could convey, they chose to emphasize general principles over learning BASIC. Couldn’t Codecademy replace a lesson or two with an interactive visualization of a Jacquard loom weaving together warp and weft threads? + +I’m banging the drum for “general principles” loudly now, so let me just explain what I think they are and why they are important. There’s a book by J. Clark Scott about computers called _But How Do It Know?_ The title comes from the anecdote that opens the book. A salesman is explaining to a group of people that a thermos can keep hot food hot and cold food cold. A member of the audience, astounded by this new invention, asks, “But how do it know?” The joke of course is that the thermos is not perceiving the temperature of the food and then making a decision—the thermos is just constructed so that cold food inevitably stays cold and hot food inevitably stays hot. People anthropomorphize computers in the same way, believing that computers are digital brains that somehow “choose” to do one thing or another based on the code they are fed. But learning a few things about how computers work, even at a rudimentary level, takes the homunculus out of the machine. That’s why the Jacquard loom is such a good go-to illustration. It may at first seem like an incredible device. It reads punch cards and somehow “knows” to weave the right pattern! The reality is mundane: Each row of holes corresponds to a thread, and where there is a hole in that row the corresponding thread gets lifted. Understanding this may not help you do anything new with computers, but it will give you the confidence that you are not dealing with something magical. We should impart this sense of confidence to beginners as soon as we can. + +Alas, it’s possible that the real problem is that nobody wants to learn about the Jacquard loom. Judging by how Codecademy emphasizes the professional applications of what it teaches, many people probably start using Codecademy because they believe it will help them “level up” their careers. They believe, not unreasonably, that the primary challenge will be understanding the gobbledygook, so they want to “learn to code.” And they want to do it as quickly as possible, in the hour or two they have each night between dinner and collapsing into bed. Codecademy, which after all is a business, gives these people what they are looking for—not some roundabout explanation involving a machine invented in the 18th century. + +The _Computer Literacy Project_, on the other hand, is what a bunch of producers and civil servants at the BBC thought would be the best way to educate the nation about computing. I admit that it is a bit elitist to suggest we should laud this group of people for teaching the masses what they were incapable of seeking out on their own. But I can’t help but think they got it right. Lots of people first learned about computing using a BBC Micro, and many of these people went on to become successful software developers or game designers. [As I’ve written before][14], I suspect learning about computing at a time when computers were relatively simple was a huge advantage. But perhaps another advantage these people had is shows like _The Computer Programme_, which strove to teach not just programming but also how and why computers can run programs at all. After watching _The Computer Programme_, you may not understand all the gobbledygook on a computer screen, but you don’t really need to because you know that, whatever the “code” looks like, the computer is always doing the same basic thing. After a course or two on Codecademy, you understand some flavors of gobbledygook, but to you a computer is just a magical machine that somehow turns gobbledygook into running software. That isn’t computer literacy. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][15] on Twitter or subscribe to the [RSS feed][16] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> FINALLY some new damn content, amirite? +> +> Wanted to write an article about how Simula bought us object-oriented programming. It did that, but early Simula also flirted with a different vision for how OOP would work. Wrote about that instead! +> +> — TwoBitHistory (@TwoBitHistory) [February 1, 2019][17] + + 1. Robert Albury and David Allen, Microelectronics, report (1979). [↩︎][18] + + 2. Gregg Williams, “Microcomputing, British Style”, Byte Magazine, 40, January 1983, accessed on March 31, 2019, . [↩︎][19] + + 3. John Radcliffe, “Toward Computer Literacy,” Computer Literacy Project Achive, 42, accessed March 31, 2019, [https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards Computer Literacy.pdf][20]. [↩︎][21] + + 4. David Allen, “About the Computer Literacy Project,” Computer Literacy Project Archive, accessed March 31, 2019, . [↩︎][22] + + 5. ibid. [↩︎][23] + + 6. Williams, 51. [↩︎][24] + + 7. Radcliffe, 11. [↩︎][25] + + 8. Radcliffe, 5. [↩︎][26] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2019/03/31/bbc-micro.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: tmp.05mfBL4kP8#fn:1 +[2]: tmp.05mfBL4kP8#fn:2 +[3]: tmp.05mfBL4kP8#fn:3 +[4]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/ +[5]: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html +[6]: tmp.05mfBL4kP8#fn:4 +[7]: tmp.05mfBL4kP8#fn:5 +[8]: tmp.05mfBL4kP8#fn:6 +[9]: https://twobithistory.org/images/beeb.jpg +[10]: https://twitter.com/TwoBitHistory/status/1112372000742404098 +[11]: tmp.05mfBL4kP8#fn:7 +[12]: https://twitter.com/TwoBitHistory/status/1111305774939234304 +[13]: tmp.05mfBL4kP8#fn:8 +[14]: https://twobithistory.org/2018/09/02/learning-basic.html +[15]: https://twitter.com/TwoBitHistory +[16]: https://twobithistory.org/feed.xml +[17]: https://twitter.com/TwoBitHistory/status/1091148050221944832?ref_src=twsrc%5Etfw +[18]: tmp.05mfBL4kP8#fnref:1 +[19]: tmp.05mfBL4kP8#fnref:2 +[20]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards%20Computer%20Literacy.pdf +[21]: tmp.05mfBL4kP8#fnref:3 +[22]: tmp.05mfBL4kP8#fnref:4 +[23]: tmp.05mfBL4kP8#fnref:5 +[24]: tmp.05mfBL4kP8#fnref:6 +[25]: tmp.05mfBL4kP8#fnref:7 +[26]: tmp.05mfBL4kP8#fnref:8 diff --git a/sources/talk/20200103 What you need to know about Rust in 2020.md b/sources/talk/20200103 What you need to know about Rust in 2020.md deleted file mode 100644 index ddb91f42ea..0000000000 --- a/sources/talk/20200103 What you need to know about Rust in 2020.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What you need to know about Rust in 2020) -[#]: via: (https://opensource.com/article/20/1/rust-resources) -[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) - -What you need to know about Rust in 2020 -====== -While many programmers have long used Rust for hobby projects, in 2019, -the language attracted support from major technology companies, as the -top Rust articles on Opensource.com explain. -![Person using a laptop][1] - -[Rust][2] has drawn plenty of attention from programmers on sites like Hacker News for a while. While many have long [loved using the language][3] for hobby projects, it didn't start catching on in industry until 2019, when this really started to change. - -Over the last year, many large companies, including [Microsoft][4], [Facebook][5], and [Intel][6], came out in support of Rust, and many [smaller ones][7] took notice. As the first emcee at [RustFest][8], the largest Rust conference in Europe, in 2016, I didn't meet a single person professionally using Rust who didn't work at Mozilla. Three years later, it seemed like every other person I talked to at RustFest 2019 was using Rust in their day job for another company, whether as a game developer, a backend engineer at a bank, a creator of developer tools, or something else. - -In 2019, Opensource.com also played a role by reporting on the growing interest in Rust. In case you missed them, here are the top articles about Rust on Opensource.com over the last year. - -### Building the virtualization stack of the future with rust-vmm - -Amazon's [Firecracker][9] is the virtualization technology that powers AWS Lambda and Fargate, and it is written completely in Rust. One of the technology's authors, Andreea Florescu, offers insight into Firecracker and its related technologies in [_**Building the virtualization stack of the future with rust-vmm**_][10]. - -Firecracker started life as a fork of Google's [CrosVM][11] but quickly diverged due to the differing needs of the two projects. Despite this, there are many common pieces that are best shared across the project and in any other virtual machine manager (VMM) written in Rust. With that in mind, the [rust-vmm][12] project started as a way for Amazon and Google, as well as Intel and Red Hat, to share common Rust "crates" (i.e., packages) with each other and the rest of the open source community. These include interfaces to KVM (Linux virtualization APIs), Virtio device support, and a kernel loader. - -It's truly amazing to see some of the titans of the software industry working together around a common technology stack written in Rust. Given this and other partnerships around [technology stacks written in Rust][13], I wouldn't be surprised to see more of this in 2020. - -### Why to choose Rust as your next programming language - -Adopting a new language, especially at a large company with a long-established technology stack, is no easy task. I had the pleasure of writing [_**Why to choose Rust as your next programming language**_][14] about how Microsoft is looking into adopting Rust when so many other interesting programming languages have not been considered. - -Choosing a programming language involves many different criteria—from technical to organizational to even emotional. Some of these criteria are easier to measure than others. For instance, it's easier to understand the costs of technical changes, like adapting build systems and building new tooling, than it is to understand organizational or emotional issues like how productive or happy developers will be using this new language. What's more, the easy-to-measure criteria are often cost-related, while the hard-to-measure criteria are often benefits-oriented. This often leads to costs getting more weight in the decision-making process, even though it's not necessarily true that the costs outweigh the benefits—it's just that they're easier to measure. This makes it unlikely for a company to adopt a new language. - -However, one of Rust's largest benefits is how easy it is to measure its ability to write secure yet performant systems software. Given that 70% of severe vulnerabilities at Microsoft are due to memory-safety issues that Rust is designed to prevent, and that these issues cost the company billions of dollars per year, it's easy to measure and understand the benefits of adopting the language. - -Whether full-scale adoption of Rust at Microsoft will happen remains to be seen, but Rust's future is bright if only for the fact that is has a clear and measurable benefit over existing technologies. - -### Rust in 2020 - -Rust is really starting to gain traction in industry. Although it still has a long way to go to reach the popularity of languages like C++. I expect more companies to start adopting Rust in 2020. The Rust community must now set its sights on welcoming people and companies into the community while ensuring that the things that have driven the language to this point remain in place. - -Rust is more than just a compiler and a set of libraries. It's a group of people who care about making systems programming easy, safe, and fun. The coming year will be critical in Rust's journey from a hobbyist language to one of the main languages used in the software industry. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/rust-resources - -作者:[Ryan Levick][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ryanlevick -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) -[2]: http://rust-lang.org/ -[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages -[4]: https://youtu.be/o01QmYVluSw -[5]: https://youtu.be/kylqq8pEgRs -[6]: https://youtu.be/l9hM0h6IQDo -[7]: https://oxide.computer/blog/introducing-the-oxide-computer-company/ -[8]: https://rustfest.eu -[9]: https://firecracker-microvm.github.io/ -[10]: https://opensource.com/article/19/3/rust-virtual-machine -[11]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ -[12]: https://github.com/rust-vmm -[13]: https://bytecodealliance.org/ -[14]: https://opensource.com/article/19/10/choose-rust-programming-language diff --git a/sources/talk/20200306 How I learned about burnout the hard way.md b/sources/talk/20200306 How I learned about burnout the hard way.md index cce3324e7e..ce9af6fb52 100644 --- a/sources/talk/20200306 How I learned about burnout the hard way.md +++ b/sources/talk/20200306 How I learned about burnout the hard way.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (chuan-325) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20200313 What is the internet backbone and how it works.md b/sources/talk/20200313 What is the internet backbone and how it works.md deleted file mode 100644 index 7a163fce7f..0000000000 --- a/sources/talk/20200313 What is the internet backbone and how it works.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is the internet backbone and how it works) -[#]: via: (https://www.networkworld.com/article/3532318/what-is-the-internet-backbone-and-how-it-works.html) -[#]: author: (Tim Greene https://www.networkworld.com/author/Tim-Greene/) - -What is the internet backbone and how it works -====== -Tier 1 internet service providers (ISP) mesh their high-speed fiber-optic networks together to create the internet backbone, which moves traffic efficiently among geographic regions. -[Gerd Altmann][1] [(CC0)][2] - -The internet generates massive amounts of computer-to-computer traffic, and insuring all that traffic can be delivered anywhere in the world requires the aggregation of a vast array of high-speed networks collectively known as the internet backbone, but how does that work? - -### What is the internet backbone? - -Like any other network, the internet consists of access links that move traffic to high-bandwidth routers that move traffic from its source over the best available path toward its destination. This core is made up of individual high-speed fiber-optic networks that peer with each other to create the internet backbone. - -The individual core networks are privately owned by Tier 1 internet service providers (ISP), giant carriers whose networks are tied together. These providers include AT&T, CenturyLink, Cogent Communications, Deutsche Telekom, Global Telecom and Technology (GTT), NTT Communications, Sprint, Tata Communications, Telecom Italia Sparkle, Telia Carrier, and Verizon. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] - -By joining these long-haul networks together, Tier 1 ISPs create a single worldwide network that gives all of them access to the entire internet routing table so they can efficiently deliver traffic to its destination through a hierarchy of progressively more local ISPs. - -In addition to being physically connected, these backbone providers are held together by a shared network protocol, TCP/IP. They are actually two protocols, transport control protocol and internet protocol that set up connections between computers, insuring that the connections are reliable and formating messages into packets. - -### Internet exchange points (IXP) tie the backbone together - -Backbone ISPs connect their networks at peering points, neutrally owned locations with high-speed switches and routers that move traffic among the peers. These are often owned by third parties, sometimes non-profits, that facilitate unifying the backbone. - -Participating Tier 1 ISPs help fund the IXPs, but don’t charge each other for transporting traffic from the other Tier 1 ISPs in a relationship known as settlement-free peering. Such agreements eliminate potential financial disputes that might have the result of slowing down internet performance. - -[][4] - -### How fast is the backbone? - -The internet backbone is made up of the fastest routers, which can deliver 100Gbps trunk speeds. These routers are made by vendors including Cisco, Extreme, Huawei, Juniper, and Nokia, and use the border gateway protocol (BGP) to route traffic among themselves. - -### How traffic gets on the backbone - -Below the Tier 1 ISPs are smaller Tier 2 and Tier 3 ISPs. - -Tier 3 providers provide businesses and consumers with access to the internet. These providers have no access of their own to the internet backbone, so on their own would not be able to connect their customers to all of the billions of internet-attached computers. - -Buying access to Tier 1 providers is expensive. So often Tier 3 ISPs contract with Tier 2 (regional) ISPs that have their own networks that can deliver traffic to a limited geographic area but not to all internet-attached devices. - -In order to do that, Tier 2 ISPs contract with Tier 1 ISPs for access to the global backbone, and in that way make the entire internet accesssible to their customers. - -This arrangment makes it possible for traffic from a computer on one side of the world to connect to one on the other side. That traffic goes from a source computer to a Tier 3 ISP that routes it to a Tier 2 ISP that routes it to a Tier 1 backbone provider that routes it to the appropriate Tier 2 ISP that routes it to a Tier 3 access provider that delivers it to the destination computer. - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3532318/what-is-the-internet-backbone-and-how-it-works.html - -作者:[Tim Greene][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Tim-Greene/ -[b]: https://github.com/lujun9972 -[1]: https://pixabay.com/en/social-media-digitization-faces-3271592/ -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200324 COVID-19- Weekly health check of ISPs, cloud providers and conferencing services.md b/sources/talk/20200324 COVID-19- Weekly health check of ISPs, cloud providers and conferencing services.md new file mode 100644 index 0000000000..a5540c4ce2 --- /dev/null +++ b/sources/talk/20200324 COVID-19- Weekly health check of ISPs, cloud providers and conferencing services.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (COVID-19: Weekly health check of ISPs, cloud providers and conferencing services) +[#]: via: (https://www.networkworld.com/article/3534130/covid-19-weekly-health-check-of-isps-cloud-providers-and-conferencing-services.html) +[#]: author: (Tim Greene https://www.networkworld.com/author/Tim-Greene/) + +COVID-19: Weekly health check of ISPs, cloud providers and conferencing services +====== +ThousandEyes, which tracks internet and cloud traffic, is providing Network World with weekly updates on the performance of three categories of service provider: ISP, cloud provider, UCaaS +[ThousandEyes][1] + +_As COVID-19 continues to spread, forcing employees to work from home, the services of ISPs, cloud providers and conferencing services a.k.a. unified communications as a service (UCaaS) providers are experiencing increased traffic._ + +_Thousand Eyes is monitoring how these increases affect outages and the performance these providers undergo. It will provide Network World a roundup of interesting events of  the week in the delivery of these services, and Network World will provide a summary here. Stop back next week for another update._ + +With the increased use of remote-access VPNs, major carriers are reporting dramatic increases in their network traffic – with Verizon reporting a 20% week-over-week increase, and Vodafone reporting an increase of 50%. + +[Read about IPv6 and cloud-access security brokers][2] + +While there has been no corresponding spike in outages in service provider networks, over the past six weeks there has been a steady increase in outages across multiple provider types both worldwide and in the U.S., all according to ThousandEyes, which keeps track of internet and cloud traffic. + +### IDG Special Report: + +Navigating the Pandemic + + * [Business continuity: Coronavirus crisis puts CIOs’ plans to the test][3] + * [Coronavirus challenges remote networking][4] + * [A security guide for pandemic planning: 7 key steps][5] + * [10 tips to set up your home office for videoconferencing][6] + * [How to survive and thrive while working from home][7] + * [WTH? OSS knows how to WFH IRL][8] + + + +This includes “a concerning upward trajectory” since the beginning of March of ISP outages worldwide that coincides with the spread of COVID-19, [according to a ThousandEyes blog][9] by Angelique Medina, the company’s director of product marketing. ISP outages worldwide hovered around 150 per week between Feb. 10 and March 19, but then increased to between just under 200 and about 225 during the following three weeks. + +In the U.S. those numbers were a little over 50 in the first time range and reaching about 100 during the first week of March. “That early March level has been mostly sustained over the last couple of weeks,” Medina writes. + +Cogent Communications was one ISP with nearly identical large scale outages on March 11 and March 18, with “disruptions for the fairly lengthy period (by Internet standards) of 30 minutes,” she wrote. + +[][10] + +Hurricane Electric suffered an outage March 20 that was less extensive and shorter than Cogent’s but included smaller disruptions that altogether affected hundreds of sites and services, she wrote. + +Public-cloud provider networks have withstood the effects of COVID-19 well, with slight increases in the number of outages in the U.S., but otherwise relatively level around the world. The possible reason: “Major public cloud providers, such as AWS, Microsoft Azure, and Google Cloud, have built massive global networks that are incredibly well-equipped to handle traffic surges,” Medina wrote. And when these networks do have major outages it’s due to routing or infrastructure state changes, not traffic congestion. + +Some providers of collaboration applications – the likes of Zoom, Webex, MSFT Teams, RingCentral – also experienced performance problems between March 9 and March 20. ThousandEyes doesn’t name them, but does list performance numbers for what it describes “the top three” UCaaS providers. One actually showed improvements in availability, latency, packet loss and jitter. The other two “showed minimal (in the grand scheme of things) degradations on all fronts — not surprising given the unprecedented strain they’ve been under,” according to the blog. + +Each provider showed spikes in traffic loss over the time period that ranged from less than 1% to more than 4% in one case. In the case of one provider, “outages within its own network spiked last week, meaning that the network issues impacting users were taking place on infrastructure managed by the provider versus an external ISP.” + +“Outage incidents within large UCaaS provider networks are fairly infrequent; however, the recent massive surge in usage is clearly stressing current design limits. Capacity is reportedly being added across the board to meet new service demands,” according to the blog. + +Meanwhile, ThousandEyes has introduced a new feature on its site a [Global Internet Outages Map][1] that is updated every few minutes. It shows recent and ongoing outages + +## Google outage unrelated to COVID-19 + +On March 26 Google suffered a 20 minute outage on the East Coast of the U.S., apparently from a router failure in Atlanta, ThousandEyes said, agreeing with a statement put out by Googe to that effect. + +That problem affected other regions of the U.S. as evidenced by Google sites such as google.com intermittently returning server errors."These 500 server errors are consistent with an inability to reach the backend systems necessary to correctly load various services," ThousandEyes said in a statement. "Any traffic traversing the affected region — connecting from Google’s front-end servers to backend services — may have been impacted and seen the resulting server errors." + +ThousandEyes posted interactive results of tests it ran about the outage [here][11] and [here][12]. + +. + +Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534130/covid-19-weekly-health-check-of-isps-cloud-providers-and-conferencing-services.html + +作者:[Tim Greene][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Tim-Greene/ +[b]: https://github.com/lujun9972 +[1]: https://www.thousandeyes.com/outages +[2]: https://www.networkworld.com/article/3391380/does-your-cloud-access-security-broker-support-ipv6-it-should.html +[3]: https://www.cio.com/article/3532899/business-continuity-coronavirus-crisis-puts-cios-plans-to-the-test.html +[4]: https://www.networkworld.com/article/3532440/coronavirus-challenges-remote-networking.html +[5]: https://www.csoonline.com/article/3528878/a-security-guide-for-pandemic-planning-7-key-steps.html +[6]: https://www.computerworld.com/article/3250684/10-tips-to-set-up-your-home-office-for-videoconferencing.html +[7]: https://www.computerworld.com/article/3532283/how-to-survive-and-thrive-while-working-from-home.html +[8]: https://www.infoworld.com/article/3533050/wth-oss-knows-how-to-wfh-irl.html +[9]: https://blog.thousandeyes.com/internet-health-during-covid-19/ +[10]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[11]: https://agisi.share.thousandeyes.com/view/endpoint-agent/?roundId=1585237800&metric=loss&scenarioId=eyebrowNetwork&filters=%7B%22filters%22:%7B%22domain%22:%5B%22google.com%22%5D,%22geonameId%22:%5B4148757,4180439,4459467,4460243,4509177,4671240,4744709,4744870,4887398,4890864,4930956,5099836,5110266,5110302,5128581,5145476,5150529,5282804,5786882%5D%7D%7D&page=0,0&grouping=BY_NETWORK,BY_DOMAIN +[12]: https://ythkurgdz.share.thousandeyes.com/view/tests/?roundId=1585236900&metric=availability&scenarioId=httpServer&testId=1283781 +[13]: https://www.facebook.com/NetworkWorld/ +[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200325 COVID-19 vs. Raspberry Pi- Researchers bring IoT technology to disease detection.md b/sources/talk/20200325 COVID-19 vs. Raspberry Pi- Researchers bring IoT technology to disease detection.md new file mode 100644 index 0000000000..cdcf720c0b --- /dev/null +++ b/sources/talk/20200325 COVID-19 vs. Raspberry Pi- Researchers bring IoT technology to disease detection.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (COVID-19 vs. Raspberry Pi: Researchers bring IoT technology to disease detection) +[#]: via: (https://www.networkworld.com/article/3534101/covid-19-vs-raspberry-pi-researchers-bring-iot-technology-to-disease-detection.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +COVID-19 vs. Raspberry Pi: Researchers bring IoT technology to disease detection +====== +Researchers from UMass say that a Raspberry Pi edge device can help identify flu-like symptoms in crowds, broadening the range of tools that can be used to track the spread of disease. +[Bill Oxford / Raspberry Pi / Modified by IDG Comm.][1] [(CC0)][2] + +An [IoT][3] device that tracks coughing and crowd size in real time could become a useful tool for identifying the presence of flu-like symptoms among large groups of people, according to a team of researchers at UMass Amherst. + +FluSense, as the researchers call it, is about the size of a dictionary. It contains a cheap microphone array, a thermal sensor, a Raspberry Pi and an Intel Movidius 2 neural computing engine. The idea is to use AI at the edge to classify audio samples and identify the number of people in a room at any given time. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +Since the system can distinguish coughing from other types of non-speech audio, correlating coughing with the size of a given crowd could give a useful index of how many people are likely to be experiencing flu-like symptoms. + +A test run between December 2018 and July 2019 saw FluSense installed in four waiting rooms at UMass’ University Health Services clinic, and the researchers said that they were able to “strongly” correlate the system’s results with clinical testing for influenza and other illnesses with similar symptoms. + +And bigger plans for FluSense are afoot, according to the paper’s lead author, Ph.D student Forsad Al Hossain and his co-author and adviser, assistant professor Tauhidur Rahman. + +“[C]urrently we are planning to deploy the FluSense system in several large public spaces (e.g., large cafeteria, classroom, dormitories, gymnasium, auditorium) to capture syndromic signals from a broad range of people who live in a certain town or city,” they said. “We are also looking for funding to run a large-scale multi-city trial. In the meantime, we are also diversifying our sensing capability by extending FluSense’s capability to capture more syndromic signals (e.g., recently we added sneeze sensing capability to FluSense). We definitely see a significant level of commercialization potential in this line of research.” + +FluSense is particularly interesting from a technical perspective because all of the meaningful processing work is done locally, via the Intel neural computing engine and Raspberry Pi. Symptom information is sent wirelessly to the lab for collation, of course, but the heavy lifting is accomplished at the edge. Al Hossain and Rahman were quick to emphasize that the device doesn’t collect personally identifiable information – the emphasis is on aggregating data in a given setting, rather than identifying sickness in any single patient – and everything it does collect is heavily encrypted, making it a minimal privacy concern. + +The key point of FluSense, according to the researchers, is to think of it as a health surveillance tool, rather than a piece of diagnostic equipment. Al Hossain and Rahman said that it has several important advantages over other health surveillance techniques, particularly those based on Internet tracking, like Google Flu Trend and Twitter. + +“FluSense is not easily influenced by public health campaigns or advertisements. Also, the contactless nature of this sensor is ideal to capture syndromic signals passively from different geographical locations and different socioeconomic groups (including underprivileged who may not have access to healthcare and may not go to a doctor/clinic,” they said. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534101/covid-19-vs-raspberry-pi-researchers-bring-iot-technology-to-disease-detection.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/tR0PPLuN6Pw +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200325 The coming together of SD-WAN and AIOps.md b/sources/talk/20200325 The coming together of SD-WAN and AIOps.md new file mode 100644 index 0000000000..690a27686d --- /dev/null +++ b/sources/talk/20200325 The coming together of SD-WAN and AIOps.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The coming together of SD-WAN and AIOps) +[#]: via: (https://www.networkworld.com/article/3533437/the-coming-together-of-aiops-and-sd-wan.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +The coming together of SD-WAN and AIOps +====== +SD-WAN delivers cost and resiliency benefits. Infusing AI into SD-WAN takes things further, enabling automated operations and business agility. +kohb / Getty Images + +Software-defined wide-area networking ([SD-WAN][1]) and AIOps are both red-hot technologies. SD-WANs increase application availability, reduce costs and in some cases improve performance. AIOps infuses machine learning into IT operations to increase the level of automation. This reduces errors and enables businesses to make changes at digital speeds. Most think of these as separate technologies, but the two are on a collision course and will give rise to what I'm calling the AI-WAN.  + +### SD-WAN not a panacea for all network woes + +SD-WAN is the biggest leap forward in networking since… well, the actual WAN. But many solutions still rely on manual configurations. SD-WANs certainly increase application resiliency, lower telecommunications costs, and often increase application performance, but they are more complicated than traditional WANs. Initial setup can be a challenge, but the bigger issue is ongoing operations. Manually tweaking and tuning the network to adapt to business changes can be time consuming and error-prone. A solution is needed to bring better automation to SD-WANs. + +**READ MORE:** [How AI can improve network capacity planning][2] + +Enter AI-WAN. Much like a self-driving car, an AI-WAN can make decisions based on different rules and adapt to changes faster than people can. Self-driving cars continually monitor road conditions, speed limits and other factors to determine what changes to make. Similarly, a self-driving network can monitor, correct, defend, and analyze with minimal to no human involvement. This is done through automation capabilities powered by AI, obviating the need for people to get involved. + +Make no mistake, manual operations will hold businesses back from reaching their full potential. An interesting data point from my research is that it takes enterprises an average of four months to make changes across a network. That's because maintaining legacy networks and fixing glitches takes too much time. One ZK Research study found 30% of engineers spend at least one day a week doing nothing but troubleshooting problems. SD-WANs can improve these metrics, but there's still a heavy people burden. + +With growing data challenges businesses face as they migrate to the cloud, they simply can't afford to wait that long. Instead of being afraid of AI taking over jobs, businesses should embrace it. AI can remove human error—which is the largest cause of unplanned network downtime—and help businesses focus on higher-level tasks instead. + +### AI-WAN will transform network operations + +So how will the evolution of SD-WAN into AI-WAN transform network management and operations? Administrators can use their time to focus on strategic initiatives instead of fixing problems. Another data point from ZK Research is that 90% of the time taken to fix a problem is spent identifying the source. Now that applications reside in the cloud and run on mobile devices, identifying the source of a problem has gotten harder. AI-WANs have the ability to spot even the smallest anomaly, even if it hasn't yet begun to impact business. + +SD-WANs are fundamentally designed so that all routing rules are managed centrally by administrators and can be transmitted across a network. AI-WAN takes it a step further and enables administrators to anticipate problems before they happen through fault prediction. It may even adjust network glitches on its own before users are affected, thus improving network performance. + +[][3] + +A self-driving car knows the rules of the road—where the blind spots are, how to synch with traffic signals, and which safety measures to take—using AI software, real-time data from IoT sensors, cameras, and much more. Similarly, a self-driving network knows the higher-level rules and can prevent administrators from making mistakes, such as allowing applications in countries where certain actions are banned.  + +Security is another concern. Everything from mobile devices to Internet of Things (IoT) to cloud computing is creating multiple new entry points and shifting resources to the network edge. This puts businesses at a security risk, as they struggle to respond to changes quickly. + +Businesses can miss security gaps created by users, with hundreds of software-as-a-service (SaaS) apps being used at the same time without IT's knowledge. Older networking technologies cannot support SaaS and cloud services, while SD-WANs can. But simply deploying an SD-WAN is not enough to protect a network. Security shouldn't be an afterthought in an SD-WAN deployment, but part of it from the get-go. + +Increasingly, vendors are bundling AI-based analytics with SD-WAN solutions to boost network security. Such solutions use AI to analyze how certain events impact the network, application performance, and security. Then, they create intelligent recommendations for any network changes, such as unauthorized use of SaaS apps. + +Going back to the autonomous car analogy, AI-WANs are designed to keep roads clear and accident-free. They enable smarter networks that can adapt quickly to changing conditions and self-heal if necessary. With the growing demands of cloud computing and SaaS apps, intelligent networks are the future and forward-thinking businesses are already in the driver’s seat. + +### AI-WAN exists today and will explode in the future + +AI-WAN may seem futuristic, but there are a number of vendors that are delivering it or in the process of bringing solutions to market. Managed service provider Masergy, for example, recently introduced [AIOps for SD-WAN][4] to deliver autonomous networking and has the most complete offering. + +Open System, another managed service provider, [snapped up cloud-based Sqooba][5] to add AIOps to its strong network and security services. Keeping with the M&A theme, VMware recently [acquired AIOps vendor Nyansa][6] and rolled it into its VeloCloud SD-WAN group. That move gives VMware similar capabilities to [Aruba Networks][7], which initially applied AI to WiFi troubleshooting but is now bringing it to its SD-Branch offering. [Cisco][8] is another networking vendor with an AIOps story, although it's trying to apply it network-wide, not just with the WAN.  + +Over time, I expect every SD-WAN or SASE vendor to bring AIOps into the fold, shifting the focus away from connectivity to automated operations. + +**Learn more about SD-WAN** + + * [Top 10 underused SD-WAN features][9] + * [SD-WAN: The inside scoop from real-world deployments][10] + * [5 reasons to choose a managed SD-WAN and 5 reasons to think twice][11] + * [10 essential SD-WAN considerations][12] + * [SD-WAN: What is it and why you’ll use it one day][13] + * [SD-WAN deployment options: DIY vs. cloud managed][14] + * [How SD-WAN can improve your security strategy][15] + * [10 hot SD-WAN startups to watch][16] + * [How SD-WAN saves $1.2M over 5 years for a radiology firm][17] + * [SD-WAN creates new security challenges][18] + + + +Join the Network World communities on [Facebook][19] and [LinkedIn][20] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533437/the-coming-together-of-aiops-and-sd-wan.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[2]: https://www.networkworld.com/article/3338100/using-ai-to-improve-network-capacity-planning-what-you-need-to-know.html +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://techcrunch.com/2020/03/19/nvidia-makes-its-gpu-powered-genome-sequencing-tool-available-free-to-those-studying-covid-19/?guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS8&guce_referrer_sig=AQAAAMI6we4H-fTz2mf5g-l6IP27C1O-V-u6EiQuJ5QzVnlrrPU04iS0fhyrZo5U8q5rAk5I9uVW5PQYKHX8ziMdWrFBxhBP7f__JshmAGevyu4Z5zm98nDnC6nEdIekjVX4RPPmF9Q_PImcQ0opZy6JukS-DZA62tHI9R7D1Q2JAog7 +[5]: https://open-systems.com/press-release/open-systems-acquires-sqooba +[6]: https://www.vmware.com/company/acquisitions/nyansa.html +[7]: https://blogs.arubanetworks.com/solutions/ai-doing-more-with-less-in-2020-and-beyond/ +[8]: https://www.cisco.com/c/en/us/products/cloud-systems-management/crosswork-network-automation/service-centric-approach-to-aiops.html#~overview +[9]: https://www.networkworld.com/article/3518992/top-10-underused-sd-wan-features.html +[10]: https://www.networkworld.com/article/3316568/sd-wan/sd-wan-the-inside-scoop-from-real-world-deployments.html +[11]: https://www.networkworld.com/article/3431080/5-reasons-to-choose-a-managed-sd-wan-and-5-reasons-to-think-twice.html +[12]: https://www.networkworld.com/article/3355138/sd-wan-10-essential-considerations.html +[13]: https://www.networkworld.com/article/3031279/sd-wan/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[14]: https://www.networkworld.com/article/3243701/wide-area-networking/sd-wan-deployment-options-diy-vs-cloud-managed.html +[15]: https://www.networkworld.com/article/3336483/how-sd-wan-can-improve-your-security-strategy.html +[16]: https://www.networkworld.com/article/3284367/sd-wan/10-hot-sd-wan-startups-to-watch.html +[17]: https://www.networkworld.com/article/3255291/lan-wan/sd-wan-helps-radiology-firm-cut-costs-scale-bandwidth.html +[18]: https://www.networkworld.com/article/3336155/sd-wan-creates-new-security-challenges.html +[19]: https://www.facebook.com/NetworkWorld/ +[20]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200326 ROLLING UPDATE- The impact of COVID-19 on public networks and security.md b/sources/talk/20200326 ROLLING UPDATE- The impact of COVID-19 on public networks and security.md new file mode 100644 index 0000000000..7f8c0a2cd8 --- /dev/null +++ b/sources/talk/20200326 ROLLING UPDATE- The impact of COVID-19 on public networks and security.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ROLLING UPDATE: The impact of COVID-19 on public networks and security) +[#]: via: (https://www.networkworld.com/article/3534037/rolling-update-the-impact-of-covid-19-on-public-networks-and-security.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +ROLLING UPDATE: The impact of COVID-19 on public networks and security +====== +Network World updates the latest coronavirus-related networking news +Ig0rZh / Getty Images + +_As the coronavirus spreads, public and private companies as well as government entities are requiring employees to work from home, putting unforeseen strain on all manner of networking technologies and causing bandwidth and security concerns.  What follows is a round-up of news and traffic updates that Network World will update as needed to help keep up with the ever-changing situation.  Check back frequently!_ + +**UPDATE 3.27** + +Broadband watchers at [BroadbandNow][1] say users in most of the cities it analyzed are experiencing normal network conditions, suggesting that ISP’s (and their networks) are holding up to the shifting demand. In a March 25 [post][2] the firm wrote: “Encouragingly, many of the areas hit hardest by the spread of the coronavirus are holding up to increased network demand. Cities like Los Angeles, Chicago, Brooklyn, and San Francisco have all experienced little or no disruption. New York City,  now the epicenter of the virus in the U.S., has seen a 24% dip out of its previous ten-week range. However, with a new median speed of nearly 52 Mbps, home connections still appear to be holding up overall.” + +**[ Also see [What to consider when deploying a next generation firewall][3]. | Get regularly scheduled insights by [signing up for Network World newsletters][4]. ]** + +Other BroadbandNow findings included: + + * Eighty eight (44%) of the 200 cities it analyzed experienced some degree of network degradation over the past week compared to the 10 weeks prior. However, only 27 (13.5%) cities experienced dips of 20% below range or greater. + * Seattle download speeds have continued to hold up over the past week, while New York City’s speeds have fallen out of range by 24%. Both cities are currently heavily affected by the coronavirus pandemic. + * Three cities – Austin, Texas, Winston Salem, N.C., and Oxnard, Calif. – have experienced significant degradations, falling out of their 10-week range by more than 40%. + + + +Cisco’s Talos threat-intelligence arm [wrote][5] on March 26 about the COVID security threat noting what it called three broad categories of attacks leveraging COVID with known advanced persistent threat participation in: [Malware and phishing campaigns][6] using COVID-themed lures; attacks against organizations that carry out research and other work related to COVID; and fraud and disinformation. From an enterprise security perspective, Talos recommended: + + * Remote access: Do not expose Remote Desktop Protocol (RDP) to the internet. Use secure VPN connections with multi-factor authentication schemes. Network access control packages can be used to ensure that systems attempting to remotely connect to the corporate environment meet a minimum set of security standards such as anti-malware protection, patch levels, etc,. prior to granting them access to corporate resources. Continually identify and remediate access-policy violations. + * Identity Management: Protect critical and public-facing applications with multi-factor authentication and supporting corporate policies. Verify that remote-account and access-termination capabilities work as intended in a remote environment. + * Endpoint Control: Because many people may be working from home networks, endpoint visibility, protection, and mitigation is now more important than ever. Consider whether remediation and reimaging capabilities will work as intended in a remote environment. Encrypt devices where possible, and add this check to your NAC solution as a gate for connectivity. Another simple method of protecting endpoints is via DNS, such as with [Cisco’s] Umbrella, by blocking the resolution of malicious domains before the host has a chance to make a connection. + + + +In an [FAQ][7] about the impact of COVID-19 on fulfilling customer hardware orders, VMware stated: “Some VMware SD-WAN hardware appliances are on backorder as a result of supply chain issues. As a result, we are extending the option to update existing orders with different appliances where inventory is more readily available. Customers may contact a special email hotline with questions related to backordered appliances. Please send an email to [sd-wan-hotline@vmware.com][8] with your questions and include the order number, urgent quantities, and contact information. We will do our best to respond within 48 hours.” + +Cisco said it has been analyzing traffic statistics with major carriers across Asia, Europe, and the Americas, and its data shows that typically, the most congested point in the network occurs at inter-provider peering points, Jonathan Davidson, senior vice president and general manager of Cisco's Mass-Scale Infrastructure Group wrote in a [blog][9] on March 26. “However, the traffic exchanged at these bottlenecks is only a part of the total internet traffic, meaning reports on traffic may be higher overall as private peering and local destinations also contribute to more traffic growth.” + +[][10] + +“Our analysis at these locations shows an increase in traffic of 10% to 33% over normal levels. In every country, traffic spiked with the decision to shut down non-essential businesses and keep people at home. Since then, traffic has remained stable or has experienced a slight uptick over the days that followed,” Davidson stated. + +He said that traffic during peak hours from 6 p.m. and 10 p.m. has increased slightly, but is not the primary driver for the overall inrease. Busy hours have extended to 9 a.m. 10 p.m., although the new busy-hour (9 a.m. to 6 p.m.) traffic is still below the traditional peak hours. "Service providers are certainly paying attention to these changes, but they are not yet a dire concern, as most networks are designed for growth. Current capacities are utilized more over the course of the entire day,” he wrote. + +Spanish multinational telecommunications company [Telefonica][11]’ said IP networks are experiencing traffic increases of close to 40% while mobile voice use is up about 50% and data is up 25%. In general, traffic through IP networks has experienced increases of nearly 40% while mobile use has increased by about 50% for voice and 25% for data. Likewise, traffic from instant-messaging tools such as Whatsapp has increased fivefold in recent days. + +**UPDATE: 3.26** + + * Week over week (ending March 23) [Ookla][12] says it has started to see a degradation of mobile and fixed-broadband performance worldwide. More detail on specific locations is available below. Comparing the week of March 16 to the week of March 9, mean download speed over mobile and fixed broadband decreased in Canada and the U.S. while both remained relatively flat in Mexico. + * What is the impact of the coronavirus on corporate network planning? Depends on how long the work-from-home mandate goes on really. Tom Nolle, president of CIMI Corp. [takes an interesting look at the situation][13] saying the shutdown “could eventually produce a major uptick for SD-WAN services, particularly in [managed service provider]    Businesses would be much more likely to embark on an SD-WAN VPN adventure that didn’t involve purchase/licensing, favoring a service approach in general, and in particular one with a fairly short contract period.” + * Statistics from VPN provider [NordVPN][14] show the growth of VPN usage across the globe.  For example, the company said the US has experienced a 65.93% growth in the use of business VPNs since March 11. It reported that mass remote working has contributed towards a rise in desktop (94.09%) and mobile app (0.39%) usage among Americans. Globally, NordVPN teams has seen a 165% spike in the use of business VPNs and business VPN usage in Netherlands (240.49%), Canada (206.29%) and Austria (207.86%) has skyrocketed beyond 200%. Italy has had the most modest growth in business VPN usage at just 10.57%. + + + +**UPDATE: 3. 25**: + + * According to [Atlas VPN][15] user data, VPN usage in the US increased by 124% during the last two weeks. VPN usage in the country increased by 71% between March 16 and 22 alone. Atlas said it measured how much traffic traveled through its servers during that period compared to March 9 to 15. The data came from the company's 53,000 weekly users. + * Verizon [reports][16] that voice usage, long declining in the age of texting, chat and social media, is up 25% in the last week. The network report shows the primary driver is accessing conference calls. In addition, people are talking longer on mobile devices with wireless voice usage notching a 10% increase and calls lasting 15% longer.  + * AT&T also [reported][17] increased calling, especially Wi-Fi calling, up 88% on March 22 versus a normal Sunday. It says that consumer home voice calls were up 74% more than an average Sunday; traffic from Netflix dipped after all-time highs on Friday and Saturday; and data traffic due to heavy video streaming between its network and peered networks tied record highs. AT&T said it has deployed portable cell nodes to bolster coverage supporting FirstNet customers in Indiana, Connecticut, New Jersey, California and New York. + * Microsoft this week advised users of Office 365 it was throttling back some services: + * **OneNote: ** OneNote in Teams will be read-only for commercial tenants, excluding EDU. Users can go to OneNote for the web for editing. Download size and sync frequency of file attachments has been changed. You can find details on these and other OneNote related updates as . + * **SharePoint:** We are rescheduling specific backend operations to regional evening and weekend business hours. Impacted capabilities include migration, DLP and delays in file management after uploading a new file, video or image. Reduced video resolution for playback videos. + * **Stream:** People timeline has been disabled for newly uploaded videos. Pre-existing videos will not be impacted. Meeting recording video resolution adjusted to 720p. + + + +**RELATED COVID-19 NEWS:** + + * Security vendor [Check Point’s Threat Intelligence][18] says that Since January 2020, there have been over 4,000 coronavirus-related domains registered globally. Out of these websites, 3% were found to be malicious and an additional 5% are suspicious. Coronavirus- related domains are 50% more likely to be malicious than other domains registered at the same period, and also higher than recent seasonal themes such as Valentine’s day. + * [Orange][19] an IT and communications **services** company aid that has increased its network capacity and upgraded its service platforms. These measures allow it to support the ongoing exponential increase in needs and uses. The number of users connecting to their company's network remotely has already increased by 700% among its customers. It has also doubled the capacity for simultaneous connections on its platforms. The use of remote collaboration solutions such as video conferencing has also risen massively with usage increasing by between 20% to 100%. + * Verizon said it has seen a 34% increase in VPN traffic from March 10 to 17. It has also seen a 75% increase in gaming traffic and web traffic increased by just under 20% in that time period according to Verizon. + * One week after the CDC declaration of the virus as a pandemic, data analytics and broadband vendor OpenVault wrote on March 19 that: + * Subscribers’ average usage during the 9 am-to-5 pm daypart has risen to 6.3 GB, 41.4% higher than the January figure of 4.4 GB.  + * During the same period, peak hours (6 pm–11 pm) usage has risen 17.2% from 5.0 GB per subscriber in January to 5.87 GB in March.  + * Overall daily usage has grown from 12.19 GB to 15.46 GB, an increase of 26.8%. + * Based on the current rate of growth, OpenVault projected that consumption for March will reach nearly 400 GB per subscriber, an increase of almost 11% over the previous monthly record of 361 GB, established in January of this year. In addition, OpenVault projects a new coronavirus-influenced run rate of 460 GB per subscriber per month going forward. + + + +Join the Network World communities on [Facebook][20] and [LinkedIn][21] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534037/rolling-update-the-impact-of-covid-19-on-public-networks-and-security.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://broadbandnow.com/ +[2]: https://broadbandnow.com/report/internet-speed-analysis-march-15th-21st/ +[3]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://blog.talosintelligence.com/2020/03/covid-19-pandemic-threats.html +[6]: https://blog.talosintelligence.com/2020/02/coronavirus-themed-malware.html +[7]: https://www.vmware.com/company/news/updates/vmware-response-covid-19.html?mid=31381&eid=CVMW2000048242496 +[8]: mailto:sd-wan-hotline@vmware.com +[9]: https://blogs.cisco.com/news/global-traffic-spikes-no-panic-at-the-cisco +[10]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[11]: https://www.telefonica.com/en/web/press-office/-/telefonica-announces-measures-related-to-covid-19 +[12]: https://downdetector.com/?utm_campaign=Ookla%20Insights%20Blog%20Subscription&utm_source=hs_email&utm_medium=email&utm_content=85202785&_hsenc=p2ANqtz--Nj93d_eQyJpsqxrPJyNPtTiMBWBQU984psLyalw51K61e4d1WODareMF5NWFriHY2Uzw3WF7rF-2vSfH5cR53Jg3K5Q&_hsmi=85202785 +[13]: https://blog.cimicorp.com/?p=4068 +[14]: https://nordvpnteams.com/ +[15]: https://atlasvpn.com/blog/lockdowns-and-panic-leads-to-a-124-surge-in-vpn-usage-in-the-us/ +[16]: https://www.verizon.com/about/news/update-verizon-serve-customers-covid-19 +[17]: https://about.att.com/pages/COVID-19.html +[18]: https://blog.checkpoint.com/2020/03/05/update-coronavirus-themed-domains-50-more-likely-to-be-malicious-than-other-domains/ +[19]: https://www.orange.com/en/Press-Room/press-releases/press-releases-2020/Orange-is-mobilised-to-ensure-continuity-of-service-for-all-customers-in-France-and-around-the-world +[20]: https://www.facebook.com/NetworkWorld/ +[21]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200327 6 tricks for developing a work from home schedule.md b/sources/talk/20200327 6 tricks for developing a work from home schedule.md new file mode 100644 index 0000000000..9253f824fd --- /dev/null +++ b/sources/talk/20200327 6 tricks for developing a work from home schedule.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 tricks for developing a work from home schedule) +[#]: via: (https://opensource.com/article/20/3/work-from-home) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +6 tricks for developing a work from home schedule +====== +Stay flexible, embrace change, and think of the transition to your home +office as an opportunity to create a healthier WFH experience. +![Working from home at a laptop][1] + +When you start working from home, one of the first things you might have noticed is that there almost no outside influences on your schedule. + +You probably have meetings—some over [team chat][2] and others over [video][3]— that you have to attend, but otherwise, there's nothing requiring you to do anything at any specific time. What you find out pretty quickly, though, is that there's an invisible influence that sneaks up on you: deadlines. + +This lack of structure fosters procrastination, sometimes willful and other times aimless, followed by frantic sprints to get something done. Learning to mitigate that, along with all the distractions working from home might offer, is often the hardest part of your home-based work. + +Here are a few ways to build in that structure for yourself do you don't end up feeling like you are falling behind. + +### You have always had your own schedule + +Everybody reacts to schedules differently. For some people, schedules offer guidance and comfort. For others, schedules are rigid and oppressive. + +An office space generally provides focus. There might be plenty of distractions at the office, but you usually find a good stretch of time at some point during your day when you can get a big chunk of work done. Even in an office, though, each person actually keeps their own schedule. Your colleague might arrive early in the day, happily completing a day's work in an empty office before anyone else arrives and then spending the rest of the day doing menial tasks and socializing. Another colleague might arrive late and leave early, maximizing time spent in the office for actual work. Still others follow a steady pace throughout the day. + +As you're settling into a WFH routine, take notes, either mentally or physically, on what seems to work well for you. If you like formalized systems, then build a schedule for yourself after a week or two, based on what you've been doing naturally. If there's something that isn't working for you, then drop it from your schedule. + +Once you've found a good rhythm for yourself, you can manage your day with a [to-do list][4] like [todo.txt][5], or if you prefer sledgehammers (or you actually manage a department), you can try a [project management][6] application. + +### Treat yourself as a new hire + +For the first week or two at home, you may find it helpful to treat yourself (and your remote team) as a new hire. Instead of trying to mimic or impose the same schedule you kept at the office or at school, take time to monitor your own activity. It takes time for your body and mind to establish new and comfortable habits, and if you're the kind of person who wanders into a routine, then you need to give yourself time to discover what those habits are. + +For instance, if you're consistently finding that you do your best work right after breakfast, then relegate menial tasks, like responding to email, reviewing tasks, or triaging bug reports, to the early morning, and make sure you have a big task set up for after breakfast. If you're having a hard time maintaining focus, then make time for morning tea so you can relax, reassess your workload, and plan your next step. Be curious about yourself like a manager would be for a brand new employee. Adjust accordingly. + +### There is no guilt to being interrupted at home + +Not everything on your schedule is under your control. If you have children too young for school, or if children are home from school, then their schedules take precedence. + +It's a perceived benefit of working from home that your schedule is more flexible than at an office, but with that assumption, there can sometimes come a little to a lot of guilt. You might feel you're not working "enough" because you have to stop to wake up and feed children, or because you want to take a few play breaks every now and again. + +That's mostly illusory, though, and here is how to think about it. If you swap out "children" for "manager," you might remember some times at the office where your "real" work was interrupted because you had to entertain upper management with sparkly presentations, or complete piles of paperwork for HR, or decompress by chatting with colleagues by the water cooler. + +Your work from home is really no different. There are plenty of distractions, and they're only a problem if you fail to acknowledge and work around them. + +### Making the choice to move beyond the 9-to-5 + +Unlike at the office, you're not forced into a rigid and dated 9-to-5 structure. If your day has to start at 7am, contains a lot of breaks, and doesn't end until 7pm, then that's alright. The essential part is to define that as your schedule for yourself (once you've established it as a schedule that works for you; remember to give yourself a few weeks to get a feel for what your schedule actually "wants" to be). Pick your start and end times, establish break times with your housemates, whether they're children, spouses, pets, or roommates/friends. Work when you're supposed to be working, and don't work when you're not scheduled to work. For most of us, colleagues don't need to know exactly when you are online as long as you're available when you're needed. In that case, your hours are your own. If the team is the kind that needs to know, run it by them. + +### Don't forget time for yourself + +It's important to at least establish times you stop thinking about work, no matter what. If you've got a very young child who's not given to staying on any schedule, then you might have to stay more flexible than most. Still, give yourself permission to actively be inactive. Do something you enjoy, even if it feels unproductive. It's normal to spend some idle time at the office to think or intentionally not think. Working from home deserves the same space. If anything, it's even more important as you establish working hours. The goal is to recognize when you're at home and when you're at work. + +Finding stuff to do at work is relatively easy, but sometimes finding things to do to relax can be hard. If you have children, you can collaborate with them using Scratch for [drawing beautiful art][7], [programming video games][8], or even [robotics][9]. For the times you're not necessarily looking to collaborate and need your little one to do some exploration of their own, there are some [great open source alternatives to Minecraft][10], too. If you're interested in getting away from the screen, though, you might try some [Arduino][11] or [Seeeduino][12] gardening projects. Start with some programming, and end up outside in the garden! + +### Choose to see change as exciting + +Some say humans don't generally love change and that we're primarily creatures of habit, so moving from an office into a home office can be upsetting. And yet, invariably, we've shown that change can be exciting and even good.  + +Use this thought experiment to remember how much you love change. Would you willingly revert to technology from even two years ago? How about five, or ten? + +If we can embrace change in technology and be uninterested in reverting back, why not embrace change elsewhere? + +When you work from home, you have the opportunity to be willing to explore change. If you find that a meeting time doesn't work for your schedule, mention it to your team. It may not work for them, either, and moving it to a different day could mean making room for a work sprint that knocks out a good chunk of your work for the week. If you find that a tool isn't working out for you, find a different one. + +In fact, some of the most productive people are constantly evaluating new applications and new methods of working. They're constantly learning new things, developing new skills. They don't do this because they need the new skill, at least not by the letter of their work contract, but learning new things often reveals a surprising applicability to something they do need. + +Need some examples? Tinkering with a Raspberry Pi for fun could result in a home server running [useful apps][13] to help you stay informed. [Learning][14] how to [write in Markdown][15] could introduce you to a new and more efficient workflow than you ever knew possible. Setting up a [computer with Linux][16] could reveal a new world of open source software that changes the way you approach problems, and improves the methods you use to solve them. The possibilities are limitless, but if you don't know where to start, you can browse through some of our articles or [cheat sheets][17] for ideas and tips. + +### Working from home is a new opportunity + +The habits we've built up around work aren't always healthy or efficient or fun. If you're starting to work from home, though, it's a chance to reinvent what work means for you. Keep the lines of [communication open][18] with your colleagues, embrace new ideas and the potential of change, and discover how you can be more productive by enjoying yourself and the place you call home (and **$HOME**). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/work-from-home + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/wfh_work_home_laptop_work.png?itok=VFwToeMy (Working from home at a laptop) +[2]: https://opensource.com/alternatives/slack +[3]: https://opensource.com/alternatives/skype +[4]: https://opensource.com/article/19/9/to-do-list-managers-linux +[5]: https://opensource.com/article/20/1/open-source-to-do-list +[6]: https://opensource.com/article/18/2/agile-project-management-tools +[7]: https://opensource.com/article/19/9/drawing-vectors-scratch-3 +[8]: https://opensource.com/article/18/4/designing-game-scratch-open-jam +[9]: https://opensource.com/education/13/8/student-programming-scratch-and-finch +[10]: https://opensource.com/alternatives/minecraft +[11]: https://opensource.com/article/17/3/arduino-garden-projects +[12]: https://opensource.com/article/19/12/seeeduino-nano-review +[13]: https://opensource.com/article/20/2/newsboat +[14]: https://opensource.com/article/19/9/introduction-markdown +[15]: https://opensource.com/article/18/11/markdown-editors +[16]: https://opensource.com/article/19/9/found-linux-video-gaming +[17]: https://opensource.com/article/20/1/cheat-sheets-guides +[18]: https://opensource.com/article/20/3/open-source-working-home diff --git a/sources/talk/20200330 Know the benefits of cloud-native networking for SASE.md b/sources/talk/20200330 Know the benefits of cloud-native networking for SASE.md new file mode 100644 index 0000000000..e4c38f352e --- /dev/null +++ b/sources/talk/20200330 Know the benefits of cloud-native networking for SASE.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Know the benefits of cloud-native networking for SASE) +[#]: via: (https://www.networkworld.com/article/3534720/know-the-benefits-of-cloud-native-networking-for-sase.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Know the benefits of cloud-native networking for SASE +====== +Shlomo Kramer, CEO of Cato Networks discusses the benefits cloud-native networking brings to SASE +Metamorworks / Getty Images + +Gartner has positioned secure access service edge (SASE) as the next wave of SD-WANs. While most industry people I talk to agree on the concept of security and networking being brought together, there is some debate surrounding cloud-native versus cloud-managed. + +To get a better understanding of why cloud native matters, I sat down with Shlomo Kramer, CEO of Cato Networks, which designed its SASE service from the ground up for cloud delivery. + +**Last year Gartner coined the term SASE, do you agree or disagree with their premise?** + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +Well I definitely agree.  The manifesto that Cato was founded on was the vision of converging network transport and network security and delivering it as a cloud service. The argument as to why you need SASE is topological in nature because traffic patterns have changed. Network traffic used to be inward bound because people sat at their desks, using corporate workstations and connecting to enterprise applications that resided in the company data centers. + +That meant security was effectively a hard shell placed around a soft core.  Security was applied at the edge and protected all the physical locations behind it. Today, the traffic patterns have changed, and the security needs to be applied everywhere.  Applications are built in AWS as well as on-premises, workers are in the office, at home and in the hotel or anywhere.  So now corporate assets are everywhere so the hard shell no longer works.  Security needs to be different and be integrated everywhere so I absolutely agree with the concept of SASE. + +**What are some other challenges with legacy technologies like MPLS and security appliances?** + +**T**he problems with MPLS are well documented, so I won’t spend too much time on this topic other than say every company we talk to wants to move off of MPLS because of high costs, long deployment times and a lack of agility.  MPLS does nothing for mobile users or cloud connectivity so organizations need to deploy VPN servers, cloud interconnects and other technologies to connect all of their company resources. + +[][2] + +On the security side, branch appliances have been an enormous problem that we as an industry accepted as the only possible solution.  Appliances need to be procured, deployed, maintained, upgraded and retired. All of which takes time and effort. They need to be integrated with one another, which requires more time and skills. Most appliances are managed from separate management consoles making operations complex and challenging.  Over time, more appliances are added, which raises the complexity level.  Also, when traffic jumps or too many features are turned on, upgrades are often required outside budget cycles.  Security professionals often lag behind when applying software patches because updating appliances is risky and needs to be carefully planned, leaving the company at risk. + +I can go on, but _appliances_ as an architecture involve too many headaches and too much cost for companies looking to become leaner and more agile. And by appliances, I also mean VNFs and virtual appliances. It's the same story again. You still need to deploy, manage and scale them. Appliances are a poor choice not because of anyone's solution's limitations but because of the architecture itself. + +**What benefit do cloud-native platforms provide?** + +For Gur (Co-Founder of Cato, Gur Shatz) and myself, who came from the security and networking worlds, we were well acquainted with these problems. As we thought about what the right architecture would be moving forward, the cloud seemed like the obvious choice. We had already seen how cloud computing changed markets for data centers, servers, storage, and applications. We thought the cloud could do the same for security and networking.  + +Like AWS for data centers and servers, we wanted to create a utility that would secure and network the complete enterprise, not just sites, but also remote users, cloud data centers, cloud applications, and third-party devices. We wanted enterprises to "tap" into this utility and instantly receive all the advanced security and networking services for the entire organization. It's why we called our SD-WAN device the "Cato Socket," like an electrical socket you plug into. This vision is in line with the SASE definition. + +Instead of appliances, we move the “heavy lifting” involved in security and networking into a global, distributed, cloud-native software platform. By cloud-native software, we mean several things.  We actually wrote a [blog on this topic][3] that talks about the value of cloud-native.  There are many benefits but in particular, multi-tenancy is game-changing. This allows cloud providers to amortize costs across their customer base, allowing them to deliver offerings at a price point unmatched by one based on purchasing appliances for customers.  + +This platform runs our single-pass, security and networking stack that performs all security inspections in parallel. A packet comes in, depacketized and decrypted by our software that then performs all the necessary security inspections in parallel before sending the packet on.  This is an incredible change from the way appliances work today. Today, each appliance must depacketize and decrypt packets, run a deep packet inspection (DPI) engine to understand the packet, apply the specific security inspections, and repacketize and re-encrypt for the next appliance to do the same.   + +**You’ve also stated that a global private network is necessary, why is that?** + +As for the network, enterprises require predictable, low latency performance everywhere all the time. That's simply not possible with Internet routing today when broadband is used. While the problems of unpredictable latency across global routes or in under-developed Internet regions is well known even within Internet regions, we've seen specific routes have problems.   + +How do you overcome latency AND the global connectivity costs of MPLS? Our answer was to leverage the massive build-out in global IP connectivity. By buying massive wholesale SLA-backed capacity across multiple IP backbones, and then dynamically selecting the best backbone at each hop across our network, we could deliver global, low-latency connections at a fraction of the cost of MPLS.    + +**The SASE industry is currently filled with start-ups and smaller vendors.  Why are the big incumbents struggling to make this shift?** + +** ** + +I think it should be evident by now, but existing appliance-based solutions simply can't be converted to become cloud-native. Re-engineering a platform for the cloud requires massive investments in R&D, which will come at the expense of existing and very successful product lines, so beyond engineering, there is also an internal conflict to overcome.    + +And that's why the "big incumbents," as you put it, are so threatened by SASE. We all recognize that SASE is the future, but to get that to that future, many of the established solution providers will need to disrupt their existing businesses. That's not easy to do, but what they can do is market.  + +We, as an industry, are seeing vendors trying to capitalize on SASE by rebranding their solutions as SASE offerings. Some are appliances without cloud capabilities; others are security services without networking capabilities. For IT to tell the difference between a true SASE platform and a "fake" one, the litmus test is simple: If the center of gravity is in the appliances. If the offer lacks SD-WAN and if there is more than one management console. It's not SASE, and it's not the future. It's a repackaging of the past.   + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534720/know-the-benefits-of-cloud-native-networking-for-sase.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.catonetworks.com/blog/the-cloud-native-network-what-it-means-and-why-it-matters/ +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200330 SASE might be better than VPNs for quickly ramping up remote access.md b/sources/talk/20200330 SASE might be better than VPNs for quickly ramping up remote access.md new file mode 100644 index 0000000000..10f3abab83 --- /dev/null +++ b/sources/talk/20200330 SASE might be better than VPNs for quickly ramping up remote access.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SASE might be better than VPNs for quickly ramping up remote access) +[#]: via: (https://www.networkworld.com/article/3534501/sase-might-be-better-than-vpns-for-quickly-ramping-up-remote-access.html) +[#]: author: (Linda Musthaler https://www.networkworld.com/author/Linda-Musthaler/) + +SASE might be better than VPNs for quickly ramping up remote access +====== +A secure access service edge model can quickly grow remote-worker capacity without requiring enterprises to deploy their own new VPN gear. +Getty Images + +The global pandemic now hitting almost every corner of the world is forcing countless millions of people to work from home. In one sense, we’re fortunate to now have the technology that allows us to do that. Between broadband Internet access in the home, corporate VPNs, team workspaces and videoconferencing services, many people can continue to do their jobs as effectively as if they were in their regular office environment. + +That doesn’t mean it’s all smooth sailing for the IT departments that have to enable and support those critical work-from-home services. Depending on the type of network architecture a company has, it can be relatively easy or significantly challenging to support tens of thousands of employees now suddenly working from home. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +I recently talked with Mark Casey, CEO of the network infrastructure services provider [Apcela][2], who conveyed the challenges that many large enterprises have. It’s these companies that typically still have a traditional hub-and-spoke kind of WAN anchored in a physical data center. Corporate traffic is backhauled from branch and remote locations (like workers’ homes) to a centralized [data center][3] to pass through a security stack before it is sent to the internet or to cloud services. Unfortunately, this legacy network architecture doesn’t adapt well to the dramatically different traffic patterns resulting from a massive surge in telework. + +When you look at the [VPN][4] architecture in this environment, it’s largely dominated by Cisco with its AnyConnect solution that pairs with the vendor’s ASA [firewall][5] products. Countless large enterprises have these hardware appliances in their on-premises data centers. Whether it’s Cisco equipment or some other vendor’s, the VPN/firewall combination is a real workhorse under normal conditions, but the vast increase in remote workers is causing a strain. + +**VPN capacity is strained** + +A home-based worker brings up a VPN connection that creates a secure tunnel to take him straight into the data center. This might be fine when the company expects 10% to 20% of its employees to work remotely at any given time, but now the numbers might approach 50% or 70%. This creates contention for resources and a poor VPN experience for all. What’s more, workers are routing a bunch of internet traffic to the data center along with traffic destined for on-premise applications like [Microsoft Office 365][6]. This is the landscape that Casey sees every day as he engages with large enterprise organizations. + +“We’ve talked to a number of companies recently that say they need to expand their VPN capacity but the legacy network architecture is holding them back. [Cisco][7], Palo Alto and others are offering free VPN client licenses but the enterprises still need to expand the VPN terminating appliances. It’s hard to quickly scale capacity in this environment,” says Casey. “Whether it’s coronavirus or some other catalyst that puts stress on the legacy network environment, we advocate that enterprises should diversify and shift portions of their network architecture to the cloud. This will give them much more flexibility to provide security and remote access services to their workforce in the long run.” + +[][8] + +**SASE for flexibility and capacity on demand** + +Casey points to the [Secure Access Service Edge][9] (SASE, pronounced “sassy”) framework as a model for re-architecting the enterprise network. SASE is Gartner’s name for a combination of [SD-WAN][10] capabilities with a number of security services that are primarily delivered through a cloud-based delivery model. + +Gartner defines the service edge as an offering that supports the access needs of digital enterprises by combining SD-WAN functions with network security services such as secure web gateway (SWG), cloud access security broker (CASB), and cloud-based firewall. In short, a SASE offering helps simplify network management by offering highly customizable policy-based control that can be tailored by user identity, session context, and application needs for performance and security – and it’s delivered from the cloud.  + +Casey explains the concept of a service edge with a geographical example. “Suppose an employee is VPNing into his corporate network from his New York area home, and the data center happens to be in Chicago. Ordinarily the traffic would all be directed to Chicago, but if he’s accessing internet content, it would be optimal to egress that traffic via secure web gateway much more locally to where the user is. It’s better to go to a site in New York where the VPN terminates on a local firewall, and there’s a secure web gateway there so the Internet traffic can be offloaded there instead of backhauling it to Chicago. This site in New York is called the service edge.” + +Casey continues his explanation: “A virtualized version of a company’s firewall sits in the hub. The VPN terminates on the VPN concentrator in the local hub and then the traffic is routed appropriately. That traffic going to the internet goes out through secure web gateway and that traffic that's destined for an application in the data center goes over a private network inside the security parameters. This is essentially another tunnel back to the data center. And that's a great use case for this whole concept of SASE, which is to lift some of your core security components and move them out to the cloud.” + +With the word cloud, people tend to think of AWS or Azure or Google Cloud Platform, but Casey gives cloud a broader definition. “Cloud is Software as a Service, like Salesforce and ServiceNow,” says Casey. “If you’re an enterprise, cloud is an Equinix data center. Cloud is anything that’s not you, and it’s delivered as a service.” + +**The service edge is a powerful hub** + +In Apcela’s parlance, a service edge is called an application hub, or AppHub. Other companies call them communication hubs, cloud hubs, or simply Points of Presence (PoPs). Regardless of the name, the concept is the same. + +These hubs consist of racks of switching and routing equipment that are typically deployed in carrier-neutral co-location centers. Then these data centers are interconnected with high-capacity, low-latency circuits that create a high-performance core network. SD-WAN, VPN and security stacks are typically deployed in the hubs. At the edge of this network, an enterprise can directly connect its own data centers, branch offices, remote and mobile users, and even third-party partners. The leading SASE providers have built hubs, or PoPs, around the world so that organizations and their workers can connect to the closest hub to obtain the communication and security services they need. Each enterprise chooses what services it wants to utilize. + +When considering how to deploy security as a virtual service, Casey says, “You don't necessarily want to put all the security in AWS because then it will work great with AWS, but it won't work for GCP or Azure, and it certainly won't help you for your SaaS applications. So having this hub environment that sits between the application clouds – Salesforce, Office 365, Workday, etc. – and the users and enterprise locations is the perfect location to put these security services. And because the hubs are essentially an Infrastructure as a Service, you're not stuck with having to move to some proprietary cloud-based platform.” + +SASE infrastructure is essentially on demand, so it’s fairly easy for new customers to adopt it. “It’s not complicated,” says Casey. “We have to find a place, somewhere in the world, and cross connect back into an enterprise’s infrastructure to deliver private connectivity. But it's all very cloud-like. It takes the agility of cloud and the speed of cloud and enables you to act quickly.” + +**SASE has VPN capacity pre-built** + +The SASE model allows companies to expand their VPN platforms easily because the capability is all pre-built. Once the service is turned on, the company is well positioned to support thousands of new home-based workers. + +I asked Casey about a realistic timeframe for companies that are new to the SASE approach before they can expect to be up and running with expanded VPN capacity. “I can only speak to the solution Apcela offers, of course, but I’d say it’s a matter of days to weeks, but certainly not months,” he says. “In our case, it depends on their security platform because we leverage virtualized network functions on the security side, so the whole concept of procuring and shipping equipment goes away.” Other vendors might do the deployment in different ways. + +Contrast this approach to the legacy model of installing new hardware in a data center to provide more capacity. By the time the company orders the hardware, gets it shipped to the data center, and then installed and configured, two or three months might pass. + +Another benefit of the SASE framework is that traffic travels over a private core network rather than the public Internet. “The Internet shouldn’t become your new [WAN][11] – certainly not for business and mission-critical platforms. You need a specialized sort of [MPLS][12]-like network for your cloud apps, which is what a SASE platform does,” says Casey. “Traffic is taken off the Internet at the secure edge, put onto a private secure network and routed directly to the appropriate SaaS or IaaS platform data center.” + +Having a private core network is especially important at this time because the public Internet is under great strain due to the traffic and content pattern shifts now that so many people are staying home or working from home. The [strain is so bad][13] that companies like Facebook and Netflix have been asked by the European Commissioner for internal market and services to throttle their services to consume less bandwidth. As Casey says, “You don’t want your corporate traffic to compete for bandwidth against Netflix and all these different videoconferencing services.” + +If your organization is struggling with ramping up work-from-home capacity in a hurry, consider how a SASE service might help you. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534501/sase-might-be-better-than-vpns-for-quickly-ramping-up-remote-access.html + +作者:[Linda Musthaler][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Linda-Musthaler/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.apcela.com/ +[3]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[4]: https://www.networkworld.com/article/3268744/understanding-virtual-private-networks-and-why-vpns-are-important-to-sd-wan.html +[5]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html +[6]: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-quickly-optimize-office-365-traffic-for-remote-staff-amp/ba-p/1214571; +[7]: https://blogs.cisco.com/security/cisco-expands-free-security-offerings-to-help-with-rise-in-remote-workers +[8]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[9]: https://www.networkworld.com/article/3516503/it-pros-need-to-weigh-in-on-that-sassy-security-model.html +[10]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[11]: https://www.networkworld.com/article/3248989/what-is-a-wan-wide-area-network-definition-and-examples.html +[12]: https://www.networkworld.com/article/2297171/network-security-mpls-explained.html +[13]: https://mashable.com/article/eu-netflix-standard-definition-coronavirus/ +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200401 How enterprise networking is changing with a work-at-home workforce.md b/sources/talk/20200401 How enterprise networking is changing with a work-at-home workforce.md new file mode 100644 index 0000000000..90f16a742e --- /dev/null +++ b/sources/talk/20200401 How enterprise networking is changing with a work-at-home workforce.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (JunJie957) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How enterprise networking is changing with a work-at-home workforce) +[#]: via: (https://www.networkworld.com/article/3534037/how-enterprise-networking-is-changing-with-a-work-at-home-workforce.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +How enterprise networking is changing with a work-at-home workforce +====== +Network World updates the latest COVID-19-related networking news +Ig0rZh / Getty Images + +_As the coronavirus spreads, public and private companies as well as government entities are requiring employees to work from home, putting unforeseen strain on all manner of networking technologies and causing bandwidth and security concerns.  What follows is a round-up of news and traffic updates that Network World will update as needed to help keep up with the ever-changing situation.  Check back frequently!_ + +UPDATE: 3.30 + +AT&T said its core network traffic – which includes business, home broadband and wireless  – was up 24% through March 30 compared to the same day last month.  It broke down some mobility traffic patterns as well: voice calls: +33%, instant messaging: +63%, text messaging: +41%, email: -18%, web browsing: -5%, video: +4% (also accounts for over half of all mobility traffic). It also usage for conferencing: AT&T’s global audio-conferencing solution: +200%; audio, web and video conferencing tools: +400%; Large-scale webcast events: +200%. + +[RELATED: Firewall face-off for the enterprise][1] + +AT&T said its investment in artificial intelligence technology is helping it keep up with demand. For example, the company said AI is helping remotely troubleshoot and diagnose problems with customer equipment, by identifying the cause or even proactively identifying a potential issue before it occurs. “We’ve expedited deployments of new AI capabilities in certain markets that will allow us to balance the traffic load within a sector and across sectors to help avoid overloading specific cells and improve the experience.” + +DNS vendor BlueCat says it has been tracking the use of DNS over HTTPS (DoH) – a method of encrypting queries to prevent visibility into DNS traffic patterns.  Over the last week through March 27, the company said it has  seen a massive increase in the use of DoH across its customer base wrote Ben Ball, director of strategy and content marketing at BlueCat in a [blog][2] about the trend. “In the course of a single weekend, the number of endpoints attempting to use DoH went from an average of 90 to about 1,400.  That’s a 1,500% increase in the use of DoH. Around 45% of these queries are from Firefox (which now activates DoH by default).  Aside from that, we’re seeing queries to eleven different DoH services from all kinds of applications. DoH usage is fairly uniform across our customer base as well – this isn’t one company or industry vertical; this is a broad trend. While we haven’t seen any clear indications that any of these queries are from [DoH enabled malware][3], that is an emerging threat that we are tracking,” Ball stated. + +Ookla’s [SpeedTest][4] shows mean download speed over fixed broadband declined only slightly in Mexico and the U.S. when comparing the week of March 23 to that of March 16, while a decline in Canada’s mean download speed over fixed broadband was more evident. Mean download speed over mobile was down in the U.S. and Canada during the week of March 23, while it rose slightly in Mexico during the same period. + +**UPDATE 3.27** + +[][5] + +Broadband watchers at [BroadbandNow][6] say users in most of the cities it analyzed are experiencing normal network conditions, suggesting that ISP’s (and their networks) are holding up to the shifting demand. In a March 25 [post][7] the firm wrote: “Encouragingly, many of the areas hit hardest by the spread of the coronavirus are holding up to increased network demand. Cities like Los Angeles, Chicago, Brooklyn, and San Francisco have all experienced little or no disruption. New York City,  now the epicenter of the virus in the U.S., has seen a 24% dip out of its previous ten-week range. However, with a new median speed of nearly 52 Mbps, home connections still appear to be holding up overall.” + +Other BroadbandNow findings included: + + * Eighty eight (44%) of the 200 cities it analyzed experienced some degree of network degradation over the past week compared to the 10 weeks prior. However, only 27 (13.5%) cities experienced dips of 20% below range or greater. + * Seattle download speeds have continued to hold up over the past week, while New York City’s speeds have fallen out of range by 24%. Both cities are currently heavily affected by the coronavirus pandemic. + * Three cities – Austin, Texas, Winston Salem, N.C., and Oxnard, Calif. – have experienced significant degradations, falling out of their 10-week range by more than 40%. + + + +Cisco’s Talos threat-intelligence arm [wrote][8] on March 26 about the COVID security threat noting what it called three broad categories of attacks leveraging COVID with known advanced persistent threat participation in: [Malware and phishing campaigns][9] using COVID-themed lures; attacks against organizations that carry out research and other work related to COVID; and fraud and disinformation. From an enterprise security perspective, Talos recommended: + + * Remote access: Do not expose Remote Desktop Protocol (RDP) to the internet. Use secure VPN connections with multi-factor authentication schemes. Network access control packages can be used to ensure that systems attempting to remotely connect to the corporate environment meet a minimum set of security standards such as anti-malware protection, patch levels, etc,. prior to granting them access to corporate resources. Continually identify and remediate access-policy violations. + * Identity Management: Protect critical and public-facing applications with multi-factor authentication and supporting corporate policies. Verify that remote-account and access-termination capabilities work as intended in a remote environment. + * Endpoint Control: Because many people may be working from home networks, endpoint visibility, protection, and mitigation is now more important than ever. Consider whether remediation and reimaging capabilities will work as intended in a remote environment. Encrypt devices where possible, and add this check to your NAC solution as a gate for connectivity. Another simple method of protecting endpoints is via DNS, such as with [Cisco’s] Umbrella, by blocking the resolution of malicious domains before the host has a chance to make a connection. + + + +In an [FAQ][10] about the impact of COVID-19 on fulfilling customer hardware orders, VMware stated: “Some VMware SD-WAN hardware appliances are on backorder as a result of supply chain issues. As a result, we are extending the option to update existing orders with different appliances where inventory is more readily available. Customers may contact a special email hotline with questions related to backordered appliances. Please send an email to [sd-wan-hotline@vmware.com][11] with your questions and include the order number, urgent quantities, and contact information. We will do our best to respond within 48 hours.” + +Cisco said it has been analyzing traffic statistics with major carriers across Asia, Europe, and the Americas, and its data shows that typically, the most congested point in the network occurs at inter-provider peering points, Jonathan Davidson, senior vice president and general manager of Cisco's Mass-Scale Infrastructure Group wrote in a [blog][12] on March 26. “However, the traffic exchanged at these bottlenecks is only a part of the total internet traffic, meaning reports on traffic may be higher overall as private peering and local destinations also contribute to more traffic growth.” + +“Our analysis at these locations shows an increase in traffic of 10% to 33% over normal levels. In every country, traffic spiked with the decision to shut down non-essential businesses and keep people at home. Since then, traffic has remained stable or has experienced a slight uptick over the days that followed,” Davidson stated. + +He said that traffic during peak hours from 6 p.m. and 10 p.m. has increased slightly, but is not the primary driver for the overall inrease. Busy hours have extended to 9 a.m. 10 p.m., although the new busy-hour (9 a.m. to 6 p.m.) traffic is still below the traditional peak hours. "Service providers are certainly paying attention to these changes, but they are not yet a dire concern, as most networks are designed for growth. Current capacities are utilized more over the course of the entire day,” he wrote. + +Spanish multinational telecommunications company [Telefonica][13]’ said IP networks are experiencing traffic increases of close to 40% while mobile voice use is up about 50% and data is up 25%. In general, traffic through IP networks has experienced increases of nearly 40% while mobile use has increased by about 50% for voice and 25% for data. Likewise, traffic from instant-messaging tools such as Whatsapp has increased fivefold in recent days. + +**UPDATE: 3.26** + + * Week over week (ending March 23) [Ookla][14] says it has started to see a degradation of mobile and fixed-broadband performance worldwide. More detail on specific locations is available below. Comparing the week of March 16 to the week of March 9, mean download speed over mobile and fixed broadband decreased in Canada and the U.S. while both remained relatively flat in Mexico. + * What is the impact of the coronavirus on corporate network planning? Depends on how long the work-from-home mandate goes on really. Tom Nolle, president of CIMI Corp. [takes an interesting look at the situation][15] saying the shutdown “could eventually produce a major uptick for SD-WAN services, particularly in [managed service provider]    Businesses would be much more likely to embark on an SD-WAN VPN adventure that didn’t involve purchase/licensing, favoring a service approach in general, and in particular one with a fairly short contract period.” + * Statistics from VPN provider [NordVPN][16] show the growth of VPN usage across the globe.  For example, the company said the US has experienced a 65.93% growth in the use of business VPNs since March 11. It reported that mass remote working has contributed towards a rise in desktop (94.09%) and mobile app (0.39%) usage among Americans. Globally, NordVPN teams has seen a 165% spike in the use of business VPNs and business VPN usage in Netherlands (240.49%), Canada (206.29%) and Austria (207.86%) has skyrocketed beyond 200%. Italy has had the most modest growth in business VPN usage at just 10.57%. + + + +**UPDATE: 3. 25**: + + * According to [Atlas VPN][17] user data, VPN usage in the US increased by 124% during the last two weeks. VPN usage in the country increased by 71% between March 16 and 22 alone. Atlas said it measured how much traffic traveled through its servers during that period compared to March 9 to 15. The data came from the company's 53,000 weekly users. + * Verizon [reports][18] that voice usage, long declining in the age of texting, chat and social media, is up 25% in the last week. The network report shows the primary driver is accessing conference calls. In addition, people are talking longer on mobile devices with wireless voice usage notching a 10% increase and calls lasting 15% longer.  + * AT&T also [reported][19] increased calling, especially Wi-Fi calling, up 88% on March 22 versus a normal Sunday. It says that consumer home voice calls were up 74% more than an average Sunday; traffic from Netflix dipped after all-time highs on Friday and Saturday; and data traffic due to heavy video streaming between its network and peered networks tied record highs. AT&T said it has deployed portable cell nodes to bolster coverage supporting FirstNet customers in Indiana, Connecticut, New Jersey, California and New York. + * Microsoft this week advised users of Office 365 it was throttling back some services: + * **OneNote: ** OneNote in Teams will be read-only for commercial tenants, excluding EDU. Users can go to OneNote for the web for editing. Download size and sync frequency of file attachments has been changed. You can find details on these and other OneNote related updates as . + * **SharePoint:** We are rescheduling specific backend operations to regional evening and weekend business hours. Impacted capabilities include migration, DLP and delays in file management after uploading a new file, video or image. Reduced video resolution for playback videos. + * **Stream:** People timeline has been disabled for newly uploaded videos. Pre-existing videos will not be impacted. Meeting recording video resolution adjusted to 720p. + + + +**RELATED COVID-19 NEWS:** + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534037/how-enterprise-networking-is-changing-with-a-work-at-home-workforce.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3189176/security/face-off-cisco-vs-fortinet-for-enterprise-firewalls.html +[2]: https://www.bluecatnetworks.com/blog/wfh-doh/ +[3]: https://blog.netlab.360.com/an-analysis-of-godlua-backdoor-en/ +[4]: https://www.speedtest.net/insights/blog/tracking-covid-19-impact-global-internet-performance/ +[5]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[6]: https://broadbandnow.com/ +[7]: https://broadbandnow.com/report/internet-speed-analysis-march-15th-21st/ +[8]: https://blog.talosintelligence.com/2020/03/covid-19-pandemic-threats.html +[9]: https://blog.talosintelligence.com/2020/02/coronavirus-themed-malware.html +[10]: https://www.vmware.com/company/news/updates/vmware-response-covid-19.html?mid=31381&eid=CVMW2000048242496 +[11]: mailto:sd-wan-hotline@vmware.com +[12]: https://blogs.cisco.com/news/global-traffic-spikes-no-panic-at-the-cisco +[13]: https://www.telefonica.com/en/web/press-office/-/telefonica-announces-measures-related-to-covid-19 +[14]: https://downdetector.com/?utm_campaign=Ookla%20Insights%20Blog%20Subscription&utm_source=hs_email&utm_medium=email&utm_content=85202785&_hsenc=p2ANqtz--Nj93d_eQyJpsqxrPJyNPtTiMBWBQU984psLyalw51K61e4d1WODareMF5NWFriHY2Uzw3WF7rF-2vSfH5cR53Jg3K5Q&_hsmi=85202785 +[15]: https://blog.cimicorp.com/?p=4068 +[16]: https://nordvpnteams.com/ +[17]: https://atlasvpn.com/blog/lockdowns-and-panic-leads-to-a-124-surge-in-vpn-usage-in-the-us/ +[18]: https://www.verizon.com/about/news/update-verizon-serve-customers-covid-19 +[19]: https://about.att.com/pages/COVID-19.html diff --git a/sources/talk/20200402 When debugging, your attitude matters.md b/sources/talk/20200402 When debugging, your attitude matters.md new file mode 100644 index 0000000000..6968d3f8e3 --- /dev/null +++ b/sources/talk/20200402 When debugging, your attitude matters.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (name1e5s) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (When debugging, your attitude matters) +[#]: via: (https://jvns.ca/blog/debugging-attitude-matters/) +[#]: author: (Julia Evans https://jvns.ca/) + +When debugging, your attitude matters +====== + +A while back I wrote [What does debugging a program look like?][1] on what to do when debugging (change one thing at a time! check your assumptions!). + +But I was debugging some CSS last week, and I think that post is missing something important: **your attitude**. + +Now – I’m not a very good CSS developer yet. I’ve never written CSS professionally and I don’t understand a lot of basic CSS concepts (I think I finally understood for the first time recently how `position: absolute` works). And last week I was working on the most complicated CSS project I’d ever attempted. + +While I was debugging my CSS, I noticed myself doing some bad things that I normally would not! I was: + + * making random changes to my code in the hopes that it would work + * googling a lot of things and trying them without understanding what they did + * if something broke, reverting my changes and starting again + + + +This strategy was exactly as effective as you might imagine (not very effective!), and it was because of my attitude about CSS! I had this unusual-for-me belief that CSS was Too Hard and impossible for me to understand. So let’s talk about that attitude a bit! + +### the problem attitude: “this is too hard for me to understand” + +One specific problem I was having was – I had 2 divs stacked on top of one another, and I wanted Div A to be on top of Div B. My model of CSS stacking order at the start of this was basically “if you want Thing A to be on top of Thing B, change the z-index to make it work”. So I changed the z-index of Div A to be 5 or something. + +But it didn’t work! In Firefox, div A was on top, but in Chrome, Div B was on top. Argh! Why? CSS is impossible!!! + +I googled a bit, and I found out that a possible reason z-index might not work was because Div A and Div B were actually in different “stacking contexts”. If that was true, even if I set the z-index of Div A to 999999 it would still not put it on top of Div B. ([here’s a small example of what this z-index problem looks like, though I think my specific bug had some extra complications][2]) + +I thought “man, this stacking context thing seems really complicated, why is it different between Firefox and Chrome, I’m not going to be able to figure this out”. So I tried a bunch of random things a bunch of blog posts suggested, which as usual did not work. + +Finally I gave up this “change random things and pray” strategy and thought “well, what if I just read the documentation on stacking order, maybe it’s not that bad”. + +So I read the [MDN page on stacking order][3], which says: + +> When the z-index property is not specified on any element, elements are stacked in the following order (from bottom to top): +> 1\. The background and borders of the root element +> 2\. Descendant non-positioned blocks, in order of appearance in the HTML +> 3\. Descendant positioned elements, in order of appearance in the HTML + +This is SO SIMPLE! It just depends on the order in the HTML! I put Div A after Div B in the HTML (as a sibling) and it made everything work in both browsers. + +### better attitude: “let’s learn the basics and see if that helps” + +This whole stacking problem turned out to really not be that complicated – all I needed to do was read a very short and simple documentation page to understand how stacking works! + +Of course, computer things are not always this simple (and even in this specific case the [rules about what creates a new stacking context][4] are pretty complicated.). But I did not need to understand those more complicated rules in order to put Div A on top of Div B! I only needed to know the much simpler 3 rules above. + +So – calm down for a second, learn a few of the basics, and see if that helps. + +### watching people who know what they’re doing is inspiring + +Another area of CSS that I thought was “too hard” for me to understand was this whole `position: absolute` and `position: relative` business. I kept seeing (and sometimes using!) examples where people made complicated CSS things with `position: absolute` but I didn’t understand how they worked. Doesn’t `position: absolute` mean that the element is always in the same place on the screen? Why are these `position: absolute` things moving when I scroll like the rest of the document? (spoiler: no, that’s `position: fixed`.) + +But last week, I paired with someone who’s a lot better at CSS than me on some code, and I saw that they were just typing in `position: absolute` and `position: relative` confidently into their code without seeming confused about it!! Could that be me? + +I looked up the [documentation on MDN][5] on `position: absolute`, and it said: + +> The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor… Its final position is determined by the values of top, right, bottom, and left. + +So things with `position: absolute` are positioned relative to their closest positioned ancestor! And you just use `top/bottom/right/left` to pick where! That’s so simple! + +### documentation that you can trust makes a big difference + +I think another big source of my frustration with CSS is that I didn’t have the best grasp of where to find accurate information & advice. I knew that MDN was a reliable reference, but MDN doesn’t really help answer questions like “ok but seriously how do I center a div???” and I found myself reading a lot of random Stack Overflow answers/blog posts that I wasn’t 100% sure were correct. + +This week I learned about [CSS Tricks][6] which has a lot of GREAT articles like [Centering in CSS: A Complete Guide][7] which seems very reputable and is written in a super clear way. + +### that’s all! + +I don’t really know why I started to believe that it was “impossible” to understand basic CSS concepts since I don’t believe that about computers in general. Maybe because I’ve been writing CSS at a beginner level for a very long time but hadn’t ever really tried to do a more involved CSS project than “let’s arrange some divs in a grid with flexbox”! + +But this attitude really got in the way of me writing the CSS I wanted to write! And once I let go of it and used my normal debugging techniques I was able to get a lot more things to work the way I wanted. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/debugging-attitude-matters/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/blog/2019/06/23/a-few-debugging-resources/ +[2]: https://codepen.io/jvns-css-fun/pen/YzXMMdQ +[3]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_without_z-index +[4]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context +[5]: https://developer.mozilla.org/en-US/docs/Web/CSS/position +[6]: https://css-tricks.com +[7]: https://css-tricks.com/centering-css-complete-guide/ diff --git a/sources/talk/20200405 Book review- Nine Lies About Work.md b/sources/talk/20200405 Book review- Nine Lies About Work.md new file mode 100644 index 0000000000..a4c06438aa --- /dev/null +++ b/sources/talk/20200405 Book review- Nine Lies About Work.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Book review: Nine Lies About Work) +[#]: via: (https://opensource.com/open-organization/20/4/book-review-nine-lies-about-work) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Book review: Nine Lies About Work +====== +An examination of common work misconceptions and how open organizations +are often ahead of the curve. +![Carrot on a stick][1] + +In _Nine Lies About Work_, authors Marcus Buckingham and Ashley Goodall examine what we might consider "common theories" about aspects of contemporary organizational life—and they debunk those theories. The book's so-called "lies" are, therefore, not really lies but rather common beliefs about work that simply aren't accurate in actual working environments today. + +In this review, I'll outline all nine of those misconceptions and explain what the authors believe is really true in the case of each one. But then I'll focus more on explaining the misconceptions that are especially relevant to [open organizations][2]. + +### Liar, liar + +Buckingham and Goodall address the following nine "lies" about work. + +Lie #1—People care about which company they work for. The authors believe that people really care about which team they're directly working on. That is where we [find engagement][3]. + +Lie #2—The best plan wins. The authors believe that the best front-line intelligence and feedback wins. In this rapidly changing world, [plans only tell you where you are now][4] and where you may be in the very near future (that is, in a few weeks or months). + +Lie #3—The best companies cascade goals. The authors believe that the best companies [disseminate downward meaning][5] (that is, public purpose) to their staff. + +Lie #4—The best people are well-rounded. The authors believe that the best people are good only at specific tasks (and not _necessarily_ other tasks). + +Lie #5—People need feedback. The authors believe that people need nonjudgmental, uncritical attention, and to be recognized; they don't need criticism. + +Lie #6—People can reliably rate other people. The authors believe that people can reliably rate their own experience and [evaluate their own performance][6] often better than others can. + +Lie #7—People have potential. The authors believe that every person possesses individual needs and individual feelings of forward momentum and progress. Therefore, their potential cannot be determined. + +Lie #8—Work-life balance matters most. The authors believe that love-in-work matters most. Companies should promote each individual finding the [love of what they do at work][7], then expand on that love. Companies should promote having fun at work, but they rarely do. + +Lie #9—Leadership is a thing. The authors believe that [we each follow people with a vision][8] in which we believe. To say a person is "a good leader" is, therefore, only situational according to individual followers. No universal criteria, rule, or model for effective leadership exists. + +### Teams over companies + +Now let's take a hard look at Lie #1. The authors believe that someone seeking a job will care about the quality of a company, their status inside that company, and their pay, but as soon as work begins, team engagement becomes far more important to them. That's because teams focus on what we do on a daily basis. Those teams might even be unofficial groups inside an organization—"[internal communities][9]," we might call them. Buckingham and Goodall provide eight characteristics of great teams, and these characteristics would ring equally true in [open organization communities][2]. The authors present them separated into two categories—"We"-related and "Me"-related): + + * The members are enthusiastic about the team mission ("We"). + * Each is surrounded by people who share the same values ("We"). + * Their teammates will stand behind them when needed ("We") + * The members feel confident regarding the future of the company ("We"). + * Each member understands what is expected ("Me"). + * Everyone feels they have a chance to use their particular strengths ("Me"). According to a 2018 study from ADP Research Institute, cited in the book's appendix, if we can use our strengths that bring us joy and energizes us 20% of the time at work, total work engagement skyrockets. + * All members can be recognized for excellent work ("Me"). + * The members are challenged to grow ("Me"). + + + +All these characteristics describe a healthy culture in an open organization community. + +According to the authors, a company should explore what [informal, unofficial teams][10] it has and learn what they're involved in. Usually, they say, the average person is on five teams, each with different purposes. Ask people if they have these types of teams (or a single mentor) with whom they can consult inside the company. Larger, more formal groups are less important. + +More important, however, are lunch meetings between informal team members or chats in corners discussing how they can help each other. When I was providing sales seminars, for example, I would walk around the company cafeteria and have these discussions with global sales departments. By doing this, I developed strong communities over a 20-year period. The quality and quantities of these teams are directly connected to employee engagement and are extremely important to the success of a company, according to the authors. An organizational leader's primary job is to create an environment where these teams can grow and thrive. + +### Forget planning + +Next, let's turn to Lie #2: the best plan wins. Buckingham and Goodall believe the best front-line intelligence wins. Open organizations [rely a great deal on bottom-up management techniques][11], which fits nicely into what the authors are saying here. All the action is on the front-line, and real-time reporting to management on situational developments is extremely important, according to the authors. Conditions are changing so fast that [by the time some plans are introduced, they are already out-of-date][12]. That is why open organizations strongly believe in cultivating ground-level decision-making practices. People closest to the issues know what's happening. + +Regarding [open organization principles][2], we might note the emphasis on getting front-line information in real-time and broadly distributing it as much as possible (inclusivity, transparency, broader community), as well as encouraging and reporting front-line suggestions (collaboration, adaptability). Communication is two-way. To share information efficiently and understand when it's needed, Buckingham and Goodall believe that many small, short, frequent meetings are always more productive than large, long, infrequent ones. + +### Don't judge + +Next, let's examine Lie #5: People need feedback. The authors do recognize people's need for nonjudgmental, uncritical attention, and their desire to be recognized. A leader's level of uncritical attention is directly connected to the level of staff engagement. Just asking, "[How are you doing in your work?][13]" and "Well, how can I help?" is all that is needed. + +The authors believe that the worst managers are those that ignore people. Average managers don't ignore people, but they give negative feedback, which weakens their teams' feelings of engagement. The best managers, team leaders, or community leaders don't ignore and don't judge. At least weekly, they simply ask questions and provide help if needed. A high degree of managerial attention directly improves front-line engagement. The authors believe that it makes members feel connected, supported, and understood. + +Buckingham and Goodall believe that looking at a staff's negative qualities is a natural tendency. Therefore, leaders and managers must make strong efforts to avoid doing so. This effort is worth it, the authors argue, as it results in greater performance, engagement, and growth. For example, when I was giving sales manager training, I frequently needed to address the situation of handling sales staff coming to the manager to help them with a customer problem. I recommended that the manager just ask the sales staff a simple question: "What did you do and say when you met the customer, and what would you do differently if you could visit the customer all over again?" This forced salespeople to come up with their own advice. + +### Concluding thoughts + +_Nine Lies about Work_ has much to teach anyone interested in open organizations. Buckingham is a global researcher in human strengths development and performance; Goodall is a senior VP in leadership and team intelligence at Cisco. It is amazing how closely their beliefs align with open organization principles. The ways they articulate those beliefs in this book are enlightening. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/4/book-review-nine-lies-about-work + +作者:[Ron McFarland][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_pink2.png?itok=I5Wgct6V (Carrot on a stick) +[2]: https://opensource.com/open-organization/resources/open-org-definition +[3]: https://opensource.com/open-organization/18/10/understanding-engagement-empowerment +[4]: https://opensource.com/open-organization/19/5/planning-future-unknowable +[5]: https://opensource.com/open-organization/18/7/culture-of-experimentation-in-4-steps +[6]: https://opensource.com/open-organization/15/5/measuring-performance-open-source-way +[7]: https://opensource.com/open-organization/15/11/reigniting-employee-passion +[8]: https://opensource.com/open-organization/18/12/what-is-open-leadership +[9]: https://opensource.com/open-organization/19/11/what-is-community-practice +[10]: https://opensource.com/open-organization/20/1/why-build-community-of-practice +[11]: https://opensource.com/open-organization/17/3/making-better-open-decisions +[12]: https://opensource.com/open-organization/18/3/try-learn-modify +[13]: https://opensource.com/open-organization/16/10/how-ask-why-without-upsetting-anyone diff --git a/sources/talk/20200406 How to Use a Differential Analyzer (to Murder People).md b/sources/talk/20200406 How to Use a Differential Analyzer (to Murder People).md new file mode 100644 index 0000000000..6796e25603 --- /dev/null +++ b/sources/talk/20200406 How to Use a Differential Analyzer (to Murder People).md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use a Differential Analyzer (to Murder People)) +[#]: via: (https://twobithistory.org/2020/04/06/differential-analyzer.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +How to Use a Differential Analyzer (to Murder People) +====== + +A differential analyzer is a mechanical, analog computer that can solve differential equations. Differential analyzers aren’t used anymore because even a cheap laptop can solve the same equations much faster—and can do it in the background while you stream the new season of Westworld on HBO. Before the invention of digital computers though, differential analyzers allowed mathematicians to make calculations that would not have been practical otherwise. + +It is hard to see today how a computer made out of anything other than digital circuitry printed in silicon could work. A mechanical computer sounds like something out of a steampunk novel. But differential analyzers did work and even proved to be an essential tool in many lines of research. Most famously, differential analyzers were used by the US Army to calculate range tables for their artillery pieces. Even the largest gun is not going to be effective unless you have a range table to help you aim it, so differential analyzers arguably played an important role in helping the Allies win the Second World War. + +To understand how differential analyzers could do all this, you will need to know what differential equations are. Forgotten what those are? That’s okay, because I had too. + +### Differential Equations + +Differential equations are something you might first encounter in the final few weeks of a college-level Calculus I course. By that point in the semester, your underpaid adjunct professor will have taught you about limits, derivatives, and integrals; if you take those concepts and add an equals sign, you get a differential equation. + +Differential equations describe rates of change in terms of some other variable (or perhaps multiple other variables). Whereas a familiar algebraic expression like (y = 4x + 3) specifies the relationship between some variable quantity (y) and some other variable quantity (x), a differential equation, which might look like (\frac{dy}{dx} = x), or even (\frac{dy}{dx} = 2), specifies the relationship between a _rate of change_ and some other variable quantity. Basically, a differential equation is just a description of a rate of change in exact mathematical terms. The first of those last two differential equations is saying, “The variable (y) changes with respect to (x) at a rate defined exactly by (x),” and the second is saying, “No matter what (x) is, the variable (y) changes with respect to (x) at a rate of exactly 2.” + +Differential equations are useful because in the real world it is often easier to describe how complex systems change from one instant to the next than it is to come up with an equation describing the system at all possible instants. Differential equations are widely used in physics and engineering for that reason. One famous differential equation is the heat equation, which describes how heat diffuses through an object over time. It would be hard to come up with a function that fully describes the distribution of heat throughout an object given only a time (t), but reasoning about how heat diffuses from one time to the next is less likely to turn your brain into soup—the hot bits near lots of cold bits will probably get colder, the cold bits near lots of hot bits will probably get hotter, etc. So the heat equation, though it is much more complicated than the examples in the last paragraph, is likewise just a description of rates of change. It describes how the temperature of any one point on the object will change over time given how its temperature differs from the points around it. + +Let’s consider another example that I think will make all of this more concrete. If I am standing in a vacuum and throw a tennis ball straight up, will it come back down before I asphyxiate? This kind of question, posed less dramatically, is the kind of thing I was asked in high school physics class, and all I needed to solve it back then were some basic Newtonian equations of motion. But let’s pretend for a minute that I have forgotten those equations and all I can remember is that objects accelerate toward earth at a constant rate of (g), or about (10 ;m/s^2). How can differential equations help me solve this problem? + +Well, we can express the one thing I remember about high school physics as a differential equation. The tennis ball, once it leaves my hand, will accelerate toward the earth at a rate of (g). This is the same as saying that the velocity of the ball will change (in the negative direction) over time at a rate of (g). We could even go one step further and say that _the rate of change in the height of my ball above the ground_ (this is just its velocity) will change over time at a rate of negative (g). We can write this down as the following, where (h) represents height and (t) represents time: + +[\frac{d^2h}{dt^2} = -g] + +This looks slightly different from the differential equations we have seen so far because this is what is known as a second-order differential equation. We are talking about the rate of change of a rate of change, which, as you might remember from your own calculus education, involves second derivatives. That’s why parts of the expression on the left look like they are being squared. But this equation is still just expressing the fact that the ball accelerates downward at a constant acceleration of (g). + +From here, one option I have is to use the tools of calculus to solve the differential equation. With differential equations, this does not mean finding a single value or set of values that satisfy the relationship but instead finding a function or set of functions that do. Another way to think about this is that the differential equation is telling us that there is some function out there whose second derivative is the constant (-g); we want to find that function because it will give us the height of the ball at any given time. This differential equation happens to be an easy one to solve. By doing so, we can re-derive the basic equations of motion that I had forgotten and easily calculate how long it will take the ball to come back down. + +But most of the time differential equations are hard to solve. Sometimes they are even impossible to solve. So another option I have, given that I paid more attention in my computer science classes that my calculus classes in college, is to take my differential equation and use it as the basis for a simulation. If I know the starting velocity and the acceleration of my tennis ball, then I can easily write a little for-loop, perhaps in Python, that iterates through my problem second by second and tells me what the velocity will be at any given second (t) after the initial time. Once I’ve done that, I could tweak my for-loop so that it also uses the calculated velocity to update the height of the ball on each iteration. Now I can run my Python simulation and figure out when the ball will come back down. My simulation won’t be perfectly accurate, but I can decrease the size of the time step if I need more accuracy. All I am trying to accomplish anyway is to figure out if the ball will come back down while I am still alive. + +This is the numerical approach to solving a differential equation. It is how differential equations are solved in practice in most fields where they arise. Computers are indispensable here, because the accuracy of the simulation depends on us being able to take millions of small little steps through our problem. Doing this by hand would obviously be error-prone and take a long time. + +So what if I were not just standing in a vacuum with a tennis ball but were standing in a vacuum with a tennis ball in, say, 1936? I still want to automate my computation, but Claude Shannon won’t even complete his master’s thesis for another year yet (the one in which he casually implements Boolean algebra using electronic circuits). Without digital computers, I’m afraid, we have to go analog. + +### The Differential Analyzer + +The first differential analyzer was built between 1928 and 1931 at MIT by Vannevar Bush and Harold Hazen. Both men were engineers. The machine was created to tackle practical problems in applied mathematics and physics. It was supposed to address what Bush described, in [a 1931 paper][1] about the machine, as the contemporary problem of mathematicians who are “continually being hampered by the complexity rather than the profundity of the equations they employ.” + +A differential analyzer is a complicated arrangement of rods, gears, and spinning discs that can solve differential equations of up to the sixth order. It is like a digital computer in this way, which is also a complicated arrangement of simple parts that somehow adds up to a machine that can do amazing things. But whereas the circuitry of a digital computer implements Boolean logic that is then used to simulate arbitrary problems, the rods, gears, and spinning discs _directly_ simulate the differential equation problem. This is what makes a differential analyzer an analog computer—it is a direct mechanical analogy for the real problem. + +How on earth do gears and spinning discs do calculus? This is actually the easiest part of the machine to explain. The most important components in a differential analyzer are the six mechanical integrators, one for each order in a sixth-order differential equation. A mechanical integrator is a relatively simple device that can integrate a single input function; mechanical integrators go back to the 19th century. We will want to understand how they work, but, as an aside here, Bush’s big accomplishment was not inventing the mechanical integrator but rather figuring out a practical way to chain integrators together to solve higher-order differential equations. + +A mechanical integrator consists of one large spinning disc and one much smaller spinning wheel. The disc is laid flat parallel to the ground like the turntable of a record player. It is driven by a motor and rotates at a constant speed. The small wheel is suspended above the disc so that it rests on the surface of the disc ever so slightly—with enough pressure that the disc drives the wheel but not enough that the wheel cannot freely slide sideways over the surface of the disc. So as the disc turns, the wheel turns too. + +The speed at which the wheel turns will depend on how far from the center of the disc the wheel is positioned. The inner parts of the disc, of course, are rotating more slowly than the outer parts. The wheel stays fixed where it is, but the disc is mounted on a carriage that can be moved back and forth in one direction, which repositions the wheel relative to the center of the disc. Now this is the key to how the integrator works: The position of the disc carriage is driven by the input function to the integrator. The output from the integrator is determined by the rotation of the small wheel. So your input function drives the rate of change of your output function and you have just transformed the derivative of some function into the function itself—which is what we call integration! + +If that explanation does nothing for you, seeing a mechanical integrator in action really helps. The principle is surprisingly simple and there is no way to watch the device operate without grasping how it works. So I have created [a visualization of a running mechanical integrator][2] that I encourage you to take a look at. The visualization shows the integration of some function (f(x)) into its antiderivative (F(x)) while various things spin and move. It’s pretty exciting. + +![][3] _A nice screenshot of my visualization, but you should check out the real thing!_ + +So we have a component that can do integration for us, but that alone is not enough to solve a differential equation. To explain the full process to you, I’m going to use an example that Bush offers himself in his 1931 paper, which also happens to be essentially the same example we contemplated in our earlier discussion of differential equations. (This was a happy accident!) Bush introduces the following differential equation to represent the motion of a falling body: + +[\frac{d^2x}{dt^2} = -k,\frac{dx}{dt} - g] + +This is the same equation we used to model the motion of our tennis ball, only Bush has used (x) in place of (h) and has added another term that accounts for how air resistance will decelerate the ball. This new term describes the effect of air resistance on the ball in the simplest possible way: The air will slow the ball’s velocity at a rate that is proportional to its velocity (the (k) here is some proportionality constant whose value we don’t really care about). So as the ball moves faster, the force of air resistance will be stronger, further decelerating the ball. + +To configure a differential analyzer to solve this differential equation, we have to start with what Bush calls the “input table.” The input table is just a piece of graphing paper mounted on a carriage. If we were trying to solve a more complicated equation, the operator of the machine would first plot our input function on the graphing paper and then, once the machine starts running, trace out the function using a pointer connected to the rest of the machine. In this case, though, our input is just the constant (g), so we only have to move the pointer to the right value and then leave it there. + +What about the other variables (x) and (t)? The (x) variable is our output as it represents the height of the ball. It will be plotted on graphing paper placed on the output table, which is similar to the input table only the pointer is a pen and is driven by the machine. The (t) variable should do nothing more than advance at a steady rate. (In our Python simulation of the tennis ball problem as posed earlier, we just incremented (t) in a loop.) So the (t) variable comes from the differential analyzer’s motor, which kicks off the whole process by rotating the rod connected to it at a constant speed. + +Bush has a helpful diagram documenting all of this that I will show you in a second, but first we need to make one more tweak to our differential equation that will make the diagram easier to understand. We can integrate both sides of our equation once, yielding the following: + +[\frac{dx}{dt} = - \int \left(k,\frac{dx}{dt} + g\right),dt] + +The terms in this equation map better to values represented by the rotation of various parts of the machine while it runs. Okay, here’s that diagram: + +![][4] _The differential analyzer configured to solve the problem of a falling body in one dimension._ + +The input table is at the top of the diagram. The output table is at the bottom-right. The output table here is set up to graph both (x) and (\frac{dx}{dt}), i.e. height and velocity. The integrators appear at the bottom-left; since this is a second-order differential equation, we need two. The motor drives the very top rod labeled (t). (Interestingly, Bush referred to these horizontal rods as “buses.”) + +That leaves two components unexplained. The box with the little (k) in it is a multiplier respresnting our proportionality constant (k). It takes the rotation of the rod labeled (\frac{dx}{dt}) and scales it up or down using a gear ratio. The box with the (\sum) symbol is an adder. It uses a clever arrangement of gears to add the rotations of two rods together to drive a third rod. We need it since our equation involves the sum of two terms. These extra components available in the differential analyzer ensure that the machine can flexibly simulate equations with all kinds of terms and coefficients. + +I find it helpful to reason in ultra-slow motion about the cascade of cause and effect that plays out as soon as the motor starts running. The motor immediately begins to rotate the rod labeled (t) at a constant speed. Thus, we have our notion of time. This rod does three things, illustrated by the three vertical rods connected to it: it drives the rotation of the discs in both integrators and also advances the carriage of the output table so that the output pen begins to draw. + +Now if the integrators were set up so that their wheels are centered, then the rotation of rod (t) would cause no other rods to rotate. The integrator discs would spin but the wheels, centered as they are, would not be driven. The output chart would just show a flat line. This happens because we have not accounted for the initial conditions of the problem. In our earlier Python simulation, we needed to know the initial velocity of the ball, which we would have represented there as a constant variable or as a parameter of our Python function. Here, we account for the initial velocity and acceleration by displacing the integrator discs by the appropriate amount before the machine begins to run. + +Once we’ve done that, the rotation of rod (t) propagates through the whole system. Physically, a lot of things start rotating at the same time, but we can think of the rotation going first to integrator II, which combines it with the acceleration expression calculated based on (g) and then integrates it to get the result (\frac{dx}{dt}). This represents the velocity of the ball. The velocity is in turn used as input to integrator I, whose disc is displaced so that the output wheel rotates at the rate (\frac{dx}{dt}). The output from integrator I is our final output (x), which gets routed directly to the output table. + +One confusing thing I’ve glossed over is that there is a cycle in the machine: Integrator II takes as an input the rotation of the rod labeled ((k,\frac{dx}{dt} + g)), but that rod’s rotation is determined in part by the output from integrator II itself. This might make you feel queasy, but there is no physical issue here—everything is rotating at once. If anything, we should not be surprised to see cycles like this, since differential equations often describe rates of change in a function as a function of the function itself. (In this example, the acceleration, which is the rate of change of velocity, depends on the velocity.) + +With everything correctly configured, the output we get is a nice graph, charting both the position and velocity of our ball over time. This graph is on paper. To our modern digital sensibilities, that might seem absurd. What can you do with a paper graph? While it’s true that the differential analyzer is not so magical that it can write out a neat mathematical expression for the solution to our problem, it’s worth remembering that neat solutions to many differential equations are not possible anyway. The paper graph that the machine does write out contains exactly the same information that could be output by our earlier Python simulation of a falling ball: where the ball is at any given time. It can be used to answer any practical question you might have about the problem. + +The differential analyzer is a preposterously cool machine. It is complicated, but it fundamentally involves nothing more than rotating rods and gears. You don’t have to be an electrical engineer or know how to fabricate a microchip to understand all the physical processes involved. And yet the machine does calculus! It solves differential equations that you never could on your own. The differential analyzer demonstrates that the key material required for the construction of a useful computing machine is not silicon but human ingenuity. + +### Murdering People + +Human ingenuity can serve purposes both good and bad. As I have mentioned, the highest-profile use of differential analyzers historically was to calculate artillery range tables for the US Army. To the extent that the Second World War was the “Good Fight,” this was probably for the best. But there is also no getting past the fact that differential analyzers helped to make very large guns better at killing lots of people. And kill lots of people they did—if Wikipedia is to be believed, more soldiers were killed by artillery than small arms fire during the Second World War. + +I will get back to the moralizing in a minute, but just a quick detour here to explain why calculating range tables was hard and how differential analyzers helped, because it’s nice to see how differential analyzers were applied to a real problem. A range table tells the artilleryman operating a gun how high to elevate the barrel to reach a certain range. One way to produce a range table might be just to fire that particular kind of gun at different angles of elevation many times and record the results. This was done at proving grounds like the Aberdeen Proving Ground in Maryland. But producing range tables solely through empirical observation like this is expensive and time-consuming. There is also no way to account for other factors like the weather or for different weights of shell without combinatorially increasing the necessary number of firings to something unmanageable. So using a mathematical theory that can fill in a complete range table based on a smaller number of observed firings is a better approach. + +I don’t want to get too deep into how these mathematical theories work, because the math is complicated and I don’t really understand it. But as you might imagine, the physics that governs the motion of an artillery shell in flight is not that different from the physics that governs the motion of a tennis ball thrown upward. The need for accuracy means that the differential equations employed have to depart from the idealized forms we’ve been using and quickly get gnarly. Even the earliest attempts to formulate a rigorous ballistic theory involve equations that account for, among other factors, the weight, diameter, and shape of the projectile, the prevailing wind, the altitude, the atmospheric density, and the rotation of the earth[1][5]. + +So the equations are complicated, but they are still differential equations that a differential analyzer can solve numerically in the way that we have already seen. Differential analyzers were put to work solving ballistics equations at the Aberdeen Proving Ground in 1935, where they dramatically sped up the process of calculating range tables.[2][6] Nevertheless, during the Second World War, the demand for range tables grew so quickly that the US Army could not calculate them fast enough to accompany all the weaponry being shipped to Europe. This eventually led the Army to fund the ENIAC project at the University of Pennsylvania, which, depending on your definitions, produced the world’s first digital computer. ENIAC could, through rewiring, run any program, but it was constructed primarily to perform range table calculations many times faster than could be done with a differential analyzer. + +Given that the range table problem drove much of the early history of computing even apart from the differential analyzer, perhaps it’s unfair to single out the differential analyzer for moral hand-wringing. The differential analyzer isn’t uniquely compromised by its military applications—the entire field of computing, during the Second World War and well afterward, advanced because of the endless funding being thrown at it by the United States military. + +Anyway, I think the more interesting legacy of the differential analyzer is what it teaches us about the nature of computing. I am surprised that the differential analyzer can accomplish as much as it can; my guess is that you are too. It is easy to fall into the trap of thinking of computing as the realm of what can be realized with very fast digital circuits. In truth, computing is a more abstract process than that, and electronic, digital circuits are just what we typically use to get it done. In his paper about the differential analyzer, Vannevar Bush suggests that his invention is just a small contribution to “the far-reaching project of utilizing complex mechanical interrelationships as substitutes for intricate processes of reasoning.” That puts it nicely. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][7] on Twitter or subscribe to the [RSS feed][8] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> Do you worry that your children are "BBS-ing"? Do you have a neighbor who talks too much about his "door games"? +> +> In this VICE News special report, we take you into the seedy underworld of bulletin board systems: +> +> — TwoBitHistory (@TwoBitHistory) [February 2, 2020][9] + + 1. Alan Gluchoff. “Artillerymen and Mathematicians: Forest Ray Moulton and Changes in American Exterior Ballistics, 1885-1934.” Historia Mathematica, vol. 38, no. 4, 2011, pp. 506–547., . [↩︎][10] + + 2. Karl Kempf. “Electronic Computers within the Ordnance Corps,” 1961, accessed April 6, 2020, . [↩︎][11] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2020/04/06/differential-analyzer.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: http://worrydream.com/refs/Bush%20-%20The%20Differential%20Analyzer.pdf +[2]: https://sinclairtarget.com/differential-analyzer/ +[3]: https://twobithistory.org/images/diff-analyzer-viz.png +[4]: https://twobithistory.org/images/analyzer-diagram.png +[5]: tmp.GUgd146Tkg#fn:1 +[6]: tmp.GUgd146Tkg#fn:2 +[7]: https://twitter.com/TwoBitHistory +[8]: https://twobithistory.org/feed.xml +[9]: https://twitter.com/TwoBitHistory/status/1224014531778826240?ref_src=twsrc%5Etfw +[10]: tmp.GUgd146Tkg#fnref:1 +[11]: tmp.GUgd146Tkg#fnref:2 diff --git a/sources/talk/20200406 What is good documentation for software projects.md b/sources/talk/20200406 What is good documentation for software projects.md new file mode 100644 index 0000000000..7726287131 --- /dev/null +++ b/sources/talk/20200406 What is good documentation for software projects.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is good documentation for software projects?) +[#]: via: (https://opensource.com/article/20/4/documentation) +[#]: author: (Cameron Shorter https://opensource.com/users/cameronshorter) + +What is good documentation for software projects? +====== +Mixing experienced tech writers with open source communities reveals new +approaches for creating better docs. +![Typewriter with hands][1] + +The [Open Geospatial (OSGeo) Foundation][2] recently participated in Google's first [Season of Docs][3], in which Google sponsored senior technical writers to contribute to open source projects. OSGeo is an umbrella organization for around 50 geospatial open source projects. I've contributed to a number of these projects over the years and recently co-mentored the two Season of Docs technical writers Google allocated to OSGeo. + +We discovered during our involvement that, like many open source projects, we knew little about: + + * The state of our docs + * What we were aiming for + * Our priorities + * The details of the challenges we faced + * How to improve + + + +We discovered: + + * How hard it is to keep tech docs current + * Skillsets from multiple roles are needed to create good docs + * Open source's docs and writing processes are immature when compared to software development + + + +It is an exciting problem space with high-value challenges ready to be tackled. It reminds me of the early days of open source, before it became trendy with business. + +### What should tech writers work on? + +Open source communities welcomed the chance to have tech writers improve our docs and expressed a pressing need for it, but found it hard to articulate exactly what needed to be fixed: + + * People explained that their project docs often hadn't been updated between doc releases. + * Some projects had new features that had not been documented. + * Other projects had issue lists, collating observed deficiencies, but had no systematic review. + * Most observed that docs were created by developers with no formal tech writing training. + * Many noted that their English docs were written by non-native English speakers. + + + +But where should we start? We needed to decide on what we wanted and what we should work on first. + +### Defining good docs + +We then realized that we didn't have a good definition of "good documentation." For our software projects, we have a comprehensive [incubation process][4] to assess the maturity of software and the project's community, but we couldn't find a similar set of metrics to define "good documentation." So we started the [Good Docs Project][5] to collate "best-practice templates and writing instructions for documenting open source software." This helped us define what we were aiming for and prioritize what we can achieve with our available resources. + +### Documentation audit + +Once we knew what good docs looked like, we could audit the status of a project's docs: + + * What documentation do we have? + * Does it cover all the functionality? + * Does it cover end-user needs? + * Is the documentation any good? + + + +We discovered that the quality, currency, and completeness of our OSGeo docs were immature when compared to the quality of the software they described. + +### It takes a village to raise good docs + +In researching open source projects' documentation needs, it became clear that crafting good docs requires multiple skillsets. Ideally, a doc team has access to: + + * A developer with a deep understanding of the software being described + * A software user who can explain the application within the context of the application's domain + * An educator who understands the principles of learning + * An information architect who understands how to structure material + * A writer who writes clearly and concisely with good grammar + * Someone who speaks English as a first language (for English docs) + * A translator who is good at translating docs into multiple languages + * A DevOps person who can set up doc-build pipelines + * A community builder, facilitator, and coordinator who can inspire collective action, capture offers of help, and help all these different personas collaborate + + + +Technical writers usually have a high-level understanding of most of these domains, and their skills are often under-appreciated and under-utilized, especially if they are directed with a vague "just clean up the grammar and stuff." + +However, the best docs typically have been influenced by multiple stakeholders. This can be partly achieved by [using templates to collaborate][6] between domains, timeframes, projects, and organizations. + +### Tools for documenting open source projects are painful + +We experienced significant pain in trying to convert between software and [writing toolsets][7]. We love the versioning of Git, are frustrated by clunky Markdown interfaces, and want access to editing and review workflows in Word and Google Docs along with grammar and syntax plugin tools such as Grammarly. Translation tools such as Transifex are pretty cool, too. + +Could someone please write an application that addresses this use case? Maybe there is an idea in here for a future [Google Summer of Code][8]? + +### Achievements during OSGeo's Season of Docs + +We're quite proud of our achievements during OSGeo's participation in Google's Season of Docs. Our allocated tech writers amplified the effectiveness of our existing documentation communities, and our documentation communities amplified the effectiveness of these tech writers: + + * [Felicity Brand][9] worked with around 50 of OSGeo's open source projects to update the Quickstarts as part of our [OSGeoLive][10] distribution of software. + * [Swapnil Ogale][11] worked directly with [GeoNetwork's][12] documentation team, auditing the breadth and quality of docs, setting up templates for future docs, and updating many of the docs. + + + +Further: + + * We kicked off the Good Docs Project to establish "best-practice templates and writing instructions for documenting open source software." + * In conjunction with the [OGC][13] and [ISO][14] spatial standards communities, we kicked off an [OSGeo Lexicon][15] project to coordinate official definitions for terminology used within the OSGeo context. This will apply best-practice definitions to previously haphazard glossaries. + * We did a [deep-dive analysis][16] of the documentation challenges faced by QGIS, one of OSGeo's most successful projects. Surprisingly, its biggest problem isn't a lack of tech writers or complicated tools (although they are factors). Key problems center around: + * Poorly capturing community goodwill and offers of assistance + * Lack of direction + * Struggling to keep up with a rapidly evolving software baseline + * Insufficient writing expertise + * A high technical barrier to entry + * Documentation and training being generated outside of the core project + * Awkward documentation tools and processes + + + +### Thanks, Google + +We are grateful to Google for sponsoring Season of Docs. We've learned plenty from Felicity and Swapnil, the great writers that Google provided to us, and we hope what we have learned will help make future Season of Docs initiatives even better. + +* * * + +_This originally appeared on [Cameron Shorter's blog][17] and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/documentation + +作者:[Cameron Shorter][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cameronshorter +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/typewriter-hands.jpg?itok=oPugBzgv (Typewriter with hands) +[2]: https://www.osgeo.org/ +[3]: https://developers.google.com/season-of-docs +[4]: https://www.osgeo.org/about/committees/incubation/graduation/ +[5]: https://thegooddocsproject.dev/ +[6]: http://cameronshorter.blogspot.com/2019/02/inspiring-techies-to-become-great.html +[7]: https://opensource.com/article/20/3/open-source-writing-tools +[8]: https://summerofcode.withgoogle.com/ +[9]: https://flicstar.com/2019/11/27/project-report-for-season-of-docs-2019/ +[10]: https://live.osgeo.org/en/index.html +[11]: https://docs.google.com/document/d/1sTGz8aWPTS6moxgrtsBRz19roemJlilcdQk6B-9IZOo +[12]: https://geonetwork-opensource.org/ +[13]: https://www.ogc.org/ +[14]: https://committee.iso.org/home/tc211 +[15]: https://wiki.osgeo.org/wiki/Lexicon_Committee +[16]: http://cameronshorter.blogspot.com/2019/12/why-qgis-docs-team-is-struggling.html +[17]: https://cameronshorter.blogspot.com/2020/03/insights-from-mixing-writers-with-open.html diff --git a/sources/talk/20200411 5 open source activities while you work from home.md b/sources/talk/20200411 5 open source activities while you work from home.md new file mode 100644 index 0000000000..c52818f909 --- /dev/null +++ b/sources/talk/20200411 5 open source activities while you work from home.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 open source activities while you work from home) +[#]: via: (https://opensource.com/article/20/4/open-source-activities) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 open source activities while you work from home +====== +Work-life balance is important whether you're working from home +temporarily or it's your usual mode of earning a living. +![Person in a field of dandelions][1] + +The mythos of the remote home office or the exciting archetype of the digital nomad are as appealing as they are dangerous. It's great to be able to avoid a commute, to be able to stay comfortable at home while getting lots of work done, and to be master of your own schedule. But along with those liberties, you inherit the responsibility of remembering to be a normal, functioning human being. Believe it or not, the two aren't mutually exclusive. You can do both, but you have to work at it. Here are some ideas on how. + +### Plant something + +![Seeeduino in the garden][2] + +You may have an abundance of little ones to care for during the day, and if you do, you should read our [article][3] about fun open source projects for kids and parents. If you don't, or if you're just keen to try caring for something that's quiet, then you might find it satisfying to plant something. + +I used to think gardening was something you did as a way to establish a routine: each morning, you wake up and tend to your plants before you start your day, each evening you might pull weeds, and so on. Now that I have a garden, I realize that it's more like a low-stress puzzle. Learning to tend to plants is a little like learning to program. You learn the basics first, you learn to debug (literally, in the case of aphids), and then you learn how to optimize growth and maybe even [how to automate plant care][4]. + +If you're not attracted to gardening, there are plenty of other [outdoor projects][5] that are useful in getting you outdoors with a purpose and encouraging you to go back out for more. + +### Go for a walk + +![Walking][6] + +The phrases "go for a walk" or "get some fresh air" are so common that they seem trite, but that doesn't make the result any less valid. Getting outside your usual workspace is vital for clarity and drive, but sometimes going outside feels a little pointless. You can only walk around the block so many times before the journey loses excitement. + +If you need a goal for ambling around your neighborhood, you can download a handy app called [StreetComplete][7]. It's a quest-based app that presents you with points of interest in your area with incomplete [Open Street Map][8] data. You can help crowdsource better open source maps by verifying and providing information through the app. Suddenly, that aimless meandering you don't really want to do is a fun quest for you and your family. + +### Diversify + +![Mini stapler][9] + +Being in an office can present exciting challenges, whether it's because you're in a dynamic industry or in a petty fight with a colleague over ownership of a stapler. When you work from home, your daily routine can get pretty, well, routine. If that's the case, it might be time to diversify. + +If you've been meaning to [get involved with open source][10], now's a great time for it. + +If you suspect you might be artistic (or even if you're convinced you're not, but you have something you want to express), then maybe it's time to finally learn how to create some [digital imagery][11]. + +Or maybe you're curious about programming. It might be easier than you think and given enough free time, you might even end up with [your own game written in Python][12]. + +### Make some music + +![Music keyboardas][13] + +Artistic expression is important, whether you're working from home or living with someone who's bored at home. The great thing about music is that you don't need to be _musical_ to [make some really cool noise][14]. In fact, you can make some [wild sounds on a Raspberry Pi][15], if you have one lying around. + +If you happen to be musical, though, you can have a go at a digital audio workstation like [Qtractor][16] or [Rosegarden][17]. For inspiration, read about a [professional composer][18] and the music festival he created. + +### Refurbish + +![Old computers][19] + +I don't like it when good things go to waste, especially computers. Read about [refurbishing old computers][20] and [really old computers][21], and then rummage around in your attic to find one for your own experiments. + +### Meet the challenge + +Being stuck at home for long periods of time, whether it's for a few weeks or the better part of your career, can be challenging. However, open source is a vast landscape of opportunity. Explore and find the parts of it that appeal to you. You can build a hobby, and maybe even a career, out of all the fun things you can do with other people's toys. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-activities + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_dandelion_520x292.png?itok=-xhFQvUj (Person in a field of dandelions) +[2]: https://opensource.com/sites/default/files/uploads/diversions_seeeduino.jpg (Seeeduino in the garden) +[3]: https://opensource.com/article/19/12/kids-students-education +[4]: https://opensource.com/article/17/3/arduino-garden-projects +[5]: https://opensource.com/article/19/5/hardware-outdoors +[6]: https://opensource.com/sites/default/files/uploads/diversions_walk.jpg (Walking) +[7]: https://opensource.com/article/20/1/streetcomplete-crowdsource-maps +[8]: https://opensource.com/article/17/8/openstreetmap +[9]: https://opensource.com/sites/default/files/uploads/diversions_stapler.jpg (Mini stapler) +[10]: https://opensource.com/article/17/10/open-source-cats +[11]: https://opensource.com/life/12/6/design-without-debt-five-tools-for-designers +[12]: https://opensource.com/article/17/10/python-101 +[13]: https://opensource.com/sites/default/files/uploads/diversions_keyboards.jpg (Music keyboards) +[14]: https://opensource.com/life/16/2/linux-multimedia-studio +[15]: https://opensource.com/article/20/3/sonic-pi +[16]: https://opensource.com/article/17/6/qtractor-audio +[17]: https://opensource.com/article/18/3/make-sweet-music-digital-audio-workstation-rosegarden +[18]: https://opensource.com/article/20/2/linux-open-source-music +[19]: https://opensource.com/sites/default/files/uploads/diversions_old-computers.jpg (Old computers) +[20]: https://opensource.com/article/19/7/how-make-old-computer-useful-again +[21]: https://opensource.com/article/20/2/restore-old-computer-linux diff --git a/sources/talk/20200414 How World of Warcraft introduced me to Linux.md b/sources/talk/20200414 How World of Warcraft introduced me to Linux.md new file mode 100644 index 0000000000..b1836ccb43 --- /dev/null +++ b/sources/talk/20200414 How World of Warcraft introduced me to Linux.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How World of Warcraft introduced me to Linux) +[#]: via: (https://opensource.com/article/20/4/wow-linux) +[#]: author: (Luke Rawlins, RHCE https://opensource.com/users/sudoluke) + +How World of Warcraft introduced me to Linux +====== +One Linux sysadmin traces his journey from video-gaming car mechanic to +a new career in IT. +![Gaming with penguin pawns][1] + +The story behind my career with [Linux][2] is a bit unusual. It starts back in 2005; I was working as an auto mechanic at a Nissan dealership in Toledo, Ohio. I had never used a computer for anything other than checking email, browsing the web, and playing World of Warcraft. + +I had never heard of Linux, I didn't know the term "open source," I probably couldn't even have walked you through how to copy a file from one place to another, and I certainly never thought that I would eventually find myself working in IT or running a website. + +### The "Blue Screen of Death" that changed my life + +I mentioned that I liked to play World of Warcraft (I still do, you can find me on my Mage "Elodinn—Twisting Nether" most of the time). This game was a huge hit in the early 2000s, and it consumed an enormous amount of my time (truth be told, probably a little too much of my time). + +You can imagine my horror one evening when I boot up my PC to be greeted by a blue screen with lots of cryptic messages, including "A problem has been detected…" Hmm weird, maybe I'll just unplug it and plug it back in—that works around the shop sometimes. No such luck, the same message comes up. Over and over, to no avail. + +### How do you fix this? + +So I called a friend and explained the problem. [Big blue screen][3]. Lots of little white letters. I'm going to miss the raid! + +He wasn't sure but said something about drivers, or maybe a hardware problem. I ended up calling around to a few computer repair shops to see if they could fix it. They all said the same thing after I read the message on the screen, and explained the problem to them. "I really can't be sure over the phone, but it sounds like the motherboard is bad. It's going to be $95 for diagnostics and I should be able to get it back to you in about a week." + +There was no way I was going to pay $95 for a diagnostic on an old crappy computer just to be told that either I needed a new one, or that the repair was going to be even more money on top of the diagnostic fee. So I thought to myself, if I can fix a car, then I can definitely fix this little computer. It was broken anyway; what was the worst that could happen? I end up breaking it more and need a new one? I was already in that situation. + +So I spent the next couple of days at work doing some research on computer parts, in between cars. I found out that replacing the motherboard meant that I was probably going to need a new processor. I found a motherboard/processor combo on Newegg for a decent price that I was fairly confident would work on my computer. Great! + +I ordered the parts, and a few days later, after printing out a few instructions, I had swapped out the motherboard and replaced it with my new hardware from Newegg. I was incredibly proud of my new found skills and naturally assumed that I was some kind of elite hacker. That is, until I started the computer up. + +I don't know if you know this, but Windows XP didn't like it when you replaced a lot of parts in your computer. I didn't know it at the time either, but now I had spent probably $150 because I didn't want to pay $95 for a diagnostic, and my computer was still broken. + +### The deep dark web has all the answers + +The next day, once again, I'm using all my breaks to research what went wrong. Pretty quickly I realized that my problem was tied to the fact that I needed a new Windows license. I also realized that there was no way I was going to purchase the software. I'd get a new computer before I purchased a new Windows license. But I wasn't quite ready to give up yet. + +One click leads to another, and I end up on a computer repair forum with someone complaining about a similar problem. All the replies are basically the same—buy a Windows license or buy a new PC—but one. Near the bottom of the forum, some unknown hero of the internet says, "You can always give Ubuntu a try." and leaves it at that. + +"What's Ubuntu?" I said to myself, "and how on earth do you even pronounce that word?" + +Anyway, after some more intensive searching, I found out that Ubuntu is a free operating system that is widely considered to be one of the most user-friendly Linux distributions (whatever that is) that you can get. What's more, I found a book that included an installation CD available at the Barnes and Noble bookstore that I passed on my way home from work. Why not give Ubuntu a try? After all, the computer was already broken, and the book was only $18.99. + +### This story is already too long + +I wish I still had that book. I think I sold it with a box full of old books at a garage sale when we moved a few years ago. I wanted to share my Linux story because it's different than many of the other stories I read about. I was not a college graduate at the time, I didn't learn to code as a child, and I am not an exceptionally intelligent person. I was, at best, an average student, a recently separated Marine, and I assumed that fixing computers couldn't be much different from fixing cars. At the end of the day, you're still just swapping out different parts, right? Different tools, different parts, same job—no problem. + +Along the way I ran into a lot of problems, the first one was the discovery that after all that work, I still couldn't play World of Warcraft. Eventually, I discovered WineHQ and Open Office, and all the incredible things that have come out of the open-source world. That mysterious blue screen and my World of Warcraft obsession redirected the course of my entire working life, for the better. That's an odd thing to admit, but it's probably true. + +### How does the story end? + +Well, it's not over, and I still have a lot to learn. After some frustrating trial and error, I did eventually learn how to install World of Warcraft using Wine. I missed a few weeks in the game, but I didn't lose my raid spot in the guild, and all things considered, I was no worse for the wear. At the time, I was playing a Druid, and everyone always had room for a healer when it came time to battle Ragnaros, the Fire Lord! + +Up to this point, however, my little computer repair project has turned into a wonderful career as a Linux systems administrator, a bachelor's degree, a whole bunch of IT certifications, including the Red Hat Certified Engineer certification, and a [blog][4] that I use as my way of giving back to the community that has given me so much. + +So, if you are like me, a person who is at best moderately intelligent, persistent, incredibly cheap, and not afraid to break a few things, go ahead and try out Linux the next time your computer breaks. + +I'm excited. I mean really excited. Excited to the point that I can hardly think. I'm talking six-... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/wow-linux + +作者:[Luke Rawlins, RHCE][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sudoluke +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/gaming_grid_penguin.png?itok=7Fv83mHR (Gaming with penguin pawns) +[2]: https://opensource.com/resources/linux +[3]: https://en.wikipedia.org/wiki/Blue_screen_of_death +[4]: https://sudoedit.com diff --git a/sources/talk/20200415 Fedora Origins - Part 01.md b/sources/talk/20200415 Fedora Origins - Part 01.md new file mode 100644 index 0000000000..43c381958e --- /dev/null +++ b/sources/talk/20200415 Fedora Origins - Part 01.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Origins – Part 01) +[#]: via: (https://fedoramagazine.org/fedora-origins-part-01/) +[#]: author: (Sylvia Sánchez https://fedoramagazine.org/author/lailah/) + +Fedora Origins – Part 01 +====== + +![][1] + +_Editor’s comment:_ The format of this article is different from the usual article that Fedora Magazine has published: a Fedora origins story told from the point of view of a Fedora user. The author has chosen to tell a story, since to simply present the bare facts is akin to just reading the wiki page about it. + +### Hello World! + +Hello, I am… no, I’m not going to give my real name. Let’s say I’m female, probably shorter and older than you. I used to go by the nick of Isadora, more on that later. + +![Here you have one of the old RH boxes][2] + +Now some context. Back in the late ’90s, internet became popular and PCs started to be a thing. However, most people didn’t have either because it was very expensive and often you could do better with the traditional methods. Yes, computers were very basic back then. I used to play with these pocket games that were fascinating at the time, but totally lame now. Monochrome screens with pixelated flat animations. Not going to dive there, just giving an idea how it was. + +In the mid-90s a company named Red Hat emerged and slowly started to make a profit of its own by selling its own business-oriented distribution and software utilities. The name comes from one of its founders, Marc Ewing, who used to wear a red lacrosse in university so other students could spot him easily and ask him questions. +Of course, as it was a business-oriented distribution, and I was busy with multiple other things, I didn’t pay much attention to it. It lacked the software I needed and since I wasn’t a customer, I was nobody to ask for additions. However, it was Linux and as such Open Source. People started to package stuff for RHL and put it in repositories. I was invited to join the community project, Fedora.us. I promptly declined, misunderstanding the name. It was the second time I got invited that I asked ‘what is with the “US” there (in the name)?` Another user explained it was ‘us’ as in ‘we’ not as in the ‘United States.’ They explained a bit about how the community worked and I decided to give it a go. + +Then my studies got in the way, and I had to shelve it. + +![Login Screen in Fedora Core][3] + +### Press Return + +By the time I came back to Fedora.us it had changed its name to Fedora Project and was actively being worked on from within Red Hat. Now, I wasn’t there so my direct knowledge of how this happened is a bit foggy. Some say that Fedora existed separately and Red Hat added/invited them, some say that Fedora was completely RH’s idea, some say they existed independently and at some point met or joined. Choose the version you like, I’ll put some links down there so you can know more details and decide for yourself. As far as I’m concerned, they worked together. + +Well, as usual someone dropped some CDs with ISOs for me. If I had an euro for every ISO I’ve been offered, or had tossed at my desk, for me to try it, I would be rich. As a matter of fact, I’m not rich but I do have a big rack full of old distros. + +_Anyways_… + +Now it’s the early 2000s and things have changed dramatically. Computers’ prices have dropped and internet speed is increasing, plus a set of new technologies make it cheaper and more reliable. Computers now can do so much more than just a decade ago, and they’re smaller too. Screens are bigger, with better colors and resolution. Laptops are starting to become popular though still expensive and less powerful than desktop PCs. + +During this time, I tried both Fedora and Red Hat. Now, as has been said before, Red Hat focuses on businesses and companies. Their main concern is having exactly the software their customers need, with the features their customers need, delivered as rock solid stability and a reliable update & support cycle. A lot of customization, variety of options and many cool new features are not their main core. More software means more testing and development work and bigger chances of things failing. Yet the technology industry is constantly changing and innovating. Sticking too much to older versions or proven formulas can be fatal for a company. + +So what to do? Well, they solved it with Fedora. Fedora Project would be the innovative, looking ahead test bed, and Red Hat Enterprise Linux was the more conservative, rock solid operating system for businesses. Yes, they changed the name from Red Hat Linux to Red Hat _Enterprise_ Linux. Sounds better, doesn’t it? + +Unsurprisingly, Fedora had a fame of being difficult, unstable and for “hackers only”. Whenever I said I was using Fedora, they would give me odd looks or say something like “I want something stable” or “I’m not into _that_” (meaning they didn’t fancy programming/hacking activities). Countless individuals suggested I might want to use one of the other, beginner-friendly distributions, without themselves even giving Fedora a try! Many would disregard Linux as a whole as an amateur thing, only valid for playing but not good for serious work and companies. To each their own, I suppose. + +![Note the F and the bubble already there][4] + +### Yes, but why? + +Those early versions were called Fedora Core and had a very uncertain release pattern. The six months cycle came much later. Fedora Core got its name because there were two repositories, Core and Extras. Core had the essentials, so to speak, and was maintained by Red Hat. Extras was, well, everything else. Any software that most users would want or need was included there, and it was maintained by a wide range of contributors. + +From the beginning, one of the most powerful reasons for me to use it was the community and its core values. The _Four Foundations_ of Fedora, _Freedom, Features, First & Friends_ were lived and breathed and not just a catchy line on a website or a leaflet. Fedora Project strove (and still does) to deliver the newest features first, caring for freedom (of choice and software) and keeping a good open community, making friends as we contribute to the project. + +I also liked the fact that Fedora, as its purpose was testing for Red Hat, delivered a lot of new software and technologies; it was like opening the window to see the future today. + +The downside was its unreliable upgrade cycle. You could get a new version in a few months or next year… nobody knew, there was no agreed schedule. + +![Note how, despite being Fedora, RH’s logo and signature is omnipresent][5] + +### What was in the box + +Fedora Core kept this name up to the sixth version. From the start, it was meant to be a distribution you could use right after installing it, so it came with Gnome 2, KDE 3, OpenOffice and some browser I forgot, possibly Firefox. + +I remember it being the first to introduce SELinux and SystemD by default, and to replace LILO with GRUB. I also remember the hardware requirements were something at the time, although they now sound laughable: Pentium II 400MHz, 256MB RAM (yes, you read it right) and 2GB of space in disk. It even had an option for terminal only! This would require only 64MB RAM and Pentium II 200MHz. Amazing, isn’t it? + +It had codenames. Not publicly, but it had, and they were quite peculiar. Fedora Core 1 was code named «Yarrow» which is a medium size plant with yellow or white crown-like flowers. Core 2 was Tettnang which is a small town in Baden-Württemberg, Germany. Not sure about Core 3, I think it was Heidelberg, but maybe I’m mixing with later releases. Core 4 was Stentz, if I recall correctly (no idea what it means), Core 5 was a colour, I think Bordeaux, and Core 6 was Zod that _I think_ it was a comic character but I could be wrong. If there was a method in their madness I have no idea. I thought the names amusing but didn’t give a second thought to it as they didn’t affect anything, not even the design of each release. + +![Ah… good ol` genetic helix][6] + +### So what now? + +Well, of course, Fedora Project has evolved from where we have stopped. But that’s for later articles or this one will be too long. For now, I leave you with an extract of an interview with Matthew Miller, current Project Leader and some links in case you want to know more. + +_**Extracts to interview with Matthew Miller, Project Leader.**_ + +Matthew Miller tells about the beginnings in Eduard Lucena’s podcast (transcription [here][7]): _“Fedora started about 15 years ago, really. It actually started as a thing called Fedora.us.” Back in those days, there was Red Hat Linux.” “Meanwhile, there was this thing called Fedora.us which was basically a project to make additional software available to users of Red Hat Linux. Find things that weren’t part of Red Hat Linux, and package them up, and make them available to everybody. That was started as a community project.”_ + +_“Red Hat_ (then) _merged with this [Fedora.us][8] project to form Fedora Project that produces an upstream operating system that Red Hat Enterprise Linux is derived from but then moves on a slower pace.”_ + +_“We were then two parts, Fedora Core, which was basically inherited from the old Red Hat Linux and only Red Hat employees could do anything with and then Fedora Extras, where community could come together to add things on top of that Fedora Core. It took a little while to get off the ground but it was fairly successful”_ + +“_Around the time of Fedora Core 6, those were actually merged together into one big Fedora where all of the packages were all part of the same thing. There was no more distinction of Core and Extras, and everything was all together and, more importantly, all the community was all together._ + +_They invited the community to take ownership of the whole thing and for Red Hat to become part of the community rather than separate. That was a huge success.”_ + +_**Links of interest**_ + +**Fedora, a visual history** +[https://www.phoronix.com/scan.php?page=article&item=678&num=1][9] + +**Red Hat Videos – Fedora’s anniversary** + + +**Red Hat Videos – Default to open** + + +**Fedora’s Mission & Foundations** + + +**A short history of Fedora** + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-origins-part-01/ + +作者:[Sylvia Sánchez][a] +选题:[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/lailah/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/fedora-origins-816x352.png +[2]: https://fedoramagazine.org/wp-content/uploads/2020/03/IMG_0554-768x1024.jpeg +[3]: https://fedoramagazine.org/wp-content/uploads/2020/04/15112-1.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/04/Fedora_Core_5.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/Fedora_Core_3.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/04/Artwork_FC7Themes_Fc7ThemeProposalFlyingHigh_Fc7ThemeProposalFlyingHighRhgl_rhgb-core6-1.png +[7]: https://x3mboy.fedorapeople.org/podcast/transcripts/transcriptFedoraPodcastEpisode01.html +[8]: http://fedora.us/ +[9]: https://www.phoronix.com/scan.php?page=article&item=678&num=1 diff --git a/sources/talk/20200415 How to dispose of IT hardware without hurting the environment.md b/sources/talk/20200415 How to dispose of IT hardware without hurting the environment.md new file mode 100644 index 0000000000..511720d7fd --- /dev/null +++ b/sources/talk/20200415 How to dispose of IT hardware without hurting the environment.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to dispose of IT hardware without hurting the environment) +[#]: via: (https://www.networkworld.com/article/3537928/how-to-dispose-of-it-hardware-without-hurting-the-environment.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +How to dispose of IT hardware without hurting the environment +====== +Find certified recyclers and disposal firms in order to know that the retirement of your old electronics gear is handled safely. +[Angelo Tsirekas][1] [(CC BY 3.0)][2] + +Many enterprises don’t think much about where their obsolete IT gear winds up, but it’s possible to be green-minded, not bust the budget, and even benefit a little from proper disposal. Here is how. + +### Go back to where you bought + +The first option to consider is returning the equipment the vendor or reseller you bought it from, says Susan Middleton, research director, financing strategies at IDC. “Every year we ask customers, ‘How do you handle end-of-lease?’ Overwhelmingly, they return to vendor or partner who are better equipped to handle recycling,” she says. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Vendors often give a fair-market buyout for the devices that can go toward new products, Middleton says. “The big players like IBM and HPE do a great job because they can clean them up and resell them, and the facilities to do that are pretty big,” she says. + +### Vet disposal firms + +If that’s not an option,  and you have to find a disposal company – an IT Asset Disposition (ITAD) service – on your own, the first thing to check is whether it is properly certified, says Mike Satter, CEO of IT asset disposal and [data-center][4]-decommissioning provider OceanTech. Proper certification starts with a [Responsible Recycling (R2) certification][5]. + +R2s are administered by [Sustainable Electronics Recycling International][6] (SERI), a non-profit organization dedicated to the responsible reuse, repair, and recycling of electronic products. It sets the R2 standard and audits ITAD providers that carry the standard to make sure they are in compliance with the standard. Being responsible means creating a paper trail that shows the electronic waste – which contains heavy metals including arsenic, beryllium, cadmium, chromium, cobalt, indium, lead, mercury, nickel, and thallium, and are toxic in high enough doses – is reused, recovered or recycled. + +Some disposal firms dump old gear in general landfills or export them to other countries where regulations aren’t as strong.   + +“Any ITAD service provider that does not carry an R2 certification cannot fully guarantee zero landfill or zero export of materials,” says Satter. “Many recyclers will say they are compliant, but without verified certifications you’re taking a chance.” + +[][7] + +Mark Dobson, IT asset disposal security specialist with NextUse, a firm that removes and the resells second-hand IT assets, cites six disposal certifications that companies should look for: [R2][5],  [e-Stewards][8],  [NAID][9], [NAID AAA][10] (which has greater certification of regulatory compliance), [ISO 14001][11], and ISO 18001. “R2 would be the floor,” he says. + +Briefly, here’s what these certifications do. + + * **e-Stewards** is a standard set by the Basel Action Network in Sweden, which recognizes electronics recyclers that adhere to the most stringent environmentally and socially responsible practices when recovering hazardous electronic materials. In particular it is focused on making sure it was not shipped off to poor countries, where underage workers were exposed to toxic materials in careless work conditions. + * **NAID and NAID** AAA certification are set by The National Association of Information Destruction, a standards body that sets rules for the proper disposal of information devices, like hard drives. + * **ISO 14001** is a management framework for organizations to “achieve the intended outcomes of its environmental management system, which provide value for the environment, the organization itself and interested parties.” Outcomes of the framework should enhance environmental performance, fulfill compliance obligations and achieve environmental objectives. ISO is the International Organization of Standards, a global standards body. + * **ISO 18001** is the international standard for health and safety management systems. + + + +Dobson says ITAD companies that do it right are using one or more of the certification standards for data security and responsible recycling, and getting and maintaining those standard takes substantial initial and on-going investment in facilities, equipment, hardware, software, personnel, policies and procedures. + +“When those vendors charge more for their services, it is to cover those expenses, not to be excessively profitable,” he says. “Companies that do it the cheap way are skipping many if not all of those investments.” + +If an e-waste company says they will take retired equipment for free, consider that a red flag, says Satter. “Compliant e-waste companies have to hire vetted/credentialed employees, which must pass background checks to ensure compliance is delivered,” Satter says. “All of that costs money.” + +But the additional cost of using a certified company is minor. “We’re not talking hundreds of thousands of dollars,” says Dobson. “Even on the biggest job, it’s a few thousand dollars difference between the right way and the cheap way. For your average client, you’re talking thousands of dollars between the best vendors possible and totally half-assing it with the cheapest vendor that’s not operating in anyone’s best interest but their own.” + +### Penalties + +State environmental laws about illegal disposal are mainly enforced by state attorneys general. In addition, various federal agencies enforce violations of their agency's laws and regulations. + +Satter thinks enforcement needs to be tougher. “It will take the federal government to create extreme enforcement measures to ensure our e-waste is handled properly. The CEO or owner of companies should be arrested if they violate illegal e-waste dumping laws or knowingly exports e-waste to developing countries,” he says. + +In one case, two executives of a Seattle e-waste recycling company got [28 months in jail][12] for improper disposal of e-waste. In that case, it was e-Stewards that got wise to their illegal activities and turned them in to the Washington state AG. + +But that’s an exception, not the rule. Dobson says he sees very little enforcement. “The regulations are in place but spotily enforced, and penalties are not incentivizing. A lot of this is viewed as the cost of doing business. They build the fines for if they get caught into the cost of disposal,” he says. + +Fines for illegal dumping of old IT assets, are determined by the size of the violation, the clean-up cost, and the guidelines in the state or federal law. AT&T got one of the largest fines on record in 2014 for illegal disposal of e-waste, socked with a [$52 million fine][13]. Two years later, Apple got a spanking of $450,000 for its own [illegal dumping][14]. + +Middleton says first and foremost companies should ask for a paper trail to verify proper handling and disposal of assets from the moment they are picked up. “Ask about who certifies that your [disposal] partners are doing it correctly. When you don’t get a good answer, you walk away,” she says. + +But she says she thinks most firms are legit. “Anyone that’s lasted in this business isn’t shady. The majority that have been around a while are responsible,” says Middleton. + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537928/how-to-dispose-of-it-hardware-without-hurting-the-environment.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Kerbside_collection#/media/File:ACT_recycling_truck.jpg +[2]: https://creativecommons.org/licenses/by/3.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[5]: https://sustainableelectronics.org/r2-standard +[6]: https://sustainableelectronics.org/ +[7]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[8]: http://e-stewards.org/ +[9]: https://naidonline.org/ +[10]: https://naidonline.org/certifications/why-become-certified/ +[11]: https://www.iso.org/iso-14001-environmental-management.html +[12]: https://www.theverge.com/2019/12/4/20992240/e-waste-recycling-electronic-basel-convention-crime-total-reclaim-fraud +[13]: https://www.reuters.com/article/us-usa-at-t-california/att-to-pay-california-52-million-in-hazardous-waste-disposal-settlement-idUSKCN0J50AG20141121 +[14]: https://www.mercurynews.com/2016/12/06/apple-to-pay-450000-after-allegations-of-hazardous-waste-violations/ +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200415 IBM extends z15 mainframe family, intensifies Linux security.md b/sources/talk/20200415 IBM extends z15 mainframe family, intensifies Linux security.md new file mode 100644 index 0000000000..2ec127350a --- /dev/null +++ b/sources/talk/20200415 IBM extends z15 mainframe family, intensifies Linux security.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IBM extends z15 mainframe family, intensifies Linux security) +[#]: via: (https://www.networkworld.com/article/3537678/ibm-extends-z15-mainframe-family-intensifies-linux-security.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +IBM extends z15 mainframe family, intensifies Linux security +====== +IBM continued to reshape the mainframe with an eye toward further integrating it within hybrid clouds and further securing Linux-based workloads. +Kali Linux / nevarpp / Getty Images + +IBM continued to reshape the [mainframe][1] with an eye toward further integrating it within hybrid clouds and securing [Linux][2]-based workloads. + +On the hardware side, IBM rolled out two entry-level, 19” single-frame, air-cooled platforms, the  [z15 Model T02][3] and [LinuxONE III Model LT2][4]. The new machines are extensions of the IBM z15 family that [Big Blue rolled out in September][5] of last year.  + +Both can fit in cloud [data-center][6] racks and can be outfitted with a second drawer, should customers need to grow capacity.  Both feature 65 cores using commercial processors running at 4.5GHz and can be configured to support all manner of workloads.  + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][7] + +IBM said new machines support z/OS Container Extensions that enable access to an ecosystem of open-source and Linux-on-IBM Z applications that may be deployed within the native z/OS environment without requiring a separate Linux server, using Docker container skills and patterns. In addition customers can use the latest open-source tools, popular NoSQL databases, analytics frameworks and application servers, IBM said. + +The LinuxONE Model LT2 can run a number of Linux systems including [Red Hat Enterprise Linux][8], SUSE and Ubuntu, alone or side by side with IBM z/VM environments on a single physical server. The IBM LinuxONE server can run Linux workloads independently on a single server. + +Both systems support IBM’s prepackaged Cloud Paks, which include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers, the company said. IBM has standard Cloud Paks for data, application, integration, automation and multicloud management and security. The idea is to help customers develop, deploy, and manage cloud-native applications for the z15 family, IBM stated. + +Security and privacy features are key for the z15 and those have been extended with the introduction of IBM Secure Execution for Linux for the all z15 models.  In a [blog post][9] about the security extensions, IBM stated that at its core, a Secure Execution provides a KVM-based virtual machine that is fully isolated and protected from the hypervisor with encryption keys that only the IBM Z hardware and firmware have access to. + +[][10] + +“In practice, an encrypted Linux image is created using the host public key and a customer-specific key. Since the encryption keys are stored on the IBM Z hardware and firmware, the encrypted image can only be executed in a virtual machine on the host(s) it has been prepared for, and the image can’t be decrypted or tampered with outside of the designated host(s). In addition, your unencrypted virtual machine memory cannot be accessed by the host operating system either,” IBM stated. “Applications are then run inside of that virtual machine, allowing the owner of the application to focus on just disk and network data encryption, both of which can be easily handled in userland.” + +In an environment where [customers are running Kubernetes][11] across servers running on x86 and Linux on Z systems, you can deploy the Secure Execution containers specifically for the applications you want to have protected, like sensitive databases and blockchain services. In this model, Kubernetes still manages the orchestration of containers, both on x86 and IBM Z, but it has no access to the data inside the Secure Execution environment container, IBM stated.  + +With Secure Execution IBM is trying to mitigate insider threats to enterprise data. + +From 2016 to 2019, the average number of incidents involving employee or contractor negligence has increased from 10.5 to 14.5–and the average number of credential theft incidents per company has tripled over the past three years, from 1.0 to 3.2, According to the [Ponemon Institute’s 2020 Cost of an Insider Breach Report][12], IBM stated.  “IBM Secure Execution for Linux helps to mitigate these concerns by enabling clients to isolate large numbers of workloads with granularity and at scale, within a trusted execution environment.” + +The z15 family already supports what IBM calls [Data Privacy Passports][13] that promise to let customers control privacy and security by defining how all data is accessed, stored and shared. The idea is to let customers  protect and provision data and revoke access to that data at any time, not only within the z15 environment but across an enterprise's hybrid [multicloud][14] environment, IBM stated.  + +The new systems and software are expected to be available by mid-May.  z15 T02 pricing starts at $160,000 but each machine is built to order so prices vary. + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537678/ibm-extends-z15-mainframe-family-intensifies-linux-security.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3446140/enterprises-find-a-new-use-for-mainframes-blockchain-and-containerized-apps.html +[2]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html +[3]: https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS120-006&appname=USN +[4]: https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS120-014&appname=USN +[5]: https://www.networkworld.com/article/3438542/ibm-z15-mainframe-amps-up-cloud-security-features.html +[6]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[7]: https://www.networkworld.com/newsletters/signup.html +[8]: https://www.redhat.com/en/blog/enterprise-linux-all-architectures-bringing-red-hat-enterprise-linux-ibm-z15-and-linuxone-iii-single-frame-systems?sc_cid=701f2000000txokAAA&utm_source=bambu&utm_medium=social&utm_campaign=Partner +[9]: https://developer.ibm.com/blogs/inside-the-new-ibm-z15-t02-and-linuxone-iii-lt2/ +[10]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[11]: https://www.networkworld.com/article/3536654/ibm-taps-new-leaders-for-hybrid-cloud-battles-ahead.html +[12]: https://www.ibm.com/downloads/cas/LQZ4RONE +[13]: https://developer.ibm.com/blogs/data-privacy-passports-for-developers/ +[14]: https://www.networkworld.com/article/3429258/real-world-tools-for-multi-cloud-management.html +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200415 Network World 2020 State of the Network- SD-WAN, edge networking and security are hot.md b/sources/talk/20200415 Network World 2020 State of the Network- SD-WAN, edge networking and security are hot.md new file mode 100644 index 0000000000..7e9543e099 --- /dev/null +++ b/sources/talk/20200415 Network World 2020 State of the Network- SD-WAN, edge networking and security are hot.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Network World 2020 State of the Network: SD-WAN, edge networking and security are hot) +[#]: via: (https://www.networkworld.com/article/3537559/state-of-the-network-sd-wan-edge-networking-and-security-issues-heat-things-up.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Network World 2020 State of the Network: SD-WAN, edge networking and security are hot +====== +Network World survey finds 5G, IoT, server consolidation and WAN optimization top priorities. +[orna wachman / Pixabay][1] [(CC0)][2] + +Networking trends including [SD-WAN][3], edge and [5G][4] technology dominate the plans of IT executives and management as they look to develop efficient, bulletproof enterprise communications strategies for the future. + +Those trends and others such as network security, server consolidation and WAN optimization were cited as primary IT drivers of future investment, according to Network World's 2020 State of the Network report. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] + +The  survey tapped 268 IT executives and management personnel with primary networking responsibilities for their organization to find out what initiatives are motivating the move to a more digital business environment. + +### SD-WAN and WAN optimization + +The survey found that 58% of respondents said SD-WAN can improve bandwidth efficiency, and 55% said it will expand connectivity options. 48% said it will encourage [hybrid cloud][6] and 41% said it would encourage multi-cloud adoption. The Network World survey found that the increased use of containers and cloud-based applications that need access from the edge is also driving the use of SD-WAN technologies. + +There are a few differences by company size: 63% of enterprises say SD-WAN will improve the bandwidth efficiency for its cloud resources compared to 55% of SMBs. Close to half (46%) of enterprises expect SD-WAN to encourage multi-cloud, while only 26% of SMBs agree, perhaps because multicloud is less prevalent in smaller organizations, the survey stated. + +The State of the Network survey found that 44% of organizations are currently piloting or using SD-WAN, and another 28% have it on their radar. Organizations expect SD-WAN to improve management and monitoring (52%), increase resiliency (51%), improve network security (50%) and prioritize business-critical traffic (46%), the survey stated. + +It will probably come as little surprise that the technologies around SD-WAN are hot. In separate recent survey reports, analyst firm IDC says that 95% of enterprises will be using [SD-WAN][7] technology within two years, and that 42% have already deployed it. IDC also says the SD-WAN infrastructure market will hit $4.5 billion by 2022, growing at a more than 40% yearly clip between now and then. + +[][8] + +“The growth of SD-WAN is a broad-based trend that is driven largely by the enterprise desire to optimize cloud connectivity for remote sites,” Rohit Mehra, vice president, network infrastructure at IDC [said recently][9]. Going forward, the addition of features such as cloud-based application insights and performance monitoring will be a key part of SD-WAN rollouts, Mehra said. + +Cisco has talked about the growth of multicloud networking motivating many businesses to re-tool their networks in favor of SD-WAN technology, Cisco wrote recently. SD-WAN is critical for businesses adopting cloud services, acting as a connective fabric between the campus, branch, [IoT][10], [data center][11] and cloud. + +While SD-WAN is popular, its predecessor, WAN optimiization, is still in heavy use. The IDG survey found that more than half of organizations (53%) are currently piloting or using WAN optimization, which was traditionally centered around a single centralized hub or data center where an organization’s applications and data are hosted. With widely disparate user communities, many enterprises are now viewing new application-centric or regionally distributed architecture as a way to replace MPLS sprawl with purpose-built regional hubs, the survey stated. + +### Edge is big + +Often associated with SD-WAN, edge computing is also a high priority for customers in the Network World study, which found that more than one-third of organizations surveyed (36%) already have edge computing tools in production or are piloting initiatives, and another 25% are actively researching the technology. + +Edge computing is driven by a number of factors. Gartner research says that by 2023, more than 50% of enterprise-generated data will be created and processed outside the [data center][11] or cloud, up from less than 10% in 2019. + +Hand-in-hand with that change is a shift in what technologies are supported at the edge of the network, and that means information processing, content collection and delivery are placed closer to the sources, repositories and consumers of this information. Edge networking tries to keep the traffic and processing local to reduce latency, exploit the capabilities of the edge and enable greater autonomy at the edge, Gartner says. + +The Network World survey stated that [edge-computing][12] adopters expect the technologies  to reduce network latency and operational expenses, allow real-time data processing and save bandwidth. It is also expected to preserve uptime and resilience by reducing the number of network failures, providing an [IoT][10] security framework and reducing the impact of data-center outages. + +Despite all of the virtues of edge computing, security concerns are still on the minds of the vast majority of respondents (77%). More than half of those surveyed believe that  edge devices were not built with security in mind (55%), that the need for middleware creates an additional attack surface (51%) and that there are many other potential attack vectors due to the heterogeneous computing environment (51%). + +The survey stated that 69% of respondents implementing edge computing said network security has already been or will be affected, and 55% said their network management will be affected. Additionally, 49% said their cloud will be affected, perhaps because edge computing has the ability to reduce the amount of data that needs to be processed in theh cloud. + +### Security is a hot spot + +The "State of the Network" survey found there are a variety of data-center security concerns. Topping the list are DDoS attacks, which are aimed at disrupting and disabling internet services, and web application attacks where attackers target vulnerable web servers and install malicious code. + +Organizations are taking a variety of actions when it comes to mitigating these security risks, according to the study. For example the survey found that for 88% of respondents, [firewalls][10] are still the front-line defense. Access-control technologies are being used by about 81% of respondents and anti-malware is being used by 70% of enterprise customers with intrusion prevention being used by 66%. + +With the increasing number and complexity of cyber threats, it’s not surprising that almost three-quarters of respondents (71%) are either piloting, currently using or upgrading network security-monitoring technology. Network security monitoring helps to identify slowdowns and problem areas as well as allows administrators to attack problems as they happen and help prevent future attacks, the survey stated. + +### 5G is on the radar + +51% of respondents say their organization is actively researching 5G, but just 11% are piloting or using it in any capacity. Uses interested organizations are considering include broadband mobile (51%), IoT connectivity (43%), [branch or remote site connectivity][13] (41%) and low-latency communications and fixed wireless access (40% each), the survey stated. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537559/state-of-the-network-sd-wan-edge-networking-and-security-issues-heat-things-up.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/photos/young-man-student-studying-learning-4053324/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[4]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[5]: https://www.networkworld.com/newsletters/signup.html +[6]: https://www.networkworld.com/article/3429258/real-world-tools-for-multi-cloud-management.html +[7]: https://www.networkworld.com/article/3489938/what-s-hot-at-the-edge-for-2020-everything.html +[8]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[9]: https://www.networkworld.com/article/3527194/multicloud-security-integration-drive-massive-sd-wan-adoption.html +[10]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[11]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[12]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[13]: https://www.networkworld.com/article/3250664/sd-branch-what-it-is-and-why-youll-need-it.html +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200416 Contact tracing via Bluetooth could help track COVID-19 transmission.md b/sources/talk/20200416 Contact tracing via Bluetooth could help track COVID-19 transmission.md new file mode 100644 index 0000000000..86fa318f1c --- /dev/null +++ b/sources/talk/20200416 Contact tracing via Bluetooth could help track COVID-19 transmission.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Contact tracing via Bluetooth could help track COVID-19 transmission) +[#]: via: (https://www.networkworld.com/article/3538333/contact-tracing-via-bluetooth-could-help-track-covid-19-transmission.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Contact tracing via Bluetooth could help track COVID-19 transmission +====== + +Thinkstock + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +A team of researchers from MIT has developed a novel method of tracking COVID-19 transmission among the population, using Bluetooth “chirps” that could automatically trace COVID-positive contacts and warn those who have potentially become infected, without violating their privacy. + +The system is called PACT, or Private Automated Contact Tracing. It works by sending random strings of numbers via low-power Bluetooth from a user’s smartphone to other nearby devices using the system, creating a coded list of smartphones that a given user has been close to in the past 14 days. + +If the user subsequently tests positive for COVID, he or she can upload that list of “chirps” to the database, so that other users can run a check to determine whether they might have exposed. + +MIT said that the system uses advanced privacy protection methods to ensure the privacy of both COVID sufferers and those checking to see whether they’ve been exposed. People would need to opt in, and researchers specifically highlighted that PACT does not use any GPS, wireless location or phone ID information. + +“For these broadcasts, we’re using cryptographic techniques to generate random, rotating numbers that are not just anonymous, but pseudonymous, constantly changing their ‘ID,’ and that can’t be traced back to an individual,” said MIT institute professor Ron Rivest, who led the project. (Rivest knows a  thing or two about cryptography: he’s the R in RSA, the first publicly available public-key cryptosystem.) + +The idea behind PACT is to make sure that the system isn’t tracking any individuals specifically. Rather, it’s meant to be a yes/no resource for those wondering whether they may have been in proximity to someone with COVID. It’s currently at the proof-of-concept stage – the team recently overcame the hurdle of getting Androids and iPhones to speak to each other – and overtures have been made to smartphone makers, Apple, Google and Microsoft to try and get the system into the public’s hands as quickly as possible. + +“The aim of the prototype is to prove to these developers that this is feasible for them to implement,” said Rivest. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][2] ]** + +The team hopes that if PACT comes into widespread use it would enable a much more selective approach to quarantine and give communities the ability to return to normalcy more quickly. Tracking the spread of a disease like COVID with more speed and precision could let public health authorities suggest testing to specific groups of people if they notice a pattern emerging. + +MIT also said that the team has demonstrated PACT to various government agencies, and coordinating similar efforts elsewhere in the U.S., as well as in Europe. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538333/contact-tracing-via-bluetooth-could-help-track-covid-19-transmission.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200416 Harvesting ambient energy will power IoT, scientists say.md b/sources/talk/20200416 Harvesting ambient energy will power IoT, scientists say.md new file mode 100644 index 0000000000..8831fcbfbe --- /dev/null +++ b/sources/talk/20200416 Harvesting ambient energy will power IoT, scientists say.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Harvesting ambient energy will power IoT, scientists say) +[#]: via: (https://www.networkworld.com/article/3536697/harvesting-ambient-energy-will-power-iot-scientists-say.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Harvesting ambient energy will power IoT, scientists say +====== +Magnetic fields found naturally around electrical devices could be diverted and converted into electricity to power the IoT. +Thinkstock + +Stray, ambient magnetic fields that are naturally created from electricity usage should be captured, diverted, and converted into power for Internet of Things sensors, researchers say. + +"Just like sunlight is a free source of energy we try to harvest, so are magnetic fields," said Shashank Priya, professor of materials science and engineering and associate vice president for research at Penn State, in a statement published [on the university's web site][1]. "We have this ubiquitous energy present in our homes, office spaces, work spaces and cars. It's everywhere, and we have an opportunity to harvest this background noise and convert it to useable electricity." + +Electricity produces tiny magnetic fields around common power cables, computers and lighting found in factories, homes and offices. That energy, if harnessed, could power sensors and small data-sending radios, the academics think. Penn State is attempting to design ambient power receptors for IoT. + +### Materials science + +The group at Penn State has been having some success getting it to work. Experimental devices that are thin and about 1.5 inches long are being tested. Placing the capture-device around or on common appliances does produce electricity, the researchers claim. The key is to put the device where the magnetic field is the strongest. In one experiment, the researchers were able to generate enough power to run 180 LED lighting arrays with a device placed about 4 inches from a space heater. At 8 inches, the device produced enough electricity to operate a clock. + +"These results provide significant advancements toward sustainable power for integrated sensors and wireless communication systems," said Min Gyu Kang, an assistant research professor at Penn State and joint lead author of the study. + +Electricity and magnetism have always gone hand in hand. Magnetism is created by a moving electric charge. It's that movement which creates the magnetic field. That's why low-level magnetism is manifested in electrical wires generally, for example—the electricity is moving along the cable. + +In this case, the scientists are converting the magnetic field, which is caused by the moving electricity, into a separate electrical current. They're doing it with materials science by combining two materials. One of the materials is a magnetostrictor – it converts the magnetic field into stress-generating vibrations. The another material is piezoelectric, which grabs the vibrations and translates that energy into electricity. + +[][2] + +### How to power sensors + +Producing usable power from stray magnetic fields is just one stab at powering the IoT. Just how one goes about producing power for the millions, and possibly billions, of environmental, factory process and other sensors that are expected to come on stream as IoT takes off is up for grabs. + +Batteries have limitations—they need to be changed or charged, for example. Ambient humidity is one possibility I [wrote about recently][3]. In that case, bio-electronics have been proven to capture half-a-volt from ambient air, scientists claim. That's enough to operate rudimentary sensors. Waste heat, too, is another possible source: Researchers are [exploring ways to convert excess heat][4], such as is found in data centers, into light, and then turn that light into electricity. + +Other angles include simply reducing energy consumption through more efficient chips or streamlined wireless communications hardware. Other parasitic techniques are being tried. They include [turning existing wireless noise into a data carrier][5]. It's efficient because one doesn't have to make so much power for radio transceivers—the carrier already exists. + +In the case of the Penn State work, less obvious benefits might exist, too. + +"In buildings, it's known that if you automate a lot of functions, you could actually improve the energy efficiency very significantly," Priya said. “Buildings are one of the largest consumers of electricity in the United States. So even a few percent drop in energy consumption could represent or translate into megawatts of savings. Sensors are what will make it possible to automate these controls, and this technology is a realistic way to power those sensors." + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3536697/harvesting-ambient-energy-will-power-iot-scientists-say.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://news.psu.edu/story/613154/2020/03/31/research/scientists-tap-unused-energy-source-power-smart-sensor-networks +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.networkworld.com/article/3529893/seawater-humidity-inspire-new-ways-to-generate-power.html +[4]: https://www.networkworld.com/article/3410578/data-centers-may-soon-recycle-heat-into-electricity.html +[5]: https://www.networkworld.com/article/3449819/wireless-noise-protocol-can-extend-iot-range.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200416 How I-ve adjusted my work-from-home habits.md b/sources/talk/20200416 How I-ve adjusted my work-from-home habits.md new file mode 100644 index 0000000000..251e9a7b9e --- /dev/null +++ b/sources/talk/20200416 How I-ve adjusted my work-from-home habits.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I've adjusted my work-from-home habits) +[#]: via: (https://opensource.com/article/20/4/healthy-remote-work-habits) +[#]: author: (Will Kelly https://opensource.com/users/willkelly) + +How I've adjusted my work-from-home habits +====== +WFH newbs and veterans alike have to adjust to self-quarantine; here's +how to maintain some balance. +![Oatmeal and a laptop.][1] + +I've been a remote worker during various chapters in my career, and have tried to carry those lessons into each new remote work experience. At the end of last year, I switched to a job that lets me work from home. Fast forward to the COVID-19 outbreak; even though I was no WFH novice, I found myself having to adapt just like the many other workers who've been suddenly thrust into remote work. + +In hopes of easing that transition, here are some healthy remote work habits to adapt during a pandemic. + +### Keep exercising even if your gym is closed + +I watched the crowd in my gym dwindle the week before my state government issued its stay at home orders. Whether I've been working in an office or at home, going to the gym helps me vent stress, plus it acts as a logical break in my daily routine because I put down my phone and keyboard to clear my head. + +Fortunately, my gym put some training activities online that I plan to use. I already have a stability ball and Bosu ball in my home office that I began using on day three after the pandemic closed all the offices, schools, and later gyms in my local area. As I write this article, I'm entering week 4 of COVID-19-mandated remote work, and I'm still trying to get back to the exercise dedication and momentum I had before this all happened. + +### Dress (and groom) yourself for work + +I've worked from home on and off during my career. When I started my new job, I decided not to repeat some mistakes I made during the last time I worked from home. One mistake I made was not shaving every day. I also stopped getting dressed for work. + +When you dress and groom yourself for work every day, it can help put you in focus for work. You don't have to be too strict; it is a pandemic after all. I'm still debating on sweatpants Fridays during this crisis. + +### Eat meals away from your desk + +It's too easy to just eat meals at your desk when you work at home. Many even do it at the office. I recommend as you get through your COVID-19-enforced remote working that you use eating as a natural break in the ebbs and flows of your day. For example, unless a deadline was calling, I would go out to lunch to break up my remote working days. These days I get up from my desk, walk outside to get a breath of fresh air and have lunch in my living room. + +### Keep a schedule and track your progress + +It's easy to sleep in when you don't have to go to the office. I recommend trying to keep to your regular schedule as much as possible. It's admittedly easy for me to say that because I live alone. If you're home with children, work with your employer to time-shift your schedule to accommodate the added responsibilities and other challenges you're facing right now. It may take a few iterations to get the right schedule, but you'll appreciate the consistency. + +Another word about keeping a schedule—you might add important work meetings to your personal calendar or as reminders on your mobile device, so you have another reminder as you adjust to the new normal of COVID-19. + +The open source community has a lot of great scheduling and project management tools that you can use to track your own time and progress. There are [project management tools][2] for agile development teams. You can also find open source alternatives to [Googl][3][e Calendar][3] available on Android. + +### Put backup communications channels in place + +Even companies with robust telework programs may see some communications outages. It may not even be their CIO's fault, such as the Microsoft Teams outage that happened in Europe early on during the COVID-19 pandemic. + +Having problems dialing into a conference bridge or your employer's group chat having sporadic issues will surprise nobody right now; most understand that workers are in a period of transition, and not everything will run smoothly. However, you still need to have backup channels in place to make that communication happen, even if it's just coworkers exchanging cell numbers so they can text or call each other as needed. + +There are some fully-featured open source [Slack alternatives][4] available that are worth exploring if your organization is lacking in chat applications or if you want to give your team a backup channel to your official corporate application. (Whether you do it with the approval of your corporate IT department is up to you). + +You should also consider installing implementing [MediaWiki][5] or [Twiki][6] to improve collaboration or to give your team an accessible document repository. + +### Pivot on communications when needed + +Every company where I've been an employee or contractor has had its own communications style. Remote working at scale during the COVID-19 epidemic will challenge those communication styles. + +Be prepared to shake up your communication style, whether you're a newb or long term remote worker. That could mean writing more detailed emails instead of the terse ones you normally send to becoming more of a power user with your company's group chat tool. There are also the open source wikis I mentioned earlier that can provide you a centralized platform for any long-form writing you need to do to help communicate project requirements and changes. + +I also extend this advice to your personal communications during the workday. For example, a friend and I video conference during the day. We never did that pre-COVID-19. + +### Final thoughts + +Lots of people will evolve and rethink their remote work habits. It's only healthy that you prepare yourself for adjusting your own remote working habits. What worked for me pre-COVID-19 doesn't necessarily work right now, so I'm adjusting my remote work habits weekly as I see fit so I can maximize my productivity during the current crisis. + +How are you adjusting your remote work habits during self-quarantine? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/healthy-remote-work-habits + +作者:[Will Kelly][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/willkelly +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/oatmeal-and-fedora.jpg?itok=NBFUH9eF (Oatmeal and a laptop.) +[2]: https://opensource.com/article/18/2/agile-project-management-tools +[3]: https://www.androidpolice.com/2019/12/30/the-best-free-and-open-source-alternatives-to-google-calendar-on-android/ +[4]: https://opensource.com/alternatives/slack +[5]: http://www.mediawiki.org/ +[6]: http://www.twiki.org/ diff --git a/sources/talk/20200417 Face-to-face collaboration for community to become more impactful - Chip Childers.md b/sources/talk/20200417 Face-to-face collaboration for community to become more impactful - Chip Childers.md new file mode 100644 index 0000000000..ccc63dc914 --- /dev/null +++ b/sources/talk/20200417 Face-to-face collaboration for community to become more impactful - Chip Childers.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Face-to-face collaboration for community to become more impactful – Chip Childers) +[#]: via: (https://www.linux.com/articles/face-to-face-collaboration-for-community-to-become-more-impactful-chip-childers/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Face-to-face collaboration for community to become more impactful – Chip Childers +====== + +“Anytime there’s a crisis, there’s also an opportunity for open source communities to find ways to be helpful,” affirms Chip Childers, the Executive Director of Cloud Foundry Foundation. He believes the remarkable work the Cloud Foundry community has done over the years to enhance enterprise developer productivity will now help those who have adopted the platform to combat COVID-19.; + +“It (the platform) allows them to move quickly to respond to changing conditions, whether those are market conditions, or in this case, a global pandemic. We’re actually pretty proud of a lot of the end-users and how they’re able to use the software more efficiently now,” he says. + +Prior to becoming the Executive Director, Childers served as the CTO for a little over five years. He feels “it’s a very exciting time to be stepping into the role,” and has already chalked out a robust strategy to take the Foundation to the next level. + +For starters, Google has upped its membership of Cloud Foundry and is now at the technical tier. “We were quite happy to have them decide to upgrade and we appreciate their support on that,” says Childers. + +He is also happy with how Kubernetes and Cloud Foundry are coming together. + +“Cloud Foundry and Kubernetes are now becoming complementary. The Cloud Foundry developer platform should run on the Kube infrastructure platform. Both communities have reached the point where they’re ready to see this get blended,” says Childers. + +**Unswerving Support** +VMware ranks among the largest contributors to communities. Last year, it acquired Pivotal, which is one of the biggest stakeholders in the Cloud Foundry project. So, what are the implications on Cloud Foundry of a player that has stakes in both Kubernetes and Cloud Foundry? + +“It’s a clear indication the teams that used to work for Pivotal are being intermixed with the teams that were at VMware, and through some of their other acquisitions like Heptio, they’re all working together on the shared vision of creating the Tanzu platform. This happens to align well with the vision that other Cloud Foundry distributions have — like the way SUSE builds Kubernetes-based infrastructure layers Cloud Foundry on top for developer productivity,” explains Childers. + +Childers believes Paul Fazzone’s promotion to Chairman of the Board will provide an additional boost to Cloud Foundry. + +“Paul heads R&D for VMware’s modern applications business unit. He’s been on our board for a long time. So it’s great that we’re going to continue to see the investment in the open source community not just at the business level from VMware, but also in terms of supporting the contributors, be it developers, product managers, project management support, or marketing support. They’re not wavering in their commitment to open source across the board and Cloud Foundry is one of those communities that will benefit from that,” he states. + +**A Three-Pronged Strategy** +The core mission of the Foundation is to bring a world-class enterprise developer experience to as many enterprise developers as possible. Childers, therefore, considers “enterprise developer productivity for Kubernetes infrastructure our new north star” and has devised a three-pronged strategy to align with it. + +“The first thing is that we will focus on working with the contributing community — the Foundation staff, key member contacts and participants — to improve their experience. + +Next is to build upon the inclusivity and diversity work that the Foundation has done over the years. “We’ve always had a number of different audiences to whom we’ve tried to describe the work of the project: line of business leaders, CIOs, IT operations, and enterprise developers. It is important to make a little bit of a dent in the broader technology industry,” avers Childers. + +The third and final prong of Childers strategy is to encourage developers or companies participating in Cloud Foundry efforts to also participate in Istio (an open platform that connects, manages, and secures microservices), Kubernetes, and the various scenes within the community. + +“There’s a massive overlap, which I think will be very beneficial to everyone. The learnings that developers helping to code Kubernetes or Istio learn during that process should flow in such a way that the CF community builds the developer experience on top of those systems. From this perspective, cross-pollination is really, really important,” says Childers. + +Childers is also planning a tectonic shift in the way Foundation contributors work. “While now it’s going to become a little bit harder as we deal with some of the challenges around the pandemic, I’m very excited about spending a lot of our effort focused on increasing the impact of the face-to-face collaboration time that we’re able to create for the community,” adds Childers. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/face-to-face-collaboration-for-community-to-become-more-impactful-chip-childers/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200418 My 10 guiding principles for open source community management.md b/sources/talk/20200418 My 10 guiding principles for open source community management.md new file mode 100644 index 0000000000..c5e62ba6b3 --- /dev/null +++ b/sources/talk/20200418 My 10 guiding principles for open source community management.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My 10 guiding principles for open source community management) +[#]: via: (https://opensource.com/article/20/4/open-source-community-management) +[#]: author: (Florian Effenberger https://opensource.com/users/floeff) + +My 10 guiding principles for open source community management +====== +It's not just about subject matter expertise; leadership in the open +source world requires special skills and processes. +![community team brainstorming ideas][1] + +Many activities these days, be they sports, social work, arts or free and open source software, are organized in some sort of community. If backed by a respective legal entity, this not only helps with getting donations and entering contracts but also puts statutes and rules in place that establish the values and ideals all contributors share and abide by. + +Inside these communities, there can be various roles. Some of them have formal requirements and annual or biannual elections, e.g., the board of directors or the supervisory board; others exist ad hoc within dynamically grown groups and can change frequently. Either of those are ideally composed of experienced and enthusiastic community members who take leadership and responsibility. + +Many regular contributors will, therefore, eventually face the question of whether to accept a certain role. Based on my experience with being a board member of the former German associations [OpenOffice.org][2] Deutschland e.V. and Freies Office Deutschland e.V., previous chairman and current executive director of [The Document Foundation][3] and founding member of the Munich [Open-Source-Treffen e.V.][4], I would like to share some personal insights on the topic. + +These views are purely my own, and your mileage might vary. It is likely that others had both similar and different experiences, so I'm looking forward to any feedback and thoughts you might have. + +### 1\. Cooperation + +A community is all about cooperation. Boards, groups, and bodies are no different in this regard. Usually, you don't know who will co-serve on an elected committee with you until shortly before you start your duty. Therefore, it is important to cooperate openly with your new colleagues in a transparent, trustworthy, and effective way, within the committee as well as the larger community. + +Sharing a common understanding of responsibilities and duties, and even more importantly, of your goals, visions, and plans can help a lot. It's not necessary for these to all be totally aligned in the first place, as long as there are consensus and compromise to help you identify goals that benefit the community and their objectives at large. In a vivid and diverse community, several goals can often be pursued at once, as most won't be mutually exclusive or otherwise prohibitive. + +And then let's not forget one thing: the fun! Be proud that you have been entrusted by your peers to drive the community and its projects toward a bright future. Be proud that you can help steer the ship and shape the soul of something that is important to you. As is often the case in life, cooperating and working together with others is key to success. Joining forces is not only easier but also much more fun than working alone. + +### 2\. Commitment + +Taking over a role is something that can and should make you proud. See this as something you have been entrusted with for a certain amount of time because your contributions have been recognized by the community as extraordinary and remarkable. You acted in a visible and trustworthy fashion, and people credit you with leadership skills. + +Depending on the role you take, the honor often comes with a fair amount of new responsibility beyond what you already do, and it might involve subjects yet unknown to you. In other words: Be ready to put in some time and effort. + +How much time such a commitment takes obviously depends on multiple factors: what specific role you take, how many contributors you have to coordinate with, how large your organization is, and of course, what kind of projects you run. [In one of its annual reports][5], board members of The Document Foundation explained that every year "they each donate 15 to 20 days of activity to TDF for Board duties in addition to other volunteering" and the members of its membership committee donate "between 10 and 15 days of activity." + +### 3\. Variety + +Should you be elected into an organizations' formal body, you will see yourself responsible for representing the entity from a marketing perspective, but also from a legal and organizational point of view. Other than the more glamorous parts, these duties often also entail regular meetings, annual budget planning and reserve building, tax filings and annual activity reports, team management, trademark and copyright handling, planning and overseeing tenders, and all sorts of expected and unexpected legal matters and fostering liaisons with other entities, all of which are rather unglamorous tasks rarely seen by the general public. + +That requires the willingness to learn in a variety of areas and for having a rather high tolerance for frustration. Luckily, most of the groups I know are composed of members with different skills, so it's likely someone is either already experienced in or willing to learn one or more of the respective areas. Looking at The Document Foundation's [rules of procedure][6] for the board, a total of 13 different areas of oversight can be identified, each one staffed with one or more volunteers, matched to their area of interest. + +### 4\. Delegation + +Handling all the work alone as a pure volunteer will sooner or later become an impossible task and, unless you have magical superpowers, it's strongly advisable to share these with other seat holders, volunteers, and, if they exist, staff and external professionals. Often, growing organizational demands luckily come together with the financial growth of the entity, which makes paying professionals for certain tasks quite feasible and sensible. Accounting, administration, and legal advice are prime examples of things to outsource (unless that's the service you already provide, of course). + +If you oversee a large part of the organization, you primarily need to focus on strategy and the mission at large, so it is advisable to delegate many tasks to others. Remember, the community has entrusted you to steer the ship, to oversee the big picture; don't bother yourself with every little detail and micromanagement, but get enough insight to oversee those you task and trust that they do a good job. + +### 5\. Responsibility + +In the end, however, it still is the ultimate and shared responsibility of all representatives to oversee and coordinate the work, ensure all duties are fulfilled, and, especially for board members, take care that all legal obligations are met. Remember, donors trust you to make good use of their money, so you have a huge responsibility. + +In nearly all legislations, there exist numerous rules and regulations you are bound by, and the unfortunate tendency is often to make things more complicated instead of relaxing them. + +In case something goes wrong, those most exposed are first in line to be confronted with that, both from a social and legal point of view. + +### 6\. Social + +Depending on the size of the organization and your role, you might not only have responsibility for tasks and projects, but also for a paid team. Keep in mind that, for many, their economic situation depends on the success of your organization. Job security and a positive work environment are important factors to keep a happy and dedicated team. + +Gaining the skills and finding the time as a pure volunteer to oversee a large full-time team is demanding. Interacting by talking, listening, and being open helps a lot for both your team and the organization. In many organizations, the paid team is there to serve your community, to drive forward the success of the project, to take away annoying administrative tasks from you, and to work on tasks that support and enable your contributors. + +Working at charities can be a bit different from companies. Given most of your income consists of donor's money, you have less monetary flexibility than commercial employers. However, you provide a far superior experience than many traditional businesses. Use that as your advantage—your team does something for the good cause, can work with people around the world, can really make a difference, and at the same time make a living out of what they love. Communicate frequently, and don't forget to laud people if they do a good job, especially in remote working environments. + +### 7\. Diversity + +Crucial and essential is that representatives reflect the diversity of the community—different genders, religions, languages, cultures, backgrounds, and experiences add an incredibly exciting variety that you should aim hard to achieve in any board, committee, and group. While this can turn out to be challenging in the beginning, it for sure will enrich your community in ways you never dared to dream of before. + +This diversity is one of the most important and exciting assets a larger community offers; you'll soon learn how it widens the view, helps you to question your own thoughts and positions, and contributes greatly to your overall efforts. If you run an open source community, do exactly as the name suggests—be open, be passionate, and try to get to the bottom of things! + +### 8\. Coordination + +Having members from around the globe can make you face some practical problems though—most notably, languages and time zones. While English as a common denominator is spoken widely in Europe, it might be different for other countries, and including those who don't speak English as their mother tongue is key if you have a large community. You risk losing vital insight into what your worldwide community does if you don't manage to connect to them. + +Something the law of physics at least currently doesn't allow is overcoming the different time zones. Finding suitable meeting slots for participants on different continents, matching everyone's working schedule, and providing a work-life balance aren't trivial requirements, especially when you want to include a paid team. As you end your workday, colleagues from a different continent are just about to start theirs. While the volunteers need meeting times after office hours, your staff would probably rather not stay in the office until late or during the weekends. + +Likely there isn't an ideal meeting time, but you will end up finding a compromise that works for most people, possibly including alternate meeting times. A word to the wise: use calendar invites and meeting planners with time zones to avoid confusion, especially during times of daylight savings changes. + +The choice of medium is important as well—all stakeholders need to be aware of and included in important discussions. Some of these are thus better done in email; others are easier to handle on the phone. You might also find it convenient to prepare initial discussions via emails and have the final vote on the phone. + +Properly prefixing email subjects with votes and discussions can likewise be helpful to handle the influx of messages and catch people's attention. The same is true for meeting intervals, agendas, deadlines, quorum requirements, and sunset periods—these need to reflect everyone's needs, factoring in availabilities, vacations, and absences. The rationale behind this is that taking a role requires continuous, active participation in many communities, to keep up with what's going on, and that is much easier when the rules are clear. + +Depending on your setup and the jurisdiction you're in, votes and meetings also have formal requirements you have to stick to. + +### 9\. Trust + +Trustworthiness is probably one of the most important characteristics for anyone who fills a leadership role. Email conversations lack tone and gestures, making it harder to understand moods, emotions, and intentions. Thus it's even more important to assume best intentions on each side, trying to avoid what is known as confirmation bias, i.e., interpreting actions and words in a way that seems to confirm your existing negative assumptions. + +Trust especially comes into play when the entity is located in a country whose language you don't speak or whose legal system you are not familiar with—you will have to rely on translation services and people acting as gateways, be they volunteers or paid professionals. + +### 10\. Reward + +Filling a community role usually means plenty of hard work on top of your existing duties, but there are plenty of rewards for all that work. It is a very honorable and truly exciting opportunity that will not only enrich your professional life (and makes a good item on a CV) but beyond that, enriches your personality, your skills, and your point of view. If you're passionate about what you do, if you're open to new things, if you want to shape the future of what you love—then you indeed might be a great candidate to serve the community and lead by example. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-community-management + +作者:[Florian Effenberger][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/floeff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting_discussion_brainstorm.png?itok=7_m4CC8S (community team brainstorming ideas) +[2]: http://OpenOffice.org +[3]: https://www.documentfoundation.org/ +[4]: https://www.opensourcetreffen.de/ +[5]: https://wiki.documentfoundation.org/File:AnnualReport2016LR.pdf +[6]: https://wiki.documentfoundation.org/TDF/BoD_rules diff --git a/sources/talk/20200420 Why I use open source technology for web development.md b/sources/talk/20200420 Why I use open source technology for web development.md new file mode 100644 index 0000000000..03a2ea4148 --- /dev/null +++ b/sources/talk/20200420 Why I use open source technology for web development.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I use open source technology for web development) +[#]: via: (https://opensource.com/article/20/4/open-source-web-development) +[#]: author: (Jimmy McArthur https://opensource.com/users/jimmymcarthur) + +Why I use open source technology for web development +====== +Micro-frontends with an API-driven approach power the OpenStack +Foundation's platforms. +![Text editor on a browser, in blue][1] + +Every day, millions of people all over the world access the [OpenStack Foundation][2]'s (OSF) web properties to learn about open infrastructure. This level of usage requires a platform and toolsets that are fast, flexible, and affordable—and this is where open source comes in. Not only that, but given that we work for an open source software foundation, we naturally incorporate open source technologies into everything we do, including web development. + +### Considerations for web development + +When thinking about web development technologies, we must consider how we manage our software lifecycles. All software development includes some sort of [lifecycle management][3] with the opportunity to plan, analyze, design, and implement the code. Our web development team usually works on the fly, often under tight deadlines, and with other departments. That means our requirements and workflow must be flexible enough to allow for quick iterations, updates, and corrections. I'd rather push out something quickly and, if needed, go back in and make things pixel perfect after the fact. + +Our team also has to consider all the stakeholders involved in the website, including our talented marketing teams who aren't familiar with Git workflows. That led us, like many others, to utilize a content management system (CMS), so those professionals can make updates without having to use Git. + +### Building a CMS-agnostic web architecture + +In order to uphold this need for flexibility, traditionally, we relied on an open source CMS, [SilverStripe][4]. However, our requirements quickly outgrew the system. So, we built a standalone API and use static micro-sites with [React][5] JavaScript components to pull data into custom-designed presentation layers. We use this system in everything from mobile apps to websites to digital signs. This has become known as a [Jamstack][6] architecture. We found this model was extensible enough that it allowed us to move our data anywhere while being CMS-agnostic. + +When adopting this API-driven workflow, we realized that our data was used in many different places and presented in many different ways. Across our seven web properties, we share everything from graphics to dynamic content. A standard CMS won't do this without a lot of custom development work along with either cron jobs or costly database queries. + +When things are API-driven, you can access all these different datasets across a variety of platforms while largely protecting your infrastructure from major traffic spikes. For example, the OSF collaborated with [Tipit][7], the OSF's digital design and development partner, to develop a completely open source end-to-end event management software. Our event-schedule data is presented on web pages, mobile apps, and digital signage. It's the same data, managed from a single place, but with different presentation layers, formats, and platforms. + +### Open source identity access management + +A cornerstone of moving to a decentralized Jamstack architecture is the need to establish identity and access rights. When using JavaScript to call for things in an API, we may need to require authentication and authorization. Therefore, we had to separate the identity provider from any individual implementation. There are two concepts to this: identity (authN) and identity access management (authZ). The identity provider confirms who you are, while access management confirms what roles and permissions you have to do different things. One of the first requirements when developing the event-management software was to establish a standalone identity provider. + +Enter [OpenStackID][8], which is an [OpenID Connect][9] with oAuth2 SSO solution. OpenStackID started out as a more secure way for users to log into [Openstack.org][10] and manage their profiles. Even as the number of websites and event apps we manage grows, this creates a seamless authentication experience for users. The access-management portion allows us to build standalone React-based apps that use the identity provider to determine if a particular user has the rights to do the things they want to do in that specific application. + +One thing that runs through everyone's mind—especially in a global open source community—is privacy. It's a large factor in creating our web and event properties. With OpenStackID, users can log into their [OpenStackID account][11] and set application permissions using the OAuth 2 console. If they decide they no longer want their app associated with their OpenStackID, they can simply remove permissions. + +For example, we have users for our events that do not want their personal information to be associated with their presence at our conferences. The way the platforms are set up, all personally identifiable data is managed securely on the OpenID server, and it's not shared between applications unless the user strictly enables it. Beyond that, we never share things like the events a user attends or pieces of their user profile unless it's completely anonymized, or they specifically allow it in order to remain aligned with the [Four Opens][12] or our community philosophy. + +### Better web infrastructure using open source + +Taking our considerations and shifting toward a more flexible implementation of a CMS has helped our teams collaborate more effectively. Most importantly, we continue to follow our community values by providing great privacy and security options thanks to open source technology. + +If you're interested in our approach, check out the OSF Foundation website's [source code][13]. You can also access the following source code repos to see the approach in action: + + * [Zuul website][14] + * [Airship website][15] + * [StarlingX website][16] + * [Kata Containers website][17] + * [MOC and Open Infra Labs website][18] + * [Open Stack Foundation website][19] + * [Open Infrastructure Summit admin][20] + * [Open Infrastructure Summit CFP][21] + * [Open Infrastructure Summit Signage][22] + * [OpenStack Survey GraphQL API to access survey data and reports][23] + * [OpenStack Survey Graphene API to feed summit reports][24] + * [OpenStackID authentication system][25] + * [OpenStackID resource server][26] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-web-development + +作者:[Jimmy McArthur][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jimmymcarthur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://osf.dev/ +[3]: https://en.wikipedia.org/wiki/Systems_development_life_cycle +[4]: https://www.silverstripe.org/ +[5]: https://reactjs.org/ +[6]: https://jamstack.org/ +[7]: https://www.tipit.net/ +[8]: https://opendev.org/explore/repos?q=openstackid&tab=&sort=recentupdate +[9]: https://openid.net/connect/ +[10]: http://Openstack.org +[11]: https://openstackid.org/ +[12]: https://osf.dev/about/four-opens/ +[13]: https://github.com/OpenStackweb/openstack-org +[14]: https://opendev.org/zuul/zuul-website +[15]: https://github.com/AirshipWeb/airship-website +[16]: https://github.com/StarlingXWeb/starlingx-website +[17]: https://github.com/kata-containers/www.katacontainers.io +[18]: https://github.com/OpenStackweb/openinfralabs-website +[19]: https://github.com/OpenStackweb/osf-website +[20]: https://github.com/OpenStackweb/summit-admin +[21]: https://github.com/OpenStackweb/call-for-presentations +[22]: https://github.com/OpenStackweb/openstacksignage +[23]: https://github.com/OpenStackweb/openstack-survey-api +[24]: https://github.com/OpenStackweb/summit-reports-api +[25]: https://opendev.org/osf/openstackid +[26]: https://opendev.org/osf/openstackid-resources diff --git a/sources/talk/20200421 How underwater Internet of Things will work.md b/sources/talk/20200421 How underwater Internet of Things will work.md new file mode 100644 index 0000000000..16503a8143 --- /dev/null +++ b/sources/talk/20200421 How underwater Internet of Things will work.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How underwater Internet of Things will work) +[#]: via: (https://www.networkworld.com/article/3538393/how-underwater-internet-of-things-will-work.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How underwater Internet of Things will work +====== +Lasers will be used to power underwater devices and transmit data below the ocean's surface. +North Sea Port + +More than two-thirds of the world's surface is covered by water. It plays an important role in our economic existence, including in major verticals such as oil and gas, shipping and tourism. + +As the Internet of Things proliferates, questions arise as to how IoT will manifest itself underwater given that radio waves degrade over distance in seawater, and underwater acoustic communication (which does actually work okay) is easily eavesdropped on and isn't stealthy. + +To make the underwater Internet of Things happen, light is the answer, some say. Researchers at King Abdullah University of Science and Technology (KAUST) in Thuwal, Saudi Arabia, are proposing underwater optical communications. They're investigating simultaneous lightwave information and power transfer (SLIPT) configurations, which they're using to transmit energy and data to underwater electronic devices. Recently, the researchers announced a breakthrough experiment in which they were able to achieve an underwater, two-way transmission of data and power over 1.5 yards between a solar panel-equipped sensor and a receiver. + +The SLIPT system will be more usable than wires strung. And in the case of human underwater equipment inspections, for example, SLIPT will be less prone to error than hand signals and less prone to audible confusion than ultrasound voice-based communicators. Remarkably, to this day, hand signals are still a common form of communication between divers. + +"SLIPT can help charge devices in inaccessible locations where continuous powering is costly or not possible," said Jose Filho, a PhD student at KAUST, [in an article][1] on the school's web site. + +Filho, who has been involved in developing the laser project, envisages ships or boats on the water's surface beaming optical communications to underwater vehicles or IoT sensors on the ocean floor. The lasers would simultaneously communicate with and power underwater robots and devices. Return data is relayed to the surface vessel, which then communicates to land bases or data centers via RF (radio). + +Surface buoys – or even unmanned aerial vehicles (drones) flying well above turbulent waves – could be used to inject power down to the seabed surface and, at the same time, receive data, researchers believe. + +[][2] + +The school explains that there's still much development that needs to be performed before SLIPT is operational, but it sees potential. "Underwater optical communication provides an enormous bandwidth and is useful for reliably transmitting information over several meters," co-first author Abderrahmen Trichili said in the article. + +KAUST, located on the Red Sea coast, has been involved in this area of technical exploration for some years. It was involved in developing some early, record-breaking underwater data communications. In 2015 it ran a 4.8 gigabit per second, 16-QAM-OFDM transmission with a 450-nanometer laser. OFDM, or Orthogonal Frequency Division Multiplexing, splits single data streams into multiple channels to reduce interference. + +Interestingly, seas and oceans are becoming increasingly important to data centers. Large swaths of the world's population are found on or near coasts, rather than inland, and we're seeing a shift towards edge-style computing that positions resources closer to sources of data. There's also a need for compute cooling, which ocean water can provide. Even wave energy as a method of powering servers means sea and data are becoming intertwined. + +Microsoft launched an [undersea water-cooling data center][3] 117 feet below the water surface in 2018. Additionally, garden-hose-sized cables carry almost all global, public Internet traffic [underwater, across oceans and between continents][4]. It's not done through satellite, as many imagine. + +So, this is not a brand-new synergy. Apart from the eco-monitoring drivers, one of the likeliest and most important reasons that ocean-based computing is being explored keenly is that there isn't any rent payable or jurisdictional ownership on the high seas. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538393/how-underwater-internet-of-things-will-work.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://discovery.kaust.edu.sa/en/article/952/the-power-of-light-for-internet-of-underwater-things +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.networkworld.com/article/3283332/microsoft-launches-undersea-free-cooling-data-center.html +[4]: https://www.networkworld.com/article/3004465/how-vulnerable-are-the-internets-undersea-cables.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200421 IoT offers a way to track COVID-19 via connected thermometers.md b/sources/talk/20200421 IoT offers a way to track COVID-19 via connected thermometers.md new file mode 100644 index 0000000000..a3ba9f972e --- /dev/null +++ b/sources/talk/20200421 IoT offers a way to track COVID-19 via connected thermometers.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IoT offers a way to track COVID-19 via connected thermometers) +[#]: via: (https://www.networkworld.com/article/3539058/iot-offers-a-way-to-track-covid-19-via-connected-thermometers.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +IoT offers a way to track COVID-19 via connected thermometers +====== +The COVID-19 pandemic has catapulted one manufacturer of connected thermometers to national prominence, as Kinsa provides a possible window into the spread of the disease. +[Kinsa / Leaflet / OpenStreetMap / CARTO][1] + +A company called Kinsa is leveraging [IoT][2] tech to create a network of connected thermometers, collecting a huge amount of anonymous health data that could offer insights into the current and future pandemics. + +The company’s founder and CEO, Inder Singh, said that the ability to track fever levels across the U.S. in close to real time could be a crucial piece of information for both the public at large and for decision-makers in the healthcare sector and government. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The system’s networking technology is relatively straightforward – the thermometer connects via Bluetooth to an app on the user’s phone, which reports anonymized data back to Kinsa’s cloud over the Internet. Singh emphasizes that the company only organizes data down to the county level, and asserts that identifying individuals through Kinsa’s data is more or less impossible. + +“We’re not providing PII, we’re not providing identified data,” he said. “The app just guides you to the care and services you need.” + +Armed with the temperature reading and some basic demographic information about the person whose temperature was taken and their other symptoms, the app can offer rudimentary guidance about whether a visit to the doctor is needed or not, and whether the user’s area is seeing unusual levels of fever. + +However, the real value is in the aggregated data that Kinsa analyzes and breaks out on its [U.S. Health Weather Map][1], gleaned from the million-plus thermometers in the company’s ecosystem. The idea, according to Singh, is to provide the public with a way to make more informed decisions about their health. + +“It’s very participatory,” he said. “Everyone gets the data, and everyone can respond.” + +Kinsa still sells its thermometers directly to consumers, but plans are afoot for the company to collaborate more closely with local governments, health authorities and even school districts – Singh said that Kinsa is already partnering with two U.S. states (which he declined to name), and several city governments, including St. Augustine, Florida. + +“Our hope is that we can figure out how to build a scalable model – we’re never gonna scale globally by just selling $20 thermometers,” he said. The goal is to become widespread enough that the product can act as a meaningful early warning system for the healthcare sector. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3539058/iot-offers-a-way-to-track-covid-19-via-connected-thermometers.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://healthweather.us/?mode=Atypical +[2]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200421 What is a High Traffic Website.md b/sources/talk/20200421 What is a High Traffic Website.md new file mode 100644 index 0000000000..d9207af7dd --- /dev/null +++ b/sources/talk/20200421 What is a High Traffic Website.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is a High Traffic Website?) +[#]: via: (https://theartofmachinery.com/2020/04/21/what_is_high_traffic.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +What is a High Traffic Website? +====== + +Terms like “high traffic” are hazardous when designing online services because salespeople, business analysts and engineers all have different perspectives about what they mean. If we’re talking about, say, a high-stakes online poker room, then “high traffic” for the business side will be very low compared to what it is for the technical side. However, all these people will be in a meeting room together making decisions, using the same words to mean different things. It’s obvious how that can lead to bad (and sometimes expensive) choices. + +A lot of my day job is talking to business stakeholders and figuring out the technical solutions they need, so this is a problem I have to deal with. So I’ve got my own purely technical way to think about traffic levels for online services. + +### Scalability vs performance + +First, let’s be clear about two concepts that come up a lot in online service design. + +For online services, performance is all about how well (usually how fast) the system can handle a single request or unit of work. Scalability is about the volume or size of work that can be handled. For online services, scalability is usually about the number of user requests that can be handled within a timeframe, while for batch jobs we typically care about the size of the dataset we can process. Sometimes we want the system capacity to grow and shrink based on demand, but sometimes we don’t care as long as we can handle the full range of workloads we expect. + +Scalability and performance often get confused because they commonly work together. For example, suppose you have some online service using a slow algorithm and you improve perfomance by replacing the algorithm with another that does the same job with less work. Primarily that’s a performance gain, but as long as the new algorithm doesn’t use more memory or something, you’ll be able to handle more requests in the same time. + +There’s a counterexample I’ve discussed before: [internal caches versus external cache servers][1]. Using an external cache server like Redis means your app has to make network calls to do cache lookups, so it has performance overhead. On the other hand, if your app is replicated across multiple machines, a shared, external cache is more effective than a per-app, in-memory cache. The external cache is more scalable. + +### Response time + +When designing systems, it’s helpful to start by thinking about latency or response time requirements, even if we have to make some up and revise them later. Adding more RAM, more caches, more machines or more disk can solve a lot of problems, but latency problems tend to be fundamental to the system design. For example, suppose you’re designing an online game, and you want latencies of under 100ms for all users. Straight away, the speed of light limit means you can’t have one central server supporting a global game, regardless of whatever algorithms or hardware you throw at the problem. + +There’s another reason it’s useful to focus on server response time in practice. If you have a simple, single-function website, such as a mortgage calculator, then the response time can be estimated based on technical things like the hardware specs and code quality. But that’s not how typical online services are built. The online service industry tends to emphasise adding more and more features for less development cost. That means [webpages tend to expand in complexity][2] using the easiest code possible, and only get optimised when they become too slow and users churn. Even the typical mortgage calculator site will end up bloated with advertising and tracking functionality. So the response time of a website in my day job depends mostly on the client’s budget and priorities, not on technical factors, regardless of whether it’s an ecommerce site or a cutting-edge data application. + +### Looking at a single worker + +Okay, so now imagine a simple web app that gets about one request an hour that takes about 5s to process (ignoring static assets because they’re not the bottleneck). That app has an obvious performance problem because many users will give up before 5s. But there’s no scaling problem because the server will practically never hit capacity limits and drop requests. Even if traffic rises, the performance problem is the bottleneck that takes priority over any hypothetical scalability problems. + +That’s a simple insight that we can take further. Lets say we target 100ms per request, and our simple web app processes requests one at a time serially (i.e., no scaling). With 86,400 seconds in a day, a naïve calculation says we can handle 86,400 / 0.1 = 864,000 requests per day before we have scaling problems. + +Of course, the real world isn’t that simple. + +First, there will be slower and faster requests, and [requests that arrive at random won’t balance themselves nicely][3]. They’ll come in clusters that fill up queues, and the backlog will cause large spikes in response time. (There’s a handy rule that says [if you want to keep response time under control, you should target about 80% usage of theoretical total capacity][4].) + +Then there’s diurnal variation. Some local websites get nearly all of their traffic during business hours, or about a third of the day. Even a very global website can easily have 2-3 times more traffic at peak than at trough because populations aren’t distributed evenly around the world (a lot of internet users live in East Asia and North/South America, but not in the huge Pacific ocean). The actual ratio depends on many factors that are hard to predict. + +But even if we can’t easily get exact capacity estimates, this simple model is the justification for splitting websites into three traffic levels. + +### The three traffic levels + +The first level is for sites that get well under 100k dynamic requests a day. Most websites are at this level, and a lot will stay that way while being totally useful and successful. They can also pose complex technical challenges, both for performance and functionality, and a lot of my work is on sites this size. But they don’t have true scalability problems (as opposed to problems that can be solved purely by improving performance). + +If a website gets bigger, it can get into the “growing pains” level, which is roughly around 100k-1M dynamic requests a day. This is where scalability problems start to appear. Often the site is at least a bit scalable (thanks to, e.g., async or multithreaded programming), but Web developers scaling a site through this level keep discovering new surprise pain points. Things that a smaller site can get away with start turning into real problems in this level. Some of the biggest challenges are actually sociotechnical, with the team that builds and manages the site needing to learn to think about it in new ways. + +The next level is after leaving the 1M dynamic requests a day boundary behind. I think of sites at this level as being high traffic. Let me stress that that’s a technical line, not a value judgment or ego statement. The world’s biggest websites are orders of magnitude bigger than that, while most of the world’s useful websites are smaller. But the line matters because you simply can’t run a site at that scale without treating it like a high traffic site. You can get away with it at low traffic levels, you can fumble through it at the growing pains level, but at high traffic levels you just have to work differently. Coincidentally, it’s around this traffic level where it makes more sense to talk about requests per second than requests per day. + +By the way, don’t focus too much on the exact traffic levels above. They’re very rough and honestly I picked them because they’re convenient round numbers that happen to be reasonable for typical websites. The real values depend on the target response time and all the other factors, of course. What I’m trying to explain is 1) that these levels exist, 2) why they exist and 3) what to expect if you’re trying to grow an online service. + +### Going to more levels + +What happens with sites that get even bigger? Once the problems at one set of bottlenecks are fixed, the site should just scale until it hits a new set of bottlenecks, either because the application has changed significantly, or just because of a very large increase in traffic. For example, once the application servers are scalable, the next scaling bottleneck could be database reads, followed by database writes. However, the basic ideas are the same, just applied to a different part of the system. + +Working on a very high-traffic site can be a lot less “exciting” than working on a plain high-traffic site, simply because most major problems need to be solved to get to very high traffic levels in the first place. + +### Scaling when you don’t have scaling problems + +Some developers try to make online services scalable long before they have any scalability problems on the horizon, usually by adding exotic databases or broker servers or something. In particular, startup founders are often especially concerned that their technical assets might not scale to meet their business ambitions. It’s understandable, but it’s a dangerous trap for a couple of reasons. + +One is that Paul Graham’s classic [Do Things That Don’t Scale][5] essay applies to your technology stack, too. You can’t beat bigger companies with scale, but your competitive advantage is that you can choose to _not_ solve the scalability problems that bigger companies are forced to with every step they take. That’s what makes smaller companies agile, and a startup that worries too much about scalability is just a big enterprise without the big to back it up. + +The other problem is that premature scalability solutions can easily backfire. If you don’t have real scalability problems to test your solutions against, it’s hard to be sure you’re correctly solving a real problem. In fact, rapidly growing services tend to change requirements rapidly, too, so the risk of a scalability “solution” turning into technical debt is high. If you keep trying to add scalability to a part of the system that’s already scalable enough, chances are the next scaling bottleneck will appear somewhere else, anyway. + +Architectures that err on the side of too simple are easier to scale in the long run than architectures that are too complex. + +To be more concrete, I personally can’t think of a low-traffic online service I’ve worked on that couldn’t have been implemented cleanly enough using a simple, monolithic web app (in whatever popular language) in front of [a boring relational database][6], maybe with a search index like Xapian or Elasticsearch. [Many major websites aren’t much different from that.][7] It’s not the only valid architecture, but it’s a tried-and-tested one. + +Having said all that, sometimes low-traffic sites need things that are sometimes sold as scalability solutions. For example, replicating an app behind a load balancer can help you deploy whenever you want without downtime. One fintech service I worked on split credit card code into its own service, making PCI DSS compliance simpler. In all these cases there’s a clear problem other than scalability that’s being solved, and that’s what avoids overengineering. + +I often wish I had a systematic way to just figure out all the technical requirements for an online service in my head. But the real world is complicated and messy, and sometimes the only practical way to be sure is to experiment. However, every piece of software starts with ideas, and this is how I think about scalability for online service ideas during the early design phase. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/04/21/what_is_high_traffic.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://theartofmachinery.com/2016/07/30/server_caching_architectures.html +[2]: https://mobiforge.com/research-analysis/the-web-is-doom +[3]: https://theartofmachinery.com/2020/01/27/systems_programming_probability.html +[4]: https://www.johndcook.com/blog/2009/01/30/server-utilization-joel-on-queuing/ +[5]: http://www.paulgraham.com/ds.html +[6]: https://theartofmachinery.com/2017/10/28/rdbs_considered_useful.html +[7]: https://nickcraver.com/blog/2016/02/17/stack-overflow-the-architecture-2016-edition/ diff --git a/sources/talk/20200423 Getting to know our new, virtual world.md b/sources/talk/20200423 Getting to know our new, virtual world.md new file mode 100644 index 0000000000..70eebbbeee --- /dev/null +++ b/sources/talk/20200423 Getting to know our new, virtual world.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting to know our new, virtual world) +[#]: via: (https://opensource.com/article/20/4/virtual-community-management) +[#]: author: (Patricia Dugan https://opensource.com/users/patricia-dugan) + +Getting to know our new, virtual world +====== +Our current forced physical separation could generate innovations that +actually bring our communities closer together. +![Women in computing and open source v5][1] + +Witnessing the ongoing global impact of COVID-19 is a profoundly affecting experience that continues to humble us all in ways we couldn't have anticipated. Technology organizations are quickly evolving within this new reality, in which all of our human interactions are virtual until further notice. + +### Virtual open source community management + +When it comes to nurturing cultures designed to promote and reward open source innovation—as well as communities' economic, technological, and physical wellbeing—I can best speak to those I help build and manage. I believe communities should be built by weaving a tapestry of demographics and ranges of expertise. They should do this in a way that facilitates rich communication and empowers those building open source software to share knowledge with each other. + +The move to virtual connection and digitalized events only makes these methods more crucial. + +I'll share an example. Recently, I was speaking with a pillar of the Traefik open source community, known as a [Traefik Ambassador][2], based in Turkey, over video conference about a potential webinar. He suggested that, instead, we expand the speaker set to include other community members. Soon, we'd invited other contributors from Poland and Switzerland. We met online, and out of that conversation, the webinar has evolved into a collaborative series with community members taking turns presenting insights and melding different types of software together. What struck me was that if we'd had this conversation just one month ago, it would have simply focused on the creation of an asset. Now, contributors are bonding over a purpose-driven creation, with greater intention around facilitating innovation and excitement. + +Based on my experience building and growing open source communities, I believe that this new era of virtual connection offers an unprecedented opportunity for innovation and growth—as long as it is managed with equal focus on the people creating it. Below are five observations on how the world of open source can positively shape the future of innovation in a virtual and seemingly uncertain world. + +### The virtual world is flat. + +Open source communities, teams, and backing companies provide an exceptional model of how to accelerate innovation. That's especially true in these extraordinary times. At its core, open source democratizes the development process, something we see replicated more widely in our new virtual ecosystems. As the opportunity for input becomes more inclusive, organizations are seeing a flattening in infrastructure, both in communications and in operations. Existing hierarchical power structures are weakening as more voices are heard, and the best ideas are given the chance to rise to the top through greater exposure. + +As social distancing makes backchannel and handshake agreements much more complicated to execute, I predict that the traditional dance required to access and take positions in leadership will be replaced by flatter, more open methods that ultimately produce fresher—and better—perspectives. Online communication has a way of laying bare the real substance of interactions and ideas, bolstering meritocracy that's central to the strength of open source. + +### The virtual world is fast. + +This "flattening" structural shift has the potential to increase the pace and quality of innovation, as virtual events and communications widen the spotlight to now shine a light on previously unseen contributors. Creative minds among engineers, developers, and others outside of traditional leadership positions will leverage their comfort with the web and virtual channels to find each other and collaborate faster. This is nothing new for those in open source, and I expect organizations still clinging to legacy approaches will find themselves investing in learning how to implement flatter, virtual communications structures, and beginning to build them into traditional operational models. This means doubling down on efficiency and being willing to let go of the ["it's always been done this way"][3] mentality. + +### The virtual world needs community. + +Developers can conserve energy attending virtual events: there's no commute, nor other distractions from the work at hand. Working remotely and connecting only via virtual mediums enables open source contributors to create, share, and use code just about as fast as their brains allow, empowering rapid code contributions, collaborations, and new solutions produced with velocity. + +While this shift may result in productivity gains, organizations must be careful of creating the impression that a team member's most important asset is their brain. When open source developers were asked what the best part of their job was, [62% claimed it was their "personal passion."][4] Recognizing individuals as unique contributors to open source communities is necessary and essential to development—both technical and human. During this period, when we're hitting the pause button on in-person interaction, remote interactions via chats, video conferences, and phone calls will enable the human moments necessary for growth and connection. Those in open source rely on the power of community, and this extraordinary time will require the continuous and earnest commitment to it. + +### The virtual world is composed of individuals. + +The potential for greater innovation and meritocracy through virtual-only channels will only be realized if communities, organizations, and individuals also pursue and achieve wellness. It's crucial for the interpersonal bonds that maintain our energy and psychological health—traditionally forged through real-life, face-to-face contact—to continue to exist as part of the way we now work. If that disappears, there's the risk that our industry and communities become purely transactional, lacking the joy and drive that carries work forward, much less great work and innovation. Developers are especially rooted in a sense of purpose, with [only 3% reporting that money and perks were the best part of their job.][4] + +Overall wellness and support to prevent burnout should already have been central considerations for modern organizations, but they are even more important now. Virtual connectivity may set us up to work fast, but that can backfire if we're not also set up to be well. + +### The virtual world needs kindness. + +I also predict that virtual-only communication will close the distance between our online avatars and ourselves as real people. The impact of "toxic" individuals, hidden behind a computer, with little to no consequence for being a "bad actor," will be reduced and less acceptable. A growing presence of new voices will set the tone, adhering to well thought out codes of conduct, making poor behavior explicitly unwelcome. As much of our connection moves online, the norms that guide our offline behavior will become increasingly important. We'll transition to a less individualistic paradigm, and open source's long history of considering what defines good citizenship will offer insight to those looking to integrate a sense of shared responsibility into organizations. + +I feel extremely grateful to be in technology, particularly in the open source world, given it's an industry built upon the promise of innovation. At least for the moment, we as an industry can serve as a lighthouse for connection in difficult times, and as a model for collaboration and intention for those not as familiar with how to be highly productive in a virtual world. For the open source community and beyond, there is a great opportunity to lean into creating as much beneficial virtual culture as we can. Through this experience, we'll all learn new ways of interacting, which will serve us well in the future. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/virtual-community-management + +作者:[Patricia Dugan][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/patricia-dugan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss (Women in computing and open source v5) +[2]: https://info.containo.us/traefik-ambassador-program +[3]: https://goleansixsigma.com/the-most-dangerous-phrase/ +[4]: https://www.linuxfoundation.org/wp-content/uploads/2019/10/osjobsreport_2018.pdf diff --git a/sources/talk/20200424 FCC boosts Wi-Fi 6 spectrum five-fold.md b/sources/talk/20200424 FCC boosts Wi-Fi 6 spectrum five-fold.md new file mode 100644 index 0000000000..4d3545f522 --- /dev/null +++ b/sources/talk/20200424 FCC boosts Wi-Fi 6 spectrum five-fold.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FCC boosts Wi-Fi 6 spectrum five-fold) +[#]: via: (https://www.networkworld.com/article/3540288/fcc-boosts-wi-fi-6-spectrum-five-fold.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +FCC boosts Wi-Fi 6 spectrum five-fold +====== +The Federal Communications Commission has approved a chunk of wireless spectrum called the 6GHz band for unlicensed use by Wi-Fi 6, and gear that supports it could be available by the end of the year. +[tejasp][1] [(CC0)][2] + +The Federal Communications commission has opened up a wide swath of wireless spectrum for unlicensed use by Wi-Fi devices, which will lead to Wi-Fi access points that have greatly expanded capacity. + +It’s a huge victory for the Wi-Fi industry, as the ruling means that the amount of spectrum available for Wi-Fi just about quintupled in an instant. That means big, spacious channels – and a lot more channels overall – that can handle a lot more data and a lot more connections at the same time, according to Aruba vice president of wireless strategy and standards Chuck Lukaszewski. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +“Overnight, you’re going to see an additional gigabit per second or more of potential throughput,” he said. + +That’s a major upside, certainly, even if “overnight” might be a slightly optimistic view of when [Wi-Fi 6E][4] – the trade name for the new version of Wi-Fi that will take advantage of the new spectrum – hits the market. While some of the necessary standards haven’t yet been finalized by the IEEE, the basic ability to use 6GHz frequencies is already written into the existing Wi-Fi 6 specification. + +Broadcom director of product marketing and government affairs Chris Szymanski said that the main technical hurdle to implementing Wi-Fi 6E will be new radios, but that his company is among those that has already been designing and building compatible silicon. + +“I expect that the FCC will provide guidance on how to certify devices in the next few months,” he said. “I expect product available in the US in the late fall before the holidays.” + +Enterprise uptake will likely have to wait until compatible smartphones, laptops and the like are on shelves because existing Wi-Fi 6 cliets won’t be able to take advantage of the new 6Ghz spectrum. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][5] ]** + +New access points are likely to have three radios in them, as opposed to the usual two, noted senior vice president of Ruckus Wireless and cloud at Commscope Bart Giordano. One each for the existing 2.4GHz and 5GHz bands, and a third for 6Ghz. + +“Antennas will be very similar because these spectrums sit next to one another,” he said, “but there’s specific tunings you have to do.” + +The driving force behind the spectrum expansion is the bottomless demand for capacity caused by the increasing use of wireless just about everywhere. The FCC’s announcement cites projections from Cisco that say about 60% of worldwide data traffic will move across Wi-Fi links within the next two years. + +Incumbent licensed users of parts of the 6GHz spectrum – which are mostly businesses using microwave links for wireless backhaul and public safety services – are far less pleased by the FCC’s decision. The Utilities Technology Council is one of several groups critical of earlier proposals to open the 6GHz band to broad-based unlicensed use, saying earlier that assurances that existing users would be protected from interference are unconvincing. + +“We have and will continue to provide the FCC with technical detail demonstrating the very real interference potential from unlicensed use across all parts of the band and the need for thoroughly tested automated frequency coordination (AFC) to protect incumbent users,” the group said in a statement. “While we appreciate the FCC proposing to require AFC for the standard-power access points, these measures must also be applied to all unlicensed devices in the band to prevent interference to mission-critical utility communications systems.” + +Farpoint Group principal and Network World contributor Craig Mathias said that it’s not going to be a smooth process, but argues that the opening of 6GHz spectrum was too great an opportunity to ignore. + +“Yes, it’s a mess – spectral re-allocations always are,” he said. “[But] I don't see any issues here that can't be addressed, and more unlicensed spectrum is of course always desirable.” + +Incumbent users of the 6GHz spectrum are unlikely to see the type of interference they’re particularly worried about, he added, given the nature of the connections currently in use and the safeguards in the new rule that are designed to protect existing networks. + +“Point-to-point microwave links operate at fairly high power and use both directional antennas and error-checking protocols to ensure reliability and otherwise deal with typical radio issues beyond interference, like the various forms of fading,” said Mathias. “A nearby Wi-Fi transmitter will be operating at much lower power and use its own signal-integrity-management techniques as well. So likely no issues in the vast majority of cases, especially if history is any guide.” + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3540288/fcc-boosts-wi-fi-6-spectrum-five-fold.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/en/wifi-wireless-device-wi-fi-1371030/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3238664/80211-wi-fi-standards-and-speeds-explained.html +[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200424 Red Hat Enterprise Linux 8.2 Hits the stage.md b/sources/talk/20200424 Red Hat Enterprise Linux 8.2 Hits the stage.md new file mode 100644 index 0000000000..e00e88716c --- /dev/null +++ b/sources/talk/20200424 Red Hat Enterprise Linux 8.2 Hits the stage.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat Enterprise Linux 8.2 Hits the stage) +[#]: via: (https://www.networkworld.com/article/3540189/red-hat-enterprise-linux-82-hits-the-stage.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Red Hat Enterprise Linux 8.2 Hits the stage +====== +RHEL 8.2 has new capabilities for management of hybrid-cloud environments and container tools to help fuel cloud-native development. +Stephen Lawson/IDG + +Red Hat Enterprise Linux (RHEL) 8.2 brings new features that include expanded monitoring capabilities in Red Hat Insights for and new container tools, including containerized versions of Skopeo and Buildah. + +Red Hat says RHEL 8.2 is arriving at a time when, because of the Covid-19 pandemic, a growing percentage of IT staffers are working remotely. Their ability to support the management and monitoring of operations and their ability to detect and address problems has never been more critical, and upgrades to Red Hat Insights are designed to help. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +### Red Hat Insights + +[Red Hat Insights][2], is Red Hat’s operations and security-risk-management offering and helps detect, diagnose and remediate potential problems before they affect production systems or end users. It was included in RHEL in May 2019. + +The latest updates include: + + * Improved visibility and  security for managing large, complex environments + * Policy and patch services to help determine which product advisories apply and guidance for problem remediation + * A "drift service" to make it easier to compare baselines, shape strategies that reduce complexity, and make troubleshooting easier + + + +### Monitoring and performance updates + +RHEL 8.2 brings some performance upgrades includeing: + + * Improved resource management with Control Groups (cgroup) v2, which is designed to reserve and set limits on memory usage to help prevent processes from overconsuming memory and causing system failures or slowdowns. + * Optimizing performance-sensitive workloads via NUMA and sub-NUMA service policies. + * Performance Co-Pilot (PCP) 5.0.2 which adds collection agents for Microsoft SQL Server 2019 to gather and analyze SQL Server metrics to draw a clearer picture of database and operating-system performance. + * Red Hat subscription watch,a service for viewing and managing RHEL and Red Hat OpenShift Container Platform subscriptions. + + + +### Evolving container tools + +RHEL 8.2 includes new container tools that are supported for 24 months as part of Red Hat's Tech Preview, which provides early access to new products. The tools include Buildah for building and Skopeo for transferring container images. + +The new relase also introduces Udica, a policy tool for containerized SELinux that can make it less likely that processes will break out of containers and cause problems to other containers or the host. + +[][3] + +Red Hat Enterprise Linux 8.2 also introduces enhancements to the Red Hat Universal Base Image, including: + + * OpenJDK and .NET 3.0 for developing  certification-ready cloud-native Red Hat applications + * **Improved access to source code associated with a given image through a single command**, making it easier for Red Hat partners to meet source code requirements for open source licensing needs. + + + +### Ease of use + +Other new features are meant to make it easier to manage RHEL: + + * RHEL subscription registration as part of the installation process, making it easier to on-board new installations. + * Enabling Red Hat Insights during installation to simplify the launch of Insights for Red Hat Enterprise Linux deployments. + * Refinement and control of the Red Hat Enterprise Linux life cycle with testing for in-place upgrades, Red Hat Insights rules to help with upgrades, and the [Convert2 RHEL][4] tool that can help shift workloads from unsupported clones like CentOS to RHEL. + + + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3540189/red-hat-enterprise-linux-82-hits-the-stage.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.redhat.com/en/blog/expanding-management-operational-and-security-risks-new-red-hat-insights +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.redhat.com/en/blog/convert2rhel-how-update-rhel-systems-place-subscribe-rhel +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200427 Comparing subscription, pay-per-bug, and consulting software business models.md b/sources/talk/20200427 Comparing subscription, pay-per-bug, and consulting software business models.md new file mode 100644 index 0000000000..c7d76c5590 --- /dev/null +++ b/sources/talk/20200427 Comparing subscription, pay-per-bug, and consulting software business models.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Comparing subscription, pay-per-bug, and consulting software business models) +[#]: via: (https://opensource.com/article/20/4/open-source-business) +[#]: author: (Jos Poortvliet https://opensource.com/users/jospoortvliet) + +Comparing subscription, pay-per-bug, and consulting software business models +====== +Learn how NextCloud achieves business revenue that is one-third +consulting and two-thirds subscription. +![A chair in a field.][1] + +At FOSS Backstage this year, I hosted a discussion on open source models and shared why I think subscriptions are a great way to support open source products. + +### Picking a business model + +The company I co-founded, Nextcloud, only offers its services to customers on a (per user) subscription model. Some customers ask us during the sales conversation why they cannot just get access to our engineers on an hourly basis as they get from third party consultants: pay for the bug fix or support case, and be done? + +When we discussed how to build our new company in 2016 during our very first "[hackweek][2]," our business model was an important conversation. The team discussed different approaches, and we decided to go for a subscription model. Such a model felt more in line with our mission and principles to [create a great product and run a trustworthy company.][3] + +Why? While hourly rates seem like an easy way to get a quick fix for a problem, getting paid for fixing issues creates an incentive to create more buggy software, which of course, was not how we want to run our business. + +Let's look a bit deeper at the choices. + +### Subscription + +As a customer, you want the most reliable software. And when (not if, when) things go wrong, you want them fixed as quickly as possible. Our company offers customers a subscription to our services. Such a subscription includes direct and unlimited access to our engineers the moment you run into a problem. These two points are very important. It means that a customer has the certainty of having the very best resources at their fingertips at the moment they need them, and as much as they need them, in a way that only the original software vendor can deliver. + +For that, they pay a fee that scales with the number of users. + +### Pay-per-bug + +What if, instead, you could pay per issue fixed? In a way, this choice is similar to insurance. Indeed, when you need cold medicine once a year, the cost of a health insurance policy with a monthly premium seems prohibitive. But when a car accident crushes your spine and your medical costs skyrocket, not having to sell your house makes up for that premium and then some. + +There is also the bigger picture: The incentives potentially created by a pay-per-bug model. It is a simple, albeit cynical calculation: If we got paid per bug we fix for customers, leaving more bugs in our product would increase our income. Now we're not saying every company offering product consulting by the hour is extorting their customers, merely that this backward incentive exists, even when most moral businesses would not give in to it. + +Conversely, now that we offer insurance, we lower our support costs by building a better product, just like art insurance providers do what they can to ensure the art kept at their customers' exhibition is secure to keep their costs low. Our support team deeply cares about how our customers use our product: a better setup and good security practices not only make happier customers; it saves them time. + +Or, in other words, it helps maximize the ROI or TEI the customer gains from deploying Nextcloud. + +That is what we'd call a win-win and a business model an open source company can be proud of. + +### Consulting + +Now I discuss this business model regularly with others, and I invariably get told: "You might be right, but most of my customers only want to pay for the bugs we fix, or for features. Consulting is our main source of income! And I have no illusions about changing that." + +Yes, that's an issue. We open source folk honestly have a sales and marketing issue. And yes, you might think that, as a marketing guy, I just see everything as a nail I can hit with my communications hammer. But really, communication is core to the issue—how you communicate your value—which, in turn, requires you to be aware of your value. + +Recently, I had some challenging discussions with users on our forums who were upset that our engineers had not fixed their issues quickly enough. These users were clearly business users, and giving free support on GitHub obviously isn't exactly a great advertisement for the need for a subscription. So some abuse was thrown our way, and I took the hit. When complaining about it all to a fellow entrepreneurial friend of mine, he remarked: "Isn't that good news? They were frustrated and angry because clearly, you have something to offer, they need it, and are annoyed that they are forced to pay you for it. A good place to be in if you want to sell something!" Right he was, of course. + +The lesson I want to share with this anecdote is: You have something to offer. Your current customers will certainly be upset if you tell them that, going forward, they can only get your services under a subscription. But the angrier they are, the more you know they _need_ you, and you should persist! + +But moving to subscription from consulting requires a great deal of discipline, including saying "no" often. We have hard, internal rules, and one of these is that sales can only sell consulting valued at up to 50% of the subscription value, and only for deals greater than $10,000. + +But it has worked. The breakdown of our business revenue is now about one-third consulting and two-thirds subscription. Engineering hours for consulting work are not the limiting factor for expanding our customer base; sales and sales engineering is. We doubled our order intake last year and plan to do the same this year. + +### Bottomline: Sustainability + +For us, a better product and more sustainable business follows from the subscription model. It also benefits software engineers, who prefer to build a better product and spend less time on debugging issues with customers. A pay-by-the-hour model, with all the time tracking and incentive to keep customers dependent, does not work for us. + +What has your experience been? Tell us in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-business + +作者:[Jos Poortvliet][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jospoortvliet +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_WorkInPublic_4618517_1110_CS_A.png?itok=RwVrWArk (A chair in a field.) +[2]: https://nextcloud.com/blog/invitation-to-our-hackweek-in-stuttgart/ +[3]: https://nextcloud.com/blog/the-nextcloud-mission-and-principles/ diff --git a/sources/talk/20200427 DevOps vs. Agile- Do they have anything in common.md b/sources/talk/20200427 DevOps vs. Agile- Do they have anything in common.md new file mode 100644 index 0000000000..a8fcf422c6 --- /dev/null +++ b/sources/talk/20200427 DevOps vs. Agile- Do they have anything in common.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps vs. Agile: Do they have anything in common?) +[#]: via: (https://opensource.com/article/20/4/devops-vs-agile-common) +[#]: author: (Taz Brown https://opensource.com/users/heronthecli) + +DevOps vs. Agile: Do they have anything in common? +====== +Agile and DevOps have many differences, yet they both seek to address +complexity, improve quality, and innovate around software design. +![Women in tech boardroom][1] + +The topic of DevOps vs. Agile is almost like debating iPhone vs. Android—everyone has an opinion, and emotions can become heated, especially if people disagree. + +After writing _[DevOps v. Agile: What's the difference?][2]_ and reading the comments on the article, I wanted to add some more thoughts—including how some of my thinking has changed on the topic. + +My perspective comes from where I am now but also where I have been. I used to be a systems administrator and infrastructure engineer, and now I am a senior scrum master with a major utility company in Missouri. (I actually was a scrum master before I was an admin or engineer, but I digress.) + +My team consists of six frontend software engineers and IT programmer analysts, a business analyst, two product owners, and me. Recently, we learned that management wants our team to become a [DevSecOps][3] team, so our core scrum team is working with a DevSecOps team that is helping us make the transition. No one is naive to the fact that this will not be easy, but the DevSecOps team's experience gives us confidence that we can succeed. + +Our team's manager recently hired a senior software engineer who will drive the DevSecOps goal. As a scrum master, I will continue to focus on continuous improvement. The team is fairly young, so they don't have expansive work experience, but they are smart and driven, and there is much room for greatness. In addition, our entire organization is going through an Agile transformation, so most people are new to all things Agile, including the [Agile Manifesto][4] and the [Five Scrum Values][5]. + +![Spray paint on a container][6] + +Kyle Glenn on Unsplash + +### Agile, Scrum, DevOps, and more + +There is a clear relationship between DevOps and Agile. Agile is the methodology, Scrum is the framework, and DevOps falls under the agile [umbrella][7] along with kanban, lean, large-scale Scrum, Extreme Programming, Crystal, and more. For example, our Scrum team is an Agile team that will operate as a DevSecOps team. + +Neither DevOps nor Agile is about the tools. Rather, both are about the [mindset and culture][8]. When it is done right, teams think and act differently and achieve greater results, including faster software delivery, continuous integration (CI), continuous delivery (CD), continuous improvement, working software, faster solutions, more collaboration, and fewer silos. Additional results are seen in quality testing, better automation, and improved systems, processes, and practices. + +#### Common concepts + +Some of the Agile concepts they have in common are associated with the Agile Manifesto; the most familiar of the 12 principles are the first four: + + * Individual and interactions over processes and tools + * Working software over comprehensive documentation + * Customer collaboration over contract negotiations + * Responding to change over following a plan + + + +Some of the DevOps concepts they have in common are the CI/CD pipeline, optimizing software delivery and quality, a culture of innovation, service-level objectives and indicators (SLOs and SLIs), collaboration across teams, and automation. + +#### DevOps and Agile benefits + +DevOps speeds up things between developers and operations. Furthermore, even though DevOps isn't about the tools, the fact that the dev and ops teams use the same tech stack creates a shared language and empathy between the two. Our Scrum team uses Jira to track all bugs, enhancements, and team performance. Common DevOps tools are Jenkins, AWS, SonarQube, GitHub, Splunk, and Ansible. While the tools differ from team to team, the mindset and culture should be common across all. + +DevOps also creates less division between dev and ops and a sense of understanding of what it's like to walk in each other's shoes because now they function as one. + +Agile teams continuously deliver often and fast, adapting incrementally along the way. Working in two-week sprints appears to be the sweet spot for most software- or product-delivery teams. Agile teams may utilize DevOps principles in their work (e.g., implementing a CI/CD pipeline), and dev teams that work with ops are likely to work in the same two-week increments. + +DevOps traditionally leads to continuous deployment, delivery, and integration. Teamwork is integrated; problems and failures are jointly owned by development, operations, and other entities, such as quality assurance (QA), testing, automation, etc. + +### Summing up + +I believe that Agile and DevOps breathe the same air, with many concepts and theories crossing between them. + +While I have no doubts that there will be counter opinions and even some sharply worded disagreements with my opinions, I think we would all agree that Agile and DevOps seek to address complexity, improve quality, and innovate around software design. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/devops-vs-agile-common + +作者:[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/christina-wocintechchat-com-rg1y72ekw6o-unsplash_1.jpg?itok=MoIv8HlK (Women in tech boardroom) +[2]: https://opensource.com/article/20/2/devops-vs-agile +[3]: https://opensource.com/article/19/1/what-devsecops +[4]: https://agilemanifesto.org/ +[5]: https://www.scrumalliance.org/about-scrum/values +[6]: https://opensource.com/sites/default/files/uploads/roomtogrow_kyleglenn.jpg (Spray paint on a container) +[7]: https://opensource.com/article/20/4/kanban-devops +[8]: https://opensource.com/article/19/5/values-devops-mindset diff --git a/sources/talk/20200428 How I empower and reach millions through open source.md b/sources/talk/20200428 How I empower and reach millions through open source.md new file mode 100644 index 0000000000..a3c23dd073 --- /dev/null +++ b/sources/talk/20200428 How I empower and reach millions through open source.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I empower and reach millions through open source) +[#]: via: (https://opensource.com/article/20/4/interview-Netha-Hussain) +[#]: author: (Jay Barber https://opensource.com/users/jaybarber) + +How I empower and reach millions through open source +====== +Learn how Netha Hussain, winner of the 2020 Women in Open Source +Academic Award, shares knowledge and inspires people. +![Lightbulb][1] + +"I wanted to link to a particular Wikipedia article on my blog, but I found there wasn't one on that topic, so I wrote it myself," says Netha Hussain, 2020 [Women in Open Source Academic Award][2] winner. "That's the beauty of open source; anyone can contribute." + +![Photo by Lvova Anastasiya \(Львова Анастасия, Lvova\), CC BY-SA][3] + +Practicality drove Netha's entry into open source culture, and it has continued to be at the center of her work in the ten years since. + +She received her first computer in high school, but it did not immediately spark her passion. She says she mostly used it for games and other diversions, as many teenagers do. It wasn't until she entered medical school and realized that technology could be a powerful tool to help her achieve her goals that Netha truly found her path. Taking stock of her many contributions to [Wikimedia][4], [Mozilla][5], and [TED][6], it's fair to say that once she engaged with open source culture, she never looked back. + +### Finding ways to help + +Growing up in India, Netha was initially drawn to mathematics but soon found herself pulled in other directions. "At the time, I would have expected to continue down that path, mathematics or maybe writing, but the thing that I've always most wanted to do is help people," Netha says. "Medicine seemed to be the most direct path to providing real, tangible assistance to those around me, so I became a doctor." + +That drive to help continues to guide her now as she prepares to defend her doctoral thesis in clinical neuroscience at the University of Gothenburg in Sweden. + +"At a certain point, I decided that rather than limiting myself to what I could do through treating patients, I could also contribute in a research capacity, working to discover new, better ways to help others. I came to all of this via an unexpected route, but I love the idea of exploring and finding my own ways to help. I'm so satisfied and fulfilled by the work I'm doing now. It has been a wonderful journey." + +As she nears the completion of her degree, Netha reflects upon what she's looking forward to next. An infectious smile appears as she remarks, "I'm really excited to have more time to contribute to projects in the open source community." + +Why is she so enamored with open source? It comes back to utility. "In open source practices, I found a philosophy that closely matched my own ideals and a way of doing things that allowed me to help more people. Open source is fueled by collaboration. I've seen the things that can be accomplished by people working together, and it makes me very excited to think where it will take us in the future." + +### Reaching millions, one edit at a time + +Her first article, written to help an international audience understand her blog post, was only the first of many. Netha has now written 300 articles (200 in English and 100 in Malayalam), contributed 13,000 edits for [Wikipedia][7], added 9,000 images to [Wikimedia Commons][8], and provided 120,000 edits to [Wikidata][9]. Her commitment to bringing useful information to others can also be seen in her five years spent volunteering to translate Mozilla projects and TED talks into the Malayalam language. + +Such prolific output was born out of a simple realization. "I had shared so much on my blog but was only reaching a select audience. On Wikipedia and elsewhere, I had access to a potential audience of millions. There's a lot of power in that." + +Many of the articles Netha has written center on issues relevant to women, and that is very much by design. "I find myself writing on topics that are important to women because I feel they are an underserved community, and it is important to me that Wikipedia, as such a vital repository of information, be reflective of all users, all voices. I care deeply about the visibility of women on Wikipedia." + +Netha's commitment to women's issues led her to organize edit-a-thon initiatives and other activities with women's groups. She was also able to leverage similar strategies to assist the LGBTQ+ community in India during the campaign to legalize gay marriage. + +"In India, there are a lot of taboos around homosexuality, and I saw an opportunity to utilize my experience to help another segment of the population. Together, we were able to generate a lot of awareness, whether through raising up biographical articles on famous members of the LGBTQ+ community or shining a spotlight on anti-LGBTQ+ laws. I'm very proud of the opportunities I've had to support such efforts." + +### A path to the future + +It's clear that Netha believes strongly in empowering people, especially other women who may wish to explore open source methodologies as she has. Her advice is simple, but powerful. "Believe in yourself, and know that you have the skills and talent to do whatever you'd like to do," she finds the words easily, as if she's been waiting to be asked the question. "Follow your passion, and do what you want. There will be times of uncertainty but always move forward. Keep studying. Keep learning new things. That's how you grow, both in your field and as a person." + +Having achieved so much already, it's no surprise that Netha is enthusiastic about new challenges on the horizon. "I've put in a lot of effort to get here, but as you learn new strategies and new ways of collaborating, the work gets easier. Now, I don't consider it work at all. It's mostly fun to me." + +_Also read Jay Barber's [interview with Megan Byrd-Sanicki][10], who won the 2020 Women in Open Source Community Award._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/interview-Netha-Hussain + +作者:[Jay Barber][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jaybarber +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) +[2]: https://www.redhat.com/en/about/women-in-open-source +[3]: https://opensource.com/sites/default/files/uploads/netha_headshot.png (Photo by Lvova Anastasiya (Львова Анастасия, Lvova), CC BY-SA) +[4]: https://www.wikimedia.org/ +[5]: https://www.mozilla.org/en-US/ +[6]: https://www.ted.com/ +[7]: https://www.wikipedia.org/ +[8]: https://commons.wikimedia.org/wiki/Main_Page +[9]: https://www.wikidata.org/wiki/Wikidata:Main_Page +[10]: https://opensource.com/article/20/4/interview-Megan-Byrd-Sanicki diff --git a/sources/talk/20200430 Industrial robots could -eat metal- to power themselves.md b/sources/talk/20200430 Industrial robots could -eat metal- to power themselves.md new file mode 100644 index 0000000000..45995a9660 --- /dev/null +++ b/sources/talk/20200430 Industrial robots could -eat metal- to power themselves.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Industrial robots could 'eat metal' to power themselves) +[#]: via: (https://www.networkworld.com/article/3540194/industrial-robots-could-eat-metal-to-power-themselves.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Industrial robots could 'eat metal' to power themselves +====== +Scavenging energy by foraging for metal could power Internet of Things electronics and robots, suggest researchers at University of Pennsylvania. +Jiraroj Praditcharoenkul / Getty Images + +A fundamental manufacturing shift is on the horizon, some say. It's where robots run all elements of our future factories. The machines will operate using brain-copying artificial intelligence and handle not only manufacturing processes, but also supply-chain logistics, planning, and other roles formerly performed by humans. + +This vision of the future anticipates an industrial workplace where Internet-connected machines will mimic humans, yet do the jobs more precisely, faster and cheaper than humans. + +And the human-copying element may not end there. Researchers at the University of Pennsylvania are suggesting that robots could end up eating like humans, too. + +Robots will "eat metal for energy," according to a [news article][1] published in Medium. The researchers' vision for a "metal-air scavenger" could solve one of the quandaries of future IoT-enabled factories. That quandary is how to power a device that moves without adding mass and weight, as one does by adding bulky batteries. + +The answer, according to the University of Pennsylvania researchers, is to try to electromechanically forage for energy from the metal surfaces that a robot or IoT device traverses, thus converting material garnered, using a chemical reaction, into power. + +"Robots and electronics [would] extract energy from large volumes of energy dense material without having to carry the material on-board," the researchers say in a paper they've published in [ACS Energy Letters][2]. + +It would be like "eating metal, breaking down its chemical bonds for energy like humans do with food." Batteries work by repeatedly breaking and creating chemical bonds. + +The research references the dichotomy between computing and power storage. Computing is well suited to miniaturization, and processers have been progressively reduced in size while performance has increased, but battery storage hasn't. You need a bigger battery for more energy. + +Even if swarming, industrial robots became the size of insects (I've [written about][3] the possibility), there's an issue powering the nano devices – the required size of the power source would defeat the object of the miniaturization. The battery alone could crush the device, and even if it didn't, the machine would need excessive amounts of energy to move, because of the battery mass. This conundrum is one of the reasons there's an emphasis in IoT development to find ways to harvest energy ambiently. + +However, with ambient power – such as is found in [solar or potentially magnetism][4], for example – power density comes into play. That's where the harvesting technology can't pull enough energy out of the environment, or it does it so slowly that it's not as power-effective as traditional batteries. + +Enter the metal-eating robot. The University of Pennsylvania researchers' form of harvesting efficiently replicates a power-dense battery. Metal is more dense than the battery chemistry. + +The group performs their foraging energy production with a hydrogel electrolyte sponge towed by the robot. It uses a cathode, dragged over the surface, to extract amperages from the metal fuel source, such as steel or aluminum. + +"Our [metal-air scavenger] has a power density that's ten times better than the best harvesters, to the point that we can compete against batteries," said James Pikul, an assistant professor in the University of Pennsylvania's Department of Mechanical Engineering and Applied Mechanics and one of the paper authors, in the Medium post. "It's using battery chemistry, but doesn't have the associated weight, because it's taking those chemicals from the environment." + +This method is also potentially better than existing lithium-ion battery chemistry, according to Pikul. + +"One day, a robot that needs to recharge its batteries will just need to find some aluminum to 'eat,'" Pikul said. + +The robot, although ultimately likely to be a better worker than the human, is a messy eater. As it oxidizes the metal it passes over, it leaves a "microscopic layer of rust in its wake," according to the article. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3540194/industrial-robots-could-eat-metal-to-power-themselves.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://medium.com/penn-engineering/penn-engineerings-new-scavenger-technology-allows-robots-to-eat-metal-for-energy-bd12f3b83893 +[2]: https://pubs.acs.org/doi/10.1021/acsenergylett.9b02661 +[3]: https://www.networkworld.com/article/3429200/self-organizing-micro-robots-may-soon-swarm-the-industrial-iot.html +[4]: https://www.networkworld.com/article/3536697/harvesting-ambient-energy-will-power-iot-scientists-say.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200501 Red Hat Summit 2020 virtual experience.md b/sources/talk/20200501 Red Hat Summit 2020 virtual experience.md new file mode 100644 index 0000000000..334c52c1f9 --- /dev/null +++ b/sources/talk/20200501 Red Hat Summit 2020 virtual experience.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat Summit 2020 virtual experience) +[#]: via: (https://www.networkworld.com/article/3541289/red-hat-summit-2020-virtual-experience.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Red Hat Summit 2020 virtual experience +====== + +[Virginiambe][1] [(CC BY-SA 3.0)][2] + +In the last couple days, Red Hat was able to demonstrate that an online technical conference can succeed. The Summit, normally held in Boston or San Francisco, was held online thanks to the Covid-19 pandemic still gripping the world. + +The fact that 80,000 people attended the online event warrants a huge applause. By comparison, last year’s in-person conference broke the record with only 8,900 attendees. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### **Being “there”** + +The experience of attending the conference was in many ways what you would expect when attending a large conference in person. There were keynotes, general sessions and breakout sessions. There were many opportunities to ask questions. And it was often difficult but necessary to choose between parallel sessions. I attended both days and was very impressed. + +I also enjoyed some nostalgia about how we’ve all arrived at the places we are today with respect to Linux. It was clear that many attendees were overwhelmed by the progress that has been made just since last year. Linux, and [RHEL][4] in particular, is becoming more innovative, more clever in the ways that it can detect and respond to problems and yet in some important ways easier to manage because of the way the tools have evolved. + +Announcements at the conference included Red Hat OpenShift 4.4, OpenShift virtualization and Red Hat Advanced Container Management for Kubernetes. + +What was novel about attending a technical conference online was that we didn’t have to leave our home or office and that we could review sessions that we missed by selecting them later from the session layout pages. In fact, the sessions are still online and may well be for the coming year. If you didn’t participate in Red Hat Summit 2020, you can still sign up and you can still watch the sessions at your convenience. Just go to the [summit site][5]. And, did I mention, that it's free? + +### Catching up + +Once you’re signed up, you can click on the Watch and Learn at the top of the page and choose General Sessions or Sessions and Labs. The presentations will now all be labeled On Demand though they once displayed upcoming time slots. The individuals presenting information are excellent and the material is exciting. Even if you’re not working with Red Hat Enterprise Linux, you will learn a lot about Linux in general and how open source has evolved over the decades and is still evolving in important and critical ways. + +Topics covered at the conference include OpenShift, open hybrid cloud, future technologies, robotics and automation, advances on the edge and the power of open source. Red Hat Summit also includes joint sessions with both Red Hat and technology collaborators such as Ford, Verizon, Intel, Microsoft and Credit Suisse. + +### What’s next? + +Watching the conference online at a time when I can't leave my home was informative, but also encouraging and comforting. Linux has been an important part of my life for decades. It felt good to be connected to the larger community and to sense the currents of progress through my desktop system. + +While there’s no way to know at this point whether future Red Hat Summits or other Linux conferences will be held or made available online, the fact that Red Hat Summit 2020 was available online when so many of us are still huddled up at home wondering when our world will reopen was a testament not just to great technology but to the deep-seated conviction that it is critical that we work together and that open source can make that happen in ways that nothing else can. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3541289/red-hat-summit-2020-virtual-experience.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://commons.wikimedia.org/wiki/File:Red_hat_with_bow2.JPG +[2]: https://creativecommons.org/licenses/by-sa/3.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3540189/red-hat-enterprise-linux-82-hits-the-stage.html +[5]: https://www.redhat.com/summit +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200502 The real impact of canceling PyCon due to COVID-19.md b/sources/talk/20200502 The real impact of canceling PyCon due to COVID-19.md new file mode 100644 index 0000000000..aebbbf28c4 --- /dev/null +++ b/sources/talk/20200502 The real impact of canceling PyCon due to COVID-19.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The real impact of canceling PyCon due to COVID-19) +[#]: via: (https://opensource.com/article/20/5/pycon-covid-19) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +The real impact of canceling PyCon due to COVID-19 +====== +An interview with Ewa Jodlowska on how the Python Software Foundation is +responding to the cancelation of in-person events. +![A dollar sign in a network][1] + +The Python Software Foundation (PSF) had to [cancel its popular PyCon US][2] event in response to COVID-19. I interviewed [Ewa Jodlowska][3], Executive Director of the PSF, to talk about the experience and see what we all can learn, and how we can be supportive of the non-profit that supports one of my favorite programming languages. + +### The impact on PSF employees + +I asked Jodlowska "how have you had to adjust your work in light of COVID-19?" + +In her response, the day-to-day didn't sound like much of a change. PSF staff "have always worked remotely." The organization practices a [fully remote work][4] culture and doesn’t have an office. The small staff of seven employees is well versed in collaborating outside of an office. + +Familiarity aside, the emotional impact of needing to cancel an event they put a year’s worth of planning into hurt. + +> **"We all believe in what we do. Which is particularly why we’re such a great small team. So it really impacted us emotionally and mentally. And it continues to."** + +We spoke about how the team is reliving what the days would have looked like if PyCon wasn't interrupted by COVID-19–keynotes would start _now_, the sponsor booths would be in full motion right _now_–and just how emotionally taxing it all was. Throughout the discussion, Jodlowska always came back to recognizing the staff for their resiliency and energy to pivot the event online. + +### The cascading impact of event cancellation + +Jodlowska has been incredibly transparent about the experience. In her March 31st [article on the financial outcome][5], she outlines it clearly: the Python Software Foundation would take a hit from the event cancelation.  + +Jodlowska notes that part of the challenge is that PyCon accounts for too much of the organization’s financial health. About 63% of the 2020 revenue was projected to come from the show. While that number is down from the [2017 estimate of 80%][6], it’s still a concern when in-person events will remain limited to keep attendees safe during the COVID-19 outbreak. + +> **"We don’t want to rely on one event**–**or events in general**–**to operate and provide community support."** + +The PSF board of directors is hard at work to look into the diversification of funding. In the meantime, PyCon remains essential to sustainability running the organization. + +### Community support makes all the difference + +It's at this point that Jodlowska again recognizes the incredible work of the PSF staff. They quickly pivoted the vision of the event, and the community of attendees, sponsors, and speakers were all supportive of the move. + +> **"[We] have been brought to tears many times by the generosity of our sponsors and our individual donors."** + +Jodlowska noted that the generosity of so many resulted in reducing the financial impact on the PSF. An incredible amount of Individual attendees are donating their registration costs to the PSF. They are also showing up across social media sites to participate in their own distributed virtual experience of PyCon.  + +Another important part of the community, the corporate sponsors of the show, are also showing up to support the non-profit. Many sponsors had already canceled physical presence at the show before the event was officially moved online. Some of them were kind enough, as Jodlowska noted, to donate the cost of sponsorship to the PSF. In a huge turn of events, the list of sponsors **grew** as the online event came together. + +> **[M]any sponsors have opted into participating in PyCon 2020 online. Because of this we have decreased the amount needed from our reserve by 77%! The PSF will now only need $141,713 from its financial reserve to get through 2020.** + +For more on the data side, see Jodlowska’s article _[Thank you to donors & sponsors][7]_. + +Support in all its forms led to the conference feeling like it is well on its way. Some sponsors are even moving to a virtual booth experience. + +> Since our sponsors can’t be with you in person, we’ve created a place to provide their content online - . [#PyCon2020][8] Gold Sponsor Weekly Python Exercise shared this video to introduce you to their offerings: . +> +> — PyCon US (@pycon) [April 18, 2020][9] + +Maybe most impressively, many speakers and tutorial instructors made the effort of recording their sessions. That’s helped PyCon to [gradually unfold online][10] with incredible educational content. The audience is still able to interact as well: YouTube comments are open for moderation so speakers can interact with their audience. + +Lastly, there remains an army of volunteers who shifted their in-person plans online and continue to help in any way possible. + +### Some of the surprising positives from this difficult change + +While it is without a doubt a challenging time for the organization, Jodlowska noted a number of positives that are unfolding due to this move to virtual. + +To start, the staff of the PSF “have never been closer,” as they bond over the experience and spend more time getting to know each other through weekly video calls and baking competitions. + +Jodlowska was inspired to get involved in another open source effort, [FOSS responders][11], who are helping organizations respond to the cancelation of events due to COVID-19. (If you’ve been affected as well, they are there to help.) + +The generosity mentioned above is a silver lining to the experience and encouraging to the hardworking team that uplifts the popular Python programming language. + +There is also a broader impact on participation in PyCon. While the final numbers are not in yet, an international audience has access to all of PyCon as it unfolds, which gives the entire world a chance to be part of an excellent event [I got to attend][12] last year. On the development side, Jodlowska mentioned that the [core-dev team][13] that maintains Python, who would normally meet in person, shifted to a virtual meeting. As a result of that shift, some participants got to attend that otherwise would not have had the opportunity to join in person. + +### How you can help the Python Software Foundation + +I reached out to Jodlowska because I am impressed with and supportive of their mission to support the Python community. If you want to support them as well, you have options: + + * Become a [free or supporting member][14] of the PSF to get involved in our future. + * [Sign up for the PSF’s free newsletter][15] to stay up to date. + * [Donate][16] directly to the PSF (and thank you to those that already have). + * Ask your employer to [sponsor the PSF][17]. + * Ask your employer if they match donations to 501(c)(3) non-profits, and ask for your donations to the PSF to be matched. + + + +Last but not least, participate in PyCon over the next few weeks. You can learn from all kinds of smart people on a range of topics like [Matt Harrison][18]’s [Hands-on Python for Programmers][19] that guides attendees through analyzing COVID-19 data to [Katie McLaughlin][20]’s thoughtful talk on [What is deployment, anyway?][21] + +Be sure to [review the full][10] list and engage with the amazing lineup of speakers. + +* * * + +_Are you part of a non-profit looking to connect with your open source community at this time of social distancing? Let me know at matt @ opensource.com._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/pycon-covid-19 + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0 (A dollar sign in a network) +[2]: https://pycon.blogspot.com/2020/03/pycon-us-2020-in-pittsburgh.html +[3]: https://www.python.org/psf/records/staff/ +[4]: https://opensource.com/tags/wfh +[5]: http://pyfound.blogspot.com/2020/03/psfs-projected-2020-financial-outcome.html +[6]: https://www.youtube.com/watch?v=79AIzbjLzdk +[7]: http://pyfound.blogspot.com/2020/04/thank-you-to-donors-sponsors.html +[8]: https://twitter.com/hashtag/PyCon2020?src=hash&ref_src=twsrc%5Etfw +[9]: https://twitter.com/pycon/status/1251563142641000455?ref_src=twsrc%5Etfw +[10]: https://us.pycon.org/2020/online/ +[11]: https://fossresponders.com/ +[12]: https://opensource.com/article/19/5/jupyterlab-python-developers-magic +[13]: https://devguide.python.org/coredev/ +[14]: https://www.python.org/psf/membership/ +[15]: https://www.python.org/psf/newsletter/ +[16]: https://www.python.org/psf/donations/ +[17]: https://www.python.org/psf/sponsorship/ +[18]: https://us.pycon.org/2020/speaker/profile/454/ +[19]: https://youtu.be/fuJcSNUMrW0 +[20]: https://opensource.com/users/glasnt +[21]: https://youtu.be/8vstov3Y7uE diff --git a/sources/talk/20200505 11 DevOps lessons from My Little Pony.md b/sources/talk/20200505 11 DevOps lessons from My Little Pony.md new file mode 100644 index 0000000000..f550f871a1 --- /dev/null +++ b/sources/talk/20200505 11 DevOps lessons from My Little Pony.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 DevOps lessons from My Little Pony) +[#]: via: (https://opensource.com/article/20/5/devops-lessons) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +11 DevOps lessons from My Little Pony +====== +What you never thought you could learn about DevOps for Twilight Sparkle +and her friends. +![My Little Pony][1] + +In 2010, the My Little Pony franchise was rebooted with the animated show _My Little Pony: Friendship is Magic_. The combination of accessibility to children with the sophisticated themes the show tackled garnered a following that cut across ages. I was swept up in the wave and discovered there is a lot to learn about DevOps from the show. + +### Discovering technical debt + +The show begins with Twilight Sparkle reading obscure documentation, only to realize that Equestria, where the show is set, is due to suffer a calamity. Though someone named Nightmare Moon has been imprisoned for a thousand years, there is a prophecy she will return. + +#### Lesson 1: Technical debt matters. + +Nightmare Moon is a perfect stand-in for technical debt. Document it. Pay attention to the signs of risk no matter how infrequently they occur. Have a plan to resolve it. + +Twilight Sparkle goes to her manager with the news, only to be told that it is not a current priority. She is sent to Ponyville to prepare for the coming celebration, instead. + +#### Lesson 2: Communication with management is key. + +Twilight Sparkle communicated her priority (the risk of technical debt) but did not convince her management that it was more important than the celebration (of the next release or a new customer). + +We all need to make clear what the business case is for resolving critical issues. It is also not straightforward to explain technical debt in business terms. If management does not agree on the severity, find new ways to communicate the risk, and team up with others who speak that language. + +### When technical debt becomes an outage + +As the prophecy has foreseen, Nightmare Moon returns and declares eternal night. (In this DevOps story, this marks the beginning of a catastrophic outage.) Twilight quickly understands that she cannot resolve the issue by herself, and she recruits the ponies who will become, with her, the "Mane Six." They each stand for a different element of harmony—Applejack stands for Honesty, Fluttershy for Kindness, Pinkie Pie for Laughter, Rarity for Generosity, Rainbow Dash for Loyalty, and Twilight Sparkle herself for Magic. This team-building is full of lessons: + +#### Lesson 3: Few are the issues that can be resolved by one person. + +When facing an outage, reach out to other people with complementary skills who can help you. It is best if they are different than you: different backgrounds leads to differing perspectives, and that can lead to better problem-solving. + +#### Lesson 4: When resolving an outage, honest communication is key. + +Throughout the struggle against the eternal night, the Mane Six have to speak openly and honestly about what's not working. Their [blameless communication][2] is part of problem-solving. + +#### Lesson 5: When resolving an outage, kindness to yourself and to others is crucial. + +Though tempers flare hot in the land of Equestria, we all benefit from coming back to working together. + +#### Lesson 6: Laughter is important. + +Even when everything comes crashing down, remember to take a break, drink a glass of water, and take a deep breath. Stressing out does not help anything. + +#### Lesson 7: Be generous. + +Even if you are not on-call right now, if your help is needed to resolve a problem, help out as you hope your colleagues will do for you. + +#### Lesson 8: Be loyal. + +An outage is not a time to settle rivalries between teams. Focus on how to collaborate and resolve the outage as a team. + +#### Lesson 9: Though people skills are important, you have to understand the technology on a deep level. + +Keep your skills sharp. Expertise is not only the ability to learn; it is knowing when that information is needed. Part of being an expert is practice. + +### Growing into a culture of continual improvement + +After the issue is resolved, Princess Celestia realizes that the Mane Six are crucial to the long-term survival of Equestria, and tells Twilight Sparkle to stay in Ponyville and keep researching the magic of friendship. + +#### Lesson 10: After an outage is resolved, conduct a review, take concrete lessons, and act on them. + +I could go on, episode by episode, detailing lessons relevant for DevOps, but I will wrap up with one of my favorite ones. In the "Winter Wrap-Up" episode, all the ponies in Ponyville help in preparing for the spring. As per tradition, they do not use magic, leaving Twilight Sparkle to wonder how she can contribute. Eventually, she realizes that she can help by making a checklist to make sure everything is done in the right order. + +#### Lesson 11: When automation is impossible or inadvisable, write a solid checklist, and follow it. Do not depend on your memory. + +Twilight Sparkle and the Mane Six overcome great obstacles as a team, and now have a system to improve as a team. + +### A story of DevOps + +This story reflects how many organizations slowly adopt DevOps. The transition from recognizing a fear of technical debt toward addressing it is not simple. With courageous leadership, teamwork, and a willingness to improve, all organizations can come out on the other side with a similar story to Twilight Sparkle and her friends. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/devops-lessons + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/my-little-pony.jpg?itok=X-rwAGuE (My Little Pony) +[2]: https://opensource.com/article/19/4/psychology-behind-blameless-retrospective diff --git a/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md b/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md new file mode 100644 index 0000000000..ef7d152e55 --- /dev/null +++ b/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IBM rolls Red Hat into edge, AI, hybrid-cloud expansion) +[#]: via: (https://www.networkworld.com/article/3542409/ibm-rolls-red-hat-into-edge-ai-hybrid-cloud-expansion.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +IBM rolls Red Hat into edge, AI, hybrid-cloud expansion +====== +Every company will be an AI company new IBM CEO Krishna tells Think! virtual gathering +Getty + +Deeply assimilating its Red Hat technology, IBM this week rolled out a set of new platforms and services designed to help customers manage edge-based application workloads and exploit artificial intelligence for infrastructure resiliency. + +The announcements came at IBM’s virtualized Think! 2020 event that also featured the first Big Blue keynote by [the company's new CEO Arvind Krishna][1], during which he told the online audience about challenges of COVID-19: "History will look back on this as the moment when the digital transformation of business and society suddenly accelerated,” but also that [hybrid cloud and AI][2] are the two dominant forces driving digital transformation. + +[Now see how AI can boost data-center availability and efficiency][3] + +“More than 20 years ago, experts predicted every company would become an internet company. I am predicting today that every company will become an AI company, not because they can, but because they must,” he said. + +With that idea in mind the company rolled out [IBM Watson AIOps][4], an application that uses AI to automate how enterprises detect, diagnose and respond to IT anomalies in real time. Watson AIOps works by grouping log anomalies and alerts based on spatial and temporal reasoning as well as similarity to past situations, IBM said. It uses IBM’s natural language processing technology to understand the content in trouble tickets to identify and extract resolution actions automatically. + +Then it provides a pointer to where the problem is and identifies other services that might be affected.  “It does this by showing details of the problem based on data from existing tools in the environment, all in the context of the application topology, distilling multiple signals into a succinct report” and eliminating the need for multiple dashboards, IBM stated. + +AI can automate tasks like shifting traffic from one router to another, freeing up space on a drive, or restarting an application. AI systems can also be trained to self-correct, IBM stated. + +“The problem is that many businesses are consumed with fixing problems after they occur, instead of preventing them before they happen. Watson AIOps relies on AI to solve and automate how enterprises self-detect, diagnose and respond to anomalies in real time,” Krishna said. + +AIOps is built on the latest release of Red Hat OpenShift, supports Slack and Box, and can be integrated with IT-monitoring packages from Mattermost and ServiceNow, IBM stated.  + +The Kubernetes-based OpenShift Container Platform lets enterprise customers deploy and manage containers on their infrastructure of choice, be it private or public clouds, including AWS, Microsoft Azure, Google Cloud Platform, Alibaba and IBM Cloud.  It also integrates with IBM prepackaged Cloud Paks, which include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers. + +OpenShift is also the underlying package for a new version of its [edge network][5] management application called IBM Edge Application Manager. Based on the open source project [Open Horizon][6], the Edge Application Manager can use AI and analytics to help deploy and manage up to 10,000 edge nodes simultaneously by a single administrator. With the platform customers can remotely add new capabilities to a single-purpose device or automatically direct a device to use a variety of cloud-based resources depending on what resources it needs.   + +Cisco said it was working with the IBM Edge Application Manager to deploy apps and analytics models that run on a broad range of Cisco products, such as servers, its industrial portfolio of gateways, routers, switches, SD-WAN, and wireless-connectivity offerings for edge computing.  + +“As an example, IBM Edge Application Manager leverages [Cisco HyperFlex Edge][7] and Cisco IC3000 Industrial Compute Gateway servers. The HyperFlex Edge and IC3K platforms are specifically designed to support a number of edge use cases, such as optimizing traffic management, increasing manufacturing productivity, and increasing the safety of oil and gas pipelines,” Cisco [stated][8]. + +In addition, Cisco said it has used the capabilities in IBM Edge Application Manager to build an “Edge in a Box proposal,” where customers can deploy remote edge applications that run entirely disconnected from public or private clouds but are also synchronized and managed remotely in controlled connectivity windows. For instance, client edge locations may need to operate in disconnected mode but have the ability to synch up for automated application updates and data exchanges, Cisco stated. + +Other edge-related announcements include: + + * IBM [Edge Ecosystem][9], a group of industry players who will target open technology developments to let customers move data and applications between private data centers, hybrid multicloud environments and the edge. The group includes Cisco, Juniper, Samsung and NVIDIA among others. IBM said a Telco Network Cloud Ecosystem will serve a similar function for their network cloud platforms. + * A preview of an upcoming service, called IBM Cloud Satellite. This will extend IBM’s public-cloud service to give customers the ability to use IBM Cloud anywhere – on-premises, in data centers or at the edge – delivered as a service that can be managed from a single pane of glass controlled through the public cloud. It lets customers run applications where it makes sense while utilizing cloud security and ops benefits, IBM stated. Satellite runs on Red Hat OpenShift. + * Telco Network Cloud Manager – a telco/service provider offering that runs  on Red Hat OpenShift to deliver intelligent automation capabilities to orchestrate virtual and container network functions in minutes. Service providers will have the ability to manage workloads on both Red Hat OpenShift and Red Hat OpenStack platforms, which will be critical as telcos increasingly look to modernize their networks for greater agility and efficiency, and to provide new services as 5G adoption expands, IBM stated. + * New capabilities for some of its Cloud Paks including extending the Cloud Pak for Data to include the ability to better automate planning, budgeting and forecasting in [hybrid-cloud][10] environments. IBM upgraded tools for business routing and data capture to the Cloud Pak for Automation as well. + + + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3542409/ibm-rolls-red-hat-into-edge-ai-hybrid-cloud-expansion.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3536654/ibm-taps-new-leaders-for-hybrid-cloud-battles-ahead.html +[2]: https://www.infoworld.com/article/3541825/ibms-new-ceo-lays-out-his-roadmap.html +[3]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[4]: https://www.ibm.com/watson/assets/duo/pdf/WDDE814_IBM_Watson_AIOps_Web.pdf +[5]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[6]: https://developer.ibm.com/blogs/open-horizon-joins-linux-foundation-grow-open-edge-computing-platform/ +[7]: https://www.cisco.com/c/en/us/products/hyperconverged-infrastructure/index.html?dtid=oblgzzz001087 +[8]: https://blogs.cisco.com/partner/cisco-and-ibm-teaming-at-the-edge +[9]: https://www.ibm.com/blogs/business-partners/join-the-edge-ecosystem/ +[10]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md b/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md new file mode 100644 index 0000000000..983c11dac6 --- /dev/null +++ b/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ethernet Alliance study finds Power over Ethernet issues) +[#]: via: (https://www.networkworld.com/article/3543258/ethernet-alliance-study-finds-power-over-ethernet-issues.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Ethernet Alliance study finds Power over Ethernet issues +====== +Reliability, connection issues, failure to deliver power traced to interoperability issues with Power over Ethernet. +Martyn Williams/IDGNS + +Four out five users experience challenges with power over Ethernet (PoE) deployments, according to a new survey of nearly 800 Ethernet designers, manufacturers, resellers, system integrators, network operators and others. + +Conducted by the Ethernet Alliance in January, the study  found a number of key PoE insights, including: + + * Four out of five users experienced issues, including support, reliability, or connection challenges. + * The top three PoE installations are cameras and phones, as well as computing and storage devices; + * Of customers planning to implement PoE 63% said they would need 30w; 47% would need between 30-60w and 27% need greater than 60w. + + + +**[ Now see [7 free network tools you must have][1]. ]** + +With the global market projected to grow to $2 billion by 2025, PoE remains a wellspring of lucrative opportunities for designers, systems integrators, and solutions providers, David Tremblay, chair of the alliance's PoE Subcommittee, and system architect for Aruba, said in a statement. “Despite this good news, there are significant challenges that could threaten PoE’s growing adoption.” + +According to the survey those chief PoE challenges include, vendor support, unreliable power or operation, long repair times, and first-time connection issues. + +The Alliance reported that while 78% of respondents experienced difficulties with PoE deployments, 72% expect improvement with products certified through the Ethernet Alliance’s [PoE Certification Program][2]. The study found 84% said they expect certified PoE devices would be more likely to work the first time, and 85% expect those devices to be more reliable. + +“Lacking a registered trademark, the use of the term ‘PoE’ is not formally regulated, allowing any vendor to freely describe products and solutions as PoE-enabled. Additionally, terminologies such as ‘PoE+’, as well as non-standard PoE implementations are causing confusion with device interoperability among technicians, designers, and end users,” the Alliance stated. + +[Experts say][3] the single greatest challenge for PoE  is assuring interoperability.  Multivendor interoperability is Ethernet’s hallmark and it's an important consideration for consumers who want to know the gear will just work, while industry players need a way to find new partnership opportunities with companies offering certified equipment, the Dell’Oro Group said. + +“With the diversity of application, come interoperability problems which dictate the need for testing and certification,” said Sameh Boujelbene, Senior Research Director for Ethernet Switch market research at Dell’Oro. + +Certified Ethernet Alliance products range from component level Ethernet evaluation boards, to power-sourcing equipment, enterprise switches, and adapters. + +Ultimately the Ethernet Alliance’s Power over Ethernet (PoE) Certification Program is the place customers should look to enable faster PoE installations with zero interoperability issues, Tremblay said. + +A number of key Ethernet vendors including Cisco, Hewlett Packard Enterprise, Huawei, Analog Devices, Texas Instruments, Microsemi and others are part of the certification program. + +Details about certified products are available via the [program’s public registry][4]. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543258/ethernet-alliance-study-finds-power-over-ethernet-issues.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/2825879/7-free-open-source-network-monitoring-tools.html +[2]: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbit.ly%2FEA_PoECertification&data=02%7C01%7C%7Ca67fc55074c748affa8408d7f74fc98e%7C3aedb78fc8e04326888a74230d1978ff%7C0%7C0%7C637249794373724526&sdata=2QDd6oO2Yu6EiCj6m7i%2BtbVJD1wHxmNwtDr2oMe9TgQ%3D&reserved=0 +[3]: https://www.networkworld.com/article/2328615/the-power-over-ethernet.html +[4]: https://ea-poe-cert.iol.unh.edu/?utm_source=General%20Distribution&utm_medium=Press%20Release&utm_campaign=October%20PoE%20Certification%20Press%20Release +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md b/sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md new file mode 100644 index 0000000000..b34f3508de --- /dev/null +++ b/sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (In Free Software, the Community is the Most Important Ingredient: Jerry Bezencon of Linux Lite [Interview]) +[#]: via: (https://itsfoss.com/linux-lite-interview/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +In Free Software, the Community is the Most Important Ingredient: Jerry Bezencon of Linux Lite [Interview] +====== + +You are probably aware of [Linux Lite][1]. It is a [lightweight Linux distribution][2] based on Ubuntu. If you have an older system with 1 GB of RAM, Linux Lite becomes an excellent choice for you. + +We have covered Linux Lite releases several times on It’s FOSS and if you are a regular reader, you would have come across it. + +![][3] + +We talked to Jerry Bezencon, the creator of Linux Lite project, to know some background details on this project. + +### Interview with Jerry Bezencon of Linux Lite + +Jerry is based in Auckland, New Zealand, and he devotes a good deal of time and effort on Linux Lite project. Jerry shares his vision of the project in this interview. + +_**Tell us about the origins of Linux Lite. When did you create it first and what made you create it in the first place?**_ + +Linux Lite was started in 2012 for 3 important reasons. One, I wanted to dispel myths that a Linux based operating system was hard to use. Two, at that time, there was a shortage of simple, intuitive desktop experiences on Linux that offered long-term support. Three, I had used Linux for over 10 years before starting Linux Lite. + +I felt I needed to give back to a community that had given so much to me. A community that taught me that by sharing code and knowledge, one could have a dramatically positive impact over peoples computing experiences. + +_**How is Linux Lite different from so many other Ubuntu-based distributions?**_ + +Our approach to problem solving and our support. The first sits within the system itself. Lite Tweaks is a good example of this. We try to think of all the things that could possibly go wrong with a computer system, then write applications that fix those problems as easily as possible, should they occur. There is a lot of foresight in the team. + +The second is our approach to support. This mainly comes in 2 forms. Our massive built-in and online Help Manual and [our large forum community][4] full of some of the nicest people I’ve ever dealt with in the free software and open source community. + +_**How do you and your team work on developing Linux Lite?**_ + +There are 24 hours in a day. With 6 – 8 hours for sleep and another 6 – 8 hours for my other job, that’s more than enough time to put towards any project, hobby or job, or all 3. + +I take a more professional approach to code writing. I’ll come up with an idea, mock-up the UI then write the base code, or the whole application myself. If I need help, I prefer to hire and pay via our generous donators, freelancers. + +That way I can set a budget, the user gets a solid, well-written application by a qualified professional who is fluent in that language, and get I exactly what I ask for on time and without the usual flame wars and egos that can exist in some teams. + +By using professional, paid programmers, I avoid all the negativity completely. Application writing has become an extremely peaceful and rewarding exercise. + +_**What are you most proud of about this project?**_ + +![Linux Lite Interview][5] + +I’m most proud of the community that has stayed loyal to us throughout the years. In a business, your staff are your most valuable asset, in free software, the community is the most important ingredient. + +_**What are your future plans with Linux Lite?**_ + +To always strive to look for ways to make a person’s computing experience simpler, faster and trouble free. Our target audience shouldn’t have to dive into the terminal to try and fix things. To continue to build a feature-complete operating system that is light on resources. + +_**What new features can we expect in Linux Lite in upcoming versions?**_ + +Due to tradition, we like to keep those as surprises. I never run out of ideas. Some nights I get no sleep because my mind is buzzing with ideas for our next application, or how to solve an ongoing, difficult bug. + +_**Are there any features that you really want to implement but haven’t been able to do so far?**_ + +You can always do more to enhance an operating system. I’m currently working on our most ambitious application to date. One that doesn’t need a GUI and that sits within the system, anticipates problems and solves them before they are seen by the user. It will have a Reports feature so that those who like to know what is going on, can see for themselves what the code is doing. It will, of course, be free software. My first foray into A.I. that I hope other Linux systems can benefit from in the future. + +_**Have you achieved the goal for which you started the project?**_ + +Goal setting is ongoing. There’s no such thing as the perfect operating system. But there is no harm in aiming for that. + +_**How can the users and readers help the project?**_ + +In the usual ways. Documentation, coding, volunteering on the Forums, buying merchandise, writing blogs, donating, making videos, starting websites like yours – the list goes on. + +* * * + +We hope you like reading about the background of open source projects. You may [read more interviews with various project leaders][6]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-lite-interview/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxliteos.com/ +[2]: https://itsfoss.com/lightweight-linux-beginners/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux_Lite.jpg?ssl=1 +[4]: https://www.linuxliteos.com/forums/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-lite-interview.png?ssl=1 +[6]: https://itsfoss.com/interviews/ diff --git a/sources/talk/20200530 How open standards guide us in a world of change.md b/sources/talk/20200530 How open standards guide us in a world of change.md new file mode 100644 index 0000000000..3ee87d50ef --- /dev/null +++ b/sources/talk/20200530 How open standards guide us in a world of change.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How open standards guide us in a world of change) +[#]: via: (https://opensource.com/article/20/5/oasis-open) +[#]: author: (Guy Martin https://opensource.com/users/guyma) + +How open standards guide us in a world of change +====== +OASIS Open brings open source and standards communities together during +this time of crisis to help define a new, collaborative future to +benefit all. +![Globe up in the clouds][1] + +As I write this article in my home office in Beaverton, Oregon, a Portland suburb, I'm relying (and reflecting) on years of work that went into standards like TCP/IP, HTTP, NTP, XMPP, SAML, and many others, as well as open source implementations of these standards from organizations such as the [Apache Software Foundation][2]. The combination of these standards and technologies is literally saving lives, as many of us are able to work from home while "flattening the curve." + +Nothing has dominated the news more in 2020 than COVID-19. Yet, in the midst of challenging time, I've found opportunities for personal and industrial renewal. By fortunate (some may say unfortunate) timing, I found myself switching roles in the middle of this crisis from helping to build and run Open Source Program Offices (OSPOs) to becoming the executive director at [OASIS Open][3], a standards development organization that is helping bring standards and open source together in practical and productive ways. + +Looking through the many articles on Opensource.com related to [standards][4] (and there are [quite a few][5]), I went on an interesting journey through the different thought processes—and sometimes biases—that people involved in each community have. What stood out most was this: both standards professionals and open source advocates want the same thing—better technology that we all can rely on. + +As I was transitioning to this new role at OASIS, some colleagues and friends in the open source world that I've been a part of for many years questioned my motivations for making this move. In explaining why I took this job, I reflected on the larger role I think the intersection of standards and open source can play, especially in the current crisis we all face. + +### 4 reflections on open source and standards + +First, I've seen efforts like the [Open Connectivity Foundation][6], which I was fortunate to help start, get this right in balancing a standard with multiple reference implementations. Early in that effort, the standard was actively driven by the open source project, and the project took cues from the work of the standards teams. The result is both working code and a standard that can help shield IoT developers from having to worry about the many underlying network protocols in use in this ecosystem. + +Second, I'm extremely energized by the opportunity to work with some of the best minds in the open source community, many of whom I'm fortunate enough to call friends. One of the first steps OASIS took when developing its [Open Projects][7] program was to assemble an advisory council of open source all-stars. Chris Ferris, Jim Jagielski, Nithya Ruff, Deb Bryant, and many others regularly come together, with support from OASIS staffer Jory Burson, to hash out best practices with a path to standardization and recognition in international standards bodies like ISO, ITU, W3C, and others. + +This group, along with our staff, is rethinking everything from governance to IP to community building to funding and process, taking the best from both worlds to create something new. We're bridging the agile, collaborative excellence that is open source with the trusted, interoperable reliability that is open standards, and helping to demystify open source for heavily regulated procurement processes (government, financial, NGO, etc.). The possibility of getting open source into supply chains that have traditionally relied on standards is very exciting. + +Third, I see the huge potential for what the response to this pandemic represents. This is arguably a once-in-a-generation opportunity for standards and open source communities to help define and build the future of emergency management, e-learning, medical technologies, and many other aspects of our daily lives. Determining how these elements work together effectively will be paramount to our shared future. + +Finally, I'm excited to see the role that OASIS and other standards and open source bodies can play as we tackle some of our biggest challenges in the coming months and years together. COVID-19 is changing our world and our way of life forever; how we adapt and thrive will, in large part, be determined by how well we all collaborate, and I can think of no better time for the open source and standards communities to unite to chart a course forward for all of us. + +I'm proud to be part of the movement to build a stronger bridge between open source and open standards, and I invite you all to join us. If you have thoughts to share or a project you'd like to advance, I'd love to hear from you. You can [visit us][8] or use the comments section below. Let's write the next chapter together. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/oasis-open + +作者:[Guy Martin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/guyma +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://apache.org +[3]: https://oasis-open.org +[4]: https://opensource.com/resources/what-are-open-standards +[5]: https://opensource.com/tags/open-standards +[6]: https://openconnectivity.org +[7]: https://oasis-open-projects.org/ +[8]: https://oasis-open-projects.org/get-involved diff --git a/sources/talk/20200531 Red Hat- Holding Its Own and Fueling Open Source Innovation.md b/sources/talk/20200531 Red Hat- Holding Its Own and Fueling Open Source Innovation.md new file mode 100644 index 0000000000..b2879802f2 --- /dev/null +++ b/sources/talk/20200531 Red Hat- Holding Its Own and Fueling Open Source Innovation.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat: Holding Its Own and Fueling Open Source Innovation) +[#]: via: (https://www.linux.com/articles/red-hat-holding-its-own-and-fueling-open-source-innovation/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Red Hat: Holding Its Own and Fueling Open Source Innovation +====== + +When IBM acquired Red Hat for $34 billion in 2019, it was considered the industry’s largest software acquisition. The synergy between the two companies led them to become one of the leading hybrid multi-cloud providers globally. + +In most acquisitions, the acquired entity sometimes loses momentum and sheds some of its original luster. This does not seem to be the case with Red Hat. + +**Distinct Identity** +“I would define it as a separate company and that’s how we run it,” affirms Paul Cormier, President & CEO of Red Hat, who is credited with conceptualizing the company’s open hybrid cloud platform. + +“We set our own strategy, we set our own road maps. It’s completely up to us. We have stayed as a self-contained company. Red Hat still has all the pieces to be a separate company: its own Engineering, product lines, back office, HR, Legal, and Finance. It’s very much like VMware is to Dell, or LinkedIn is to Microsoft,” he explains. + +Cormier believes it’s important to have separate identities for partner ecosystems to thrive. + +“We are talking about integrating Arc with OpenShift. IBM didn’t even know this was happening as we had kept it confidential,” he says. + +Microsoft’s Azure Arc is a management tool for hybrid cloud application infrastructures, while OpenShift is a family of containerization software developed by Red Hat. + +“We’re big on Intel platforms. We’re also big on IBM Z, IBM I, IBM P. Since we support Intel in Red Hat Enterprise Linux (REL), we know their road maps long before they’re implemented.  However, we have to show Intel that we would not give away their secrets to IBM. This is the most important reason that we must remain separate so that those partner ecosystems remain,” he says. + +**Linux: The Innovation Engine** +Cormier points out that what makes Red Hat very unique is its completely open-source software development model. + +“That’s our development model. Open source is not a thing — it’s an action,” he says. + +Underlining the importance of Linux, he explains that “Linux went by Unix a long time ago in terms of features, function, and performance. However, Linux was so available that eventually, it became the innovation engine. All the technologies today — on the infrastructure and the development side, on the tools side — they are all built-in and around Linux. OpenShift is still a Linux platform. Its containers are Linux. All the innovation is now around that.” + +Cormier is also confident of meeting the demand of customers adopting hybrid cloud. + +“For us, it doesn’t matter whether it’s 20% on-premise, 20% in the cloud and 80% on-premise, or 60/40 or 50/50 — it’s still a hybrid world. I can’t predict if the COVID thing is going to push people to the cloud more quickly or more slowly, but we don’t care. It doesn’t matter. For us, it’s the same value proposition,” he avers. + +**Virtualization meets Kubernetes ** +Red Hat is now working on bringing VMs into the Kubernetes architecture. + +“As opposed to some of our competitors that are trying to bring containers back to their world, we’re moving in the other direction. We are working on advanced cluster management on Kubernetes. As customers increasingly go hybrid, having OpenShift with containers running in different places will help them easily manage across clusters,” Cormier says. + +“We’re also focusing on telco 5G use cases on the OpenShift platform. We’re doing a lot of work with Verizon and the other telcos,” he adds. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/red-hat-holding-its-own-and-fueling-open-source-innovation/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200603 5 common open source testing myths debunked.md b/sources/talk/20200603 5 common open source testing myths debunked.md new file mode 100644 index 0000000000..5ce22be725 --- /dev/null +++ b/sources/talk/20200603 5 common open source testing myths debunked.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 common open source testing myths debunked) +[#]: via: (https://opensource.com/article/20/6/open-source-testing-myths) +[#]: author: (Kevin Dunne https://opensource.com/users/kdunne916) + +5 common open source testing myths debunked +====== +These survey results paint a picture of the bright future of open source +testing. +![Collaboration on a mobile software design][1] + +Open source tools are constantly changing the landscape of testing, and the community around these tools is bigger and more vocal than ever. + +The first-ever _[State of Open Source Testing Survey][2]_ examines the latest trends and developments across the software development industry. This survey received over 2,000 responses from practitioners across the behavior-driven development, functional testing, and load testing domains. + +The survey reveals a great deal about software testing and how it uses open source, and based on the results, it's reasonable to expect an increased rate of adoption and deployment of open source tools. + +Importantly, the survey results also debunk some of the common myths around open source and software testing. Here's a look at the top five: + +### Myth #1: The biggest impediment to using open source testing tools are the skills required. + +There is undoubtedly a large jump in technical skill sets required to use open source testing tools, and typically a need to brush up on or learn new coding skills. However, while 40% of respondents did cite the lack of technical skills as one of their largest roadblocks, the most common roadblock cited was simply lack of time to learn new tools. + +![OS testing impediments][3] + +### Myth #2: Open source testing happens mostly in English-speaking countries. + +Of all respondents to the survey, 61% are in Asia. While many have believed that Agile and DevOps are making co-located work more essential, the significant number of respondents in countries like India, Vietnam, and the Philippines says otherwise. There's a possibility that the rise of remote work and distributed teams will continue to grow the importance of multilingual support for projects and more adoption of asynchronous communication practices. + +![OS testing offshore][4] + +### Myth 3: Open source tools are only used for cost savings. + +Sure, the largest reason for using open source testing tools stated was cost (39%). However, the overwhelming majority of respondents (61%) cited other primary reasons for leveraging open source tools, including community support, better integration, and more ability to customize to their liking. Simply put, the choice to use open source is not a purely economic one. + +![OS testing benefits][5] + +### Myth #4: Quality Assurance Engineering is no longer a career because developers write their own tests. + +An overwhelming majority (84%) of organizations surveyed still had dedicated testing and QA personnel contributing to the creation of functional automated tests against their applications. Only a small percentage (8%) left those tasks completely up to developers to handle. + +![functional testing roles][6] + +When looking at other types of testing, such as load and performance testing, there seemed to be a wider variety of titles/roles that were involved (performance engineering, operations, etc.). Still, the role of a dedicated tester, whether technically focused or otherwise, seems to be one that won't be eliminated anytime soon. + +![performance/load testing roles][7] + +### Myth #5: Behavior-driven development means you don't have to plan ahead. + +[Behavior-driven development][8] (BDD) is a hot topic in industry discussions these days, with anywhere between 15-40% of companies using it (depending on your source). While many have implemented the tools that support BDD (Cucumber, SpecFlow, and so on), few have implemented the true foundation of the approach: specification-by-example using scenarios. Teams have often managed to get by with suboptimal requirement definitions due to their frequent, in-person collaboration; requirements are defined along the way, as things develop. If only 20% of companies provide documentation in the required format, it's likely we'll see struggles now that teams are increasingly remote. + +![BDD usage][9] + +### Open source and the future + +The future of open source testing is bright, but it's changing. Few industries are as well-equipped to adapt to rapid change as open source development. + +Want to dig a little deeper? Head over to Tricentis' [infographic][10] to explore the detailed results and sign up to participate in the _2021 State of Open Source Testing Survey_. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/open-source-testing-myths + +作者:[Kevin Dunne][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kdunne916 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mobile-device-phone-team-collaboration-demo.png?itok=q96f2Eao (Collaboration on a mobile software design) +[2]: https://www.tricentis.com/state-of-open-source-2020/ +[3]: https://opensource.com/sites/default/files/uploads/os_testing_1_0.png (OS testing impediments) +[4]: https://opensource.com/sites/default/files/uploads/os_testing_2.png (OS testing offshore) +[5]: https://opensource.com/sites/default/files/uploads/os_testing_3.png (OS testing benefits) +[6]: https://opensource.com/sites/default/files/uploads/os_testing_4.png (functional testing roles) +[7]: https://opensource.com/sites/default/files/uploads/os_testing_5.png (performance/load testing roles) +[8]: https://opensource.com/article/19/2/behavior-driven-development-tools +[9]: https://opensource.com/sites/default/files/uploads/os_testing_6.png (BDD usage) +[10]: https://www.tricentis.com/state-of-open-source-2020 diff --git a/sources/talk/20200604 Airbus tells quantum-computing developers what it needs from the the technology.md b/sources/talk/20200604 Airbus tells quantum-computing developers what it needs from the the technology.md new file mode 100644 index 0000000000..b078a5287d --- /dev/null +++ b/sources/talk/20200604 Airbus tells quantum-computing developers what it needs from the the technology.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Airbus tells quantum-computing developers what it needs from the the technology) +[#]: via: (https://www.networkworld.com/article/3561228/airbus-tells-quantum-computing-developers-what-it-needs-from-the-the-technology.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Airbus tells quantum-computing developers what it needs from the the technology +====== +Aerospace multinational Airbus says it is 'quantum-ready' and helping to shape the future capabilities of quantum computing. +[Glosser.ca / Pete Linforth][1] [(CC BY-SA 3.0)][2] + +Airbus expects quantum computing to have major production, performance and efficiency benefits as the technology plays a role in its cybersecurity, aerospace and communications businesses. + +“We are users of quantum computing and intend to use it to deliver more powerful services and systems,” said [Paolo Bianco][3], global research & technology cooperation manager for Airbus to an online audience at the [Inside Quantum Technology][4] virtual event this week. + +[10 of the world's fastest supercomputers][5] + +“We are not very much interested in developing our own quantum technology but will help others develop quantum technologies so that we can integrate them into what we are doing.  Our aim is to be quantum-ready.  It’s a race, and we want to hit the ground running.” + +The multinational aerospace corporation and world’s largest airline manufacturer is well on its way to utilizing and helping influence the develop the future of quantum computing.  + +For example, Bianco pointed to three key quantum technology areas Airbus is interested in – communication/security, computing and sensing. + +"The field of quantum communications is where we started in 2012 as the company was evaluating the technology’s threat to secure communications," Bianco said. + +According to a recent Airbus [blog][6], "Today’s cryptographic algorithms—such as the widely used encryption via asymmetric keys—will not be able to sustain attacks by the quantum computers of tomorrow. Our goal is to develop a future secure communications infrastructure for our aerospace platforms based on security-enhancing quantum information technologies (algorithms, authentications, keys).”   + +Airbus wants to make quantum computing a significant part of its ongoing high-performance computing (HPC) work.  + +"We are an avid HPC user because we do a lot of simulations and design," the company says, "and we have invested a lot of time and money to understand how quantum computing can be used with HPC to improve our efficiency and performance." + +The third area Airbus is looking to develop is quantum sensors that "are effective at measuring physical quantities such as frequency, acceleration, rotation rates, electric and magnetic fields, and temperature with the highest relative and absolute accuracy," Airbus stated.  + +"We believe this could have direct applications in improving our navigation systems in which precise acceleration measurement is used to achieve position data," Airbus stated. "In addition, quantum sensors could act as payloads for a range of different applications, such as climate dynamics from satellites or underground resources surveying from an aircraft." + +In addition to those three areas, the company 18 months ago began the [Airbus Quantum Computing Challenge][7] (AQCC) to get the quantum community involved in addressing aerospace-flight physics problems. The challenge put forward five distinct  problems, such as saving fuel or designing aircraft wings, with varying degrees of complexity, ranging from a simple mathematical question to a global flight physics problem, Airbus stated.  + +The challenge involved quantum-computing research from Airbus’ team and third parties, and the results were expected earlier this year. But as with many things, the announcement of the winner has been delayed due the COVID-19 pandemic, but Bianco said results are expected soon.  + +Beyond the Challenge, Airbus has taken part in the development of the quantum computing community. For example it provided early funding to quantum-computing-as-a-service vendor QC Ware, which offers a cloud-based service that provides enterprises with access to quantum resources. Other vendors such as [D-Wave][8], Google, [IBM][9] and [Rigetti][10] offer similar cloud-based resource services. + +Airbus has also been involved in developing quantum technologies for use in [space][11], as well as facilitating [university research][12] with the Quantum Technology Application Centre. + +“We need to develop systems that are far away from the everyday experience…we are ready to go the extra mile to understand something we are going to use,” Bianco said.  Aerospace could be one of the technologies that helps everyone learn what quantum can do, particularly in extreme environments, he said. + +Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3561228/airbus-tells-quantum-computing-developers-what-it-needs-from-the-the-technology.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/File:Bloch_Sphere.svg +[2]: https://creativecommons.org/licenses/by-sa/3.0/legalcode +[3]: https://www.linkedin.com/in/paolobianco1/?originalSubdomain=uk +[4]: https://www.insidequantumtechnology.com/news/inside-quantum-technology-new-york-online-tuesday-june-2/ +[5]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[6]: https://www.airbus.com/innovation/future-technology/quantum-technologies.html +[7]: https://www.airbus.com/newsroom/news/en/2019/10/world-leading-experts-Airbus-Quantum-Computing-Challenge.html +[8]: https://www.dwavesys.com/quantum-computing +[9]: https://www.ibm.com/quantum-computing/ +[10]: https://rigetti.com/ +[11]: http://qtspace.eu:8080/sites/testqtspace.eu/files/QTspace_Stretegic_Report_Intermediate.pdf +[12]: http://www.bristol.ac.uk/temple-quarter-campus/research-teaching-and-partnerships/qtic/ +[13]: https://www.facebook.com/NetworkWorld/ +[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200607 Is your team a -glue team.md b/sources/talk/20200607 Is your team a -glue team.md new file mode 100644 index 0000000000..d62fed9525 --- /dev/null +++ b/sources/talk/20200607 Is your team a -glue team.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is your team a "glue team?") +[#]: via: (https://opensource.com/open-organization/20/6/glue-team) +[#]: author: (Lauri Apple https://opensource.com/users/lapple) + +Is your team a "glue team?" +====== +Glue teams help keep an organization running smoothly. Here's how to +help them do their best work and avoid burnout. +![Teamwork starts with communication amongst teams and across silos][1] + +In his book [_How to Win_][2], New York Times senior economic correspondent Neil Irwin championed the role of "glue people" in bringing about better alignment, collaboration, and organizational maturity. "There is particular value in being a 'glue person,'" [Irwin writes][3], "someone who understands how their specialty fits together with other types of technical expertise, who can ensure that teams containing people with diverse skills can work together to create something greater than the sum of its parts." + +In many organizations, "glue people" are identified by their roles—product managers, team leads, program manager, project manager, agile coach, business systems analyst. They're people like me—an agile program manager who's been developing cross-team and cross-organizational initiatives for the past seven years at large- and medium-sized companies. + +In one company, I served as program manager for a company-wide open source initiative—aligning 1,800 developers behind a common strategy and setting development practices. In another, I worked with three teams building out a self-service deployment platform based on Kubernetes and AWS. In these days of Coronavirus, I'm helping 14 delivery teams to launch an MVP offering that augments our core business. + +The subject matter has been different in each role, but the same key activities that I bring to work every day remain consistent: + + * Drive alignment + * Coordinate people, efforts, and teams + * Call out ambiguous language to drive clarity and replace assumptions with facts + * Be the neutral party or "fresh eyes" who distills detailed conversations and plans down into simple questions: "Are you doing this, or that?"; "Are you building two things or one thing?" So often, these basics go overlooked! + * Coach leaders on delegation, prioritization and strategic thinking + * Facilitate informed decision-making + * Forecast dependencies and other risks and help mitigate them + * Visualize complex packages of work in simple, clear diagrams and language to improve transparency and accountability + + + +The glue people in your organization might also be program managers, or agile coaches, scrum masters, or engineering managers. Some organizations rely on their savviest product managers and engineering managers to provide the glue; in other organizations, the CEO doubles as Chief Glue Officer. In any case, we glue people spend much of our workdays connecting the dots between people, topics, and themes, to paint the whole picture instead of little corners. + +Maybe you are a glue person. Have you ever considered the specific ways you may fulfill this role? + +### Understanding the need for coherent storytelling + +Do you ever think of yourself as a storyteller, embracing or asserting a narrative as a means of keeping your organization aligned? If so, you're fulfilling a valuable glue-person responsibility. + +Coherent storytelling essentially amounts to connecting the dots. In your average tech organization, there is lots of activity moving forward; maybe this is even documented. But does it all add up to a story anyone can follow? For example: + + * Have you ever seen a roadmap that was formatted as a to-do list, and wondered how the different items corresponded to each other? + * Have you ever seen goals stated on a vision document and wondered, "we've never fulfilled that function before, and we don't have a team set up to do it anytime soon. So what are the steps between now and that team forming? How do we get there?" + * Have you or your team ever been asked to drop what you're doing right now, even though last week it was "super-urgent," and start doing this other thing right now because it's suddenly also "super-urgent?" + * Does your product roadmap look more like spinning a bunch of plates to keep different customers happy than building increments of value to serve current and future customers? + * Does your organization try to do too much, making an extreme sport out of context-switching? + + + +I've seen all of the above. They're all pretty failsafe ways to get talented people to burn out, lose motivation, and leave your organization. These frustrated folks see their companies constantly [disrupting themselves][4] and determine that they will never get anything done. They don't know where they're headed, and no one is telling them that story in any clear, purpose-focused way. What's unfortunate is that such problems are usually not difficult to solve—the content and context are there, but no one is assembling it into the narrative or editing out the filler. + +Even the most clear-headed companies struggle to permanently bake common sense fundamentals like prioritization and evidence-based decision-making into their cultures and habits. They're aware of the importance of values like focus, clarity, and prioritization. Maybe the companies even worked hard to attain them through pragmatic-sounding values statements, objective and key results (OKR) strategies, offsites, workshops, and other common tools of the transformation trade. Nevertheless, hierarchies form, and a few teams start getting left out of decisions that affect them. Politics seep in. Inertia creeps. Docs—what are docs? Decision logs—what are decision logs? Meetings get longer and more boring. Time starts to run out, and you end up at the point where you "just have to ship something." The plot gets lost. + +> "We used to be excellent at getting work done. The more people we add, the less we're getting done." + +Some organizations lose the plot of their own story by over-reliance on oral storytelling. They hold a lot of meetings where much is said, but no one takes notes. There's no basic roadmap or vision posted; in fact, there is resistance to the idea of those things. "It takes too much time," is the usual argument. "No one will read them anyway," is another common one. Often, in these organizations, the processes they've developed rely too much on personal connections, and not enough on well-designed communication flow. Their processes are lightweight because they're nonexistent. + +From time to time, I've asked colleagues, "would you rather write this down once, or have three or four meetings where you have to clarify the same point with the same people?" Usually, they decide to write it down. But the habit of oral storytelling and hallway negotiation can take time to break. + +As a former reporter, it's not much of a stretch for me to view my role as that of a storyteller. Much of what I do on a daily basis is similar to when I was reporting: + + * Asking people questions + * Clarifying the responses + * Challenging the responses ("but what about this?") to sharpen their meaning + * Organizing the information into stories, starting with the most important details ("the lede") first + * Constantly asking, "who is going to care about this detail?" and segmenting the content by audience + * Categorizing related types of information to form sub-themes and identify sub-narratives + + + +When I give road-mapping workshops, I cover the 5 Ws—it feels like giving a Journalism 101 class to engineering managers and product teams: + + * WHO is the customer? The team/set of teams about to do the work? + * WHAT are we doing? + * WHY are we doing it? Why are we not doing this other thing instead? + * WHEN do we start? When do we hope to finish something? + * WHERE does this effort reside in the landscape of our other efforts? + * HOW do you want to do it? + + + +In leading these road-mapping sessions, I'm looking for a few key outcomes of success: + + * A story that reflects a very strict work-in-progress limit—i.e., a primary plot, and two to three related sub-plots maximum, but no more + * Stated objectives for whatever the organization is working on that are customer-agnostic and framed in a broader context (i.e., doing X will strengthen or complement Y, in these ways) + * Metrics and data points that clearly show the impact of delivering something + + + +One other similarity between being a "glue person" in a tech organization, and being a journalist, is that it's vital to ask tough questions, to get to the bottom of stories. This is to ensure that the "readers" of those stories—the teams, the departments, the C-level, and anyone else seeking the information—have all the clarity they need to follow the plot. Here some example questions from my real-life experience: + + * To a group of 15 engineering managers who have spent an hour-long meeting prioritizing a bunch of greenfield development initiatives—"How did protecting customer data from known potential leaks end up near the bottom of your list?" + * To a head of engineering, who wanted to create dashboards so he could survey team progress—"Who needs these bug-counting dashboards; the delivery teams, or you? How does this scale? Is 'number of bugs' a reliable metric?" + * To two teams who want to build their own Kubernetes cluster when one is sufficient—"Hey, what's the value of doing that?" + + + +A lot of what I'm suggesting depends on changing habits, which takes time. Unfortunately, you're in the middle of a global pandemic and don't have time to waste on getting the right teams and people assembled and a plan in motion. You probably don't have the bandwidth to do it all yourself. + +So, don't be the sole glue person in your organization. Be one of many glue people, and help other people adapt to playing this role. It's especially crucial during a crisis. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/glue-team + +作者:[Lauri Apple][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lapple +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fistbump-team-teamwork.png?itok=WuSu8-wE (Teamwork starts with communication amongst teams and across silos) +[2]: https://www.neilirwin.com/how-to-win +[3]: https://www.theatlantic.com/ideas/archive/2019/06/its-a-winner-take-all-world-heres-how-to-get-ahead/591700/ +[4]: https://barryoreilly.com/when-your-startup-cant-stop-disrupting-itself/ diff --git a/sources/talk/20200610 8 steps to make your next meeting more productive.md b/sources/talk/20200610 8 steps to make your next meeting more productive.md new file mode 100644 index 0000000000..8b612dec2c --- /dev/null +++ b/sources/talk/20200610 8 steps to make your next meeting more productive.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 steps to make your next meeting more productive) +[#]: via: (https://opensource.com/article/20/6/meeting-productivity) +[#]: author: (Emily Brand https://opensource.com/users/emily-brand) + +8 steps to make your next meeting more productive +====== +Make your meeting a productivity powerhouse—not a time waster—with these +tips. +![interviewing for a job in a conference room][1] + +Many organizations' cultures encourage team meetings, as they can be a valuable time for groups of employees to collaborate and innovate together. However, too often, meetings are unproductive, repetitive, and waste valuable time that employees could use for work. According to a Korn Ferry survey, 67% of employees claim that their job performance is [negatively impacted][2] by spending too much time in meetings. That number is far too high for modern companies interested in growth and productivity. + +Because all types of organizations, including open source communities, depend on effective meetings and communication standards to get things done, many try to instill more effective meeting environments. For example, some carve out time each week when meetings are not allowed, so the company can reach a flow state. While this is helpful during that time, the rest of the week may be wasted by unproductive meetings. + +The following steps can help make meetings more efficient and create a focused, productive workforce. + +### Before the meeting + +#### 1\. Be prepared + +Too many meetings begin with the question, "why are we here?" One way to make a meeting more productive is to ensure every participant understands the meeting's purpose before the meeting. The agenda should include the start and end time, the topics that will be covered, and a short description written by the organizer answering that "why" question. The easiest way to communicate these things is to share the meeting's agenda in the invitation, and certainly enough time before the meeting that participants can familiarize themselves with the documents before starting. This enables everyone to think about the meeting's goal, plan ahead, and arrive prepared to work toward that goal. + +#### 2\. Is this necessary? + +To prevent unnecessary meetings, everyone must understand the intended outcomes in advance. If the organizer is unable to articulate intentional goals and outcomes, then the meeting should be canceled or postponed until that happens. Also, think about whether the meeting's outcomes and decisions could be completed in an asynchronous fashion (with chat or email). + +Thinking critically about the purpose of the meeting and the people who can contribute to that goal helps organizers and participants stay on task during the meeting. As Krystal D'Costa writes in _Scientific American_, "Since spectators aren't grounded in the project or invested in the outcome, they often derail the meeting." If you're an attendee and don't understand the meeting's purpose, don't be afraid to ask the organizer if you need to be there. + +#### 3\. Keep people engaged remotely + +For long-form remote meetings (beyond basic update calls), use videoconferencing to ensure attendance, accountability, and engagement. A full 93% of communication is nonverbal, and video meetings take advantage of that fact for productivity. Also, it is easy to disengage during a phone meeting by staying on mute or participating as little as possible while working on other things. This behavior perpetuates the cycle of unproductive meetings. + +Videoconferencing increases meeting productivity, so using this collaboration method for remote meetings will have a major impact on the success of decisions going forward. Running productive remote meetings is especially important for open source communities with volunteers spread across geography trying to give back to the project. There are several [open source videoconferencing][3] tools.  + +### During the meeting + +#### 1\. Encourage mindfulness + +Most people are running to and from meetings (literally and figuratively), which causes a lack of focus. A proven practice to encourage meeting participants to re-engage and be mindful is to begin every meeting with [at least 90 seconds][4] of technology-free silence. This will allow everybody to switch gears so they can focus on the current meeting. This is a good time to display the meeting agenda and brief on a screen in the meeting room to remind everyone of its goals and purpose. + +#### 2\. Begin with agreement + +Before beginning, verify that everyone understands the meeting's objectives and the reason they are there. You can do this with a verbal yes in a small group or a non-verbal hand raise in a larger group. If there is any disagreement or confusion regarding the purpose of the meeting, one tangent or participant may sidetrack the entire meeting. This can lead to separate conversations later, which further draws everyone away from the larger picture and the original meeting goals. + +#### 3\. Be conscious of time constraints + +Every meeting should have a stated start and end time. Once a meeting reaches (or worse, exceeds) the allotted time, participants will begin to lose focus and start thinking about the next thing on their to-do list. By ending meetings five minutes early, attendees will have time to reflect on their decisions with a sense of calmness, which is key to ending a meeting with purpose. + +#### 4\. Identify action items + +During the meeting, be sure to establish any follow-up that will be needed, including identifying someone to lead each task (or to assign it if no one volunteers). In addition, assign someone in the room to provide status reports on that task going forward to ensure accountability. Reiterate all action items before the end of the meeting to get consensus on each task and so that people claim purposeful responsibility for their assignments. + +### After the meeting + +#### 1\. Verify action items and next steps + +At the end of the meeting, someone should send out the action items and who owns them to all attendees so that everyone knows what their tasks are. Between meetings and official reports, tracking tools like Trello and its [open source alternatives][5] can help everyone track the ongoing status of action items. + +### Some changes are better than none + +Depending on your line of work, who you are meeting with, or the number of people in a meeting, it can be very difficult to implement all these changes. Even so, even implementing a few can dramatically increase productivity. + +It is tempting to banish meetings altogether when the load is overwhelming and the productivity is low, but that is not plausible. Instead, enforcing productivity through these steps is well within your control as a meeting host or attendee. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/meeting-productivity + +作者:[Emily Brand][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/emily-brand +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-meeting-notebook-conference-brainstorm.png?itok=Rb_rv8-d (interviewing for a job in a conference room) +[2]: https://www.cnbc.com/2019/11/17/67percent-of-workers-say-spending-too-much-time-in-meetings-distracts-them.html +[3]: https://opensource.com/article/20/5/open-source-video-conferencing +[4]: https://www.inc.com/chris-matyszczyk/this-is-astonishing-amount-of-time-it-takes-to-calm-down-when-youre-angry-according-to-a-police-organization.html +[5]: https://opensource.com/alternatives/trello diff --git a/sources/talk/20200612 3 lessons from remote meetings we-re taking back to the office.md b/sources/talk/20200612 3 lessons from remote meetings we-re taking back to the office.md new file mode 100644 index 0000000000..a073bda1d1 --- /dev/null +++ b/sources/talk/20200612 3 lessons from remote meetings we-re taking back to the office.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 lessons from remote meetings we’re taking back to the office) +[#]: via: (https://opensource.com/article/20/6/remote-meetings) +[#]: author: (Abigail Cabunoc Mayes https://opensource.com/users/abbycabs) + +3 lessons from remote meetings we’re taking back to the office +====== +Some of the ways we're accommodating working at home during the pandemic +can make in-real-life meetings better and more inclusive when we get +back to the office. +![Two people chatting via a video conference app][1] + +For those of us fortunate enough to work remotely during this pandemic, we'll likely be camped out in our home offices for a while yet. The transition back to in-person work will [take time and be geographically patchy][2]. + +As I've talked with colleagues who are working remotely, many people say this period is temporary and makeshift: "_Once it's safe to return to the office, we can resume all our old habits and processes_." But in truth, this period of working from home and our eventual return to the office are deeply entwined. The choices and changes we make now will impact the ways we work once we step back into our offices, laboratories, classrooms, and other workspaces. + +Rather than viewing this moment as temporary and makeshift, we should see it as formative. By investing in and improving our online meeting experience _now_, we can build the foundation for a better work environment that persists long after the pandemic. We can use this moment to recalibrate our culture and systems, so they are more robust, resilient, and inclusive. Those of us in scientific fields can use this moment to deliberately shift toward [kinder science][3]. + +Meetings are just one example: Rather than trying to recreate in-person meetings online, let's reimagine what remote meetings can be. With online meetings, you have to be intentional about setting up channels through which participants can contribute and take time to make sure that they know how and feel comfortable doing so. We can take this practice back to the office, providing an opportunity to be more inclusive in-person and break power balances (including leadership hierarchy and majority groups) that can keep folks silent. + +Using this difficult moment to build a better work environment may sound overwhelming. But, there's good news: There's no shortage of resources and experiences to draw from. Working remotely feels new to a lot of us, but folks in the open source software world have been working this way and building community online for a long time: Tim O'Reilly has described this as the [architecture of participation][4]. Mozilla has been empowering cohorts of [Open Leaders][5] around the globe for years. And [rOpenSci][6], [RStudio][7], and the [Carpentries][8] have created and support remote, collaborative communities of scientists and coders. We can learn a lot from these communities that have been building relationships and innovating together from afar. + +Ready to get started? Below, we share three principles for empowering remote interactions that we can also carry forward in real life (IRL). + +### Set an inclusive tone + +Remote meetings can easily feel disconnected or unnatural—especially if you're new to meeting online. Start all meetings with a welcome to earn buy-in and participation. For example, schedule time at the very beginning to welcome everyone, announce the meeting goals, and explain how to participate, like how to unmute microphones, use the chat, or write in a shared document. Starting with a quick roll call and icebreaker question during the meeting makes folks less anonymous and encourages participation. Additionally, outline the shared expectations and culture of the meeting by summarizing the code of conduct or community participation guidelines. + +Create a detailed agenda with specific minutes allotted to different topics, including the welcome. The agenda should be shared ahead of time and contain enough structure to allow for productive conversations, but also enough flexibility to allow for fruitful digressions. Agendas can be designed with [POP][9] to clearly state the _purpose_, _outcomes_, and _process_ of the meeting. + +Providing multiple communication channels during the meeting for folks to "speak up" is important not just for introverts but also for underrepresented minorities, students, and early career people, as well as international or multi-lingual participants. If you're using a shared document, writing feedback instead of verbalizing it can save time and also be used for side and asynchronous conversations. Using multiple channels also provides ways to be in touch and catch up if folks join the call late or drop off due to connectivity issues. + +### Provide robust documentation + +People can walk away (or log off) from meetings with different perceptions and expectations. Robust documentation can dispel this ambiguity and keep everyone on the same page. + +Write meeting notes in a document—preferably in the agenda document mentioned above. Use collaborative document software such as Google Docs or an open source alternative like [Etherpad][10] so that folks can take live notes together. Invite and teach participants how to contribute and have them get into the rhythm early on, for example, with a written roll call that also buffers time as folks arrive at the start. + +Encouraging everyone to participate in the document will result in a record of the meeting that is less brittle than anything produced by a single designated note-taker and will include more voices. Folks can contribute in many ways (including adding links, comments, +1's to affirm others' ideas, and emojis to provide quick emotion and color). Further, people can contribute to shared documents live during a meeting or asynchronously before and afterward. These notes can also be shared in many ways after the meeting (email digest, Slack, Twitter, [Mattermost][11], etc.) with different audiences and become more accessible in "post-production" (e.g., captioning, alt-tags on any images shared, etc.). + +### Choose the right tools + +Choosing the appropriate communication channels for meetings and follow-up is important. It also requires time and empathy to make sure everyone knows how to use the technology. + +For virtual meetings, videoconferencing software like [Jitsi][12] allow participants to engage with "faces on." This is a nice norm to set if participants are comfortable, but it is also important to state that it is fine to participate without enabling video for any reason, including bandwidth or privacy issues. + +Providing the opportunity for participants to have smaller conversations through [Big Blue Button][13]'s breakout rooms can be very fruitful for moving ideas forward and strengthening relationships and trust. Having prompts or tasks to center the conversations helps make the best use of time, and scheduling time for summaries once the whole group has reconvened allows more ideas and insights to be shared. + +Using collaborative software for creating presentations can strengthen engagement while reducing bandwidth issues. Asking participants to open the presentation on their computers and advance the slides themselves eliminates the need for screen-sharing—and the bandwidth issues, multiple windows kerfuffling, and passiveness that can arise as a result. + +Being deliberate about the communication platforms outside of meetings is also important. For example, [GitHub Issues][14] might be better for archiving decision-making conversations. And a messaging platform like [Mattermost][15] might be better for quick contact, co-working, and community-building. Whichever platforms you use, take some time to make sure that they meet your team's needs and provide enough control to make them as safe as possible for your participants. + +### Make meetings work online, offline, or both + +When we're in person again, these principles and tips don't become obsolete. They're relevant and critical to a productive, inclusive workplace, whether we're online, offline, or a hybrid of the two. We have led our [Mozilla Open Leaders][16] and [Openscapes Champions][17] programs this way, and we've learned that these approaches can transcend discipline and organization size. + +And while each principle takes time and practice, they're all attainable. We have a big chance here to redesign the way we interact and collaborate, so let's start with intention and kindness. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/remote-meetings + +作者:[Abigail Cabunoc Mayes][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/abbycabs +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chat_video_conference_talk_team.png?itok=t2_7fEH0 (Two people chatting via a video conference app) +[2]: https://www.theatlantic.com/health/archive/2020/03/how-will-coronavirus-end/608719/ +[3]: https://blogs.scientificamerican.com/observations/open-software-means-kinder-science/ +[4]: http://radar.oreilly.com/2015/03/socialcivics-and-the-architecture-of-participation.html +[5]: https://foundation.mozilla.org/en/opportunity/mozilla-open-leaders/ +[6]: https://ropensci.org/ +[7]: https://community.rstudio.com/ +[8]: http://carpentries.org/ +[9]: https://suzannehawkes.com/2010/04/09/pop-everything/ +[10]: https://opensource.com/business/15/7/five-open-source-alternatives-google-docs +[11]: https://opensource.com/alternatives/slack +[12]: https://opensource.com/alternatives/skype +[13]: https://opensource.com/article/20/5/open-source-video-conferencing#bigbluebutton +[14]: https://openscapes.github.io/series/github-issues.html +[15]: https://mattermost.com/ +[16]: https://foundation.mozilla.org/en/blog/online-meeting-tips/ +[17]: https://www.openscapes.org/blog/2020/03/11/how-to-run-a-remote-workshop/ diff --git a/sources/talk/20200613 Introducing the Open Management Practices.md b/sources/talk/20200613 Introducing the Open Management Practices.md new file mode 100644 index 0000000000..df53d52ab4 --- /dev/null +++ b/sources/talk/20200613 Introducing the Open Management Practices.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introducing the Open Management Practices) +[#]: via: (https://opensource.com/open-organization/20/6/open-management-practices) +[#]: author: (Heidi Hess von Ludewig https://opensource.com/users/heidi-hess-von-ludewig) + +Introducing the Open Management Practices +====== +What does great management look like in an open organization? DeLisa +Alexander of Red Hat explains a new, open resource that paints one +vision. +![Media ladder][1] + +For the second article in this series on [Managing with Open Values][2], I spoke with DeLisa Alexander, Executive Vice President and Chief People Officer at Red Hat, specifically about how managing with open values works in that organization. DeLisa's team recently created and open sourced a new resource—[the Open Management Practices][3]—to help Red Hat managers understand their roles in an open organization and to empower Red Hat associates to help those managers practice openness. + +I spoke with DeLisa, a 19-year veteran of Red Hat, about what led to the creation of the practices, how she and her team developed them, and how the organization plans to integrate them into its manager competencies. DeLisa came to Red Hat with a legal background and began her career at the company as inside counsel. The legal field is very hierarchical and not too open in its values (due in part to the confidentiality required of counsel). In our interview, DeLisa explains how, over the course of her career, she's been able to grow and guide the development of Red Hat's "bottom-up" organization. + +I've transcribed parts of our interview below and edited them for readability. + +* * * + +**Heidi:** This interview series is about "managing with open values," and one of the first questions we've been asking interviewees is: What does that mean to you, to "manage according to open values"? As the executive overseeing the People team at Red Hat, why is this issue important to you? + +**DeLisa:** Red Hat started as a movement, in part because of the internet and the connected, democratic nature the technology brought with it. Red Hat hired top contributors of open source communities, which meant that these associates, now hired into decision making roles, were "infused with open"—they lead like community members, not conventional executives. The expectation was that the culture supported collaboration, participation, and community—the values of the open source community. They brought the culture with them, in other words. Upholding and catalyzing this culture via the body of community members into a profitable company is very important, and very different from proprietary software companies. + +**Heidi:** That's so interesting, because as a relatively new Red Hatter I didn't really see that connection as clearly as you explain it. Now I can better understand the passion that a movement started while intersecting with a corporate culture. + +**DeLisa:** Yes. Having come from the law I felt the same way, and it took me a while to realize how it worked and what the expectations were. + +As I navigated my way in the open source community culture, we started to see that those who were not coming from Red Hat communities didn't know how to navigate this new culture. So, we created the [Open Decision Framework][4] (ODF) to help them grow and align to Red Hat values. + +Associates and leaders with decision making responsibilities needed to understand and practice open source practices because our culture is so important. In addition, when you use the ODF, you get better and more creative decisions—that might take longer to get, but then you don't have the change management, like at other companies, after the fact. The transparency offered by the framework aligned with the cultural expectations of the community. When people don't get what they expect, that's when things blow up. So the ODF helps associates and leaders navigate working and decision making in the Red Hat community in ways they expect. + +**Heidi:** So Red Hat is essentially an open source community culture _at scale_. + +**DeLisa:** Yes. Over time, we have had to develop and grow in ways that are consistent with our values. We've created tools and had projects that used open tools to do that. For example, [when we created our "Why,"][5] our shared purpose, the proposed plan was going to take a year before it opened to the associates. The focus of the proposal was on the leaders coming up with it in a closed room—which wouldn't work at Red Hat. But we decide to involve the associates and do the change management synchronously with the activity. The power of participation will create something amazing (when it's important to do) for Red Hat, but you have to take it on faith, and you don't know when it's going to be done. The iterative process means that project plans are less defined and you have to trust: when it's baked, it's baked. You have to lean into the instinct that you will know when it's baked. + +**Heidi:** From my own experience, I can see and feel that, from the associate perspective, there are large gains by being able to participate. But what are the benefits to the managers themselves when they manage with open values? + +**DeLisa:** One of the most important values of open source community members is that they want to contribute right away; there is a meritocracy where title doesn't matter. That's important and that's also what Millennials expect for themselves. Millennials are working this way now. That means that managers at Red Hat had to learn how to manage Millennial-like people 20 years before Millennials came into the workforce! There is a significant advantage in that, because it helps to create a highly engaged workforce where people have a part in making a great team and a great organization. Managers also develop associate capabilities: their skill, their understanding of context, and purpose. Managers are helping "develop these muscles' [in their associates] while creating a learning zone at the same time. + +Listen to DeLisa describe the importance and benefits of managing with open values + +**Heidi:** In this way, managers are creating their own succession plans, because there isn't an us/them context that some conventional organizations have about leadership. In my experience working at conventional organizations, there is a distinct disjointedness between leaders and associates—either you are In the club, or you are not. Where there are open values, leaders and associates are one and the same, or at least the boundary is less distinct. + +**DeLisa:** When I took this job, everyone was a leader. You might be a manager, a _role_ that manages people, but everyone was expected to be a leader. We have tried to carefully define "leader" so that we don't lose the concept and impact the meritocracy. + +**Heidi:** We've talked a little bit about the growth of Red Hat, and I wonder how you and your team have scaled the role of manager, and managing with open values, across the large and growing organization. What does it look like and what strategies are you working on? + +**DeLisa:** As you know, things always look and work a little differently at Red Hat. [Our competency model][6], for instance, helps people know what good looks like in their roles, and then we created the Open Decision Framework to help leaders make decisions in an open way. But we found that managers didn't understand what was expected of them in an open organization. Some brought with them ways of working from their former companies. And yet, as a people manager, they are a key leverage point for Red Hat, essentially responsible for supporting talent. The experience of the associate is greatly influenced by their manager and when you don't have managers who don't manage with open values, then the associates are not getting the full experience of working at an open organization. + +We started at the beginning, asking ourselves ["If everyone is a leader, do we even need people managers?"][7] And we decided we needed the manager role. There are too many operationalization points regarding hiring, development, performance, etc. Our next step was the practices (do's and don'ts) and mindsets for managers. The Do's and Don'ts were communicated to Red Hat as a whole to get feedback, including all the geos, using a global face-to-face tour. These became the six Open Management Practices. + +**Heidi:** Of the six Open Management Practices, which do you feel is most important? + +**DeLIsa:** Probably the one that is most important to us today is "Creating an environment of respect, belonging, and mutual support." It is foundational for meritocracy and the idea that people can contribute even if their style of thinking, language, or remote work are differences. People need to feel like they belong because every associate has to feel comfortable contributing at our very, very best. This is on my mind all the time because there is a lot of research about it, one book for instance is _The Fearless Organization_ by [Amy C. Edmonson][8]. Meritocracy is not just "being nice." It is linked to the learning organization—fail fast and often— and this is how the world's problems are getting solved these days. + +**Heidi:** So we've talked about how the Open Management Practices benefit both associates and managers, and I'm curious about the topic of accountability. How is Red Hat helping to make managers and associates accountable for using these practices? + +**DeLisa:** That's a great question and a hotly debated topic within my team. Part of the genesis for the Open Management Practices was to create accountability between associates and managers. We asked ourselves "how can we help people to want to be accountable?" We can't legislate this. These practices can't be done "because the People team told me to." We need to inspire ownership, so we made the idea of ownership part of the workshop conversation. The tool helps build a competence—"what good looks like"—by defining the practice. So, the People team asked managers, "Once you are enabled, would you be committed to these practices?" and 97% said "yes"! Therefore, we focused on enabling them knowing that the ownership and accountability would follow. + +Listen to DeLisa describe how managers and associates co-created the Open Management Practices + +In addition, the No. 1 request in the workshop was for a 360-degree feedback mechanism. We are excited to partner with TILT365 [Red Hat's vendor for personality style testing] to create a multi-factor survey that helped identify a questionnaire for management feedback. This makes the whole model and process very transparent. Associates know what the do's and don'ts for management practices are, and managers have feedback; leaders can support development plans for their managers. All this creates a full, virtuous cycle because the Open Management Practices created a path for managers to commit to their own development. + +Listen to DeLisa describe how managing openly can increase commitment and accountability + +**Heidi:** That's really interesting! I can see how the definition of the practices helped people understand what they were committing to, and the workshops and using the Open Decision Framework to get feedback from Red Hatters at all levels, helped to create the commitment needed in a natural way, as an obvious extension of the activity. + +DeLisa, thank you for your time! I appreciate your taking the time to speak with me today. + +**DeLisa:** I appreciate it, your time, and your interest in this! Thank you for having me. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/open-management-practices + +作者:[Heidi Hess von Ludewig][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/heidi-hess-von-ludewig +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_meritladder.png?itok=eWIDxnh2 (Media ladder) +[2]: https://opensource.com/open-organization/20/5/commitment-engagement-org-psychology +[3]: https://github.com/red-hat-people-team/open-management-practices +[4]: https://opensource.com/open-organization/resources/open-decision-framework +[5]: https://opensource.com/open-organization/17/9/rediscovering-your-why +[6]: https://github.com/red-hat-people-team/red-hat-multiplier +[7]: https://opensource.com/open-organization/18/10/understanding-engagement-empowerment +[8]: https://www.hbs.edu/faculty/Pages/profile.aspx?facId=6451 diff --git a/sources/talk/20200614 Who is the glue person on your team.md b/sources/talk/20200614 Who is the glue person on your team.md new file mode 100644 index 0000000000..9c855b01e6 --- /dev/null +++ b/sources/talk/20200614 Who is the glue person on your team.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Who is the glue person on your team?) +[#]: via: (https://opensource.com/open-organization/20/6/glue-person) +[#]: author: (Lauri Apple https://opensource.com/users/lapple) + +Who is the glue person on your team? +====== +How to identify and utilize the role of a clear-headed, storyteller on +your team. +![Business woman on laptop sitting in front of window][1] + +Here's a test: how long do you think it would take for your organization to kickstart a brand new effort? A few days? A week? + +How ready would your teams be—do they already know how to roadmap, align, prioritize, and coordinate with each other? + +Are your teams successfully ending any wasteful activities? These might include running unused AWS stacks, building the same thing twice, or consistently preferring tactical, localized optimizations over strategically collaborating with other teams. + +If your organization has such activities in motion, you're probably on the right track. If not, that's a warning signal that your team is lacking some core capabilities you'll need for successfully launching any new endeavor, pandemic or not. + +Does your organization allow your [glue people][2] to develop those core capabilities, or are you pressuring them to stay in their boxes? + +### Zombie scrum, velocity counters, clipboard dogmatists, and other occupational hazards + +Not long ago, on a lark, I interviewed for some freelance project management work with a US-based company. The experience was bizarre. The recruiter, who expressed all the enthusiasm of a bowl of cold pea soup, asked me to do tasks that require much more time and context than what was allotted, even to achieve the goals at a mediocre level. I was penalized for stating that I have never seen scrum by the book—aka [zombie scrum][3]—succeed in any organization. And I was somewhat scolded for asking analytical questions that, in my experience, are critical to driving focus and clarity. + +I didn't get passed to the next stage of the process, in part because the recruiter said my zombie scrum comment was a red flag. I took that as a compliment. But I also felt sorry for any project manager—or scrum master, agile coach, or any other creative person—who's made to apply cookie-cutter solutions to situations that require listening, empathy, and creativity. "Follow the book" is a simplistic, anti-intellectual way to crush innovation and generates stereotypes about professionals whose valuable work aims to glue teams, departments, and narratives together. + +Countless books, articles, and tweets from frustrated agile practitioners have been written about the tendency of many companies to pick an agile framework and force it to stick. A well-meaning company picks scrum, then instantly gets dogmatic about it and hires a bunch of scrum masters to hold the required ceremonies. In this environment, it's easy for the scrum masters to tie their competence to existing certifications instead of growing and expanding their skills into areas like psychology or conflict resolution. The company then puts a bunch of additional requirements on top of their framework of choice—checklists, team working agreements that look a certain way, mandatory JIRA fields separating "internal work" from "external work" (whatever that means). + +Maybe this stuff works somewhere? I have never seen it. + +There's never a good time to pressure your people to dumb down process and now is especially not a good time. Your organization needs even more of what makes a highly effective glue-person: + + * Pragmatism + * Objectivity and a habit of identifying assumptions + * Communication skills, which most tech companies struggle with even in calm times + * Good listening skills + * Pattern detection + * Research skills + * Neutrality and diplomacy + * Strategic mindset over tactical, quick-fix, trees-for-the-forest thinking + + + +If you're not supporting your team in valuing and encouraging these attributes in your people—regardless of whether their job title includes "agile" or not—please start now. + +Of course, some people who take on "agile practitioner" roles actually prefer to be dogmatists, by-the-book folks, and bug counters. In that case, you have two options: either see if they're willing to explore different approaches to their work, or, if they're not, explore other people. + +### Know your PMO + +If you hear teams grumble that your project management office (PMO) is a bunch of non-technical clipboard people who block progress, challenge those biases. Maybe your PMO really is ineffective; some are. But maybe there's a different issue at work—either micromanaging on their part or lack of accountability on the rest of the organization's part. + +A friend described to me a situation in which the two engineering executives in their company constantly complained about the PMO, for reasons that were never clear. What was clear was that the engineering executives did not value transparency or accountability. Meanwhile, my friend stated that many people in the company swore that without the PMO, nothing would have gotten done within any reasonable amount of time. After a leadership change, the engineering executives were replaced; the PMO remained. + +If the issue is with the PMO, consider coaching the team to be more effective. This can be done through a retrospective or, if you have time, one-on-ones. I have been lucky enough to work in three organizations with high-performing PMO organizations. They framed conversations with teams to similarly focus on goals and broader developments taking place around them. They were empathetic—trying to understand why programs lagged behind, instead of blaming or nagging. They were focused on producing value—aligning teams, making work transparent, keeping meetings well-organized and constructive, and asking pragmatic questions that averted disasters or surfaced gaps in strategy. + +Instead of checking in to see if people were doing their work, they helped teams find out ways to help each other. In many cases, they helped drive knowledge exchange to cross-pollinate new ideas and solutions either by running effective meetings or hosting dedicated conversations. + +If the issue is with your organization, work with the PMO to see how your leadership team can become better advocates for PMO work. Sometimes the issue for PMOs is a lack of public relations and reputation management. Sadly, PMOs can become the canvases upon which disgruntled parties project everything they're mad about, and this really isn't helpful to anyone. Neither are out-of-the-box expectations that PMOs can solve product strategy problems when product managers abdicate responsibility, or solve your technical architecture, or resolve every conflict between two engineers. Your organization might simply be misapplying your PMO power in ways that reinforce existing biases or misunderstandings of their work. Find ways to stop that. + +As a PMO of one person, I work closely with stakeholders across my organization to break down complexity, clarify outcomes, and track work-in-progress through lightweight visualizations. It's all storytelling. I work closely with our agile coaching team, laying the groundwork with delivery teams to form a coherent vision for what to build, then collaborating with the coaches to work with specific teams to boost performance and ensure better flow on that vision. It's not wizardry, and I've recycled it from what other successful PMOs have shown and taught me over the years. It seems to work. + +### Give your agile coaches and scrum masters meaningful metrics + +"I thought agile coaches just measured velocity and story points, and scrum masters do the same but also keep JIRA updated," more than one person on earth has said. How did they reach this conclusion? Possibly by working in an organization that asked coaches and scrum masters to focus on output instead of value. Maybe those organizations didn't expect or even care if the coaches demonstrated their effectiveness; the coaches and scrum masters were there to serve a purpose, like security blankets of agility. + +Story points and velocity are worthless metrics if the work delivered isn't valuable. So is counting the number of retrospectives, or counting the decline in the number of bugs per team (easily gamed), or the amount of time spent pair programming. These metrics do not necessarily tell a coherent story about your organization, and they do not help the coaches and scrum masters grow. + +I like [this list of agile coach metrics by Andy Sio][4]: measure impact by looking for evidence of efficiency, or reducing meetings, or collecting data points around teams using coaches' suggestions to make improvements. For the scrum masters, Ryan Ripley invites leaders to [rethink the role][5] as one of service, challenging the status quo. Find someone else to update the JIRAs and take the notes. + +Maybe you're cool with empowering coaches and scrum masters, but now you're asking, "we have product managers and business analysts—why do we need coaches to do this?" Because dysfunction in delivery is usually systemic. It's about a confluence of discussions, decisions, communications, and other bits and pieces of work going awry, slowly at first, until it all adds up to become A Bigger Problem. + +A coach can help your product managers, analysts, and devs surface those Bigger Problems, understand the root causes, and find more effective alternatives to right the ship. If urgent enough, this can mean the difference between success and failure. For example: + + * How effective can a scrum master assigned to two or three teams possibly be if those teams are facing a constant barrage of "this is urgent!" work chucked in from the leadership team? + * How can a team align with other teams, if those teams aren't sharing roadmaps? + * How can engineering and product remain aligned if there are two competing roadmaps? + * If you're facing Coronavirus, will your product managers, devs, and analysts have time to unpack all of this systemic dysfunction, or could they use a little help? + + + +Identify the "glue people" in your organization and find ways to leverage them through focused programs dedicated to one or two outcomes at most. Consider forming a "community of practice," an informal setting (Lean Coffee or other formats) for them to share best practices or highlight and resolve process-related needs in the organization. + +If your glue people are already overwhelmed, consider hiring more of them. This might sound counterintuitive if you're laying people off, but what costs more—hiring one program manager to do the job well, or having ten developers and product managers do the job with less focus, while not doing their usual jobs? + +Hopefully, you're able to identify the people in your organization who can connect the dots, tell your story, and bring everyone together. Maybe you've even hired people specifically to mind your processes and haven't laid them off yet. Please don't! They might save you and everyone else in your company. But only if you empower them. + +If you're starting something from scratch, support your glue people in keeping everyone else from losing the plot. Then you build a culture of maintaining the plot. It's easier to iterate and improve upon such a culture when it's the foundation of your new initiative or product than to force it after developing lots of antipatterns and worst-practice habits. Sure, incremental change can bring teams and organizations back on track—but why tolerate being off-track in the first place? "Going faster at the beginning" isn't a good reason; you can go super-fast and be experimental and still hold your team together. + +Process can be simple and lightweight—in fact, it should be. But it can't be solved simply by putting some meetings in a calendar and writing everything down in Confluence. It has to be customized and curated, created to achieve and sustain flow, and designed to be adapted depending on what's necessary. Otherwise, it will be an obstacle and a waste of time instead of an aid, and people will hate it. And it probably won't come from following scrum by the book, or anything by the book. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/glue-person + +作者:[Lauri Apple][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lapple +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://opensource.com/open-organization/20/6/glue-team +[3]: https://www.scrum.org/resources/blog/zombie-scrum-symptoms-causes-and-treatment?gclid=EAIaIQobChMI97Cr6v-96QIVFO3tCh25RgrWEAAYASAAEgIgYfD_BwE +[4]: https://www.strategicquadrant.com/blog/how-to-measure-your-successas-an-agile-coach/ +[5]: https://enterprisersproject.com/article/2020/4/scrum-master-role-how-rethink diff --git a/sources/talk/20200616 Changing the world with open source- GNOME president shares her story.md b/sources/talk/20200616 Changing the world with open source- GNOME president shares her story.md new file mode 100644 index 0000000000..98ddcd364c --- /dev/null +++ b/sources/talk/20200616 Changing the world with open source- GNOME president shares her story.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Changing the world with open source: GNOME president shares her story) +[#]: via: (https://opensource.com/article/20/6/nuritzi-sanchez-interview) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Changing the world with open source: GNOME president shares her story +====== +GitLab's new senior open source program manager and founding team member +of Endless OS shares her vision for using open source to improve +society. +![Globe up in the clouds][1] + +Growing up in Silicon Valley, [Nuritzi Sanchez][2] saw the powerful impact software can make on the world. Yet, unlike many others who were also steeped in the tech industry, her journey has taken her into the world of open source, where she is contributing to that impact. + +After graduating from Stanford University with a degree in International Relations, she ****became a founding team member of open source computing company [Endless OS][3], served three terms as president and chair of GNOME's board of directors, and in February 2020 was hired as the senior open source program manager (OSPM) at GitLab. + +I am impressed by this talented woman, and I reached out to her to learn more about her and her work. I believe you will also be fascinated with her journey after reading our interview, which has been lightly edited for clarity. + +**Don Watkins:** How did you get started with open source? + +**Nuritzi Sanchez**: My first experience with open source software was using an Ubuntu-based computer at an immigration law clinic when I was interning there as an undergrad. I remember being really surprised that something other than Macs and Windows existed. I had a good experience using the Ubuntu machine. + +Later, in 2012, I helped start a company called [Endless][4] that aimed to make computing universally accessible. By leveraging the power of open source software, we wanted to create computers that were great for users that had little to no access to the internet or were new to computers. + +As I deep-dived into that world, I was amazed by how vast the open source application ecosystem is. In my college years, I had become an Apple fangirl, and I immediately noticed the difference in user experience and design. Thanks to the CEO and founder's strong interest in great design, Endless was created from the beginning to delight users. Our team hoped to bring more user-centered design to the Linux desktop world. + +![GUADEC 2015 newcomers' event][5] + +GUADEC 2015 newcomers' event (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +In 2015, I gave my first talk at [GUADEC][7] (the GNOME community's largest conference) about [adapting GNOME for the developing world][8]. I didn't know what to expect going into the conference since that was the first time I'd attended an open source software event, and I was incredibly impressed with how friendly and welcoming the GNOME community was. The newcomers' and social events helped me bond with the existing community, and when I attended a Birds of a Feather (BoF) session, I noticed that my project management and leadership skillset was immediately useful. Even though I was new to the community and was not an engineer, I felt like I could immediately contribute. I wished I had known about GNOME and the open source world years before! + +**DW:** What is the power of open source for you? + +**NS**: Open source software helps democratize the world and enables us to solve the challenges we know best. You can build on top of the work that others have done in order to solve unique challenges around you instead of having to recreate something completely from scratch. It thus spurs innovation. + +Since a lot of open source software is not only free as in philosophy but also free as in price, it also gives people who may not otherwise be able to afford it access to tools that are essential to be part of the modern workforce. + +**DW:** How did your family background drive your interest in open source? + +**NS**: My parents are from Mexico, and when we visited family there, I was struck by the differences between where I was growing up, in the Silicon Valley, and where my parents were from. Sometimes we would visit towns where people had cardboard instead of windows, elderly people were sitting in the heat trying to sell artisanal goods they made, and poverty was visible in every corner. I heard heartbreaking stories about the struggles that people were facing, and as an empathetic kid, that all greatly impacted me. I wanted to do something to help. + +During my undergraduate years at Stanford, I really struggled to find just one thing that I was interested in. I was drawn to social impact initiatives, but I wanted to help people be healthier, have access to great education, find jobs, and feel fulfilled. I basically wanted to do _all the things_. This led me to explore many potential career paths through internships. + +Unsurprisingly for someone who grew up in the Valley, I ended up believing that getting involved with software was the best way for me to make a huge impact. I saw how just a small team could create software that was used by millions of people and could impact their lives. It seemed like a superpower. I then became enamored with open source software because of all the reasons I've mentioned above. As a bonus, open source software usually already has an international community, and as I've gotten more involved, I've been keen on helping to expand its reach. + +**DW: How has your involvement with Endless shaped your vision and direction?** + +**NS:** One of the things that I loved about Endless is how much the team valued getting to know its users. Every employee was able to go to one of Endless' target markets and do in-field research. We were able to meet people whose lives we were actually being impacted by our work. + +My time at Endless allowed me to travel and become immersed in different cultures to an extent that I wouldn't have had otherwise. I sometimes spent several months in a target market when I was helping with special initiatives. I met people from the international open source community who are extremely dedicated to the open source philosophy—and I also learned more about the challenges they face when contributing. + +![Endless OS user testing in Guatemala][9] + +Endless OS user testing in Guatemala (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +The other theme is the importance of user-centered design. I'm very grateful to have been part of a team with extremely talented designers and executives that believed that great design was essential. Our COO attended the [Stanford d.school][10] and helped infuse the company with an appreciation for design thinking. Similarly, our CEO had a sharp eye for things being pixel-perfect and always challenged our designers to create beautiful software. I developed a certain aesthetic and a deep appreciation of the design process. My time at Endless helped me appreciate some of the unique challenges that designers face when trying to contribute to open source software. + +**DW:** Diversity and inclusion are really important to you. How does diversity improve products and communities? + +**NS**: Diversity of thought is something incredibly important when solving any kind of challenge. In order to do that, you need to bring in people from diverse backgrounds. New perspectives often bring new insights or new ideas into the mix. + +One of the tangible examples I have from my time at Endless is when we were working in Indonesia and wanted to do user research there to better understand the market. One of our Endless Ambassadors, Siska, belonged to a group of housewives that met regularly, and she introduced Endless at one of their meetings. Many of the housewives who attended got really excited about Endless and told their partners and children about it. Being great networkers, some of them helped us find people for our user research studies and became evangelists of our product in their communities. It was something that, at least to me, wasn't a normal path to take, and it was something that was hugely beneficial. + +![Meeting with open source community members in Indonesia][11] + +Meeting with open source community members in Indonesia (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +**DW:** What led you to leave Endless and move to GNOME? + +**NS**: Endless did a lot of things right, and it still faced a lot of the challenges that all open source desktops face in a world that is [dominated][12] by Microsoft. Endless had to make some hard choices about how to evolve its strategy and also started to explore some new ideas—like how to make Endless a great platform to teach children how to code. It was during this time that we parted ways, but I continue to be a huge fan and still use Endless OS on my personal computer. + +I ended up taking some time off after Endless to travel and to continue my third term as the president and chairperson of the board of directors at GNOME. + +![Women Who Code Taipei event][13] + +Meeting with Women Who Code Taipei (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +**DW:** GNOME experienced tremendous growth during your tenure. What do you attribute that to? + +**NS**: There were many things that factored into the growth we saw during my tenure. Here are the most important ones: + + * **Improving the newcomer's story:** Carlos Soriano, Bastian Ilso, and Christian Hergert, in particular, really helped set GNOME's momentum in motion by working on a newcomer's guide for code contributors. They developed the workflows and tools that made an immediate impact on our community's growth. Later, Carlos led an evaluation of tooling and helped GNOME find GitLab as the solution to further simplifying the contribution process. + + * **Broadcasting our story and promoting our brand:** As part of the Engagement team, I helped to amplify our work on the newcomers initiatives and helped to build our brand and online presence. GNOME's work on improving the newcomers' story gained a lot of interest within the wider community and brought about new interest in the GNOME project, and we used that to help build the sense that GNOME was in forward momentum. Marketing, brand, and dedicated community-building are really important for open source organizations. + + * [**Flatpak**][14]**,** [**Flathub**][15]**, and** [**Builder**][16]**!** There were several technological innovations that helped propel GNOME forward. For example, Flatpak and Builder helped to make creating a GNOME app easier than ever, and users were able to find and install apps directly from Flathub. These innovations were _huge_ because they made it possible for anyone to create and enjoy great Linux desktops. Furthermore, it helped unify the Linux desktop community a bit since any distribution that enabled Flatpak apps could benefit from easier distribution and management of apps. + + * **Hiring an** **executive** **director (ED):** GNOME had been without an ED for several years before I joined. With the help of a hiring committee, the board soon interviewed several highly qualified candidates for the ED position. Leveraging my startup experience in hiring, I worked with our vice president at the time to figure out all the logistics behind hiring our first-ever non-US employee and closing the loop. We soon announced that Neil McGovern would join as the GNOME executive director. This was an important step for us since the board had absorbed the ED's responsibilities while the position was unfilled. Since the board was elected annually, that meant that planning long-term, strategic initiatives was rather difficult because of turnover. + + * **Dreaming new dreams:** While I'm biased, I do think that Endless' new perspective helped the GNOME community to dream a new dream and start creating GNOME for a user beyond the "typical Linux desktop user." This meant working on features that enabled a less tech-savvy, more design-sensitive, and less-connected user. Since Endless worked heavily upstream, GNOME experienced an influx of contributors from Endless' employees and Endless' ecosystem. This, combined with the newcomers' story, helped propel GNOME into an era of being more accessible to more people around the world. This also helped attract donations from organizations, including a $1 million pledge that helped GNOME dream new dreams. As part of that, the board decided that expanding the GNOME Foundation would help sustain GNOME's momentum and that employees would be hired for the first time ever to work directly on aspects of the project, like on GTK and event planning. + + * **Restructuring the** **GNOME** **Foundation:** One of my short-term goals upon hiring our executive director was leading the board of directors to be more of a strategic entity and allowing the day-to-day work to be handled by employees. I proposed having a board hackathon so that we could set aside time to do some strategic planning, reassess how we did budgeting, and also work on important initiatives that often got pushed to the side. The first hackathon was a success, and it's now an annually recurring event. Once the employees had been hired, we worked on transferring responsibilities to them and helping to integrate them into the larger community. There were some challenges we faced along the way, but overall, this went smoothly, and the community was excited about seeing the Foundation grow to support its needs. + + * ![Linux App Summit 2019][17] + +Linux App Summit 2019 (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +**New policies to enable growth:** While on the board, I helped with some initiatives that also helped us build momentum. Two such policies were our [Code of Conduct][18] and our [Travel Policy][19]. These two helped make the GNOME community more inclusive and helped show that GNOME cares about continuing to build a great and diverse community. + + * **Linux App Summit:** Finally, another thing I think helped was the work we did around creating a new conference, the [Linux App Summit][20]. While the conference started in 2016, in 2019, we joined forces with KDE. This doubled attendance and showed the world that KDE and GNOME could work together towards a greater purpose. As part of the founding team of that conference, I'm very proud of our work there. + + + + +**DW:** You've recently moved to GitLab as senior open source program manager (OPSM). What are you doing there? What are your short-term and long-term goals there? + +**NS**: I am thrilled to be at GitLab! My main focus right now is on the [GitLab for Open Source][21] program, which offers our top tiers for free to qualifying open source projects. As part of that program, we also help large open source organizations with their migrations (GNOME, KDE, Drupal, etc.). I'm working on formalizing aspects of the program and streamlining processes that will allow us to scale the program. + +![GitLab's community relations team][22] + +GitLab's community relations team (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +As I work on this program, I'm being exposed to new open source communities, and I'm learning more about the DevOps world. It's been incredibly rewarding already! My hope is to help make GitLab the best place for open source organizations to thrive at scale, and in order to do so, there are many pieces involved. I see myself advocating for features that are important to open source projects, facilitating communication between our community and our internal team, and working with the community relations team to help make it a great experience to be part of our community. Apart from that, one thing that I've been interested in is how to help make open source more sustainable, so I'm keen on continuing to learn about and explore that topic. Last but not least, I’m also very excited about the work that the CHAOSS community is doing on creating metrics to measure the health of open source communities. I recently joined a new working group there to create a set of metrics that foundations like GNOME and KDE can use to measure their community’s health. + +**DW:** Would you recommend other open source companies have OSPMs? What about non-open source companies? + +**NS**: Since software is eating the world, and open source software is eating the software world, I absolutely would encourage companies to devote more resources into understanding their dependency on and growing their involvement in open source software. + +If a company is just starting off or isn't able to have an open source program office (OSPO) right away, having an open source program manager is a great entry point. These early hires can help lay down some initial structure and work on high-priority initiatives relating to the open source work that the company is doing or wants to participate in. This can later turn into a larger program office if and when the company is ready for that. + +* * * + +I appreciate the time Nuritizi took to share her journey with me and the work she's doing to support open source and the communities that build up around open source projects. If you'd like to learn more about her, I recommend you join me in following her on [Twitter][2]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/nuritzi-sanchez-interview + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://twitter.com/1nuritzi +[3]: https://opensource.com/article/18/2/meet-endless-os-lightweight-linux +[4]: https://endlessos.com/home/ +[5]: https://opensource.com/sites/default/files/uploads/guadec_2015.jpg (GUADEC 2015 newcomers' event) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://events.gnome.org/event/1/ +[8]: https://www.youtube.com/watch?v=qs5J_IWSmiE +[9]: https://opensource.com/sites/default/files/uploads/endless_usertestingguatemala.jpg (Endless OS user testing in Guatemala) +[10]: https://dschool.stanford.edu/ +[11]: https://opensource.com/sites/default/files/uploads/indonesiacommunitygathering.jpg (Meeting with open source community members in Indonesia) +[12]: https://en.wikipedia.org/wiki/Usage_share_of_operating_systems +[13]: https://opensource.com/sites/default/files/uploads/womenwhocodetaipei.jpg (Women Who Code Taipei event) +[14]: https://flatpak.org/ +[15]: https://flathub.org/home +[16]: https://wiki.gnome.org/Apps/Builder +[17]: https://opensource.com/sites/default/files/uploads/linuxappsummit2019.jpg (Linux App Summit 2019) +[18]: https://wiki.gnome.org/Foundation/CodeOfConduct +[19]: https://wiki.gnome.org/Travel +[20]: https://linuxappsummit.org/ +[21]: https://about.gitlab.com/solutions/open-source/ +[22]: https://opensource.com/sites/default/files/uploads/gitlab_cr-team.jpg (GitLab's community relations team) diff --git a/sources/talk/20200619 What do Paketo Buildpacks Mean for Developers and Operators.md b/sources/talk/20200619 What do Paketo Buildpacks Mean for Developers and Operators.md new file mode 100644 index 0000000000..77ed828a9d --- /dev/null +++ b/sources/talk/20200619 What do Paketo Buildpacks Mean for Developers and Operators.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What do Paketo Buildpacks Mean for Developers and Operators) +[#]: via: (https://www.linux.com/audience/developers/what-do-paketo-buildpacks-mean-for-developers-and-operators/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +What do Paketo Buildpacks Mean for Developers and Operators +====== + +Cloud Foundry Foundation recently announced the launch of [Paketo Buildpacks][1] for cloud native developers and operators. But what’s the difference between Cloud Foundry’s Packet and the Buildpacks announced by CNCF? What does it mean for developers who are already using buildpacks? What kind of community is Cloud Foundry look at building around Paketo? What does the roadmap look like? + +To get answers to these questions and deep dive into Paketo Buildpacks, [Swapnil Bhartiya][2], Founder of TFiR.io spoke with Chip Childers, Executive Director, Cloud Foundry Foundation and Kashyap Vedurmudi, Product Manager at VMware. + +_Here is a lightly edited transcript of the interview:_ + +**Swapnil Bhartiya: Today we have two guests, Kashyap Vidurmudi, product manager at VMware, and Chip Childers, executive director of Cloud Foundry. Today we are going to talk about the recently announced Paketo Buildpacks. I don’t want to get into that old debate about Docker files versus Buildpacks, but there are two things that I do want to talk about before we talk about Paketo in specific – compliance and security. How does Paketo Buildpacks solve these two problems?** + +Kashyap Vidurmudi: So, we have a couple of things. We are constantly shipping Buildpacks just whenever upstream security vulnerability comes out, a new language family version, things like that. So Buildpacks make it much easier especially for enterprise users just to continuously make sure that their apps stay up to date, and secure, and compliant. So this is I think a huge value proposition of what Buildpacks offer versus using Docker files to run your apps and to build your apps and production. + +Chip Childers: The history of the Cloud Foundry project is, it’s been using Buildpack since nearly the beginning of its inception, originally at VMware, right, before it took it to journey to pivotal and then the CFF. So Buildpacks have demonstrated their value when used with a platform that’s able to implement them effectively, a few times, right? In particular, I’m thinking about the OpenSSL Heartbleed vulnerability. I found that to be a great example of when languages and runtimes don’t embed too many things in their distribution statically, then you’re able to use the Buildpack process to roll out security patches to these really important underlying libraries very quickly. + +Chip Childers: As an example, Kashyap said that the buildpack project with Paketo Buildpacks, they’ve always been keeping up to date with all their critical vulnerabilities or high vulnerabilities from all the languages and frameworks that get pulled together. We had the OpenSSL update rolled out to the whole ecosystem and it managed to percolate through all the platforms that had the CF Buildpacks embedded in them very quickly, like in a matter of days. And it was really smooth. The only hiccup back then was that no JS actually included the OpenSSL library in its own distribution. So I think it was about a month or so after Heartbleed that they split that out and then Buildpacks could be more effective at helping to support some of these underlying libraries. + +**Swapnil Bhartiya: Thanks for explaining that. If I’m not wrong, last year, CNCF also announced a Buildpack project. What is the difference between what CNCF is doing there versus what you guys are trying to do?** + +Kashyap Vidurmudi: That’s a great question and probably the biggest question we’ve been getting asked with this whole launch. So the CNCF Cloud Native Buildpacks project, they built the underlying specification and tooling needed to build a Cloud Native compliant Buildpack. Or the Paketo Buildpacks project is just a set of language family implementations on top of these Cloud Native Buildpack specifications. So we build implementations when we launched the other day, we have Java, node.js, PHP, .NET Core, and probably a couple of others that I’m missing, Buildpack implementations on top of that spec. + +**Swapnil Bhartiya: And why do you call it Paketo Buildpacks, the specific reasons for this naming?** + +Kashyap Vidurmudi: That’s a great question as well. To be completely honest with you, our whole engineering team went through about two different naming exercises just to generate different names for Buildpacks. At a team lunch, a couple of months ago, someone came up with the Paketo, which translates to Greek and… Sorry, it translates to package in Greek. What we really liked about it was Kubernetes translates to pilot and Greek, and we liked that with Paketo translating a package in Greek. We can come off with the association that Paketo packages your apps as container images that any Cloud Native platforms similar to Kubernetes can work as straight. So the name stuck at the end. + +**Swapnil Bhartiya: Talk a bit about the collaboration between Cloud Foundry and VMware for this project.** + +Chip Childers: I want to start probably by saying, the kind of Buildpack project is a Cloud Foundry Foundation project, right? And so what that means is it’s the same engineers and contributors that are working on the traditional Cloud Foundry. Buildpacks are building the Paketo Buildpacks collection, right? So you get all their past experience as a community building and maintaining, and keeping up to date these new Cloud Native Buildpack compliant things. One of the goals of the project team, which I’m sure Kashyap could share a little bit more about as well, is that traditionally the Cloud Foundry Buildpack collection has seen the majority of the effort that was put into maintaining it coming from pivotal. + +There were certainly a lot of casual contributors, but it was something, that pivotal bore the full burden on. And we think that it’s incredibly important that now that the Cloud Native Buildpacks spec can be used in many different platforms. That a lot of participants rally around this because it’s an opportunity to get really high-quality Buildpack code brought into whichever platform you’re using, whether it’s Tecton, or it’s Google Cloud run, or whether it’s the CF [inaudible 00:07:06] distribution of Cloud Foundry. There are going to be a lot of end-users that should be able to amplify the feedback loop back to the project team. And we’re very open to new contributors there. + +**Swapnil Bhartiya: What kind of community are you planning to build around these Paketo Buildpacks and what will be the resources available for the community to build and consume these Buildpacks?** + +Kashyap Vidurmudi: I think just to add on a little bit to what Chip said, the community is super important for us with this whole Paketo Buildpacks launch. I think what we’re looking for ideally is a mix of vendors helping us out similar to what Cloud Foundry Foundation has had in the past, as well as individual contributors. And what’s super exciting to see is we just launched a couple of days ago and we’re already seeing a bunch of people reaching out, and trying out Paketo Buildpacks, and interested in contributing. We’re seeing that maybe people might be interested in helping us develop a Python, Paketo Buildpacks, which is really cool to see. To answer the second part of your question around a marketplace or some ecosystem, I think in the future, that would be super cool to have something like that. In the short term, what we’re doing is we have with this concept of builder images where a builder is effectively a set of Buildpacks, Paketo Buildpacks that are packaged in there. So we ship our builders onto a GCR registry that users can then use to consume our Buildpacks. + +**Swapnil Bhartiya: Is there any specific Buildpacks that will be available or you’ll be focusing on to start with?** + +Kashyap Vidurmudi: Yeah. When we launched the other day, we officially have Java, node.js, .NET Core, PHP, and Nginx Paketo Buildpacks available at the moment. We’re currently just getting started around a Ruby Paketo Buildpacks and looking into publishing some official project-wide roadmap in the future to show what’s coming next. + +Chip Childers: I think that’s another really good opportunity for people to get involved. As you said, there’s been interest organically in helping to add Python as a Buildpack. There’s a very long tail of different languages and frameworks that are used in the enterprise context. And so Paketo Buildpacks was going out the door with a set of Buildpacks that basically solved the majority of enterprise development use cases, right? Python is used very heavily, but it’s a little bit less than Java, right? And so the tail starts to drop a little bit. But there’s a lot of opportunity in those languages and frameworks that the Paketo Buildpacks project team hasn’t created on their own. But those same patterns can be followed for languages that might be maybe less used. + +As the community grows around, not just the Cloud Native Buildpacks spec, right, because anyone can build a Buildpack to that spec. But I think the practices of the Paketo Buildpacks project lend themselves to quality distribution of a Buildpack, right? If you search and get up for Buildpacks, even if you’re just looking at the past version of the way Buildpacks work, you find thousands of them, right? But some of them are stale, some of them are, they have work. And I think the more important than exactly which Buildpacks are offered today is that the Paketo Buildpacks project is an opportunity for people to come together around the discipline of building quality Buildpacks and then maintaining them over time. + +Kashyap Vidurmudi: Yeah, exactly. That’s a really good point. And I think that over the next coming weeks to months, we’re really focused on improving a lot of our documentation to help enable things like this. We have a couple of tutorials right now just to help users create a Paketo style Buildpack and lots of tools and things like that out there. So my end goal and just sure Chip agrees with this, which is, I’d love to see a user just coming in with very little Buildpack experience and be able to build, say, a Rust Cloud Native Buildpack or something like that very simply and easily and support that. And that’s the end goal of where we want to go in terms of enabling the community to build Buildpacks easily. + +**Swapnil Bhartiya: So what happens to the existing Buildpacks that people are already using?** + +Kashyap Vidurmudi: For Cloud Foundry Buildpacks, we’re going to continue providing support for CF workloads into the foreseeable future. So what we did is we built a concept of a compatibility layer on top of every one of our Paketo Buildpacks, which allow us to ship a Cloud Foundry compatible Cloud Native Buildpack. And that enables your CF workflows to continue to work with Paketo Buildpacks. + +Chip Childers: I think one of the things to understand, and this is where it gets a little bit confusing, right? Buildpacks as a concept has a fairly long history. So it started at Heroku. CF was emulating Heroku, right? It was the open source alternative to Heroku and it implemented Buildpacks in order to have that support. And for a while, they were largely compatible, right? You could take a Heroku Buildpack and you could use that in a Cloud Foundry context or you could do the reverse. And so that worked for a while. The two platforms, right, Cloud Foundry and opensource community. And then Heroku as a product or a platform as a service, that’s all proprietary, they started to diverge, right? So the compatibility within the ecosystem started to break down. + +When the CNCF Cloud Native Buildpacks project kicked off, to me that was actually one of the most important moments in the platform as a service space in a number of years. Because it represented a reconvergence of streams of work and sets of experiences with different end-users that made a ton of sense for everyone. But what that means though, is that the CMB spec is, it’s a new way to build Buildpacks, right? So all that historical work for the CF community building that shim is important, but it’s really critical to understand that a Cloud Native Buildpack, compliant Buildpack is different from a traditional Heroku or Cloud Foundry, older version Buildpack. They’re implemented differently. And so it’s a new generation of them. And that’s where a new ecosystem because there are multiple platforms that don’t support their use, is really going to kick in here. + +**Swapnil Bhartiya: Kashyap, you mentioned there’ll be a lot of resources documentation that would be coming up. What are the resources that are available at this moment that people can either read or go to that to get more aware of the project at the same time, how they can get involved with the project?** + +Kashyap Vidurmudi: Yeah. So right now we have a couple of tutorials out there just around how to get started with Paketo Buildpacks as well as how to go ahead and create your own Paketo Buildpacks. In terms of getting started and helping out and getting involved, I think the best way to get started right now is to join us on Slack, our Slack is Slack.paketo, P-A-K-E-T-O.io, or visit our website and go through the content. The website is P-A-K-E-T-O.io. + +**Swapnil Bhartiya: Chip and Kashyap, thank you so much for taking time out of your schedule and talking to us today about this project. Good luck with that project and thank you once again.** + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/audience/developers/what-do-paketo-buildpacks-mean-for-developers-and-operators/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://paketo.io/ +[2]: https://www.tfir.io/author/arnieswap/ diff --git a/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md new file mode 100644 index 0000000000..73fd16ff41 --- /dev/null +++ b/sources/talk/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Wi-Fi 6E: When it’s coming and what it’s good for) +[#]: via: (https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Wi-Fi 6E: When it’s coming and what it’s good for +====== +New wireless spectrum recently dedicated to Wi-Fi allows for more channels and higher density deployments, but gear to support it won’t be widely deployed until 2020, according to an Extreme Networks exec. +Thinkstock + +This spring [the FCC opened up a new swath of unlicensed wireless spectrum][1] in the 6GHz band that’s intended for use with Wi-Fi and can provide lower latency and faster data rates. The new spectrum also has a shorter range and supports more channels than bands that were already dedicated to Wi-Fi, making it suitable for deployment in high-density areas like stadiums. + +To further understand what Wi-Fi 6E is and how it differs from Wi-Fi 6, I recently talked with Perry Correll, director of product management for networking solutions vendor Extreme Networks. + +**Learn more about 5G and WiFi 6** + + * [What is 5G? How is it better than 4G?][2] + * [How to determine if WiFi 6 is right for you][3] + * [What is MU-MIMO? Why do you need it in your wireless routers?][4] + * [When to use 5G, when to use WiFi 6][5] + * [How enterprises can prep for 5G networks][6] + + + +**Kerravala:** **Wi-Fi 6 seems to be getting a lot of hype but not Wi-Fi 6E. Why?** + +**Correll:** There’s so much confusion around all the 666 numbers, it’ll scare you to death. You’ve got Wi-Fi 6, Wi-Fi 6E – and Wi-Fi 6 still has additional enhancements coming after that, with multi-user multiple input, multiple output (multi-user MIMO) functionalities. Then there’s the 6GHz spectrum, but that’s not where Wi-Fi 6 gets its name from: It’s the sixth generation of Wi-Fi. On top of all that, we are just getting a handle 5G and there already talking about 6G – seriously, look it up – it's going to get even more confusing. + +**Kerravala:** **Why do we need Wi-Fi 6E versus regular Wi-Fi 6?** + +**Correll:** The last time we got a boost in UNII-2 and UNII-2 Extended was 15 years ago and smartphones hadn’t even taken off yet. Now being able to get 1.2GHz is enormous. With Wi-Fi 6E, we’re not doubling the amount of Wi-Fi space, we're actually quadrupling the amount of usable space. That’s three, four, or five times more spectrum, depending on where you are in the world. Plus you don't have to worry about DFS [dynamic frequency selection], especially indoors. + +Wi-Fi 6E is not going to be faster than Wi-Fi 6 and it’s not adding enhanced technology features. The neat thing is operating the 6GHz will require Wi-Fi 6 or above clients. So, we’re not going to have any slow clients and we’re not going to have a lot of noise. We’re going to gain performance in a cleaner environment with faster devices. + +**Kerravala:** **Can you also run wider channels?** + +**Correll:** Exactly, that's the cool thing about it. If you’re in a typical enterprise environment, 20 and 40MHz is pretty much all you need. In high-density environments like stadiums, trying to do 80 or 160MHz just became tough. Wider channels are really going help things like [virtual reality], which can take advantage of those channels that are eating up the rest of the spectrum. That’s probably the biggest use case. + +Three or four years down the road, if you want to do digital signage or screen edge at stadiums then you can use 80 of the 160MHz without getting impacted by anything else. There’s already talk of Wi-Fi 7 and it’s going to have 320MHz-wide channels. + +**Kerravala:** **Will this be primarily an augmentation to most Wi-Fi strategies?** + +**Correll:** It's definitely going to be at the edges in the short term. The first products are probably going to launch at the end of this year, and they’re going to be consumer-grade. For the enterprise, 6GHz-capable products will start showing up next year. Not before 2022 will you actually start seeing any density – so, not any time soon. For smartphone companies, Wi-Fi is not a big deal and they’d rather focus on other features. + +Still, it’s a huge opportunity. The nicest thing about the 6GHz versus CBRS [Citizens Broadband Radio Service] or 5G is [that many] would rather stick with Wi-Fi than having to move to a different architecture. These are the users that are going to drive the manufacturers of the widgets to IoT devices or robots or whatever requires the 6GHz. It's a clean spectrum and might be cheaper than the regular Wi-Fi 6. There are also some power-saving benefits there, too. + +**Kerravala:** **There’s talk of 5G replacing Wi-Fi 6. But what’s the practicality of that?** + +**Correll:** Realistically, you can’t put a SIM in every device. But one of the big issues that come up is data ownership because the carrier is going to own your data, not you. If you want to use your data for any kind of business analytics, will the carrier release the data back to you at a certain price? That’s a frightening thought. + +There are just too many reasons why Wi-Fi is not going away. When Wi-Fi 6 and 5G-capable devices come out, what will happen to all the other laptops, tablets, and IoT devices that only have Wi-Fi? There will either be Wi-Fi-only or Wi-Fi and 5G devices, but 5G is not going to replace Wi-Fi altogether. If you look at the 5G radio network backbone, Wi-Fi is a component. It's one big happy family. The technologies are designed to coexist. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3540288/how-wi-fi-6e-boosts-wireless-spectrum-five-fold.html +[2]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[3]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[4]: https://www.networkworld.com/article/3250268/what-is-mu-mimo-and-why-you-need-it-in-your-wireless-routers.html +[5]: https://www.networkworld.com/article/3402316/when-to-use-5g-when-to-use-wi-fi-6.html +[6]: https://www.networkworld.com/article/3306720/mobile-wireless/how-enterprises-can-prep-for-5g.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200629 NIST aims to make frequency sharing more efficient for wireless networks.md b/sources/talk/20200629 NIST aims to make frequency sharing more efficient for wireless networks.md new file mode 100644 index 0000000000..2b703e5ac5 --- /dev/null +++ b/sources/talk/20200629 NIST aims to make frequency sharing more efficient for wireless networks.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NIST aims to make frequency sharing more efficient for wireless networks) +[#]: via: (https://www.networkworld.com/article/3561618/nist-aims-to-make-frequency-sharing-more-efficient-for-wireless-networks.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +NIST aims to make frequency sharing more efficient for wireless networks +====== +Machine-learning formula will help different radio protocols, such as Wi-Fi and LTE, work together more efficiently in the same wireless spectrum. +Martyn Williams/IDG + +A machine-learning formula developed by the National Institute of Standards and Technology ([NIST][1]) has the potential to significantly improve how [5G][2] and other wireless networks select and share communications frequencies. Compared to trial-and-error methods, NIST's formula could make the process of sharing communications frequencies as much as 5,000 times more efficient, researchers claim. + +The NIST system is based the idea that radio equipment can learn its network environments from experience rather than, as is done now, simply select frequency channels based on trial-and-error. + +"The algorithm learns which channel provides the best outcome" under specific environmental conditions, NIST says in an [article on its website][3]. + +**READ MORE:** [How beamforming makes wireless communication faster][4] + +"The formula could be programmed into software on transmitters in many [different] types of real-world networks," the team says. + +Essentially, the computer-modeled algorithm is a formula that maps prior experience in environmental RF conditions. Those conditions can include the number of transmitters operating within a channel (set of adjacent frequencies), for example. + +"… if a transmitter selects a channel that is not occupied, then the probability of a successful transmission rises, leading to a higher data rate," the article says. Likewise, when a transmitter selects a channel that doesn't have much interference on it, the signal is stronger, and you get a better data rate. The transmitter remembers which channel provides the best outcome and learns to choose that spot on the dial when it next needs a clear signal. + +That's different from the way things generally work today. That is, a radio simply tries to find an open frequency and then communicates with like-protocol radios. In sophisticated cases, like Wi-Fi, for example, frequency hopping and [beamforming][4] are used to optimize channels. + +Where NIST's machine-learning technique shines is in the case of shared spectrum, such as sharing Wi-Fi with License Assisted Access (LAA), the researchers explain. LAA is LTE in unlicensed spectrum, known as LTE-U, at 5 GHz. In that combination of Wi-Fi with LAA, on the same frequencies, the protocols are disparate: the radios don't communicate with each other to function in harmony, and chaos could occur the busier the band got—transmissions would bump into other transmissions. But, if all the radios were better at choosing their slot, by learning what works and what doesn't, then things would be better. + +"This could potentially make communications in the unlicensed bands much more efficient," says Jason Coder, a NIST engineer, in the article. + +Indeed, it "could help 5G and other wireless networks select and share communications frequencies about 5,000 times more efficiently than trial-and-error methods," NIST claims. + +The key word here is "share," because in order to increase communications in limited spectrum, more sharing must take place—the users, such as IoT, or media streaming, are all competing for the same metaphorical real estate. Combining unlicensed and licensed bands, as is the case in LAA, will likely become more common as IoT and digital continues to expand. (Unlicensed bands are those not assigned to a specific user, like a mobile network operator; licensed bands are won in auctions and allocated.) + +In the NIST scenario, the competing transmitters "each learn to maximize the total network data rate without communicating with each other." Therefore, multiple protocols and data types, like video or sensor data, or Wi-Fi and mobile networks, can function alongside each other. + +NIST's formula significantly simplifies the process of assigning optimum channels to transmitters, according to the article: "The study found that an exhaustive effort [using trial and error] to identify the best solution would require about 45,600 trials, whereas the formula could select a similar solution by trying only 10 channels, just 0.02 percent of the effort." + +The NIST researchers recently presented their research at [IEEE's 91st Vehicular Technology Conference][5], held virtually this year. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3561618/nist-aims-to-make-frequency-sharing-more-efficient-for-wireless-networks.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.nist.gov/ +[2]: https://www.networkworld.com/article/3330603/5g-versus-4g-how-speed-latency-and-application-support-differ.html +[3]: https://www.nist.gov/news-events/news/2020/05/nist-formula-may-help-5g-wireless-networks-efficiently-share-communications +[4]: https://www.networkworld.com/article/3445039/beamforming-explained-how-it-makes-wireless-communication-faster.html +[5]: https://events.vtsociety.org/vtc2020-spring/conference-sessions/program/ +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200630 Should API-restricting licenses qualify as open source.md b/sources/talk/20200630 Should API-restricting licenses qualify as open source.md new file mode 100644 index 0000000000..54b18eaed6 --- /dev/null +++ b/sources/talk/20200630 Should API-restricting licenses qualify as open source.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Should API-restricting licenses qualify as open source?) +[#]: via: (https://opensource.com/article/20/6/api-copyright) +[#]: author: (Richard Fontana https://opensource.com/users/fontana) + +Should API-restricting licenses qualify as open source? +====== +A look at how a closely-watched legal case about copyright and APIs +might affect open source licensing +![Two government buildings][1] + +In its 2014 _[Oracle v. Google][2]_ decision, the United States Court of Appeals for the Federal Circuit held that the method declarations and "structure, sequence, and organization" (SSO) of the Java SE API were protected by copyright. This much-criticized result contradicted a decades-old industry and professional consensus assumption that APIs were in the public domain, reflected in an ongoing common practice of successive reimplementation of APIs, and persisting even after the general copyrightability of software was settled by statute. Unsurprisingly, that consensus shaped the view of APIs from within open source. Open source licenses, in particular, do not address APIs, and their conditions have not customarily been understood to apply to APIs. + +If the copyrightability ruling survives its current [review][3] by the United States Supreme Court, there is reason to worry that _Oracle v. Google_ will eventually have some detrimental impact on open source licensing. License authors might draft new licenses that would explicitly extend familiar kinds of open source license conditions to activities merely involving APIs. There could also be comparable efforts to advance _Oracle v. Google_-influenced reinterpretations of existing open source licenses. + +We've already seen an example of a new open source-like license that restricts APIs. Last year, Holochain, through its lawyer [Van Lindberg][4], submitted the [Cryptographic Autonomy License][5] (CAL) for approval by the Open Source Initiative (OSI). The [1.0-Beta][6] draft included source availability and licensing requirements placed on works merely containing or derivative of interfaces included in or derived from the licensed work. (CAL 1.0-Beta was [rejected][7] by the OSI for reasons other than the interface copyleft feature. Subsequent revisions of CAL removed explicit references to interfaces, and the OSI approved CAL 1.0 earlier this year.) Licenses like CAL 1.0-Beta would extend copyleft to reimplementations of APIs having no code in common with the original. Though less likely, new permissive licenses might similarly extend notice preservation requirements to mere copies of APIs. + +In my view, API-restricting licenses, though otherwise FOSS-like, would not qualify for the open source label. To simplify what is actually a complicated and contentious issue, let's accept the view that the license approval decisions of the OSI, interpreting the [Open Source Definition][8] (OSD), are the authoritative basis for determining whether a license is open source. The OSD makes no mention of software interfaces. Some advocates of a relaxation of standards for approving open source licenses have argued that if a type of restriction is not explicitly prohibited by the OSD, it should be considered acceptable in an open source license. To guard against this tactic, which amounts to ["gaming" the OSD][9], the OSI [clarified][10] in 2019 that the purpose of the approval process is to ensure that approved licenses not only conform to the OSD but also provide software freedom. + +Though [Luis Villa has raised concerns][11] that it gives rise to a "[no true Scotsman][12]" problem, I believe the emphasis on software freedom as a grounding principle will enable the OSI to deal effectively and in a well-reasoned, predictable way with cases where license submissions expose unforeseen gaps or vagueness in the OSD, which is politically difficult for the OSI to revise. (Disclosure: I was on the OSI board when this change to the license review process was made.) It is also an honest acknowledgment that the OSD, like the [Free Software Definition][13] maintained by the Free Software Foundation, is an unavoidably imperfect and incomplete attempt to distill the underlying community norms and expectations surrounding what FOSS is. + +Software freedom is the outgrowth of a long-lived culture. Judging whether a license that extends FOSS-normative conditions to APIs provides software freedom should begin with an examination of tradition. This leads to a straightforward conclusion. As noted above, from nearly the earliest days of programming and continuing without interruption through the rise of the modern open source commons, software developers have shared and acted on a belief in an unconditional right to reimplement software interfaces. From a historical perspective, it is difficult to think of anything as core to software freedom as this right to reimplement. + +The inquiry cannot be entirely backward-looking, however, since the understanding of software freedom necessarily changes in response to new societal or technological developments. It is worth asking whether a departure from the traditional expectation of unrestricted APIs would advance the broader goals of open source licensing. At first glance, this might seem to be true for copyleft licensing, since, in theory, compliant adoption of API copyleft licenses could expand the open source software commons. But expanding the scope of copyleft to API reimplementations—software traditionally seen as unrelated to the original work—would violate another open source norm, the limited reach of open source licenses, which is partially captured in [OSD 9][14]. + +Another observation is that software freedom is endangered by licensing arrangements that are excessively complex and unpredictable and that make compliance too difficult. This would likely be true of API-restricting FOSS-like licenses, especially on the copyleft side. For example, copyleft licenses typically place conditions on the grant of permission to prepare derivative works. Trying to figure out what is a derivative work of a Java method declaration, or the SSO of a set of APIs, could become a compliance nightmare. Would it include reimplementations of APIs? Code merely invoking APIs? The fundamental vagueness of _Oracle v. Google_-style API copyright bears some resemblance to certain kinds of software patent claims. It is not difficult to imagine acquirers of copyrights covered by API-restrictive licenses adopting the litigation strategies of patent trolls. In addition to this risk, accepting API-restrictive licenses as open source would further legitimize API copyrightability in jurisdictions like the United States, where the legal issue is currently unsettled. + +_Oracle v. Google_-influenced interpretations of existing open source licenses would similarly extend familiar open source license conditions to activities merely involving APIs. Such reinterpretations would transform these licenses into ones that fail to provide software freedom and advance the goals of open source, for the same reasons that apply to the new license case. In addition, they would upend the intentions and expectations of the authors of those licenses, as well as nearly all of their licensors and licensees. + +It might be argued that because open source licenses are principally ([though not exclusively][15]) copyright licenses, it is necessary, if not beneficial, for their conditions to closely track the expansion of copyright to APIs. This is not so for new open source licenses, which can be drafted explicitly to nullify the impact of _Oracle v. Google_. As for reinterpretations of existing open source licenses, while the issue of API copyrightability remains unsettled, it would not be appropriate to abandon traditional interpretations in favor of anticipating what an _Oracle v. Google_-influenced court, unfamiliar with open source culture, would decide. Litigation over open source licenses continues to be uncommon, and influential open source license interpretations have emerged in the technical community with little regard to how courts might act. In any event, courts engaged in interpreting commonly-used open source licenses may well be persuaded to treat APIs as unconstrained. + +Some have suggested that interpretation of the GPL should take full advantage of the scope of underlying copyright rights. This is related to a view of copyleft as a "[hack on copyright][16]" or a "[judo move][17]" that "[return[s] the violent force of the oppressor against the oppressor itself][18]." It can be detected in the [copyleft tutorial][19] sponsored by the Software Freedom Conservancy and the FSF, which [says][20]: "The strongest copylefts strive to [use] the exclusive rights that copyright grants to authors as extensively as possible to maximize software freedom." It might seem logical for someone with this perspective to specifically promote an API copyright interpretation of the GPL. But I know of no advocate of strong copyleft who has done so, and the text and interpretive history of the GPL do not support such a reading. + +A somewhat different view of API copyright and GPL interpretation, occasionally voiced, is that _Oracle v. Google_ may put the doctrine of strong copyleft on a surer legal foundation. Similarly, it has sometimes been asserted that strong copyleft rested on some notion of API copyrightability all along, which suggests that _Oracle v. Google_ provides some retroactive legal legitimacy. The latter view is not held by the FSF, which in an earlier era had [opposed the expansion of copyright][21] to user interfaces. This stance made its way into GPLv2, which has a [largely overlooked provision][22] authorizing the original licensor to exclude countries that would restrict "distribution and/or use … either by patents or by copyrighted interfaces." The FSF also [severely criticized][23] Oracle's claim of copyright ownership of Java APIs. And the FSF has never questioned the right to reimplement APIs of GPL-licensed software under non-GPL licenses (as has happened, for example, with the FSF-copyrighted [GNU Readline][24] and the BSD-licensed [libedit][25]). If there were shown to be some legal deficiency in strong copyleft theory that API copyrightability could somehow fix, I believe it would be better either to live with a weaker understanding of GPL copyleft or to pursue revisions to the GPL that would reformulate strong copyleft without relying on API copyright. + +If API copyrightability survives Supreme Court review, it would then be appropriate for license stewards, licensors of existing open source licenses, and drafters of new open source licenses to take constructive steps to minimize the impact on open source. Stewards of widely used open source licenses, where they exist, could publish interpretive guidance clarifying that APIs are not restricted by the license. Updates to existing open source licenses and entirely new licenses could make unrestricted APIs an explicit policy. Licensors of existing open source licenses could make clear, in standardized license notices or through external commitments, that they will not treat open source license conditions as imposing any restriction on activities merely involving APIs. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/api-copyright + +作者:[Richard Fontana][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/fontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_lawdotgov2.png?itok=n36__lZj (Two government buildings) +[2]: http://www.cafc.uscourts.gov/sites/default/files/opinions-orders/13-1021.Opinion.5-7-2014.1.PDF +[3]: https://www.scotusblog.com/case-files/cases/google-llc-v-oracle-america-inc/ +[4]: https://twitter.com/vanl?lang=en +[5]: https://github.com/holochain/cryptographic-autonomy-license +[6]: http://lists.opensource.org/pipermail/license-review_lists.opensource.org/2019-April/004028.html +[7]: http://lists.opensource.org/pipermail/license-review_lists.opensource.org/2019-June/004248.html +[8]: https://opensource.org/osd +[9]: https://twitter.com/webmink/status/1121873263125118977?s=20 +[10]: https://opensource.org/approval +[11]: https://twitter.com/luis_in_brief/status/1143884765654687744 +[12]: https://en.wikipedia.org/wiki/No_true_Scotsman +[13]: https://www.gnu.org/philosophy/free-sw.en.html +[14]: https://opensource.org/osd#not-restrict-other-software +[15]: https://opensource.com/article/18/3/patent-grant-mit-license +[16]: https://sfconservancy.org/blog/2012/feb/01/gpl-enforcement/ +[17]: https://gondwanaland.com/mlog/2014/12/01/copyleft-org/#gpl-and-cc-by-sa-differences +[18]: https://dustycloud.org/blog/field-guide-to-copyleft/#sec-2-2 +[19]: https://copyleft.org/guide/ +[20]: https://copyleft.org/guide/comprehensive-gpl-guidech2.html#x5-120001.2.2 +[21]: https://www.gnu.org/bulletins/bull21.html +[22]: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html#section8 +[23]: https://www.fsf.org/blogs/licensing/fsf-statement-on-court-of-appeals-ruling-in-oracle-v-google +[24]: https://tiswww.case.edu/php/chet/readline/rltop.html +[25]: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/ diff --git a/sources/talk/20200630 The open organization everyone deserves.md b/sources/talk/20200630 The open organization everyone deserves.md new file mode 100644 index 0000000000..8fa93e6ec3 --- /dev/null +++ b/sources/talk/20200630 The open organization everyone deserves.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The open organization everyone deserves) +[#]: via: (https://opensource.com/open-organization/20/6/organization-everyone-deserves) +[#]: author: (Jos Groen https://opensource.com/users/jos-groen) + +The open organization everyone deserves +====== +Want to build a sustainably successful organization? Then openness is +the way. +![Two different business organization charts][1] + +Let me share an email I recently received. It meant the world to me: + +> Hi Jos, just a quick message to thank you for the past six months. I really appreciate how I've been welcomed into the company and I feel like I've genuinely found my place here. There's a great vibe among the entire staff of working hard, lots of learning, having fun, and personal responsibility. Although everyone contributes to this atmosphere, it could only have come about with the support of management. So I just want to thank you for creating such an enjoyable work environment! + +A work environment that encourages the collaborative utilization of everyone's combined skillset, one in which contributors are intrinsically motivated to do their best work, is something I would wish for everyone. That's why, over the past year especially, I've been cultivating an open organizational culture on my team and across my organization, Axians. Openness is the future, and it begins with individuals. In this article, I'll explain the mindset shifts I believe any _individual_ leader must make in order to pave the way for an organizational culture of openness. + +### The technological is social + +Social and technological changes are occurring faster than ever. These often seem like two separate movements—but are they really? The effect of the open source movement on the development of both innovative technologies and organizational cultures is many times greater than we may think. The open source community (as the name suggests) is shouldered by people—people who apply their skills to make the world a little better through new technologies, who realize the value of sharing both knowledge and material goods in both their work as well as their personal lives. + +This means that in order to get the most out of new technologies, you need to have an open organizational culture in which employees contribute from [a place of intrinsic motivation][2]. The current generation of tech employees isn't drawn to organizations with a strong hierarchical culture. They're looking for _open_ organizations that encourage and inspire them to excel every single day. They're looking for the kind of leadership that leaves ample room for individual input and ownership. A successful and future-proof organization demands an open culture and open leadership. + +At its core, a sustainably successful organization revolves around a balance between a focus on people and a focus on the business. In my experience, for the majority of organizations, this balance leans too heavily towards the business. There is an urgent need for a greater focus on people. The open organization is the answer to restoring this balance. That's why establishing and leading an open organization should be the [ultimate goal for contemporary managers][3]. But doing this requires leaders capable of restoring the balance [between business and the humans that work in it][4]—and maintaining that balance. + +A work environment that encourages the collaborative utilization of everyone's combined skillset, one in which contributors are intrinsically motivated to do their best work, is something I would wish for everyone. + +At the same time, a successful organization today is one that enables intelligent collaboration and effective coordination. This will increase the collective intelligence and offer employees the space they need to develop and grow. Unlocking and utilizing the available potential helps shape the kind of organization in which everyone participates and contributes, and this can produce some truly remarkable results. It’s no small task for a leader to establish and lead an organization of this kind. + +### Authentic leadership + +The human dimension present in an organization will in part determine the employers people choose to join, making it vital for managers to establish and lead an open organization. Part of openness is to be clear and honest about your intentions at all times. + +This isn't just a gimmick, nor is it a skill you can easily "acquire." When you're working with people, they will immediately sense if your intentions aren't genuine. Because this process takes place on a subconscious level, it is unlikely people will articulate this feeling. Instead, it'll be reflected in their behavior: you might find people less involved and not opening up to you. In turn, you could experience their behavioras frustrating, even opposition. Sound familiar? + +This is all about your credibility, which takes time to build. You'll be challenged, either consciously or subconsciously, to stick with your intentions. Be prepared to have to overcome mistrust and cynicism at times. + +Are you up for that? Are you willing to examine the cause, to really invest your time and energy in trying to understand the other person? And will you stick to your principles? + +### What about you? + +An open organization is about placing your trust in people and creating a culture of equality. At the end of the day, it's not about you; it's about the collective. _Everyone_ is involved. _Everyone_ gets to make mistakes or ask for help. Even you. As long as you can be open and honest about it. + +So have you put "openness" on the agenda? And what about your organization? Is your management ready to open up—or are they clinging to "command and control"? + +I hope you'll [join me][5] as I explore these issues further [in an upcoming webinar][6]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/organization-everyone-deserves + +作者:[Jos Groen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jos-groen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_crowdvsopen.png?itok=AFjno_8v (Two different business organization charts) +[2]: https://opensource.com/open-organization/18/5/rethink-motivation-engagement +[3]: https://opensource.com/open-organization/20/6/open-management-practices +[4]: https://opensource.com/open-organization/17/7/digital-transformation-people-1 +[5]: https://www.linkedin.com/in/josgroen/ +[6]: https://www.redhat.com/en/events/webinar/how-to-drive-the-transformation-journey-through-an-open-organization-approach-2020 diff --git a/sources/talk/20200702 How an open project-s governance model evolves.md b/sources/talk/20200702 How an open project-s governance model evolves.md new file mode 100644 index 0000000000..4ca74dd3b1 --- /dev/null +++ b/sources/talk/20200702 How an open project-s governance model evolves.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How an open project's governance model evolves) +[#]: via: (https://opensource.com/open-organization/20/7/evolving-project-governance) +[#]: author: (Bryan Behrenshausen https://opensource.com/users/bbehrens) + +How an open project's governance model evolves +====== +As open projects mature, their governance models inevitably change. +Here's how we're evolving ours. +![A two way street sign][1] + +As we continue renovating the Open Organization community, we've been asking hard questions about how we want [that community][2] to function. What do we expect of one another, and of the new contributors yet to join us? How will we work best together? And how will we keep one another accountable for achieving our shared goals? + +When open projects and communities discuss expectations like these, they're talking about "governance." In this case, "governance" refers to the [various processes by which rights and responsibilities get distributed][3] throughout a group. As community member [Jen Kelchner puts it][4], "it's the framework that creates the structure of the organizational system and the rules by which the parts of that structure can and do interact with one another." + +A community's governance model explains _how_ that community functions. Maintaining a system of governance often helps a community _define_ and _describe_ the roles people play in that community. + +Those shared definitions and descriptions are important. First, they allow community members to speak a common language about values and ambitions. They also advance community members' ability to contribute, because [they _make explicit_ the rules][5] everyone is playing by. And they ensure community members receive the various types of status and social capital they need and deserve. + +The best governance models are flexible and adaptable. They grow with their communities. As the Open Organization community grows, so does its governance model. We've needed to revisit how we describe our community and the opportunities for contribution it affords people. ([We also fix typos][6].) + +Let us describe what we're doing. + +### New commitments + +Through this conversation, we've been able to update the Open Organization [project][7] description and vision. + +That vision initially took shape nearly five years ago, when the Open Organization Ambassador team first formed. At the time, Red Hat community architects [Jason Hibbets][8] and [Bryan Behrenshausen][9] drafted a document describing what a community of passionate advocates for [open organizational principles][10] _might_ look like. The vision was entirely aspirational, describing what could be—rather than what _was_. It served as a beacon to attract passionate contributors to a still-nascent project. + +As soon as the community _did_ attract new members, however, those members promptly wrote their _own_ mission and vision for the Open Organization project, articulating their identity and purpose. And as we've grown, we've realized that we're all committed to even more than we originally described. Our community is adept at translating [open organization principles][10] for various audiences and contexts, and at helping different communities connect to our language and culture through _their_ own languages and cultures. + +The best governance models are flexible and adaptable. They grow with their communities. + +For example, [Laura Hilliger][11] has long seen an overlap between openness and cooperatives ([as have others in the community][12]). She's spoken about that overlap and lived it through her career—serving as a translator between two "radical" economic and communal ideas that use different terminology but are seeking the same kind of fair-mindedness in their activities and collaborations. Other Open Org community members have written about [Agile methodologies][13] and their association with open principles, open principles at work [in educational organizations][14], and more. + +Our commitment to this sort of "translation work" wasn't highlighted in our working project description, so we [updated the description to include it][15]. + +### Role playing + +Another hole we wanted to fill was a better description of the types of contributions one can make to this community. We wanted to talk about our contributors in a slightly more nuanced way, which we indicated in the initial project vision and then extrapolated into a fully fledged "[Community Roles][16]" wiki page. + +Being specific about community roles helps us make the project more inclusive. It also gives us a method to _codify_ policies and procedures because we can associate them with individual roles people can play in the Open Org community. + +So we've made some decisions about how contributors get read/write [access to community repositories][17], and how certain kinds of contributors can nominate people to "level up" in the community. + +Just as people join communities, they also leave. Everyone's interests and passions change over time, and sometimes what brought them to your community is no longer meaningful to them. And that's okay. + +We've also established a new kind of contributor, the "Maintainer," which gives Ambassadors expressing interest in leading and maintaining community-driven projects a way to show ownership and initiative around a particular project the community is working on. In short: It opens an important new contribution pathway and helps existing community members play an even more influential role in the Open Organization project. + +And we're also recognizing the regular flux and flow that marks an open community like ours. Just as people join communities, they also leave. Everyone's interests and passions change over time, and sometimes what brought them to your community is no longer meaningful to them. And that's okay. + +Sometimes, people will stay involved in a community because they feel a sense of belonging or status, even if they're not interested in doing the work anymore. And they carry with them important project history and context, which no one wants to see evaporate. So we're also adding another community role, the Open Organization Ambassador Emeritus. By giving community members emeritus status, we give Ambassadors the freedom to move on to something else without "kicking them out" of the project altogether. + +All in all, defining and documenting roles and responsibilities will help our community attract contribution because it clearly explains _what getting involved means_ and the _benefits of doing so_. + +### Next steps + +We've come a long way. But there's more to be done. + +The next bit of work we'd like to tackle is [developing a code of conduct][18]. Want to share your experience in this area? [Why not join us and help out?][19] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/7/evolving-project-governance + +作者:[Bryan Behrenshausen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bbehrens +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/govt_two%20way.png?itok=8dlG2Dpl (A two way street sign) +[2]: http://theopenorganization.org +[3]: https://opensource.com/article/20/5/open-source-governance +[4]: https://opensource.com/open-organization/17/2/5-elements-teams-organized +[5]: https://opensource.com/open-organization/18/4/new-governance-model-research +[6]: https://github.com/open-organization/governance/commits/master +[7]: https://github.com/open-organization/governance/blob/master/project-and-community-description.md +[8]: https://opensource.com/users/jhibbets +[9]: https://opensource.com/users/bbehrens +[10]: https://github.com/open-organization/open-org-definition +[11]: https://opensource.com/users/laurahilliger +[12]: https://opensource.com/open-organization/15/9/learn-from-co-ops +[13]: https://opensource.com/open-organization/17/11/transparency-collaboration-basefarm +[14]: https://opensource.com/open-organization/19/4/education-culture-agile +[15]: https://github.com/open-organization/governance/wiki +[16]: https://github.com/open-organization/governance/wiki/Community-Roles +[17]: https://github.com/open-organization +[18]: https://opensource.com/life/14/5/codes-of-conduct-open-source-communities +[19]: https://github.com/open-organization/governance/issues/9 diff --git a/sources/talk/20200708 How wireless networks can battle COVID-19.md b/sources/talk/20200708 How wireless networks can battle COVID-19.md new file mode 100644 index 0000000000..3c3276c55a --- /dev/null +++ b/sources/talk/20200708 How wireless networks can battle COVID-19.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (sunwenquan ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How wireless networks can battle COVID-19) +[#]: via: (https://www.networkworld.com/article/3565389/how-wireless-networks-can-battle-covid-19.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How wireless networks can battle COVID-19 +====== +Wireless network devices maintain a connection by handing off from one cell tower to another. The data created should be used to fight coronavirus, say researchers. +Sasha85ru / Getty Images + +Routinely collected cellphone-location data could be used to alert health official about crowded areas where novel coronavirus could spread rapidly, which they could then use to disperse people in order to lower the risk, according to researchers at Colorado State University. + +Mobile phones maintain connections as their users move around by continually handing off from one cell tower to another. Analyzing logs of these handoffs is a way to gauge how many people are in an area, the researchers say, and that information could flag potential virus-spreading hotspots. “Crowded regions with actively moving people are susceptible to spreading the disease,” the team say in [an abstract of their paper][1] in _IEEE Open Journal of Engineering in Medicine and Biology_. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“Our findings could help risk managers with planning and mitigation,” says Edwin Chong, Professor of Electrical and Computer Engineering and interim department head at the school [in an article on the university’s website][3]. + +The data that would be used doesn’t identify individuals who own the phones, which should alleviate privacy concerns, he says. “All we have to do is perform the measurements using anonymous data that is already being collected for other reasons. We are not tracking individuals,” he says + +Cellphone applications that have been developed to trace near encounters between individuals are different. They necessarily gather personal information so health officials can determine who might have come in proximity with an infected person. The goal is to alert those who have had such encounters so they can quarantine themselves for 14 days to prevent them from potentially spreading the virus further. But that is quite different from the information gathered by cell-tower engineering logs. + +As mobile phones move from one cell to another, a process called handover and reselection keeps the phones constantly connected to the network. The logs of this activity reveal the volume of this activity and tracks the status of phones such as non-active standby, engaged in active calls or whether it’s making data connections. + +The size of cells varies with those in densely populated areas being smaller and therefore able to deliver more granular data about where people are closer together. Indeed, future 5G deployments may have cell antennas in every municipal streetlight, making it possible to make very specific density estimates. + +  + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3565389/how-wireless-networks-can-battle-covid-19.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://ieeexplore.ieee.org/document/9117073 +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://engr.source.colostate.edu/using-cellular-networks-to-detect-at-risk-areas-for-spread-of-covid-19/ +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200715 The Impact of COVID-19 on the Global Digital Economy.md b/sources/talk/20200715 The Impact of COVID-19 on the Global Digital Economy.md new file mode 100644 index 0000000000..6d5f05b3ce --- /dev/null +++ b/sources/talk/20200715 The Impact of COVID-19 on the Global Digital Economy.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Impact of COVID-19 on the Global Digital Economy) +[#]: via: (https://www.networkworld.com/article/3566911/the-impact-of-covid-19-on-the-global-digital-economy.html) +[#]: author: (QTS https://www.networkworld.com/author/Andy-Patrizio/) + +The Impact of COVID-19 on the Global Digital Economy +====== +Post-Pandemic IT Landscape Demands a New Data Center Paradigm +QTS + +Prior to COVID-19, the world was undergoing massive business transformation illustrated by stunning success of mega-scale Internet businesses such as Amazon Prime, Twitter, Uber, Netflix, Xbox and others that are now an integral part of our lives and exemplify the new global digital economy. + +The ability to apply artificial intelligence (AL), machine learning (ML), speech recognition, location services, speed and identity tracking in real-time enabled new applications and services once thought to be beyond the reach of computing technology. + +Fueling this transformation are exponential increases in digitized data and the ability to apply enormous compute and storage capacity to it. Since 2016, digitization has created 90% of the world’s data. According to IDC, more than 59 zettabytes (ZB) of data are going to be created and consumed globally in 2020 and this is forecast to grow to 175 ZB by 2025. How much is 1 ZB you ask?  It is equivalent to a _trillion gigabytes. Or, 100 million HD movies worth of data._ + +As it turns out, according to IDC, instead of hindering growth, COVID-19 is accelerating data growth, particularly in 2020 and 2021, due to abrupt increases in work from home employees, a changing mix of richer data sets, and a surge in video-based content consumption. + +For the enterprise, an unforeseen byproduct is an even greater urgency for agility, adaptability and transformation. Business models are being disrupted while the digitalization of the economy is accelerating as new technologies and services serve a reshaped workforce. + +The competitive landscape across all market sectors is changing. Now more than ever business is looking to technology to be agile in the face of disruption and create new digitally enabled business models for the post-COVID “new normal.” + +That will require new capabilities and expertise in thousands of data centers and networks behind the scenes. That infrastructure provides the digital infrastructure that powers the critical applications and services keeping the economy afloat -- and all of us connected. The “cloud” lives in data centers and data centers are the commerce platforms of the 21st century. + +**Data centers are essential…the best ones are innovating** + +At the outset of the pandemic, data centers were designated “essential businesses” since virtually all industries and consumers depend on them. The more advanced data centers were quickly recognized for their [ability to provide customers with remote access and management of their systems][1] without operators or enterprise customers having to be there physically. + +[QTS Realty Trust (NYSE: QTS)][2] is at the forefront of providing these services to all their customers. Supporting its commitment to digitize its entire end-to-end systems and processes, QTS is the first and only multi-tenant data center operator with a sophisticated software-defined orchestration platform powered by AI, ML, predictive analytics (PA) and virtual reality (VR) technologies. + +QTS’ API-driven [Service Delivery Platform (SDP)][3] empowers customers to interact with their data, services, and connectivity ecosystem by providing real-time visibility, access and dynamic control of critical metrics across hybrid and hyperscale environments from a single platform and/or mobile device. It is akin to it having a software company within the data center delivering operational savings and business innovation which are central to every IT investment. + +SDP applications leverage next-generation AI, ML and PA to accurately forecast power consumption, automate the service provisioning, perform online ordering and asset management. VR technologies are enabling new virtual collaboration tools and a 3D visualization application that renders an exact replication of a customer’s IT environment in real-time. + +QTS’ SDP was profiled in the Raymond James Industry Brief: _Data Maps and Killer Apps_ (released June 2020) that surveyed the platforms of three global data center operators: + +_“While all three platforms have the ability to track and report common data, the ease of use of the systems was quite different. Only QTS had the entire system wrapped up into an app that was available across multiple desktop, tablet, and mobile platforms, complete with 3D imaging and simple graphics that outlined the situation visually down to an individual rack within a cabinet. QTS' system also has video capability using facial recognition to detect and identify employees and contractors separately, highlight an open cabinet door and other potential hazards inside the customers cage, and it is all either real time or on a recorded basis to highlight potential errors and problems. Live heat maps allow customers to see the areas with potential and existing performance issues and to see outages in real time and track down problems. As far as features and functionality, QTS SDP system was the clear winner.”_ + +**Customer experience is the dealmaker** + +As consumers become more adamant in their demand for quality of experience in their digital lives, businesses must ensure they are providing services, and the data that is generated from them, real-time, on-the-go, via any network, and are personalized. + +Post COVID, the ability of data centers to ensure excellent customer experience will play an even greater role as large numbers of customers continue to work remotely with less on-premises interaction. Enterprises will seek data center operators that can ensure secure, ubiquitous, real time access to services and data backed by superior customer support. + +Given a purchasing decision based on performance and price between two equally qualified data center operators, the first tiebreaker is increasingly coming down to proven and documented customer support. + +In the data center industry, QTS is the undisputed leader in customer service and support boasting an [independent Net Promoter Score of 88][4] \- more than double the average NPS score for data center companies (42). + +Customers rated QTS highly in a range of service areas, including its customer service, service delivery platform, physical facilities, processes, responsiveness, and service of onsite staff and the 24-hour [Operations Service Center][5]. QTS’ score of 88 is its highest yet and exceeds NPS scores of companies well-known for their customer service including Starbucks (71) and Apple (72). + +Enterprise, Hyperscale and government organizations recognize that the post-COVID landscape is going to present an increasing need for innovation in their IT environments. In terms of IT service delivery, this means higher levels of transparency, visibility, compliance and sustainability that are at the foundation of QTS’ Service Delivery Platform. + +With innovation come new technologies and complexity, raising the profile of the best service and support partners for companies looking to re-establish themselves in a new, post-COVID competitive landscape. + +For more information, visit [www.qtsdatacenters.com][6] + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3566911/the-impact-of-covid-19-on-the-global-digital-economy.html + +作者:[QTS][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.qtsdatacenters.com/company/news/2020/03/26/qts-reports-significant-increase-in-customer-usage-of-sdp +[2]: http://www.qtsdatacenters.com/ +[3]: https://www.qtsdatacenters.com/why-qts/service-delivery-platform +[4]: https://www.qtsdatacenters.com/why-qts/customer-benefits/nps +[5]: https://www.qtsdatacenters.com/why-qts/customer-benefits/operations-support-center +[6]: http://www.qtsdatacenters.com diff --git a/sources/talk/20200716 Options grow for migrating mainframe apps to the cloud.md b/sources/talk/20200716 Options grow for migrating mainframe apps to the cloud.md new file mode 100644 index 0000000000..fef1ca55e5 --- /dev/null +++ b/sources/talk/20200716 Options grow for migrating mainframe apps to the cloud.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Options grow for migrating mainframe apps to the cloud) +[#]: via: (https://www.networkworld.com/article/3567058/options-grow-for-migrating-mainframe-apps-to-the-cloud.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Options grow for migrating mainframe apps to the cloud +====== +Mainframe modernization vendor LzLabs is targeting Big Iron enterprises that want to move legacy applications into public or private cloud environments. +Thinkstock + +Mainframe users looking to bring legacy applications into the public or private cloud world have a new option: [LzLabs][1], a mainframe software migration vendor. + +Founded in 2011 and based in Switzerland, LzLabs this week said it's setting up shop in North America to help mainframe users move legacy applications – think COBOL – into the more modern and flexible cloud application environment. + +**Read also: [How to plan a software-defined data-center network][2]** + +At the heart of LzLabs' service is its Software Defined Mainframe (SDM), an open-source, Eclipse-based system that's designed to let legacy applications, particularly those without typically available source code, such as COBOL, run in the cloud without recompilation. + +The company says it works closely with cloud providers such as Amazon Web Services, and its service can be implemented on [Microsoft Azure][3]. It also works with other technology partners such as Red Hat and Accenture. + +Legacy applications have become locked into mainframe infrastructures, and the lack of available skilled personnel who understand the platform and its development process has revealed the urgent need to move these critical applications to open platforms and the cloud, according to Mark Cresswell, CEO of LzLabs. + +"With SDM, customers can run mainframe workloads on x86 or the cloud without recompilation or data reformatting. This approach significantly reduces the risks associated with mainframe migration, enables incremental modernization and integrates applications with DevOps, open-source and the cloud," the company [stated][4]. + +Cresswell pointed to the news stories around the COVID-19 pandemic that found many mainframe and COBOL-based state government systems were having trouble keeping up with the huge volume of unemployment claims hitting those systems. + +For example, [CNN in April reported][5] that in New Jersey, Gov. Phil Murphy put out a call for volunteers who know how to code COBOL because many of the state's systems still run on older mainframes. Connecticut is also reportedly struggling to process the large volume of unemployment claims with its decades-old mainframe; it's working to develop a new benefits system with Maine, Rhode Island, Mississippi and Oklahoma, but the system won't be finished before next year, according to the CNN story. + +"An estimated 70% of the world's commercial transactions are processed by a mainframe application at some point in their cycle, which means U.S. state governments are merely the canaries in the coal mine. Banks, insurance, telecom and manufacturing companies (to mention a few) should be planning their exit," Cresswell wrote in a [blog][6]. + +LzLabs is part of an ecosystem of mainframe modernization service providers that includes [Astadia][7], [Asysco][8], [GTSoftware][9], [Micro Focus][10] and others. + +Large cloud players are also involved in modernizing mainframe applications. For example, Google Cloud in February [bought mainframe cloud-migration service firm Cornerstone Technology][11] with an eye toward helping Big Iron customers move workloads to the private and public cloud. Google said the Cornerstone technology – found in its [G4 platform][12] – will shape the foundation of its future mainframe-to-Google Cloud offerings and help mainframe customers modernize applications and infrastructure. + +"Through the use of automated processes, Cornerstone's tools can break down your Cobol, PL/1, or Assembler programs into services and then make them cloud native, such as within a managed, containerized environment," wrote Howard Weale, Google's director, transformation practice, in a [blog][13] about the acquisition. + +"As the industry increasingly builds applications as a set of services, many customers want to break their mainframe monolith programs into either Java monoliths or Java microservices," Weale stated.  + +The Cornerstone move is also part of Google's effort stay competitive in the face of mainframe-migration offerings from [Amazon Web Services][14], [IBM/RedHat][15] and [Microsoft][16]. + +While the number of services looking to aid in mainframe modernization might be increasing, the actual migration to those services should be well planned, experts say. + +A _Network World_ article on [mainframe migration options][17] from 2017 still holds true today: "The problem facing enterprises wishing to move away from mainframes has always been the 'all-or-nothing' challenge posed by their own workloads. These workloads are so interdependent and complex that everything has to be moved at once or the enterprise suffers. The suffering typically centers on underperformance, increased complexity caused by bringing functions over piecemeal, or having to add new development or operational staff to support the target environment. In the end, the savings on hardware or software turns out to be less than the increased costs required of a hybrid computing solution." + +Gartner last year also warned that migrating legacy applications should be undertaken very deliberately. + +"The value gained by moving applications from the traditional enterprise platform onto the next 'bright, shiny thing' rarely provides an improvement in the business process or the company's bottom line. A great deal of analysis must be performed and each cost accounted for," Gartner stated in a 2019 report, [Considering Leaving Legacy IBM Platforms? Beware, as Cost Savings May Disappoint, While Risking Quality][18]*. "*Legacy platforms may seem old, outdated and due for replacement. Yet IBM and other vendors are continually integrating open-source tools to appeal to more developers while updating the hardware. Application leaders should reassess the capabilities and quality of these platforms before leaving them." + +Join the Network World communities on [Facebook][19] and [LinkedIn][20] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3567058/options-grow-for-migrating-mainframe-apps-to-the-cloud.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/LzLabsGmbH +[2]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html +[3]: https://www.astadia.com/video/mainframe-transformation-azure-is-the-new-mainframe +[4]: https://appsource.microsoft.com/en-us/product/web-apps/lzlabsgmbh-5083555.lzlabs-softwaredefinedmainframe?src=office&tab=Overview +[5]: https://www.cnn.com/2020/04/08/business/coronavirus-cobol-programmers-new-jersey-trnd/index.html +[6]: https://blog.lzlabs.com/cobol-crisis-for-us-state-government-departments-is-the-canary-in-the-coal-mine +[7]: https://www.astadia.com/blog/mainframe-migration-to-azure-in-5-steps +[8]: https://www.asysco.com/code-transformation/ +[9]: https://www.gtsoftware.com/services/migration-services/ +[10]: https://www.microfocus.com/en-us/home +[11]: https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html +[12]: https://www.cornerstone.nl/solutions/modernization +[13]: https://cloud.google.com/blog/topics/inside-google-cloud/helping-customers-migrate-their-mainframe-workloads-to-google-cloud +[14]: https://aws.amazon.com/blogs/enterprise-strategy/yes-you-should-modernize-your-mainframe-with-the-cloud/ +[15]: https://www.networkworld.com/article/3438542/ibm-z15-mainframe-amps-up-cloud-security-features.html +[16]: https://azure.microsoft.com/en-us/migration/mainframe/ +[17]: https://www.networkworld.com/article/3192652/why-are-mainframes-still-in-the-enterprise-data-center.html +[18]: https://www.gartner.com/doc/3905276 +[19]: https://www.facebook.com/NetworkWorld/ +[20]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200717 Open source accounting software developed by accountants.md b/sources/talk/20200717 Open source accounting software developed by accountants.md new file mode 100644 index 0000000000..22ae8e1689 --- /dev/null +++ b/sources/talk/20200717 Open source accounting software developed by accountants.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source accounting software developed by accountants) +[#]: via: (https://opensource.com/article/20/7/godbledger) +[#]: author: (Sean Darcy https://opensource.com/users/sean-darcy) + +Open source accounting software developed by accountants +====== +GoDBledger is open source accounting software that is both intuitive and +productive. +![Person using a laptop][1] + +Over the last six months, I have been working on [GoDBLedger][2], an open source accounting system that I feel addresses some of the issues that plague current accounting software solutions. Even in my first year as a graduate accountant, the software frustrated me because I have seen what good software can be like and how much it can improve your productivity. + +A great example of "good software" is a software developer's [Editor/IDE][3]. Developers love their editors, and there is a huge range that is highly customizable and allows for seamless coding experience. One of the major influencing factors for the existence of great software in this area is because developers are themselves the end users—they scratch their own itches and have immediate feedback on their designs. + +The relationship between developers and their editor is fascinating because the editor's job is to facilitate the efficient transfer of the developer's ideas into the codebase. + +As an accountant who loves programming in my spare time, I can see parallels between the accounting industry and software development. You can imagine the general ledger (a giant list of financial transactions) as a "codebase" that accountants work with, and it is the accountant's job to navigate and edit the general ledger before compiling it into various reports that an end user consumes—financial statements and tax returns, for example. This is similar to, for instance, the way the Red Hat Enterprise Linux codebase is maintained by developers, and then released officially as RHEL and CentOS to the world. + +Unfortunately, when comparing the software between the two industries, I have found that navigating and editing the general ledger is not seamless, at least not when compared to my experiences when programming. Additionally, the compilation is slow and involves a lot of human labor to achieve; it can ultimately be as difficult as editing the general ledger itself. + +So, given the parallels between accountants' and programmers' processes, why hasn't the accounting industry developed software to make editing the general ledger as efficient as an IDE editing a codebase? And why is compiling a set of financial statements from the general ledger not automated as is pushing code to production? + +There are two influencing factors that I have noticed. + +The first is the profit motive that drives both accountants and accounting software developers. Monetization can lead to inefficiencies in software because the most efficient end user is not always the most profitable. A profit-maximizing entity can extract more value from their users by taking actions to get control of the user's data, create walled gardens, and make it difficult for the user to change their software. + +Accounting software has always existed in the realm of paid software. Because it plays such an important role in a business, it has always been easy to monetize. This is great for software developers who wish to make a profit, but unfortunately, it means that open source principles have had minimal influence on the shape and design of the software. + +The second influencing factor is a lack of understanding of the general ledger as a data structure. The general ledger, in simple terms, is just a way to format a database of financial transactions. This data structure was designed in the 1600s, and it worked quite well within a physical book. At that point in time, working with the general ledger meant changing written text in the book as necessary, and accountants were professionals at maintaining this database. However, when relational databases were created, the structure never really got standardized and digitalized. Software packages implemented the general ledger within their own proprietary database structures, and accountants lost their ability to directly edit the database. Instead of managing the general ledger directly, the software only allowed for accountants to have restricted access. + +### The result + +Before TCP/IP got standardized, companies like AOL were creating their own proprietary environments and locking users into their walled gardens. Fortunately for the internet, they fell away to a free standard communication protocol. Unfortunately, the accounting industry did not do this, and we got stuck with "America Online." + +Imagine that the software industry was ruled by a few big IDE software conglomerates which have decided to maximize their profits rather than maximizing developer efficiency. Your editor no longer saves code as text; instead, it is saved as a proprietary data format. You can not copy a codebase easily into another IDE, and if you do change editors, it's probably safe to assume that the codebase saved in the previous system is lost. + +This is the state of the accounting software available today. + +So what can accounting software developers learn from the open source community? + +Open source means you can stand on the shoulders of giants and use codebases of other projects to influence and directly assist in the growth of your own project. If you are focusing on accountants' efficiency to edit the general ledger, you can review other software and copy the parts that work and ignore the parts that don't. In my case, I have been fortunate to leverage the great codebases of other accounting software such as [GNU Cash][4] and [Ledger-CLI][5], but there is another interesting area that has a lot to contribute—the open source servers that manage cryptocurrency nodes. + +Accounting has struggled with the transition from physical ledgers to computers, but thankfully the cryptocurrency community has already developed a lot of open source software for maintaining a database of transactions. + +The general ledger is a data structure to record financial transactions—just like a blockchain. + +### What this means + +My accounting system has been heavily influenced by [Geth (Go Ethereum)][6] and [Prysmatic Labs][7]—[Prysm][7], as there are a lot of talented developers working on these projects. They have provided the base for a server that manages financial transactions. Combining this with a database schema that was heavily influenced by GNU Cash means the heavy work behind designing an accounting system has already been done. + +The result is [GoDBLedger][2], with source code available on [github.com/darcys22/godbledger][8]. + +It is also written in Golang to leverage the already good code that exists in this area, and because Golang tends to be good for servers of this nature. + +I've talked a lot about how accountants should be able to work with the general ledger as seamlessly as a programmer can work on their codebase. I truly look forward to the day when I can create and edit journal entries with the same efficiency that I navigate and edit code using my text editor of choice. GoDBLedger is my first step toward achieving this. The next steps will be toward developing this "IDE" that communicates with GoDBLedger and its underlying database. Fortunately for me, there are already a lot of good open source database projects that I'll be able to leverage for this. + +### How to use GoDBLedger + +GoDBLedger is usable today! You can fire up a server that maintains a database for your financial transactions, and it will look and feel familiar to anyone who has run a cryptocurrency node before. + +The end goal is for it to act as the central server for receiving financial transactions and storing them in the database. It lives in the background, always running so that other systems can communicate financial data to it as needed. + +![GoDBledger operational flow chart][9] + +Right now, if you are comfortable with a command line and scripts that communicate to systems using RPC, then you can play with GoDBLedger and experience double-entry bookkeeping on a level lower than all other software (and only slightly above directly manipulating the SQL database). + +For instance, with GoDBLedger running, you can add entries in the interactive mode of ledger-cli: + + +``` +$ ~/godbledger/ledger_cli journal +Journal Entry Wizard +\-------------------- +Enter the date (yyyy-mm-dd): 2019-06-30 +Enter the Journal Descripion: Get Money Get Paid! + +Line item #1 +Enter the line Descripion: Income is good yo +Enter the Account: Revenue:Sales +Enter the Amount: -1000 +Would you like to enter more line items? (n to stop): + +Line item #2 +Enter the line Descripion: Cash is better +Enter the Account: Asset:Cash +Enter the Amount: 1000 +Would you like to enter more line items? (n to stop): n + +&{Get Money Get Paid! + 2019-06-30 00:00:00 +0000 UTC [{Revenue:Sales + Income is good yo + -1000/1} {Asset:Cash + Cash is better + 1000/1}] stuff} +``` + +However, the same entry can be made using JSON: + + +``` +`$ ~/godbledger/ledger_cli jsonjournal '{"Payee":"Darcy Financial","Date":"2019-06-30T00:00:00Z","AccountChanges":[{"Name":"Asset:Cash","Description":"Cash is better","Currency":"USD","Balance":"100"},{"Name":"Revenue:Sales","Description":"Income is good yo","Currency":"USD","Balance":"-100"}],"Signature":"anythingHereCurrently"}'` +``` + +You can view a report with the `reporter` command: + + +``` +$ ~/godbledger/reporter trialbalance + +   ACCOUNT    | BALANCE AT 20 FEBRUARY 2020 +\--------------+---------------------------- +Asset:Cash    |                        1000 +              | +Revenue:Sales |                       -1000 +              | +``` + +Read the [quickstart on the Github Wiki][10] for more information. I've also developed a few [example scripts using Python][11] to show how you can send transactions from your own software. Additionally, I have made an [example "trading bot"][12] that saves every trade it does to GoDBLedger. + +if you're interested in a procedural system to keep tracking of your accounts, try GoDBLedger. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/godbledger + +作者:[Sean Darcy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sean-darcy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://godbledger.com/ +[3]: https://www.redhat.com/en/topics/middleware/what-is-ide +[4]: https://www.gnucash.org/ +[5]: https://www.ledger-cli.org/ +[6]: https://github.com/ethereum/go-ethereum +[7]: https://github.com/prysmaticlabs/prysm +[8]: https://github.com/darcys22/godbledger +[9]: https://opensource.com/sites/default/files/uploads/godbledger_flow.png (GoDBledger operational flow chart) +[10]: https://github.com/darcys22/godbledger/wiki/Quickstart +[11]: https://github.com/darcys22/godbledger-pythonclient +[12]: https://github.com/darcys22/Trading-Simulator diff --git a/sources/talk/20200719 Open source development works to improve contact tracing in Europe.md b/sources/talk/20200719 Open source development works to improve contact tracing in Europe.md new file mode 100644 index 0000000000..be101bc70f --- /dev/null +++ b/sources/talk/20200719 Open source development works to improve contact tracing in Europe.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source development works to improve contact tracing in Europe) +[#]: via: (https://opensource.com/article/20/7/open-source-contact-tracing) +[#]: author: (J. Manrique Lopez de la Fuente https://opensource.com/users/jsmanrique) + +Open source development works to improve contact tracing in Europe +====== +Analyzing data on Corona-Warn-App's development shows how quickly open +source can scale up to help stop disease outbreaks. +![Hands holding a mobile phone with open on the screen][1] + +The [Corona-Warn-App][2] is an awesome example of how governments and public administrations can use open source software development to help citizens while simultaneously advancing the technology ecosystem. The app helps trace infection chains of [SARS-CoV-2][3] (the virus that causes [COVID-19][4]) in Germany. The app uses [a decentralized approach][5] to notify users if they have been exposed to SARS-CoV-2. + +![Corona-Warn-App branding][6] + +(Manrique Lopez, [CC BY-SA 4.0][7]) + +Transparency is essential to protecting the app's end users and encouraging its adoption, and [open source][8] is a key element of achieving transparency. Open source allows anyone to use, study, share, and [improve][9] Covid-Warn-App. This is similar to the tracing apps developed by Italy ([Immuni][10]), Switzerland ([SwissCovid][11]), and partially by France ([StopCovid][12]). In contrast, [Radar Covid][13] is a new non-open source COVID-tracking app being piloted in Spain's Canary Islands; between the non-open nature of the app and the fact that the [website][14] still fails to load in mid-July 2020, it's debatable whether citizens will trust it. + +![radarcovid.covid19.gob.es offline on July, 8th, 2020][15] + +Radar Covid [site][14] offilne on July 8, 2020. (Manrique Lopez, [CC BY-SA 4.0][7]) + +### Why open source transparency matters + +Transparency benefits software development projects in two ways: + + * Internally in the project's community, there's a sense of fair play among all the contributors because everything is in public, so everyone is accountable. + * Externally among third parties, there's a sense of trust in the project because it can be analyzed from multiple perspectives (e.g., legal, technical, project activity, development processes, etc.). + + + +Transparency should be an essential requirement in software developed by governments. Initiatives like [Public Money, Public Code][16] and the [Foundation for Public Code][17] are doing an amazing job of helping public administrators understand why their code (_our_ code as taxpayers) should be open source. + +![Corona-Warn-App's open source approach][18] + +(Manrique Lopez, [CC BY-SA 4.0][7]) + +### About Corona-Warn-App + +In early May 2020, the German government asked software developer SAP and Deutsche Telekom subsidiary T-Systems to deliver the Corona-Warn-App based on open source and decentralized technology. Many other German companies and research centers are supporting the app's development. + +![Corona-Warn-App development partners][19] + +(Manrique Lopez, [CC BY-SA 4.0][7]) + +In addition, the global open source community has been remarkable in helping to build the app, which has already been [downloaded by more than 15 million users][20]. + +### Corona-Warn-App's development + +Inspired by [Andreas Schreiber's][21] tweet, [Jesus M. Gonzalez-Barahona][22] did an [analysis][23] of Corona-Warn-App's development using [Cauldron.io][24], an open source software-as-a-service application built on top of [GrimoireLab][25], and [summarized his findings][26] on Twitter. + +Corona-Warn-App saw robust [software development activity][23] through mid-June: + + * More than 100 people contributed. + * More than 5,300 commits were made, with 1,600+ pull requests and 600+ issues. + + + +![Corona-Warn-App development data][27] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +#### Quick code reviews + +Code review for pull requests is quick, usually within one day (mean: 0.36 days). + +![Corona-Warn-App pull requests][28] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +Time to close issues is also quick at about two days. + +![Corona-Warn-App issues][29] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +This means that most pull requests are already closed, and the gap between open and closed issues is not very large. + +#### Commitment to fighting coronavirus spread + +Contributions are coming from both corporate email accounts and private addresses (such as gmail.com, gmx.de, icloud.com, and outlook.de). + +![Corona-Warn-App contributors' email domains][30] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +Also, there is no noticeable decline in commits over the weekend, which is unusual for software produced by employees on paid time. + +![Corona-Warn-App commits by date][31] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +These facts may be signs of contributors' sense of urgency or commitment to fighting the spread of COVID-19, even on their own time. + +There is, however, a different pattern in issue and pull request submissions: they are more common during the week than on weekends, even though commits happen regularly over the week. One possible explanation for this is that developers work uniformly throughout the week but upload and interact with issues mostly during workdays. + +![Corona-Warn-App patches by day][32] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +![Corona-Warn-App issues by day][33] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +#### Outstanding developer engagement + +Onboarding of developers has been really quick—currently about 50 people by daily contributions and more than 100 people by weekly contributions. + +These numbers are common for corporate projects, but Corona-Warn-App has assembled a team of more than 100 developers from at least six companies in just 45 days. Is this another lesson corporate software development can learn and apply from open source development? + +![Corona-Warn-App engagement][34] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +![Corona-Warn-App engagement][35] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +Engagement differs in different repositories; for example, the iOS app had about eight times the commits as the Android app. Lines per commit and files per commit suggest that this is likely real development, not snapshots masquerading as development. + +![Corona-Warn-App repos][36] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +#### Time efficiency + +One worrisome piece of data is in the time to close pull requests. The mean is short, but the median is too short. That could either mean a very well-streamlined code review in a tightly coupled team or very little code review. + +![Corona-Warn-App time to merge][37] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +![Corona-Warn-App open PR time][38] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +### Closing thoughts + +Corona-Warn-App is a successful example of how governments and public administrations can use open collaboration to scale up to fight a global crisis. Data saves lives, and now more than ever, we need to break silos, be transparent, and work towards a common goal. + +Transparency is not only about making code publicly available. Transparency is about fairness and trust, and software development analysis is a good example of how to take advantage of transparency to better understand the software that matters to you. + +If you liked this analysis, note that you can do your own with Cauldron.io, as it's [free, open source software][39]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/open-source-contact-tracing + +作者:[J. Manrique Lopez de la Fuente][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jsmanrique +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolserieshe_rh_041x_0.png?itok=tfg6_I78 (Hands holding a mobile phone with open on the screen) +[2]: https://www.coronawarn.app +[3]: https://en.wikipedia.org/wiki/Severe_acute_respiratory_syndrome_coronavirus_2 +[4]: https://en.wikipedia.org/wiki/Coronavirus_disease_2019 +[5]: https://en.wikipedia.org/wiki/Exposure_Notification +[6]: https://opensource.com/sites/default/files/uploads/corona-warn.png (Corona-Warn-App branding) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.org/osd +[9]: https://github.com/corona-warn-app/cwa-documentation/blob/master/CONTRIBUTING.md +[10]: https://it.wikipedia.org/wiki/Immuni +[11]: https://fr.wikipedia.org/wiki/SwissCovid +[12]: https://fr.wikipedia.org/wiki/StopCovid +[13]: https://english.elpais.com/society/2020-06-29/spain-launches-first-phase-of-coronavirus-tracking-app.html +[14]: https://radarcovid.covid19.gob.es/ +[15]: https://opensource.com/sites/default/files/uploads/radarcovid.jpg (radarcovid.covid19.gob.es offline on July, 8th, 2020) +[16]: https://publiccode.eu/ +[17]: https://publiccode.net/ +[18]: https://opensource.com/sites/default/files/uploads/corona-warn-open-source.jpg (Corona-Warn-App's open source approach) +[19]: https://opensource.com/sites/default/files/uploads/corona-warn-partner.jpg (Corona-Warn-App development partners) +[20]: https://de.statista.com/statistik/daten/studie/1125951/umfrage/downloads-der-corona-warn-app/ +[21]: https://twitter.com/onyame/status/1272505372360785920 +[22]: https://opensource.com/users/jgbarah +[23]: https://cauldron.io/dashboard/1545 +[24]: https://cauldron.io/ +[25]: https://chaoss.github.io/grimoirelab/ +[26]: https://twitter.com/jgbarah/status/1272777800102141957 +[27]: https://opensource.com/sites/default/files/uploads/corona-warn_development.png (Corona-Warn-App development data) +[28]: https://opensource.com/sites/default/files/uploads/corona-warn_prs.png (Corona-Warn-App pull requests) +[29]: https://opensource.com/sites/default/files/uploads/corona-warn_issues.png (Corona-Warn-App issues) +[30]: https://opensource.com/sites/default/files/uploads/corona-warn_users.png (Corona-Warn-App contributors' email domains) +[31]: https://opensource.com/sites/default/files/uploads/corona-warn_commits.png (Corona-Warn-App commits by date) +[32]: https://opensource.com/sites/default/files/uploads/corona-warn_submission1.png (Corona-Warn-App patches by day) +[33]: https://opensource.com/sites/default/files/uploads/corona-warn_submission2.png (Corona-Warn-App issues by day) +[34]: https://opensource.com/sites/default/files/uploads/corona-warn_engagement1.png (Corona-Warn-App engagement) +[35]: https://opensource.com/sites/default/files/uploads/corona-warn_engagement2.png (Corona-Warn-App engagement) +[36]: https://opensource.com/sites/default/files/uploads/corona-warn_repo.png (Corona-Warn-App repos) +[37]: https://opensource.com/sites/default/files/uploads/corona-warn_timetomerge.png (Corona-Warn-App time to merge) +[38]: https://opensource.com/sites/default/files/uploads/corona-warn_opentime.png (Corona-Warn-App open PR time) +[39]: https://gitlab.com/cauldronio/cauldron diff --git a/sources/talk/20200721 Data-center survey- IT seeks faster switches, intelligent computing.md b/sources/talk/20200721 Data-center survey- IT seeks faster switches, intelligent computing.md new file mode 100644 index 0000000000..fe915f2a5a --- /dev/null +++ b/sources/talk/20200721 Data-center survey- IT seeks faster switches, intelligent computing.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data-center survey: IT seeks faster switches, intelligent computing) +[#]: via: (https://www.networkworld.com/article/3566925/data-center-survey-it-seeks-faster-switches-intelligent-computing.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Data-center survey: IT seeks faster switches, intelligent computing +====== +As data use changes, so do technical needs of the data center operators, who want speed and intelligence. +monsitj / Getty Images + +The growth in data use and consumption means the needs of IT managers are changing, and a survey from Omdia (formerly IHS Markit) found [data-center][1] operators are looking for intelligence of all sorts, not just the artificial kind. + +Omdia analysts recently surveyed IT leaders from 140 North American enterprises with at least 101 employees working in North American offices and data centers and asked them what features they wanted the most in their networking technology. + +The results say respondents expect to more than double their average number of data-center sites between 2019 and 2021, and the average number of servers deployed in data centers is expected to double over the same timeline. + +“The on-premises enterprise data center continues to flourish,” the authors wrote in the report. “We are seeing a continuation of the enterprise DC growth phase signaled by the 2018 respondents and confirmed by the respondents of this study. The transformation of the on-premises DC to a cloud architecture continues, and the enterprise DC will be considered a first-class citizen as enterprises build their multi-clouds and shift compute to the edge.” + +But the emphasis appears to be on networking and not necessarily server gear. From 2019 to 2021, more than 60% of respondents expect to increase their investments in Ethernet switches, Fibre Channel switches, network analytics, and network automation. The installed base of data-center Ethernet-switch ports will grow 27% between 2019 and 2021 with higher speeds (100/200/400GE) making up a larger portion of the deployed base. + +High speeds (65% of respondents), openness and interoperability (65%), and application-awareness (65%) are the top features respondents seek when making data-center Ethernet-switching purchases. Increased port speeds are an obvious upgrade decision, and it remains top-of-mind for enterprises. + +And not just any switches will do. The number of respondents using Open Compute Project (OCP)-certified switches has risen significantly since 2019: 76% of respondents adopted OCP switches in 2019 per the 2019 survey versus 60% of respondents in 2018. Bare-metal switches, like those offered by vendors of OCP-certified equipment, are available from several hardware vendors such as Edgecore, Delta Networks and Mellanox/Nvidia. + +### Smarter software** + +** + +Application awareness and automated virtual machine (VM) movement are becoming more important as more data center traffic gets routed from central data centers to edge locations globally. Omdia says the results show that data-center networks can no longer operate in siloes, and respondents want solutions that are easy to integrate, allowing them to monitor their data across compute and storage, independent of physical data-center location. + +And with all that data and virtual machines to move around, respondents seem to be keen on the benefits that AI promises to bring. Many vendors claim their high-throughput (100G-plus Ethernet) DC switches are designed for use in environments required to handle resource-intense applications like AI and ML. But Omdia says it remains to be seen how AI features will impact the DC networking market and what qualitative and quantitative outcomes will result. + +Omdia also says data-center orchestration software will provide automated coordination and management of resource pools including network equipment, servers, and storage. “Enterprise IT teams are selecting orchestration software, and the choice for physical and virtual switching in the DC will depend on the orchestration software selected,” the report said. + +It flags Red Hat Enterprise OpenStack Platform (celebrating its tenth anniversary this month), VMware vCloud, Cisco Intelligent Automation for Cloud [IAC], and Microsoft System Centerj among the leaders of data center orchestration. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3566925/data-center-survey-it-seeks-faster-switches-intelligent-computing.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200722 Student Linux club refurbishes computers to support distance learning.md b/sources/talk/20200722 Student Linux club refurbishes computers to support distance learning.md new file mode 100644 index 0000000000..18f40c2026 --- /dev/null +++ b/sources/talk/20200722 Student Linux club refurbishes computers to support distance learning.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Student Linux club refurbishes computers to support distance learning) +[#]: via: (https://opensource.com/article/20/7/donate-linux) +[#]: author: (Cam Citrowske https://opensource.com/users/camcitrowske) + +Student Linux club refurbishes computers to support distance learning +====== +Open source helps bridge the digital divide for families in need of +computers for distance learning during the pandemic. +![][1] + +_This article is co-written by Cam Citrowske, a member of the Penguin Corps._ + +It was March 17, 2020, and I was in my classroom at Aspen Academy. The clock was ticking. This was to be the last day of school before we, along with every other public school in Minnesota, would close due to the outbreak of the new coronavirus. I had students in my room during lunch, advisory periods, and my elective classes all doing the same thing—installing Linux onto old computers so we could give them to students who would use them for school at home during the shelter in place order. I was only going to have the kids' help until dismissal time, but in the end, we had 17 computers ready to go. It was a start. + +Hi, I'm Stu Keroff. I'm a social studies and technology teacher at Aspen Academy in Savage, MN. I am also the director of the Penguin Corps, our school's Linux club. When we started the club back in September of 2019, I wanted the kids at my new school to take on the same type of mission that the kids at my last school had: using Linux to close the "digital divide" (see this [article][2] about the Community School of Excellence Asian Penguins for more information). The Penguin Corps gave away a few computers during the year, but nothing had prepared us for what was coming. + +It was in January that I first heard about COVID-19. At the time, it was making people sick in other countries, and while it was a topic of discussion in my social studies classes, I wasn't concerned because it wasn't in Minnesota. + +![Linux club donating computers][3] + +(Stu Keroff, [CC BY-SA 4.0][4]) + +By March, that had changed. Businesses were talking about how they would respond to the pandemic, and it raised the conversation about how it would affect schools. Fast forward to March 18, when all the schools in Minnesota were closed and converted to distance learning—teachers provide lessons online, and kids attend school in their homes over the internet. It was a huge change for all of us! + +While it was tough for many of my students to go to school from their bedrooms or dining rooms, at least most of them had computers to use. But what about the kids at school who didn't have computers? Or the families who didn't have enough computers for all of the kids in the house? What were they supposed to do? + +Our school's administrators reached out to me and the Penguin Corps to create a solution. We surveyed parents to find out how many families needed a computer and then got to work. We started by putting Linux on computers the school was no longer using, and then we gave those away. More responses started to pour in. We realized that the supply we had would not even be close to enough. This became a serious problem that was in need of a bigger solution. + +Once we realized that, we started to ask for more. With help from the school, we reached out over social media and in the local newspaper, asking people to donate their old computers to us. A number of people and even some businesses like Caribou Coffee and St. Vincent de Paul of the Twin Cities responded. Laptops started to pour in. Most of them worked, but some needed minor repairs, such as new batteries, a charger, or a hard drive. All of the computers needed new software. Linux and open source apps were the solution. We got the computers up and running, tested them, and left them with the school to distribute. + +The school continued to take referrals, and people came in to pick up laptops. The office receptionist eventually joined our team, walking parents through the software before they left with their laptops. Even though she had no previous experience with Linux, she was able to jump right in and contribute. + +Prior to the shutdown, the Penguin Corps gave away six computers. Between March 16 and the first week of May, we gave away 60 computers. This effectively closed our school's digital divide. + +And at what cost? Since we chose to go with used computers instead of buying new ones, the only thing we had to pay for were batteries, chargers, a couple of hard drives, and a keyboard. Total cost: approximately $900.00, or an average of $12.33 per computer, including the computers we had left over, which we're saving for the fall term. + +The program even gave us the opportunity to help people outside of our school. Reverend Tim Christopher, a pastor in North Minneapolis, reached out to me and the Penguin Corps to ask for our help. A single mother in Minneapolis with two school-aged children needed computers for her kids to do distance learning from their home. Thanks to the Penguin Corps, both kids got one to use for school, for free. + +Aspen Academy principal Melanie Jiskra said, "It was through this group of change agents that all Aspen Academy families had enough devices to continue their education through distance learning. Without the generosity of the people and companies who donated the laptops, the hard work and commitment of Mr. Keroff, and the talent, drive, and passion of the students to serve others, Aspen Academy would not have as successfully bridged the digital divide during this pandemic." + +COVID-19 presented all schools with a challenge, and Aspen Academy's Penguin Corps demonstrated that open source software could be used to meet it. Our biggest challenge became our biggest victory. + +Do you want to know more about how a Linux club can help your school or a school near you? You can email me at [studoeslinux@gmail.com][5]. You can also get ideas for starting your own program at [www.linuxclubguide.com][6]. + +The Asian Penguins Linux users group for middle school students is improving people’s lives through... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/donate-linux + +作者:[Cam Citrowske][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/camcitrowske +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/penguin_corps_group_photo.jpg?itok=_uQlfxDa +[2]: https://opensource.com/education/15/3/asian-penguins-Linux-middle-school-club +[3]: https://opensource.com/sites/default/files/pictures/linux-club-donating-computers.jpg (Middle school Linux club donating computers) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: mailto:studoeslinux@gmail.com +[6]: http://www.linuxclubguide.com diff --git a/sources/talk/20200726 Globalization- A history of openness.md b/sources/talk/20200726 Globalization- A history of openness.md new file mode 100644 index 0000000000..7c056d7107 --- /dev/null +++ b/sources/talk/20200726 Globalization- A history of openness.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Globalization: A history of openness) +[#]: via: (https://opensource.com/open-organization/20/7/globalization-history-open) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Globalization: A history of openness +====== +The history of our interconnected world is also a history of our +willingness to open up. +![India on the globe][1] + +In my career conducting international business, I traveled to more than 80 countries worldwide. I was always struck by how strongly regions of the world are connected, and I began studying the forces of globalization as a result. + +Several books on this subject were critical to this research. But the one I'd like to highlight here is [World 3.0: Global Prosperity and How to Achieve It][2] by Pankaj Ghemawat. This book first taught me how _little_ the global community is connected—but also how far it has come compared to the past. During Prof. Ghemawat's research, he worked with DHL and ultimately helped develop the [DHL Global Connectedness Index][3], which tracks how well the global community is interacting in four key measurements: trade, investment, telecommunication, and travel/migration. From that work, I developed and delivered a presentation on [global connectedness][4], which stressed that the world should increase its scores on those four measurements of globalization, as they are directly linked to food supply, health, security, pollution, jobs and other global benefits. + +In this article series, I'll present my research from that period, then explain how we might think about the intersection of globalization and [open organization principles][5] around the world today. When people use terms like "globalization" and "global connectedness," in most cases what they _really_ mean is "building coordinated communities to provide goods/service globally and address global issues." Open organization principles are applicable here—but in this context, on a global scale. + +But before I can explain that interconnection, I'll first need to outline Prof. Ghemawat's criteria. In this article, I'll do that, with a special emphasis on the way open organization principles are critical to all of them. + +### Trade + +By "trade," I'm referring to the imports and exports of goods and services between countries. It's a key dimension of a globally connected world. Trading extremely simple products and services might be possible via electronic transactions, perhaps over the internet. But on the other hand, highly complex products may require a company to build a distribution network in a wide range of countries worldwide. In this case, then, connectivity, collaboration, and leveraging other open organization principles would be extremely important. In my last job, for example, I set up product distributors throughout Europe and the United States and a production operation in China. Building a strong relationship was very important, difficult and took time and effort. I had to use open organization principles to their fullest. + +### Investment + +Global financial investments also have an impact on global connectedness. If an investor simply purchases shares of an overseas company or deposits funds in an overseas bank account, then more complex relationships are not as critical. But if a company wants to invest in a factory (or sales office for that matter) in a foreign country, then a great deal of interpersonal interaction is required. Economists define these two types of investments differently; they call the latter "foreign direct investment" or FDI. Projects focused on FDI get people working closely with each other across traditional geographic boundaries. Here again, open organization principles will play an important role. + +### Communications + +When considering global communications, think of two broad categories: verbal communications and written communications. The former may involve, for example, telephone communications—simply having the ability to get on a telephone and affordably talk to someone anywhere on the globe. Even today, in many parts of the world, this is not technically possible. On top of that, language becomes a problem internationally, as many people aren't communicating in a common language. These issues are being addressed, but according to the 2019 DHL Global Connectedness Index, this has been more difficult to measure than in the past. Today, there are simply too many communication methods to make tracking this dimension as easy as it was in the past, and those methods seem to be increasing at an exponential rate. + +Thanks to proliferating internet access, written forms of communication are also increasing worldwide, but measuring, again, is more difficult to do. For this reason, I'd guess that the next real technological breakthrough will involve both foreign language electronic verbal communication (interpreting) and written communication (translating) software. This software is improving all the time, and could greatly contribute to global communications and information sharing between languages. This, then, will all lead to better integration and spread of open organization principles, as communications are sure to continue to increase worldwide. (Personally, I don't think this technology will replace person-to-person interaction, but could certainly support it.) + +### Travel/migration + +The last factor in the DHL Global Connectedness Index is the movement of people between countries. The first question to ask here is: "Why are people leaving a country and crossing borders? Why do people go from one country to another?" Reasons may include: for better education, for tourism purposes, for economic opportunities, and for safety (e.g., escaping war). Whatever the reason, it will determine how much people will interact with others in the host country. Wanting to go to a foreign country and being forced to leave one's home country are very different situations. The DHL Global Connectedness Index tries to measure factors like this. Open organization principles can be helpful here, particularly in community-building efforts, and in efforts to promote inclusivity. + +Although these factors are always shifting, people of the world will continue to communicate, collaborate, interact, and influence each other on an ever-expanding scale. + +And yet, if you study the DHL Global Connectedness Index, you will find that in all four measurements of trade, investment, communications and travel, the world is far less connected than it could be. More interaction still occurs within national borders than between countries. But as I will demonstrate in future articles of this series, global connectedness has a rather short history, relatively speaking, and we're still learning how best to collaborate and govern in a globally connected world. Understanding the role of open organization principles in this work will become even more important in the years ahead. + +### Think global, act local + +As we consider these issues and the impact open-style thinking can have on them, we'll naturally begin to ask: Where—and on what scale—should we begin addressing these problems? Are the issues _personal_, _local, national, or global_ in their scope and impact? + +As we'll see in future articles in this series, issues like these are often too complex to be confined to just one of those scales. That's why it's important to think about "[glocalization][6]" to address these issues by respecting both local concerns and global impact. + +Take the coronavirus for example. It impacts all humanity and requires [an open, global discussion applying open organization principles][7]. And global organizations, like the [World Health Organization (WHO)][8], will be involved in determining and communicating guidelines for combating the spread of COVID-19. But the issue is a personal one, too, as individuals learn new ways to take responsibility both for their health and the health of those around them. + +So, as we continue exploring the dimensions of the DHL Global Connectedness Index, we should remember that many issues cut across all scales of human activity—and that our responses, based on open principles, should also operate at multiple levels. They should be [_adaptive_ to their contexts][9]. + +In the next article, I'll examine a short history of globalization. Interestingly enough, open organization principles have been at work since the beginning. I'll discuss globalization up to the Industrial Revolution (around the 1800s). In a later installment, I will discuss the evolution of globalization from the Industrial Revolution to the present day. + +Armed with insight from the past, I want to offer proposals for moving forward on issues like pandemics, [climate change][10], global pollution, and others. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/7/globalization-history-open + +作者:[Ron McFarland][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/india-globe-map.jpg?itok=6sSEL5iO (India on the globe) +[2]: https://www.amazon.com/World-3-0-Global-Prosperity-Achieve/dp/142213864X +[3]: https://www.dhl.com/global-en/home/insights-and-innovation/thought-leadership/case-studies/global-connectedness-index.html +[4]: https://www.slideshare.net/RonMcFarland1/global-collaborating-create-prosperity?qid=ad57b725-174e-4cf2-8264-ac424a6ad814&v=&b=&from_search=22 +[5]: https://opensource.com/open-organization/resources/open-org-definition +[6]: https://en.wikipedia.org/wiki/Glocalization +[7]: https://opensource.com/open-organization/20/6/covid-alliance +[8]: https://www.who.int/ +[9]: https://opensource.com/open-organization/19/3/adaptive-leadership-review +[10]: https://opensource.com/open-organization/19/10/global-energy-climate-challenges diff --git a/sources/talk/20200727 Are newer medical IoT devices less secure than old ones.md b/sources/talk/20200727 Are newer medical IoT devices less secure than old ones.md new file mode 100644 index 0000000000..db3345b9d9 --- /dev/null +++ b/sources/talk/20200727 Are newer medical IoT devices less secure than old ones.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Are newer medical IoT devices less secure than old ones?) +[#]: via: (https://www.networkworld.com/article/3568608/are-newer-medical-iot-devices-less-secure-than-old-ones.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Are newer medical IoT devices less secure than old ones? +====== +Legacy medical IoT devices may lack security features, but newer ones built around commodity components can have a whole different set of vulnerabilities that are better understood by attackers. +Thinkstock + +Experts differ on whether older connected medical devices or newer ones are more to blame for making healthcare networks more vulnerable to cyberattack. + +The classic narrative of insecure [IoT][1] centers on the integration of older devices into the network. In some industries, those devices pre-date the [internet][2], sometimes by a considerable length of time, so it’s hardly surprising that businesses face a lot of challenges in securing them against remote compromise. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Even if those devices aren’t quite that old, they often lack key capabilities – in particular, remote software updates and configurable password protection – that would help IT staff defend them against modern threats. + +That might not be strictly true in regards to the medical field, according to Richard Staynings, chief security strategist for medical IoT security startup Cylera. There has, he argues, been an explosion in the number and variety of medical IoT devices in recent years, and many of those gadgets are at least as insecure as the true legacy equipment in the field. + +In some cases, said Staynings, the older devices might actually be considerably more secure than those of more recent vintage. In particular, those based on dated technology like older versions of electrically erasable programmable read-only memory (EEPROM). + +“The older systems were written in EEPROM – you need an EEPROM reader to mess with them,” he said. “The codebase is not on the Internet for hackers to look at, and you need physical access to the EEPROM to rewrite it.” + +In contrast, the newer devices frequently use software and hardware components that are much more familiar to potential attackers. “They’re more ubiquitous in their design and construction – they use [consumer off-the-shelf] operating systems, like Windows embedded, which is still being used believe it or not, and they are much more vulnerable to attack than a legacy system,” Staynings said. + +Insecurity in the current generation of medical IoT hardware also carries the potential for ongoing problems, not just immediate ones. While IT assets get replaced rapidly, IoT devices often have much longer replacement cycles. “Medical devices have the half-life of plutonium,” said Staynings. “They just don’t go away.” + +Other experts are less sold on Staynings’ characterization of the threat to medical IoT, arguing that the idea that newer devices pose a greater threat than older ones flies in the face of recent efforts to make them safer. Keith Mularski directs an advisory cybersecurity practice at Ernst and Young, and described Staynings’ assertion as “surprising,” noting that the regulatory landscape for connected medical devices is quickly moving standards in a positive direction. + +“The FDA has some pretty stringent guidelines that before devices can go to market, you need to put together threat modeling, so looking at security architecture, vectors, and so on ,and then in addition to that the FDA is getting ready to require third-party pen testing in premarket submissions,” said Mularski. “With legacy devices, those premarket submissions aren’t nearly as complete.” + +Mularski does concede that some particularly vulnerable old devices are often more isolated on the network by design, in part because they’re more recognizable as vulnerable assets. Windows 95-vintage x-ray machines, for example, are easy to spot as a potential target for a bad actor. + +“For the most part, I think most of the hospital environments, they do a good job at recognizing that they have these old deices, and the ones that are more vulnerable,” he said. + +This underlines a topic most experts on – simple awareness of the potential security flaws on a given network are central to securing healthcare networks. Greg Murphy is the CEO of Ordr, a network visibility and security startup based in Santa Clara. He said that both Mularski and Staynings have points in their favor. + +“Anyone who minimizes the issue of legacy devices needs to walk a mile in the shoes of the biomedical engineering department at a hospital,” he said. “[But] on the flipside, new devices that are being connected to the network have huge vulnerabilities themselves. Many manufacturers themselves don’t know what vulnerabilities their devices have.” + +The only real way to address the issues, said Murphy, is at the network level – trying to make everything secure at the device level might be a near-impossibility in many cases, and even getting an accurate picture of every device connected to a network often requires the use of an automated solution. + +“This is not a problem of human scale anymore,” he said. + +Both Mularski and Staynings concurred on this point, as well. Regardless of which devices on a particular network are the most vulnerable, it’s worth remembering that cybercriminals generally aren’t particular about what they compromise, as long as they’re able to gain access. + +“There may be an attacker that comes across these devices, runs a scan and happens to see [a vulnerability], but we really haven’t seen specific targeting of medical devices,” said Mularski. “It’s important to make sure that companies that have medical devices are enumerating their network, tracking their devices.” + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568608/are-newer-medical-iot-devices-less-secure-than-old-ones.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[2]: https://www.networkworld.com/article/3410588/evolution-of-the-internet-celebrating-50-years-since-arpanet.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200728 Green Data Centers - Scaling environmental sustainability for business and consumers collectively.md b/sources/talk/20200728 Green Data Centers - Scaling environmental sustainability for business and consumers collectively.md new file mode 100644 index 0000000000..88bc67ff05 --- /dev/null +++ b/sources/talk/20200728 Green Data Centers - Scaling environmental sustainability for business and consumers collectively.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Green Data Centers – Scaling environmental sustainability for business and consumers collectively) +[#]: via: (https://www.networkworld.com/article/3568670/green-data-centers-scaling-environmental-sustainability-for-business-and-consumers-collectively.html) +[#]: author: (QTS https://www.networkworld.com/author/Andy-Patrizio/) + +Green Data Centers – Scaling environmental sustainability for business and consumers collectively +====== +10 Tips for Choosing the Best Green Data Center +Regardless of how you identify politically, environmental sustainability has become an undeniable business directive. Global warming from carbon emissions, increasing sea levels and images of pollution are increasing public and shareholder pressure on corporations to take an active role in finding solutions and be accountable by setting goals and publicly documenting results. + +In the IT industry, reducing electrical power generation from fossil fuels is priority #1, followed closely by water conservation and waste management.   + +Multi-tenant data centers are one of the largest per capita consumers of electric power. Based on current estimates, data centers in the U.S. alone will consume approximately 73 thousand megawatts (MW) in 2020. + +To put this in perspective, one megawatt is enough to power 700 households. A single data center can use power equivalent to a small city and typically requires a significant amount of water for cooling. + +Worldwide, it’s estimated that data centers consume about three percent of the global electric supply and account for about two percent of total greenhouse gas (GHG) emissions. + +Data center efficiency and sustainability now transcends companies, geographies, and workloads. There is no simple solution and the challenge is compounded as massive digitization of data globally is creating a parallel demand for energy. + +IDC predicts the world’s data will grow from 33 zettabytes in 2017 to 175 zettabytes in 2025 and the amount of energy used by data centers continues to double every four years - meaning they have the fastest-growing carbon footprint of any area within the IT sector.  + +Technological advancements are difficult to forecast, but several models predict data center energy usage could surpass more than 10% of the global electricity supply by 2030 if left unchecked. + +For all of these reasons, the creation of green, sustainable, multi-tenant data centers has become essential in both an environmental and a business sense. Green data centers are built on pillars of commitments to innovative green and renewable strategies, water reclamation, recycling and waste management, and more. They do not contain obsolete systems (such as inactive or underused servers), and take advantage of newer, more efficient technologies. + +Taking cues from the hyperscale data center operators, green data centers recognize the need to lead with modular energy efficient data center designs from the onset, adopt the latest in building technology and influence the overall supply chain for the actual sourcing of materials for these green data centers. + +Benefits such as cost reduction, increased efficiency and knowledge that you are a better corporate citizen are obvious. What is not readily apparent is that by moving into a green multi-tenant data center, sustainability benefits are also passed on to the businesses and consumers who collectively benefit from the data center’s green IT infrastructure. + +The economies of scale are extremely significant. Instead of a business (such as a large online retailer) attempting to deploy its own green IT environment to power its service delivery, it outsources it to the green data center that can do it cheaper and better. The sustainability benefits are then passed along to all the consumers using its services and there could be hundreds of businesses like this in a single  green data center. + +In addition, when you deal with a true green data center that is serious about sustainability, the benefits go far beyond the requirement that your power be renewable. There are environmental and philanthropic benefits that can be linked with your outsourced IT infrastructure. + +The best green data center operators are starting to formally document and report their progress in Environmental, Social and Governance (ESG) reports made public annually. For conventional enterprises and data centers that do not have measurable sustainability as part of their governance, it is coming. + +[QTS][1]  is one of a few data center companies holding themselves accountable as global citizens and committing to sustainability best practices that are impactful, achievable and will ultimately set the standard for the data center industry in the years to come. + +QTS has committed to minimizing its data center carbon footprint utilizing as much renewable fuel, reclaimed water and recycled materials as possible by implementing a methodic sustainability approach featuring energy efficiency measures and renewable energy procurement, all backed by continuous innovation. + +Knowing that transparency is fundamental to accountability, QTS is documenting and publicly reporting on sustainability goals, metrics and best practices – one of only a few data center companies to do so. + +To support this, QTS’ recently published its second Environmental, Social and Governance (ESG) Initiatives report ([accessed here][2]) that documents the industry’s first formal commitment to provide 100% renewable energy across all of its data centers by 2025. + +In 2019, QTS won numerous awards including the coveted GRESB benchmark ranking QTS as the #1 sustainable data center company among all data centers globally for its ESG initiatives. + +Today QTS has seven data centers running on 100% renewable energy. Approximately 30% of its overall data center power requirements are now sourced from renewable energy sources, representing over 300 million kilowatt-hours (kWh) of renewable power. [According to the EPA][3], this makes QTS one of the largest users of green power among all data center companies and the 12th largest user among Top Tech & Telecom companies.  + +**10 Tips for Choosing a Green Data Center** + +For those operating on-premises legacy data centers looking to move into green data centers, or for organizations already outsourcing to a less than green provider, following are 10 tips when evaluating green data center providers. + + * Check the providers’ ESG scores and reviews from ranking organizations such as GRESB, The Carbon Disclosure Project (CDP), RE100, the EPA Green Power Partnership, Sustainalytics and look for documented commitments to 100% renewable energy. + + + * Look for innovation in power such as the use of AI to forecast power consumption, analyze data output, humidity, temperature, and other important statistics for improving efficiency, drive down costs, and reduce total power consumption. + + + * Check the EPA Green Power ranking to find the data centers leading in renewable power commitments. + * Look for industry-first zero water cooling solutions powered by 100% renewable wind and solar power. + + + * Renewable energy should impactful and cost effective. Look for data centers with innovative power procurement models that allow it purchase renewable energy on parity or below the price of conventionally produced power. + + + * Look for innovative companies that create an open dialogue with customers to gather feedback on sustainability initiatives and help the customers meet their ESG goals. + + + * Look for data center operators that work closely with utilities to develop tariffs and legislation that make it easier and more cost effective for everyone to procure renewable energy. + + + * Look for providers with innovative philanthropic programs such as the “Grow with QTS” program that plants more than 20,000 trees in the Sierra Mountains every year on behalf of its customers, or its HumanKind program that promotes clean water solutions in developing regions. + + + * Look for providers actively speaking and participating with leading organizations such as the EPA’s Green Power Partnership, REBA, the Data Center Coalition’s energy committee and RE100. + + + * Look for providers touting on-site physical features such as smart temperature and lighting controls, rainwater reclamation, recycling and waste initiatives, and EV charging stations. + + + +No industry, nor individual company, is perfect. But, when necessary, it can align around a core set of principles that benefit themselves, their communities and generations to come. The threat of global climate change makes it impossible for data center providers to ignore their roles in the global concern. Committing to action today, as a unified industry, benefits all. + +The fact that so many businesses are more environmentally aware means that contemplating what green, sustainable data centers can offer is becoming an increasingly important standard for choosing a data center provider. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568670/green-data-centers-scaling-environmental-sustainability-for-business-and-consumers-collectively.html + +作者:[QTS][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.qtsdatacenters.com/ +[2]: https://www.qtsdatacenters.com/resources/brochures/esg-initiatives-2019 +[3]: https://www.epa.gov/greenpower/green-power-partnership-top-30-tech-telecom diff --git a/sources/talk/20200729 Switch turns to Tesla for renewable energy storage.md b/sources/talk/20200729 Switch turns to Tesla for renewable energy storage.md new file mode 100644 index 0000000000..dfbcdb7320 --- /dev/null +++ b/sources/talk/20200729 Switch turns to Tesla for renewable energy storage.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Switch turns to Tesla for renewable energy storage) +[#]: via: (https://www.networkworld.com/article/3568358/switch-turns-to-tesla-for-renewable-energy-storage.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Switch turns to Tesla for renewable energy storage +====== +Switch will power its massive data centers with solar energy and use Tesla Megapacks for large-scale energy storage. +ipopba / Getty Images + +Data center provider [Switch][1] has selected Tesla as the battery supplier for a massive solar project at its northern Nevada data center facilities. + +It's a geographically easy alliance as Switch's campus is right near Tesla's [Gigafactory Nevada][2] manufacturing facility. While best known for its cars, Tesla has also made quite an entry in the battery space with products such as the Powerwall, Powerpack, and Megapack energy storage products. + +Switch recently broke ground on Gigawatt 1, a huge project that will use solar panels from First Solar to generate a total of 555 megawatts (MWs) of power at three locations and Tesla Megapacks to store the energy. + +**READ MORE:** [Data-center power consumption holds steady][3] + +Data centers are frequently built close to renewable sources of energy, usually hydropower. That's why many Amazon, Google, Facebook and Microsoft data centers are sitting by rivers. Solar is the easiest form of power to collect, but it's also the most fickle. Solar-powered sites are at the mercy of darkness and cloudy days, and users don't care if it's overcast out. + +Adam Kramer, executive vice president of strategy at Switch, says peak solar production is around 1 p.m. when the sun is overhead, but overall peak consumer demand is around 5 p.m. to 6 p.m., when the sun is either setting or has set, depending on the time of year. + +In running a [data center][4], there are no peak hours. "The Internet is 24/7. If they aren't using it in New York, they are using it in L.A. We have a very flat power profile. Our load looks the same at 2 a.m. as it does at 2 p.m.," Kramer told me. ** +** + +With solar, and especially in Nevada, Switch had "an overabundance of solar generation but nowhere to store it. During the day we generate max power but [have] no need to use it." + +Advances in Tesla battery storage are a key piece of the puzzle. Switch has been running on 100% solar power since 2016 but couldn't store it because "the technology just wasn't there for it," Kramer says. + +Enter Tesla's Megapack. The Megapack is a beefed-up version of the Tesla PowerWall used for individual homes to store solar power and the PowerPack technology Tesla uses in its electric vehicles. Each Megapack can hold up to three megawatt hours (MWhs) of storage and 1.5 MW of inverter capacity. + +So with enough Megapacks, sunlight energy captured at 1 p.m. can be powering the data center at 1 a.m. + +Kramer says this benefits not only Switch but also its customers. "We are able to lock in extremely competitive pricing for switching our clients for the long-term and not be subject to market volatility. When we're able to reduce our cost, it provides cost savings for all our clients," he says. + +So if Switch can power its massive data centers with solar energy even when the sun does not shine, why can't you? + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568358/switch-turns-to-tesla-for-renewable-energy-storage.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.switch.com/ +[2]: https://www.tesla.com/gigafactory +[3]: https://www.networkworld.com/article/3531316/data-center-power-consumption-holds-steady.html +[4]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200730 4 ways I contribute to open source as a Linux systems administrator.md b/sources/talk/20200730 4 ways I contribute to open source as a Linux systems administrator.md new file mode 100644 index 0000000000..2850fc614c --- /dev/null +++ b/sources/talk/20200730 4 ways I contribute to open source as a Linux systems administrator.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways I contribute to open source as a Linux systems administrator) +[#]: via: (https://opensource.com/article/20/7/open-source-sysadmin) +[#]: author: (Elizabeth K. Joseph https://opensource.com/users/pleia2) + +4 ways I contribute to open source as a Linux systems administrator +====== +You don't have to be a coder to make valuable contributions to the open +source community; here are some other important roles you can fill as a +sysadmin. +![open source button on keyboard][1] + +I recently participated in The Linux Foundation Open Source Summit North America, held virtually June 29-July 2, 2020. In the course of that event, I had the opportunity to speak with a fellow attendee about my career in Linux systems administration and how it had led me to a career focused on [open source][2]. Specifically, he asked, how does a systems administrator who doesn't do a lot of coding participate in open source projects? + +That's a great question! + +A lot of focus in open source projects is placed on the actual code, but there's a lot more to it than that. The following are some ways that I've been deeply involved in open source projects, without writing code. + +### Improving documentation + +I got my official start in open source by rewriting a quickstart guide for a project I used heavily. We spend most of our time using software in production and at scale. We routinely run into configuration gotchas and edge cases, and we often privately develop best practices for managing services effectively. + +Inevitably, we run into things that aren't documented, have out of date documentation, or need improvements to the documentation to be made. This is a great opportunity! The developers and documentation writers are often unaware of these issues, and you have the key to solving them. Typically it starts with a bug report to the documentation project, but if you know the answer, you can often submit a patch to the documentation to improve it. + +### Contributing "recipes" + +We often spend too much time reinventing the wheel when we're launching common services. I remember my early days of slogging through MySQL configuration files to figure out the best settings for the databases for a particular customer. Today, a lot of that has been simplified, allowing us to use Ansible playbooks, Puppet modules, and more to get a basic configuration going. This is a place where you can contribute! Whether it's an official "recipe" you contribute to the appropriate hub or a sample rundown of your configuration or architecture diagram of Logstash, sharing your expertise in the form of examples can be incredibly helpful to others who are facing the same configuration challenges. + +### Hosting project resources + +I spent part of my career as a full-time systems administrator, directly working on hosting project resources for OpenStack, an infrastructure that is fully open source—every config file and Puppet change is done through public code review and tracked in a public Git repository. There are several projects out there that host their infrastructures in an open source manner, many of which are listed on the [Open Source Infrastructure (#openinfra) homepage][3]. These range from KDE and Debian to the Apache Software Foundation. In these communities, external participants can submit improvements to the infrastructure as their time and expertise allow. Since a lot of this is peer-reviewed, it's also a nice opportunity to build your skills in areas you may not be strictly focused on at work. + +I've also done work on specific projects where the need was not broadcasted but was clear once I joined the community. For instance, one of my Linux communities needed a place to host a development website environment so we could try out new plugins and features outside of our production environment. We also found that giving shell accounts to participants was a valuable way to make sure they were always connected to IRC and had a sandbox beyond their own desktop. I now manage two virtual servers for this project to address these needs and have built up my own little systems team inside the project, so I'm not the only administrator. + +### Supporting your fellow users + +As someone who is using software in production, your operational experience is essential to a thriving support outlet, so don't be shy. Participation in user forums, mailing lists, and chat may seem like something that only experts can do, but regardless of your level, you will always have more experience than someone who just started out. A newcomer to the space can help out with simple questions, and give the more experienced participants the energy to answer more complicated questions. The more experience you gain, the more involved you can get in the community. + +### Be a better sysadmin by contributing + +Whatever way you decide to participate, the value gained from contributing to open source projects as a [systems administrator][4] cannot be understated. Your contributions will be noticed by members of the community, and often result in opportunities to chat on the latest project podcast, sit for an interview on the project blog, or speak at an event. All of these things raise your profile in the project as someone who is knowledgeable about the technology. You can also point to your public expertise when you're interviewing for your next role, having a public track record of giving advice in a project where a company is looking for expertise is a huge vote in your favor. + +Finally, I've also found that participating in open source projects to be tremendously valuable on a personal level. I feel good about contributing to the community, and it's rewarding to know that your expertise is valuable to folks outside the walls of your organization. + +Looking for a place to start? Find the communities behind the open source technology you already use and love. Or, if you're looking for a place to [write][5], you've found it here at Opensource.com. + +You don't need to be a master coder to contribute to open source. Jade Wang shares 8 ways you can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/open-source-sysadmin + +作者:[Elizabeth K. Joseph][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pleia2 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) +[2]: https://opensource.com/resources/what-open-source +[3]: https://opensourceinfra.org/ +[4]: https://opensource.com/article/19/7/be-a-sysadmin +[5]: https://opensource.com/how-submit-article diff --git a/sources/talk/20200730 Role Of SPDX In Open Source Software Supply Chain.md b/sources/talk/20200730 Role Of SPDX In Open Source Software Supply Chain.md new file mode 100644 index 0000000000..ccae1f1e2d --- /dev/null +++ b/sources/talk/20200730 Role Of SPDX In Open Source Software Supply Chain.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Role Of SPDX In Open Source Software Supply Chain) +[#]: via: (https://www.linux.com/audience/developers/role-of-spdx-in-open-source-software-supply-chain/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Role Of SPDX In Open Source Software Supply Chain +====== + +Kate Stewart is a Senior Director of Strategic Programs, responsible for the Open Compliance program at the Linux Foundation encompassing SPDX, OpenChain, Automating Compliance Tooling related projects. In this interview, we talk about the latest release and the role it’s playing in the open source software supply chain. + +*Here is a transcript of our interview. * + +Swapnil Bhartiya: Hi, this is Swapnil Bhartiya, and today we have with us, once again, Kate Stewart, Senior Director of Strategic Programs at Linux Foundation. So let’s start with SPDX. Tell us, what’s new going on in there in this specification? + +Kate Stewart: Well, the SPDX specification just a month ago released auto 2.2 and what we’ve been doing with that is adding in a lot more features that people have been wanting for their use cases, more relationships, and then we’ve been working with the Japanese automotive-made people who’ve been wanting to have a light version. So there’s lots of really new technology sitting in the SPDX 2.2 spec. And I think we’re at a stage right now where it’s good enough that there’s enough people using it, we want to probably take it to ISO. So we’ve been re-formatting the document and we’ll be starting to submit it into ISO so it can become an international specification. And that’s happening. + +Swapnil Bhartiya: Can you talk a bit about if there is anything additional that was added to the 2.2 specification. Also, I would like to talk about some of the use cases since you mentioned the automaker. But before that, I just want to talk about anything new in the specification itself. + +Kate Stewart: So in the 2.2 specifications, we’ve got a lot more relationships. People wanted to be able to handle some of the use cases that have come up from containers now. And so they wanted to be able to start to be able to express that and specify it. We’ve also been working with the NTIA. Basically they have a software bill of materials or SBoM working groups, and SPDX is one of the formats that’s been adopted. And their framing group has wanted to see certain features so that we can specify known unknowns. So that’s been added into the specification as well. + +And then there are, how you can actually capture notices since that’s something that people want to use. The license has called for it and we didn’t have a clean way of doing it and so some of our tool vendors basically asked for this. Not the vendors, I guess there are partners, there are open source projects that wanted to be able to capture this stuff. And so we needed to give them a way to help. + +We’re very much focused right now on making sure that SPDX can be useful in tools and that we can get the automation happening in the whole ecosystem. You know, be it when you build a binary to ship to someone or to test, you want to have your SBoM. When you’ve downloaded something from the internet, you want to have your SBoM. When you ship it out to your customer, you want to be able to be very explicit and clear about what’s there because you need to have that level of detail so that you can track any vulnerabilities. + +Because right now about, I guess, 19… I think there was a stat from earlier in the year from one of the surveys. And I can dig it up for you if you’d like, but I think 99% of all the code that was scanned by Synopsys last year had open source in it. And of which it was 70% of that whole build materials was open source. Open source is everywhere. And what we need to do is, be able to work with it and be able to adhere to the licenses, and transparency on the licenses is important as is being able to actually know what you have, so you can remediate any vulnerabilities. + +Swapnil Bhartiya: You mentioned a couple of things there. One was, you mentioned tooling. So I’m kind of curious, what sort of tooling that is already there? Whether it’s open source or open source be it basically commercialization that worked with the SPDX documents. + +Kate Stewart: Actually, I’ve got a document that basically lists all of these tools that we’ve been able to find and more are popping up as the day goes by. We’ve got common tools. Like, some of the Linux Foundation projects are certainly working with it. Like FOSSology, for instance, is able to both consume and generate SPDX. So if you’ve got an SPDX document and you want to pull it in and cross check it against your sources to make sure it’s matching and no one’s tampered with it, the FOSSology tool can let you do that pretty easily and codes out there that can generate FOSSology. + +Free Software Foundation Europe has a Lindt tool in their REUSE project that will basically generate an SPDX document if you’re using the IDs. I guess there’s actually a whole bunch more. So like I say, I’ve got a document with a list of about 30 to 40, and obviously the SPDX tools are there. We’ve got a free online, a validator. So if someone gives you an SPDX document, you can paste it into this validator, and it’ll tell you if it’s a valid SPDX document or not. And we’re looking to it. + +I’m finding also some tools that are emerging, one of which is decodering, which we’ll be bringing into the Act umbrella soon, which is looking at transforming between SPDX and SWID tags, which is another format that’s commonly in use. And so we have tooling emerging and making sure that what we’ve got with SPDX is usable for tool developers and that we’ve got libraries right now for SPDX to help them in Java, Python and Go. So hopefully we’ll see more tools come in and they’ll be generating SPDX documents and people will be able to share this stuff and make it automatic, which is what we need. + +Another good tool, I can’t forget this one, is Tern. And actually Tern, and so what Tern does is, it’s another tool that basically will sit there and it will decompose a container and it will let you know the bill of materials inside that container. So you can do there. And another one that’s emerging that we’ll hopefully see more soon is something called OSS Review Toolkit that goes into your bill flow. And so it goes in when you work with it in your system. And then as you’re doing bills, you’re generating your SBoMs and you’re having accurate information recorded as you go. + +As I said, all of this sort of thing should be in the background, it should not be a manual time-intensive effort. When we started this project 10 years ago, it was, and we wanted to get it automated. And I think we’re finally getting to the stage where it’s going to be… There’s enough tooling out there and there’s enough of an ecosystem building that we’ll get this automation to happen. + +This is why getting it to ISO and getting the specification to ISO means it’ll make it easier for people in procurement to specify that they want to see the input as an SPDX document to compliment the product that they’re being given so that they can ingest it, manage it and so forth. But by it being able to say it’s an ISO standard, it makes the things a lot easier in the procurement departments. + +OpenChain recognized that we needed to do this and so they went through and… OpenChain is actually the first specification we’re taking through to ISO. But for SPDX, we’re taking it through as well, because once they say you need to follow the process, you also need some for a format. And so it’s very logical to make it easy for people to work with this information. + +Swapnil Bhartiya: And as you’ve worked with different players, different of the ecosystem, what are some of the pressing needs? Like improve automation is one of those. What are some of the other pressing needs that you think that the community has to work on? + +Kate Stewart: So some of the other pressing needs that we need to be working on is more playbooks, more instructions, showing people how they can do things. You know, we figured it out, okay, here’s how we can model it, here’s how you can represent all these cases. This is all sort of known in certain people’s heads, but we have not done a good job of expressing to people so that it’s approachable for them and they can do it. + +One of the things that’s kind of exciting right now is the NTIA is having this working group on these software bill of materials. It’s coming from the security side, but there’s various proof of concepts that are going on with it. One of which is a healthcare proof of concept. And so there’s a group of about five to six device manufacturers, medical device manufacturers that are generating SBoMs in SPDX and then there are handing them into hospitals to go and be able to make sure they can ingest them in. + +And this level of bringing people up to this level where they feel like they can do these things, it’s been really eye-opening to me. You know, how much we need to improve our handholding and improve the infrastructure to make it approachable. And this obviously motivates more people to be getting involved. From the vendors and commercial side, as well as the open source, but it wouldn’t have happened, I think, to a large extent for SPDX without this open source and without the projects that have adopted it already. + +Swapnil Bhartiya: Now, just from the educational awareness point of view, like if there’s an open source project, how can they easily create SBoM documents that uses the SPDX specification with their releases and keep it synced? + +Kate Stewart: That’s exactly what we’d love to see. We’d love to see the upstream projects basically generate SPDX documents as they’re going forward. So the first step is to use the SPDX license identifiers to make sure you understand what the licensing should be in each file, and ideally you can document with eTags. But then there’s three or four tools out there that actually scan them and will generate an SPDX document for you. + +If you’re working at the command line, the REUSE Lindt tool that I was mentioning from Free Software Foundation Europe will work very fast and quickly with what you’ve got. And it’ll also help you make sure you’ve got all your files tagged properly. + +If you haven’t done all the tagging exercising and you wonder [inaudible 00:09:40] what you got, a scan code works at the command line, and it’ll give you that information as well. And then if you want to start working in a larger system and you want to store results and looking things over time, and have some state behind it all so like there’ll different versions of things over time, FOSSology will remember from one version to another and will help you create these [inaudible 00:10:01] off of bill materials. + +Swapnil Bhartiya: Can you talk about some of the new use cases that you’re seeing now, which maybe you did not expect earlier and which also shows how the whole community is actually growing? + +Kate Stewart: Oh yeah. Well, when we started the project 10 years ago, we didn’t understand containers. They weren’t even not on the raw mindset of people. And there’s a lot of information sitting in containers. We’ve had some really good talks over the last couple of years that illustrate the problems. There was a report that was put out from the Linux Foundation by Armijn Hemel, that goes into the details of what’s going on in containers and some of the concerns. + +So being able to get on top of automating, what’s going on with concern inside a container and what you’re shipping and knowing you’re not shipping more than you need to, figuring out how we can improve these sorts of things is certainly an area that was not initially thought about. + +We’ve also seen a tremendous interest in what’s going on in IOT space. And so that you need to really understand what’s going on in your devices when they’re being deployed in the field and to know whether or not, effectively is vulnerability going to break it, or can you recover? Things like that. The last 10 years we’ve seen tremendous spectrum of things we just didn’t anticipate. And the nice thing about SPDX is, you’ve got a use case that we’re not able to represent. If we can’t tell you how to do it, just open an issue, and we’ll start trying to figure it out and start to figure if we need to add fields in for you or things like that. + +Swapnil Bhartiya:  Kate, thank you so much for taking your time out and talking to me today about this project. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/audience/developers/role-of-spdx-in-open-source-software-supply-chain/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200730 SODA Foundation- Autonomous data management framework for data mobility.md b/sources/talk/20200730 SODA Foundation- Autonomous data management framework for data mobility.md new file mode 100644 index 0000000000..d24d523369 --- /dev/null +++ b/sources/talk/20200730 SODA Foundation- Autonomous data management framework for data mobility.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SODA Foundation: Autonomous data management framework for data mobility) +[#]: via: (https://www.linux.com/audience/developers/soda-foundation/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +SODA Foundation: Autonomous data management framework for data mobility +====== + +SODA Foundation is an open source project under Linux Foundation that aims to establish an open, unified, and autonomous data management framework for data mobility from the edge, to core, to cloud. We talked to Steven Tan, SODA Foundation Chair, to learn more about the project. + +_Here is a transcript of the interview:_ + +Swapnil Bhartiya: Hi, this is Swapnil Bhartiya, and today we have with us Steven Tan, chair of the SODA foundation. First of all, welcome to the show. +Steven Tan: Thank you. + +Swapnil Bhartiya: Tell us a bit about what is SODA? +Steven Tan: The foundation is actually a collaboration among vendors and users to focus on data management for, how do you call, autonomous data mesh management. And the point of this whole thing is how do we serve the users? Because a lot of our users are getting a lot of data challenges, and that’s what this foundation is for. To get users and vendors together to help to address these data challenges. + +Swapnil Bhartiya: What kind of data are we talking about? +Steven Tan: The data that we’re talking about is referring to anything like data protection, data governance, data replication, data copy management and stuff like that. And also data integration, how to connect the different data silos and stuff. + +Swapnil Bhartiya: Right. But are we talking about enterprise data or are we talking consumer data? Like there is a lot of data with Facebook, Google, and Gmail, and then there are a lot of enterprise data, which companies … Sorry, as an enterprise, I might put something on this cloud, I can put it on this cloud. So can you please clarify what data are we talking about? +Steven Tan: Actually, the data that we’re talking about is … It depends on the users. There’re all kinds of data. Like for example, I mean, in the keynote that I gave two days ago, the example I gave was from Toyota. So Toyota use case is actually car data. So car data refers to things like the car sensor data, videos, map data and stuff. And then we have users like China Unicom. I mean, they have enterprise companies going to the cloud and so on. So they’ve all kinds of enterprise data over there. And then we also have other users like Yahoo Japan, and they have like a website. So the data that you’re talking about is web data, consumer data and stuff like that. So it’s across the board. + +Swapnil Bhartiya: Oh, so it’s not as specific to an industry or any space or sector, okay. But why do you need it? What is the problem that you see in the market and in the current sphere that you’re like, hey, we should create something like that? +Steven Tan: So the problem that came, I mean the reason why all these companies came together is that they are building data centers that are from small to big. But a lot of the challenges that you have is like, it’s hard for a single project to address. It’s not like a business where we have a specific problem and then we need this to be solved and so on, it’s not like that. A lot of it is like, how do you connect the different pieces together in the data center together? +So there’s nothing like, no organization like that that can help them solve this kind of problem. Like how do you have, in order to address the data of … Or how do you address things like taking care of data protection and data privacy at the same time? And at the same time, you want to make sure that this data can be governed properly. So there isn’t any single organization that can help to take care of this kind of stuff, so we’re helping these users understand their problems and then come together and then we plan projects and roadmaps based on their problems and try to address them through these projects in the SODA foundation. + +Swapnil Bhartiya: And you gave an example of data from the cars and all these things. Does that also mean that open source has helped solving a lot of problems by breaking down a lot of silos so that there’s a lot of interaction between different silos, which were like earlier separated and isolated? Today, as you mentioned, we are living in a data driven world. No matter what we do all the way from the Ring, to what we are doing right now, talking to each other, to the product that we’ll create in the end. But most of this data is living in their own silos. There may be a lot of value in that data, which cannot be extracted because one, it is locked into the silos. The second problem is that these days, data is kind of becoming the next oil. These companies are trying to capture all the data, irrespective of the fact of what value do they see in that data today? And by leveraging machine learning and deep learning, they can in the future … So how do you look at that, and how is SODA foundation going to break those silos, without compromising on our privacy, yet allow companies … Because the fact is, as much as I prefer my privacy, I also want Google Maps to tell me the fastest route where I want to go. +Steven Tan: Right. So I think there are certain, I mean, there are different levels of privacy that we’re going to take care of. And in terms of like, first of all, there are all kinds of … I mean, in terms of the different countries or different States or different provinces like in different countries, there are different kinds of regulations and so on. So first of all, like the data silos you talk about. Yes, that’s one of the key problems that we’re trying to solve. How to connect all the different data silos so as to reduce fragmentation, and then try to minimize the so called dark data that you’re talking about, and then extract all the values over there. So that’s one of the things that we try to get here. I mean, we try to connect all the different pieces, like in the different … The data may be sitting in the edge in the data center or different data centers and in the cloud. We try to connect all these pieces together. + +I mean, that’s one of the first things that we tried to do. And then we tried to have data policies. I think this is a critical piece of things that a lot of the solutions out there don’t address. You have data policies, but it may be the data policies just for a single vendor solution. But once the data gets out, that solution then is out of control. So what we’re trying to do here is say, how do you have data policies across different solutions, so no matter where the data is it’s governed the same way, consistently? That’s the key. So then you can talk about how can you really protect the data in terms of privacy or govern the data or control the data? And in terms of the, I mentioned about the regions, right? So you know where the data is, and you know what kind of regulations that need to be taken care of and you apply it right there. That’s how it should work. + +Swapnil Bhartiya: When we look at the kind of a scenario you talked about, I see it as two-fold. One is there is a technology problem and the second is people problem. So is SODA foundation going to deal with both, or are you going to just deal with the technology aspect of it? +Steven Tan: The technology part that we talk about, we try to define in terms of the API and so on to all the data policies and so on, and try to get as many companies to support this as possible. And then the next thing that we try to do is actually try to work with standards organizations to try to make this into a standard. I mean, that’s what we’re trying to do here. + +And then government aspects, there are certain organizations that we are talking to. Like there’s the CESI, it’s China Electronic Standards organizations that we’re talking to that’s trying to work things into their … Actually, I’m not sure about China, because it’s, I mean, we don’t know about their sphere of influence within the CSI and so on. And then for the industry standards, there’s [inaudible 00:09:05] and so on, we’re trying to work with them and trying to get it to work. + +Swapnil Bhartiya: Can we talk about the ecosystem that you’re trying to build around SODA foundation? One would be the participants who are actually contributing either the code or the vision, and then the users community who would actually be benefiting from it? +Steven Tan: So the ecosystem that we are trying to build, that’s the core part, which is actually the framework. So the framework, I mean, this part will be more of the data vendors or the storage vendors that will be involved in trying to build this ecosystem. And then the outer part, what I call the outer part of the ecosystem will be things like the platforms. Things like Kubernetes, VMware, all these different vendors, and then networking kind of stuff that you need to take care of like the big data analytics and stuff. + +And then for the users, actually, if you can see from the SODA end-user advisory committee, I mean, that’s where most of our users are participating in the communication. So most of these users, I mean, they are from different regions and different countries and different industries. So we try to serve, I mean, whichever participant is interested in, they can participate in this thing. But the main thing is that because they may be from different industries, but actually most of the issues that they have is still the same thing. So there are some commonalities among all these users. + +Swapnil Bhartiya: We are in the middle of 2020, because of COVID-19 everything has slowed down, things have changed. What does your roadmap, what does your plan look like? The structure, the governance and the plan for ’21 or end of the year? +Steven Tan: We are very, how do you call it? Very community-driven or focused kind of organization. We hold a lot of meetups and events and so on where we get together the users and the vendors and so on and the community in general. So with this COVID-19 thing, a lot of the plans has been upset. I mean, it’s in chaos right now. So most of the things are like what everybody is doing, moving online. So we are having some webinars and stuff, even as of right now when we are talking, we are having a mini summit going on with the Open Source Summit North America right now. + +So for the rest of this year, most of our events will be online. We’re going to have some webinars and some meetups, you can find it out from our website. And the other plans that we have is that we are going to have, we just released the SODA federal release, which is the 1.0 release. And through the end of this year, we’re going to have two more releases, the G release and the H release at the end of this year. G release is going to be in September, and H is in the end of the year. And we’re trying to engage our users with things like the POC testing for the federal. Because each release that we have, we try to get them to do the testing, and then so that’s the way of them trying to provide feedback to us. Whether that works for them or how can we improve to make the code work for what they need. + +Swapnil Bhartiya: Awesome. So thank you so much for taking your time out and explaining more about SODA foundation, and I look forward to talking to you again because I can see that you have a very exciting pipeline ahead. So thank you. +Steven Tan: Thank you, thank you very much. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/audience/developers/soda-foundation/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200731 Linux dominates supercomputing.md b/sources/talk/20200731 Linux dominates supercomputing.md new file mode 100644 index 0000000000..6648bcfba1 --- /dev/null +++ b/sources/talk/20200731 Linux dominates supercomputing.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux dominates supercomputing) +[#]: via: (https://www.networkworld.com/article/3568616/linux-dominates-supercomputing.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux dominates supercomputing +====== +The Linux operating system runs all 500 of the world’s fastest supercomputers, which help to advance artificial intelligence, machine learning and even COVID-19 research. +Wikipedia + +In addition to all its other successes, Linux dominates supercomputing: All 500 of the worlds fastest supercomputers run Linux, and that has been the case since November 2017, according to the [TOP500][1] organization, which has been ranking the 500 most powerful computer systems since 1993. (A graph of Linux' ascension is available on [here][2].) + +How did this happen? + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### A little history + +Linux began life in 1991 as the personal project of 21-year-old Finnish student Linus Torvalds. I first became aware of it several years later while working at Johns Hopkins University’s physics and astronomy department where I managed the department’s network and a number of servers with the help of a couple grad students. + +At the time, I was intrigued by Linux, but couldn’t imagine how dominant the OS would become simply because its source code was available to anyone who wanted to work with it. I could not forsee that a significant group of large companies would grasp its value, work together and innovate to make Linux what it is today. Intense collaboration was key to this success, including contributions from countless individuals and organizations that includes IBM, Intel, NVIDIA, Red Hat, Samsung, SUSE and many others. (Browsing the [corporate members of the Linux Foundation][4] is likely to make your jaw drop.) + +The success of Linux can also be attributed to the fact that it is open source, non-proprietary, and extendable. + +### The TOP500 + +Twice a year, in June and November, TOP500 releases it a list of the 500 most powerful computer systems ranked by their performance on something called the [LINPACK Benchmark][5], which calls for the computer being tested to solve a dense system of linear equations. + +I have heard it said, though not been able to verify, that Linux runs on more than 90% of public clouds, more than 60% of embedded systems and IoT devices, as much as 99% of supercomputers and more than 80% of smartphones. If these claims are even close to the truth, it attests to the success and versatility of Linux + +In [the most recent TOP500 ranking][6], a Japanese supercomputer name [Fugaku][7] (derived from an alternate name for Mount Fuji) has taken the top spot and pushed the former leaders down a rank. Fugaku was co-developed by Riken and Fujitsu and uses Fujitsu's 48-core A64FX ARM chip. This is the first time a computer based on ARM processors has topped the list. + +The computer was fully assembled only in May but has already helped fight COVID-19 by sorting through more than 2,000 drugs that might effectively block the virus and found a dozen that show promise. + +### Containerization, AI and ML + +Recently I had a chance to discuss Linux with Stefanie Chiras, vice president and general manager of the Red Hat Enterprise Linux business unit. She sees Linux as tightly linked to supercomputing because it provides the scale and flexibility to support high-performance computing and exascale computing systems – those that are capable of calculating at least 1,018 floating point operations per second (1 exaFLOPS). She also sees Linux as adding to the ongoing development of artificial intelligence and machine learning. + +Chiras expects that containerization will enable more and more researchers and analysts to benefit from supercomputing power. And, as someone who has provided support to both scientists and analysts over the past few decades, I can appreciate what a difference this will make in their work. + +In discussing supercomputers, Chiras pointed out that, beyond having a Linux operating system, the top three fastest – Fugaku, Summit and Sierra – are all built from commercial hardware. Summit and Sierra are Power Systems-based, while Fugaku is the first Arm-powered supercomputer to top the list. The days of purpose-built, custom hardware and software in supercomputing could be over even though new and demanding workloads like AI and complex modeling require greater and greater power. + +(Chiras also wasn’t shy about mentioning that [Red Hat Enterprise Linux][8] is running on four of the top 10 supercomputers: the top three plus number nine, [Marconi-100][9].) + +The character of open source and the willingness of many companies to recognize its value and work together to develop it have made Linux the top OS for both supercomputers and micro-devices. We can expect continued improvements in how the OS is deployed – including getting supercomputing into the hands of a lot more scientists and engineers – as we move forward. As a person who has spent close to 40 years working with Unix and Linux systems, I couldn’t be more pleased. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568616/linux-dominates-supercomputing.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: http://TOP500.org +[2]: https://www.top500.org/statistics/details/osfam/1/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.linuxfoundation.org/membership/members/ +[5]: https://www.top500.org/project/linpack +[6]: https://www.networkworld.com/article/3563766/the-10-fastest-supercomputers-are-led-by-one-28x-faster-than-the-rest.html +[7]: https://www.fujitsu.com/global/about/innovation/fugaku/ +[8]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[9]: https://www.hpc.cineca.it/hardware/marconi100 +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200731 Why we open sourced our Python platform.md b/sources/talk/20200731 Why we open sourced our Python platform.md new file mode 100644 index 0000000000..fe76ac8487 --- /dev/null +++ b/sources/talk/20200731 Why we open sourced our Python platform.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why we open sourced our Python platform) +[#]: via: (https://opensource.com/article/20/7/why-open-source) +[#]: author: (Meredydd Luff https://opensource.com/users/meredydd-luff) + +Why we open sourced our Python platform +====== +Open source development philosophy makes Anvil's entire solution more +useful and trustworthy. +![neon sign with head outline and open source why spelled out][1] + +The team at Anvil recently open sourced the [Anvil App Server][2], a runtime engine for hosting web apps built entirely in Python. + +The community reaction has been overwhelmingly positive, and we, at Anvil, have already incorporated lots of that feedback into our [next release][3]. But one of the questions we keep getting asked is, "Why did you choose to open source such a core part of your product?" + +### Why we created Anvil + +[Anvil][4] is a tool that makes it as simple as possible to build a web app. We do that by enabling you to build the whole application in one language—Python. + +Before Anvil, if you wanted to build a web app, you'd have to write code using a bunch of technologies like HTML, Javascript, CSS, Python, SQL, React, Redux, Bootstrap, Sass, Webpack, etc. That's a lot to learn. And that's just for a simple app; trust me, it can get [way more complicated][5]. + +![A complex framework of development tools needed for a simple web app][6] + +Yes, really. All of these, for a simple web app. + +But even then, you're not done! You need to know all about Git and cloud hosting providers, how to secure the (most-likely) Linux operating system, how to tune the database, and then you're on call to keep it running. Forever. + +So, instead, we built Anvil, an online IDE where you can build your UI with a [drag-and-drop designer][7] and write all your [logic in Python][8], then Anvil takes care of the rest. We replace that whole teetering stack with "just write Python." + +### Simple web hosting is important, but not enough + +Anvil can also host your apps for you. And why not? There is so much complexity in deploying a web app, so running our own cloud hosting service was the only way to provide the simplicity we need. Build an app in the Anvil editor, [click a button][9], and it's live on the Internet. + +But we kept hearing from people who said, "That's great, but…" + + * "I need to run this on an offshore platform without reliable internet access." + * "I want to package my app into an IoT device I sell." + * "If I'm putting my eggs in this basket, how can I be sure I can still run my app in ten years?" + + + +These are all good points! A cloud service isn't the right solution for everyone. If we want to serve these users, there's got to be some way for them to get their apps out of Anvil and run them locally, under their own complete control. + +### Open source is an escape hatch, not an ejector seat + +At conferences, we sometimes get asked, "Can I export this as a Flask+JS app?" Sure, it would be possible to export an Anvil project into its respective Python and JavaScript—we could generate a server package, compile the client-side Python to Javascript, and spit out a classic web app. But it would have serious drawbacks, because: **code generation is an ejector seat.** + +![Code generation is an ejector seat from a structured platform][10] + +([Image][11] licensed as public domain) + +Generated code is better than nothing; at least you can edit it! But the moment you've edited that code, you've lost all the benefits of the system that generated it. If you're using Anvil because of its [drag-and-drop editor][12] and [Python in the browser][13], why should you have to use vim and Javascript in order to host your app locally? + +We believe in [escape hatches, not ejector seats][14]. So we did it the right way—we [open-sourced Anvil's runtime engine][2], which is the same code that serves your app in our hosted service. It's a standalone app; you can edit your code with a text editor and run it locally. But you can also `git push` it right back into our online IDE. It's not an ejector seat; there's no explosive transition. It's an escape hatch; you can climb out, do what you need to do, and climb right back in. + +### If it's open, is it reliable? + +A seeming contradiction in open source is that its free availability is its strength, but also sometimes creates a perception of instability. After all, if you're not charging for it, how are you keeping this platform up and healthy for the long term? + +We're doing what we always have—providing a development tool that makes it drastically simpler to build web applications, though the apps you build using Anvil are 100% yours. We provide hosting for Anvil apps and we offer the entire development and hosting platform onsite for [enterprise customers][15]. This enables us to offer a free plan so that everyone can use Anvil for hobby or educational purposes, or to start building something and see where it goes. + +### More to gain, little to lose + +Open sourcing our runtime engine isn't a detractor from our business—it makes our online IDE more useful and more trustworthy, today and in the future. We've open-sourced the Anvil App Server for the people who need it, and to provide the ultimate insurance policy. It's the right move for our users—now they can build with confidence, knowing that the open source code is [right there][3] if they need it. + +If our development philosophy resonates with you, why not try Anvil yourself? +  + +\----- + +_This post is an adaptation of [Why We Open Sourced the Anvil App Server][16] and is reused with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/why-open-source + +作者:[Meredydd Luff][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/meredydd-luff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_OSwhy_520x292_ma.png?itok=lqfhAs8L (neon sign with head outline and open source why spelled out) +[2]: https://anvil.works/blog/open-source +[3]: https://github.com/anvil-works/anvil-runtime +[4]: https://anvil.works/ +[5]: https://github.com/kamranahmedse/developer-roadmap#introduction +[6]: https://opensource.com/sites/default/files/uploads/frameworks.png (A complex framework of development tools needed for a simple web app) +[7]: https://anvil.works/docs/client/ui +[8]: https://anvil.works/docs/client/python +[9]: https://anvil.works/docs/deployment +[10]: https://opensource.com/sites/default/files/uploads/ejector-seat-opensourcecom.jpg (Code generation is an ejector seat from a structured platform) +[11]: https://commons.wikimedia.org/wiki/File:Crash.arp.600pix.jpg +[12]: https://anvil.works/docs/editor +[13]: https://anvil.works/docs/client +[14]: https://anvil.works/blog/escape-hatches-and-ejector-seats +[15]: https://anvil.works/docs/overview/enterprise +[16]: https://anvil.works/blog/why-open-source diff --git a/sources/talk/20200801 8 tips for running a virtual hackathon.md b/sources/talk/20200801 8 tips for running a virtual hackathon.md new file mode 100644 index 0000000000..0ed2d07296 --- /dev/null +++ b/sources/talk/20200801 8 tips for running a virtual hackathon.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 tips for running a virtual hackathon) +[#]: via: (https://opensource.com/article/20/8/virtual-hackathon) +[#]: author: (Jason Blais https://opensource.com/users/jasonblais) + +8 tips for running a virtual hackathon +====== +Reach new developers and engage with your existing community through +virtual hackathons. +![Two people chatting via a video conference app][1] + +Hackathons are events where developers, product managers, designers, and others come together to tackle problems over a short time period. They have become increasingly popular over the last 15 years after [OpenBSD ran the first hackathon in June 1999][2]. + +These events provide several benefits—greater engagement across the community, innovation and new ideas, awareness for the organizers, and networking opportunities for participants. + +[Mattermost][3], an open source messaging platform for DevOps teams, has also run and participated in several hackathons to engage with the open source community. So far, in 2020, we participated in a [hackathon to overcome the challenges of COVID-19][4] and ran a [hackfest to create open source chatbots for developer workflows][5]. Both had thousands of participants and were run completely virtually. + +We've come a long way from our [first hackathon in 2016][6] that had only 20 participants to building a [step-by-step guide for running a virtual hackathon][7], and we've learned many valuable lessons. + +If you are considering running a virtual hackathon, here are eight tips to keep in mind: + +### Choose your hackathon theme + +Before you begin to plan your hackathon, you'll need to choose a theme or a topic for it first. + +Is there a specific business or social problem you're trying to solve? An industry you want to reach? Technologies you want to explore together with your community? + +Choosing the theme at the start is important, as it gives you a clear focus for the rest of your planning—which communities to reach out to, how to determine logistics, what materials to prepare, and other details. It also inspires your community to work on solving the specific kinds of problems you're organizing around. + +### Decide dates for the hackathon early + +With 365 days in a year, you'd think it'd be easy to find one on which to hold an event, but it can actually be a challenge to schedule even a virtual hackathon. The most important thing is not to rush the preparation. Ideally, you should schedule the hackathon at least two months out. This gives you enough time to promote and organize it and gives your participants enough time to prepare for it—whether it's researching the hackathon topic or setting aside time for it on their calendars. + +Here are a few quick tips when trying to decide when to run hackathons: + + * Avoid overlap with major holidays in the countries you're trying to reach. If the event is global, then avoid major holidays in the countries where you have bigger communities. + * Avoid overlap with significant company or community events that may act as a distraction during the hackathon, such as major product releases or developer conferences. + * Avoid starting the hackathon on a Friday, especially if you plan to reach developers around the world. If you're located in the Western Hemisphere and hold a hackathon kick-off call on Friday, those in Europe and Asia will either have to join in late Friday night or Saturday morning, effectively meaning the hackathon starts on a weekend in those areas. It is typically better to start on a Thursday instead. + + + +Given the hackathon is online, there is also an opportunity to extend it beyond a standard 48-hour event. We have found that running a three- or four-day event, for instance, results in much higher quality submissions that are closer to completion. + +### Identify key team members to partner with during the hackathon + +It is much easier to promote and organize the event when you have someone you can collaborate with. At a minimum, find one or two developers who can act as leaders during the event, mentoring newcomers and answering questions from the participants. They can also be your point of contact for technical support before and during the event. + +You should also consider if you need a partner to run operations such as scheduling calls, and a partner to create the event marketing materials. + +Moreover, once you've picked the theme and dates of your event, reach out to your community and ask if anyone is open to help. Many may be interested. Acting as a hackathon organizer and mentor also provides a great experience for community members themselves. + +### Produce a workback schedule + +Start by listing everything you and your hackathon partners may need to do before, during, and after the hackathon. And I do mean everything—from deciding which platform to host your hackathon on to which video conferencing tool to use for presentations to what prizes to give out. The more comprehensive your workback schedule is, the better prepared you will be, and the more successful the hackathon will be. + +To help you get started, check out the Mattermost ["How to Run a Hackathon" playbook][7] with key dates and activities that you can use for inspiration. + +### Create a code of conduct + +Code of conduct is important to promote healthy behavior within your community. It establishes what is accepted by participants and helps create a safe and welcoming environment for everyone. + +The same is true for hackathons. The code of conduct establishes the rules and actions taken when the rules are broken. Include a clear contact or place to report harassment from the participants. Often, the members you're partnering with from tip #3 will also help enforce the code of conduct as needed. + +To learn more about codes of conduct, including ways to enforce them, see [this excellent guide][8]. + +### Make one landing page for the hackathon + +During the hackathon, there is a lot going on. People ask questions, share progress, and team up with others. Especially when running a hackathon with hundreds (or thousands!) of participants, it can quickly get chaotic. + +That is why a single hackathon landing page is critical. This landing page should contain all the information community members need to know, including resources to get started, where to ask questions, and how to create a submission. Updates can also be communicated in other channels like Twitter, but they should always be reflected on the hackathon's landing page. Your landing page is the source of truth. + +Plus, make sure to include plenty of information for first-time participants. If you've run a few events, a lot of the information you share is familiar to you and previous participants. However, everything is new and often confusing for first-time participants, so make sure to keep them in mind when building the landing page. + +### Plan for external promotion + +A common reason to run a hackathon is to reach new users and communities who have heard of your project before. Therefore, announcing and promoting the hackathon beyond just your social channels is very important. However, simply spamming other communities and pages is not just ineffective, but also disrespectful. + +Go back to point #1, where you selected the hackathon theme. Are there certain technologies that are relevant to it? Or industries?  + +If so, study where those communities exist and reach out in their respective channels. Even better, find their community manager and share the hackathon with them first before sharing with the wider community. + +### Include social interaction time + +The biggest challenge we've found with virtual hackathons as compared to physical hackathons are the social aspects. Since people are not working in the same rooms together anymore, building connections and collaborating with others takes extra effort. + +Make sure to add social activities throughout the event dates, accounting for different time zones. Include activity feeds where participants can share updates on what they're working on, drop-in social hours over video, coffee times, pizza hours, and more. + +Taking the extra step to ensure there are opportunities for social interaction creates a more engaging experience for everyone involved. + +### Ready to run your first virtual hackathon? + +Running a virtual hackathon is not easy, but if you prepare for it well and use the above tips to plan it, you will be set up for success, and hopefully have lots of fun along the way! There is also an [excellent guide from HackerEarth][9] that you can use as a reference. + +Ready to run your first virtual hackathon? Then use the Mattermost ["How to Run a Hackathon" playbook][7] to guide your planning and read about the [Mattermost Bot Hackfest][5] for inspiration. + +Thank you also to Jesús Espino and Justin Reynolds for their valuable feedback on this article. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/virtual-hackathon + +作者:[Jason Blais][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jasonblais +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chat_video_conference_talk_team.png?itok=t2_7fEH0 (Two people chatting via a video conference app) +[2]: http://www.openbsd.org/hackathons.html +[3]: http://mattermost.com/ +[4]: https://mattermost.com/blog/vencealvirus-virtual-hackathon/ +[5]: https://mattermost.com/blog/mattermost-bot-hackfest-winners/ +[6]: https://mattermost.com/blog/mattermost-holiday-hackfest-2016/ +[7]: https://handbook.mattermost.com/contributors/contributors/how-to-run-a-hackathon +[8]: https://opensource.guide/code-of-conduct/ +[9]: https://www.hackerearth.com/community-hackathons/resources/e-books/guide-to-organize-hackathon diff --git a/sources/talk/20200804 Leaving Google- Five Years On.md b/sources/talk/20200804 Leaving Google- Five Years On.md new file mode 100644 index 0000000000..5f94eafc04 --- /dev/null +++ b/sources/talk/20200804 Leaving Google- Five Years On.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Leaving Google: Five Years On) +[#]: via: (https://theartofmachinery.com/2020/08/04/leaving_google.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Leaving Google: Five Years On +====== + +About five years ago now, I handed in my Google employee badge and walked out of the Sydney Google office to start a new life of self-employment. I figured I should write up this story because I got a lot out of reading [Michael Lynch’s][1]. As you can see, it’s still taken me a couple of years to get around to writing this post, but I finally told myself that if I don’t write it for the fifth anniversary, I never will. + +This post is kind of long, but I hope it has something useful for new developers who are interested in working at a big tech company, or for big company employees who are wondering what it’s like to quit. I’ll talk about my story of getting into, working at and quitting Google, and what I’ve done since. Feel free to ask if you want more detail about something, though I already have a lot of blog posts to write, so I can’t promise anything in-depth straight away. + +Also, at the risk of labouring the obvious: I haven’t worked at Google for five years, so don’t take this story as a literal description of Google today or what all Google employees experience. However, I think a lot of it’s still relevant to tech careers in general. + +### The windy road to Google + +I got my first paid programming job in 2005. It was working at the local power company, taking some old Pascal code and making it work on a different OS with a different compiler. It was basically just a summer job for extra money while doing the maths and physics degree I’d started that same year. They were happy to have an undergraduate who could do the job; I was just blown away that these grown ups were not only interested in my programming hobby, but actually going to give me real money for it. + +I kept doing stuff like that until I graduated in 2007. I liked programming work, and Google was a cool company doing cool programming stuff, so I applied for an internship. The Google interview process was famous for being tough, so I spent weeks practising on all the Google interview problems I could find online. I don’t think the process has changed much in 13 years: I submitted a résumé, and I got invited to a few rounds of phone interviews that were mostly algorithmic problems (I remember a dynamic programming one and a divide-and-conquer geometric one). I passed the initial interviews, and got invited to come to Sydney for a day of on-site interviews with Google engineers. I went home and waited for what felt like an eternity for the phone call from Google HR. I got rejected. + +It’s natural to feel bad about our rejections and failures, so we don’t talk about them much. But for the same reason, other people don’t talk about theirs, which only makes things worse. When I _did_ get into Google later, I felt like there must be something a bit wrong with me as a “ex-reject”, but one day I was at a table with a bunch of colleagues and the conversation came up. That’s when I discovered that actually a lot of people around me had been rejected at least once. I wasn’t even the “worst”. One guy joked that he must have only got in because Google HR got tired of rejecting him. I’m talking about some pretty impressive engineers, as well — some were responsible for code I use all the time, and I bet you use, too. + +Companies that do interviews usually interview two or more candidates for each hire. That means there are more rejections around than acceptances, so the average interviewee gets rejected more often than not. Yet we keep forgetting that. Four developers go into an interview; one gets hired, the other three rant on social media about how the interview was totally flawed because they personally got rejected. Sure, interviews are far from perfect, but we need to stop taking them so personally. + +Rejection and failure aren’t so bad as long as you can figure out what went wrong and how you could improve yourself. The Google interviews were heavily algorithm-oriented, and I fumbled through a lot of them but definitely didn’t come out shining. + +After the Google rejection, I got two things and took a kind of sabbatical year. The first thing was an Australian Business Number (ABN) that I used to do maths and science tuition, as well as tech job contracts. The other thing I got was a library card at the university science and tech library. I wasn’t planning to interview at Google again, but the interview experience told me there was a lot I didn’t know. I’d give tutorials in the library and read books in between. By the way, a few people thought I was weird for doing all that accounting and stuff for my tuition business, when most tutors just did it cash-in-hand. But I learned a lot that’s helped me later in life, so I don’t regret a thing. + +In 2009, I did a maths honours year (a.k.a, bachelors fourth year) based on the work of a magician-turned-mathematician called Persi Diaconis. The computer science department let me take one of their algorithms units as part of it. + +As I said, I hadn’t planned to interview for Google again, but let me fast forward to how it happened. I’d been studying Japanese since high school, so in 2012 I decided to try living in Tokyo. That mostly worked out, except I made one pretty big mistake: I didn’t have any paper qualifications in Japanese, so it was really hard to get job interviews. Eventually, a friend of mine who had been accepted at Google suggested I give it another try. Like all Google offices, the official business language at Google Tokyo is English, so they didn’t require me to have Japanese qualifications. + +### Google interviews, again + +My friend gave me a recommendation to Google HR. That definitely helps, but don’t get too excited if you get a recommendation, yourself. It ensures your résumé gets noticed (not trivial) and cuts one of the phone interviews, but you still have to pass the remaining phone and on-site interviews. + +This time I practised using problems from [Project Euler][2] and [Google CodeJam][3]. I had to do some live programming in a Google Doc during the phone interview, which was a bit awkward, but otherwise the phone interviews went okay. Then I got invited to the Mori Tower office in Roppongi for a day of onsite interviews. + +![Mori Tower in Tokyo, where I interviewed for Google. It's the sixth tallest building in the city, which means it's huge. \(Photo from here.\)][4] + +My first interview went terribly. I got brain freeze. I knew I could solve the problem, but I couldn’t think straight until the interviewer walked out of the room. Instantly I relaxed and recognised it as a ternary search problem. That was pretty frustrating, but I decided to just keep going and see how the rest of the interviews went. + +Two of the interviews were bad. One is still today the worst interview question I’ve ever had. The interviewer said, “You run a program twice with the same input and get different results. Tell me why.” I replied, “When that’s happened on modern computers and I didn’t expect it, it’s usually been a race condition.” He just said, “No, it’s not a race condition,” and looked at me waiting for my next answer. The question could have been a great question if he’d been interested in a discussion, but apparently he really did just want to play “guess the secret number”. For almost everything I said, he simply replied, “No.” Apparently the program was fully deterministic, stored no state, and had no dependence on the environment (such as disk or the real time clock), but gave different results each time it was executed. I suspect we had a different understanding of what “stored state” or “environment” meant or something, but I had no way to tell. At one point (getting desperate) I tried asking if temperature changes in the electronic components were having an effect, and he said, “No, that would be a race condition, and I’ve already told you it’s not a race condition.” Eventually the interview ended, and I still don’t know what that secret number was. + +I’m telling that story because I’ve heard much tamer horror stories being told as proof that interviewers are terrible people who hate interviewees. But, contrary to popular stereotype, most of the interviews that day were basically okay, and the interviewers were friendly and respectful. Interviewing is genuinely really hard, too, so it’s good to cut interviewers some slack. Hopefully, the “guess the number” interviewer got feedback from Google HR that his question just wasn’t helpful for making hiring decisions. + +This time, the interviews resulted in an offer, but with a little catch: the job was in Sydney, working as a site reliability engineer. I’d never heard of SRE before, but I had a phone call with a senior Sydney SRE who explained that he’d noticed my experience doing embedded engineering in the natural gas industry, and thought SRE would be a good fit because of a similar emphasis on reliability and fitting tight constraints. + +Having spent about a year building up a life in Tokyo, I didn’t want to drop everything and move to Sydney, but no way in hell was I in a position to turn down an offer from Google. I did make one very stupid mistake when talking with the recruiter: I got asked how much money I was making, and I blurted it right out. [Don’t do that.][5] It means it doesn’t matter what happens in the interview, or how much you were being underpaid at your previous job, or whatever; you’ll probably either be rejected or get offered some token amount on top of your old pay and be treated as crazy and unreasonable if you try to negotiate more. In my case, I was making much less than even an entry-level position at Google. I can’t say for sure that’s the whole story, but in 2013 I moved to Sydney to be a new-grad level SRE on Google Maps. + +### Google Maps SRE at Sydney + +A product like Maps is really several software projects, each with its own team of developers. Even a feature like route-finding is really multiple software projects — from gathering transport timetable data, to calculating routes, to rendering results, etc. There are two sides to the SRE job: One is being oncall for the various projects, responding in real time to any production incidents. The other side of the job (when there aren’t any fires to fight) is applying experience from production incidents to other projects and pre-emptively finding ways they could go wrong, or opportunities to make them perform better. Google’s SREs also act like an internal consulting group for developers with questions about deployment practices, or automation, or monitoring, or things like that. + +The work was pretty intense. As a team, we were expected to deal with at least one production incident a week, or else take on responsibility for more services. Every week, all the SREs in Sydney would get together to swap stories of failures that had happened, or new tips for how to make things work better. The learning curve felt like being an undergraduate again. + +I sometimes get a shocked, “But don’t you miss the benefits?!” from people who hear I chose to quit Google. The material benefits (like meals, etc.) are definitely nice, but they’re things that you can buy, so, no, they’re not things I miss. If you ask me what I miss, I’d say it’s the people who worked there. Contrary to what you might have heard, arrogant people don’t enjoy working at places like Google. There’s an infamous story of a narcissist who got a job at Google and kept embarrassing himself by pretending to be a top expert in all kinds of things. He lasted less than half a year before leaving. Overall, the culture was very low on arrogance and blame slinging and politics compared to other places I’ve worked at. On the other hand, Google doesn’t have a monopoly on nice colleagues. + +There’s one kind of corporate politics that was a big problem, though. Getting promoted required “demonstrating impact”, and it was well known that the easiest way to do that was to launch some new thing (not the only way, but easiest). The result was Googlers who were more interesting in promoting their own alpha-quality, prototype solutions to problems than improving existing solutions. We had a standing joke in SRE that there were two kinds of software inside Google: old things that worked well but were deprecated and were Ungoogly to even consider using, and hot new things that were the 100% official tools to use today even though they didn’t work yet. As SREs, we often saw first hand what went wrong with the new hotness (which sometimes became the old deprecated thing before it even got out of alpha). ([I’ve talked more in depth about this kind of thing before.][6]) + +This isn’t something that we cynical SREs just imagined; it was openly recognised as a problem in the company, and I remember being reassured that promotion committees had started looking for evidence of impact through things like maintenance work. + +### The promotion application + +In 2015, after working at Google for a couple of years, my manager told me it really was about time to apply for a promotion above my new-grad level. The promotion process was centrally managed through promotion committees twice a year. You’d make your application and back it up with a short description of projects you’d worked on, supported by references from your colleagues. The committee would do a review and give you the thumbs up or down. Your manager’s recommendation alone wasn’t enough because your manager had an incentive to get you promoted. Having high-ranked staff under you helps your own career advancement. + +To cut a long story short, I made my application and the committee said no. Actually, it was a pretty damning no. I don’t remember the response in detail, but it felt like the committee had just gone hunting through my application looking for things to be dismissive about. For example, one project I’d worked on was an internal tool that was building up a backlog of feature requests. I’d looked at the project and figured out that the root problem was that it had outgrown the key-value store it had been built on, and needed a proper database. I argued for switching to a relational DB, and I went ahead and implemented it: schema, data migration, queries, the live site migration, etc. The new queries were much faster, and (more importantly) the new features could be supported efficiently. One problem I had to solve before migrating was that most of the code wasn’t covered by tests, and that was because most of the code wasn’t testable. I refactored the code using dependency injection and [other tricks I’ve talked about before][7], and that let me build a regression test suite. I remember that project was mostly dismissed with the comment that writing unit tests is “new-grad-level work”. + +My manager was really supportive and wrote an appeal. He didn’t show it to me, but I think it was several pages that could be reduced down to “WTF” (argued more eloquently and with more detail). Here are some of the reasons I also thought this response was a bit WTF: + +Google SRE has a concept of “point-personship”. The point person for a project has two roles: One is to know the software project to a greater depth than other SREs, so that you can answer questions they might have. The other role is to be the first point of contact for the devs on the project itself, so that they can get answers to all their SRE questions. The Google job ladder guide said that point-personship wasn’t required at the new-grad level, but looked good for promotion. As my application had said, I was point person for three projects. + +My point-personships made it easy to find senior developers who agreed to help support my promotion application. They were all shocked when they found out I was new-grad level. They’d all agreed to support my application assuming I was already at a higher level. + +On my application, I mentioned being a mentor for a group of new-grad interns we had. When I made my application, many of them were being hired as permanent employees. I was senior enough to be their mentor, but firmly not enough to be promoted above their level. + +The response to my manager’s appeal took a completely different tack from the original review. This time I was “strongly exceeding expections for my [new-grad] job level”, but the problem was that they just needed a little bit more time to be sure I could be promoted to new-grad-plus-one. I was told I could keep strongly exceeding expectations for another six months until the next promotion cycle, and maybe I’d get a promotion then. The appeal was over; that was the deal. + +I wrote an email that I was taking another option. Like many tech companies, Google has an employee stock program. You’re given a nominal grant when you start work, and you actually receive real shares at various “vestment” milestones. My next stock vestment was a couple of months away. The day after that, I wouldn’t be working for Google any more. + +### My reasons for quitting + +The decision to quit any job isn’t easy, and one day you might face the same decision. Here are some of the factors that helped me make my choice. ([Some of this thinking I explained in more depth in an older post.][8]) + +If you think about it, given that I wasn’t literally a new grad, Google’s review should have been something like, “You’re doing some things very wrong. You simply won’t get a promotion until you improve at X and Y and Z.” Being told, “You’re strongly exceeding expectations, but we need another six months or so,” didn’t make any sense. No one raised concerns about whether I was capable of doing my job. I was getting a lot of excuses, but not any useful feedback to help me do better. (NB: sometimes you have to explicitly ask for feedback. Managers can fall into the trap of defending the performance ratings they give, instead of thinking about the report’s need for feedback.) + +I also wasn’t sure what the promotion committee might see in six months that they hadn’t already seen in two years. Why wouldn’t they ask for another six months again? If I needed to prove myself for years to get new-grad-plus-one, how old would I be before I got new-grad-plus-two? + +When I first started at Google, my job level was irrelevant because I was learning so much and getting a famous company on my résumé. Two years in, the equation was different. The value of the future that Google was offering me was waning, while the value of opportunities outside Google had gone up. Google job levels mean practically nothing outside Google. In the past five years, plenty of people have asked about what I did at Google, but not a single person has asked me what my Google job level was, or called me a new grad. Although I took a financial hit short term, I effectively got a promotion that day I handed in my badge. + +Credit where it’s due, Google didn’t do anything like this, but it’s common in other companies: trying to make employees feel guilty about asking for pay rises. At a place I worked a few years ago, some engineers asked for a payrise after a highly successful launch following a lot of crunch time. Management played the victim and accused the engineers of “twisting their arms”. (About six months later they lost most of their engineering team.) If you’re genuinely co-operative about the timing of when you might quit (e.g., after a launch date, not the week before) and willing to document your knowledge and clean up after yourself, etc., you’re only twisting your employers’ arms by as much as they’re underpaying you. + +Nominally, I left a large amount of unvested stock behind at Google. But stock isn’t yours until it’s yours. I just had a promise of being paid shares in future, and I could convert it to an equivalent pay rate by dividing it by time required. Working two months for that vestment was worth it. Working years for the remaining vestments wasn’t. Don’t fall for endowment bias. + +When shouldn’t you quit? Well, are you’re getting a good deal compared to what you could get elsewhere? Corporate career paths aren’t mandated by heaven; they’re a series of business offers representing what the company estimates you’ll work for. If you think you’re getting a good deal (considering all compensation and intangibles like the work environment), great! Otherwise, it’s time to think hard about what to do next. + +### After Google + +I should warn you that I took a strategy that was high growth, at the expense of short-term stability. If stability is more important to you, you’ll do things differently. My plan A, plan B and plan C all fell apart, and I ended up spending a few months struggling to find a way. Eventually I got a contract at a small web shop, working on [Safety Town][9], a government road safety website for kids. The pay was a big cut from Google, especially considering it was my first work in months. But, you know, I really enjoyed that project. Sure, it wasn’t “cool” like Google, and maybe some kids at school didn’t think it was cool. On the other hand, at Google I was a tiny part of a huge thing. Safety Town had a small team, with everyone playing a crucial role. For part of the Safety Town project, I was _the_ backend engineer, and Safety Town was the only thing I had to worry about at that time. And, heck, maybe some kids have learned a thing or two about road safety from that website. I’ve done plenty of projects since then, most of them bigger, but I still show people Safety Town. + +![Screenshot of Safety Town home page, owned by Australian NSW government.][10] + +I remember a poster in the Sydney Google office that said, “Shoot for the moon! Even if you miss, you’ll land among the stars!” It’s easy to forget that you can have a quality life even if you’re not doing moonshots for famous companies, or doing moonshots for startups. + +Here’s one trick that helped me get contracts. I’d go to Sydney tech events, stand within view of the job board, and wait until I saw someone writing on it. Suppose they were writing about CSS development for an insurance company project. Even if I weren’t especially interested in CSS or insurance, I’d wander over and say, “Hi, what kind of insurance project is that?” It’s the easiest conversation starter because their head’s full of the project while they’re trying to fit it into a tiny space on the job board. Usually the conversation still wouldn’t lead to a job for me, but occasionally I’d discover something I could help with. Some events don’t have a job board, but the organisers are often glad to offer the microphone to someone for a few minutes. It adds community engagement to their events. + +I got a major break after working on a website for government procurement, just because I learned to not be so clueless about government procurement. It’s hard to say exactly how much that knowledge was worth, but less than a year afterwards I signed a government contract for about 40% more than I would have hoped was possible before. (I don’t do so much government and big enterprise work nowadays, though.) + +After about a year and a half, I had my own one-person company. As I built up a reputation, I gradually got more SRE-like work. Basically, doing dev work was my “in”, then several months later I’d get contacted by someone who needed SRE/DevOps help and remembered me. I actually like both SRE and pure dev work, but supply and demand means SRE work is good business. I can still do programming in my spare time. + +Speaking of which, work/life balance is my favourite thing about my new lifestyle. No one pays me between contracts, but I can make the most of it by learning new things doing side projects. After one long, intense contract, I took a break and did [a month-long backpacking trip exploring rural Japan][11]. It was a trip I’d wanted to do for a long time, but before Google I needed more money, and during Google I needed more time. Being self-employed is far from stress free and isn’t for everyone, but there’s stress that makes you feel dead, and there’s stress that makes you feel more alive. For me, self-employment is the second kind, and I’d say I’ve been less stressed overall in the past five years than I was while at Google. In my case, at least, I can honestly say I don’t regret joining Google when I did, and I don’t regret leaving when I did, either. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/08/04/leaving_google.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://mtlynch.io/why-i-quit-google/ +[2]: https://projecteuler.net +[3]: https://codingcompetitions.withgoogle.com/codejam +[4]: https://theartofmachinery.com/images/leaving_google/mori-tower.jpg +[5]: https://www.kalzumeus.com/2012/01/23/salary-negotiation/ +[6]: https://theartofmachinery.com/2019/03/19/hello_world_marketing.html +[7]: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html +[8]: https://theartofmachinery.com/2018/10/07/payrise_by_switching_jobs.html +[9]: https://www.safetytown.com.au/ +[10]: https://theartofmachinery.com/images/leaving_google/safetytown.png +[11]: https://theartofmachinery.com/2018/03/23/seto_trip_1.html diff --git a/sources/talk/20200806 5 tips for making documentation a priority in open source projects.md b/sources/talk/20200806 5 tips for making documentation a priority in open source projects.md new file mode 100644 index 0000000000..e381ee7276 --- /dev/null +++ b/sources/talk/20200806 5 tips for making documentation a priority in open source projects.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 tips for making documentation a priority in open source projects) +[#]: via: (https://opensource.com/article/20/8/documentation-open-source-projects) +[#]: author: (Ray Paik https://opensource.com/users/rpaik) + +5 tips for making documentation a priority in open source projects +====== +Documentation is as important as code, so make sure you treat it that +way. Here's how. +![Files in a folder][1] + +[Open source software][2] is now mainstream; long gone are the days when open source projects attracted developers alone. Nowadays, users across numerous industries are active consumers of open source software, and you can't expect everyone to know how to use the software just by reading the code. + +Even for developers (including those with plenty of experience in other open source projects), good documentation serves as a valuable onboarding tool when people join a community. People who are interested in contributing to a project often start by working on documentation to get familiar with the project, the community, and the community workflow. + +### Common challenges with documentation in open source + +Although everyone agrees that documentation is important and needs to be done, some of the ways we do it result in poor quality and lack of consistency across different parts of documentation in the project. For example, when developers are too focused on code, they don't start working on documentation until the last minute (e.g., right before the release). And all too often, documentation tasks are done by volunteers, people who have a hard time saying "no." To make things worse, people may forget about the documentation after the release, so they never change or improve it, and the vicious cycle repeats. + +### 5 best practices + +We have been involved in documentation in a number of open source projects at [Linux Foundation Networking][3] and [GitLab][4] over the past few years. Below, we're sharing some things we've learned that we hope will help make documentation a first-class citizen in your open source project. + + 1. **Value contributions to documentation just as much as code contributions:** A lot of the focus in many open source communities tends to be on code. One easy way to make sure documentation contributions are valued by everyone is to give equal credit to documentation and code in your community metrics. It should not matter whether a commit, merge request, or pull request is for code or documentation. In addition, when you do community recognition, include key accomplishments by the people who contribute to documentation. + + 2. **Put documentation and code in the same project repo:** We highly recommend that a project's code and documentation both reside in the same repository. (A good way is to make `/doc` or `/docs` a top-level directory in the repository.) For one, this makes documentation easy for anyone to find. More importantly, your documentation will be on equal footing as code and other project resources when everything is in the same repository. + + 3. **Make documentation a requirement for a merge or release milestone:** If your project has a lengthy release cycle (e.g., three to six months or more), we highly recommend having interim checkpoints for documentation (like this [example][5] from the ONAP community). This ensures documentation work is not put off until right before the release, and instead, everyone works on documentation throughout the release cycle. If it's feasible for your community, you could make documentation a required step for all code contributions that will impact users (see this [example][6] from GitLab). + + 4. **Have a consistent contribution process for code and documentation:** We also recommend having a consistent contribution process and using the same toolchains for code and documentation. As we noted earlier, many new community members start contributing by working on documentation, as you often don't need deep technical knowledge of the software to get started. It's good for new contributors to onboard in the community by getting familiar with the contribution workflow and meeting other community members. If these new contributors later want to get involved in other parts of the project (including code), you want the toolchains and contribution process to be familiar. Otherwise, they will need to go through another onboarding process, which creates an unnecessary hurdle for contributors. If your code and documentation have different contribution processes, you may risk creating an impression that documentation is less than a first-class citizen compared to code. + + 5. **Have well-documented processes for contributing to documentation:** This may seem obvious, but it's easy to neglect. Since documentation is a good entry point for new contributors, you want to lower the barrier to entry as much as possible. Having good documentation on the contribution workflow, how to get started, where to find issues to work on, how to get help, and more will go a long way to helping new contributors feel welcome and get involved in your community. + + + + +### What else? + +Do you have other tips for making documentation a first-class citizen in open source communities? If so, please share them in the comments. + +* * * + +*This article is based on [Ensuring that documentation Is a first-class citizen in open source projects][7] *presented *at Open Source Summit North America in June 2020. * + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/documentation-open-source-projects + +作者:[Ray Paik][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rpaik +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://opensource.com/resources/what-open-source +[3]: https://www.linuxfoundation.org/projects/networking/ +[4]: https://about.gitlab.com/ +[5]: https://wiki.onap.org/display/DW/Guilin+Documentation +[6]: https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#definition-of-done +[7]: https://sched.co/c3SY diff --git a/sources/talk/20200806 You don-t need a computer science degree to work with open source software.md b/sources/talk/20200806 You don-t need a computer science degree to work with open source software.md new file mode 100644 index 0000000000..078b0d10f9 --- /dev/null +++ b/sources/talk/20200806 You don-t need a computer science degree to work with open source software.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (You don't need a computer science degree to work with open source software) +[#]: via: (https://opensource.com/article/20/8/learn-open-source) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +You don't need a computer science degree to work with open source software +====== +Open source makes software knowledge accessible to anyone, so formal +training isn't the only path to a technology career. +![Stack of books for reading][1] + +I am mostly a self-taught programmer. When I was growing up in the late 1970s, our elementary school had a small resource room with an Apple II computer. My brother and I fell into a group of friends that liked computers, and we all helped each other learn the system. + +We showed such promise that our parents bought us an Apple II+ clone called the Franklin ACE 1000. My brother and I taught ourselves how to program in AppleSoft BASIC. Our parents bought us books, and we devoured them. I learned every corner of BASIC by reading about something in the book, then writing a practice program. My favorite pastime was writing simulations and games. + +I stayed with BASIC for a long time. Our next computer was an IBM PC clone with a version of BASIC on it. Much later, MS-DOS 5 introduced QBasic, which was a modern version of BASIC that finally eliminated line numbers. + +I began to learn other programming languages when I entered university. I was a physics student, and as part of our numerical analysis prerequisite, we had to learn Fortran. Having already learned BASIC, I thought Fortran was pretty easy to pick up. Fortran and BASIC were very similar, although Fortran was more limited in my experience. + +My brother was a computer science major at a different university, and he introduced me to the C programming language. I immediately loved working in C! It was a straightforward programming language that gave me a ton of flexibility for writing useful programs. But I didn't have room in my degree program to take a class that didn't apply to my physics major. So, instead, I taught myself C by reading books and combing through the library reference guide. Each time I wanted to learn a new topic, I looked it up in the reference guide and wrote a practice program to exercise my new knowledge. + +My early use of C was writing new utilities to expand MS-DOS. I used Unix on campus, but my computer at home mostly ran MS-DOS. I wanted MS-DOS to have similar enhanced command-line features that Unix offered, so I wrote my own utilities to give me the added functionality. + +I suppose my first tools were pretty simple programming exercises. I used programs like Unix cat or DOS TYPE to display the contents of text files, with extra command-line options to add line numbers, convert tabs to spaces, and the like. Or I'd use a program like Unix clear or DOS CLS to clear the screen, but also set the colors to something other than the usual white-on-black text. And I wrote a few new utilities to help me with my studies, like a program to find common errors in a Fortran source file, a utility to organize files in a directory, a filter to convert nroff files to LaTeX format, and a program to fit a straight line through x and y data points. + +Armed with this limited experience in C programming, I tackled my first big open source project. It turns out you can accomplish a lot if you don't know what you don't know and have a passion for a project. That's how I created the [FreeDOS Project][2] in 1994. + +Since then, I've written, maintained, or otherwise contributed to dozens of open source projects on FreeDOS, Linux, and Big Unix. My first contribution was a fix to GNU Emacs so it would compile correctly on a DomainOS Unix system. I also submitted patches to an early open source C compiler specific to HP-UX, a fun artillery game with cartoony tanks, a utility to organize music on an iPod, and other Unix and Linux programs. On FreeDOS, I wrote much of the underlying code libraries we used at the time, including an implementation of Unix catgets, so FreeDOS programs could support different spoken languages without having to be rewritten. + +Over time, I leveraged what I'd learned to pick up other programming languages. I wrote a ton of Unix Korn shell scripts, Linux Bash scripts, and AWK scripts. I wrote small utilities in Perl, and later wrote Perl CGI and PHP pages for websites. I learned enough LISP to tweak my copy of GNU Emacs, and enough Scheme to work on a project that used GNU Guile. And I continued to write and share open source games, applications, utilities, and tools for Linux and FreeDOS. + +And as I wrote more code, I got better at programming. Even today, I continue to learn new things and reinforce those lessons by [teaching others][3]. I'm always trying new things out. + +And that's my lesson. You don't have to be formally trained in computer science or hold a CS degree to contribute to open source software. Find your passion, and you can figure out the rest on your own. All that matters is that you love doing what you do and that you're willing to share your contribution with others. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/learn-open-source + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_read_list_stack_study.png?itok=GZxb9OAv (Stack of books for reading) +[2]: https://opensource.com/article/17/10/freedos +[3]: https://opensource.com/article/20/7/teaching-c diff --git a/sources/talk/20200807 Meeting for the first time after 26 years of open source collaboration.md b/sources/talk/20200807 Meeting for the first time after 26 years of open source collaboration.md new file mode 100644 index 0000000000..700b4c9db3 --- /dev/null +++ b/sources/talk/20200807 Meeting for the first time after 26 years of open source collaboration.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Meeting for the first time after 26 years of open source collaboration) +[#]: via: (https://opensource.com/article/20/8/meet-open-source-collaborators) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Meeting for the first time after 26 years of open source collaboration +====== +Open source is great because people from anywhere can get involved, but +it can be lonely. Take advantage of the proliferation of video +conferencing tools available to make connections with your fellow +developers. +![Two people chatting via a video conference app][1] + +Collaborating on an open source software project is inherently an online experience. For me, almost all of my interaction has been via email. I'll send someone a patch, and they'll review it and reply to me. Or a user will file a bug, and I'll respond to it via the bug tracker. More commonly, developers in the open source community will discuss ideas via the email list. + +Over the years, I've only interacted on projects electronically, and have only met a few people in person, usually in settings unrelated to the project. Sometimes it's at conferences—we'll recognize each other's names, and realize we're working on the same open source project. I really enjoy those connections, but they're rare. + +In 1994, I created the [FreeDOS Project][2], an open source implementation of the DOS operating system. In the last 26 years, I've met only a handful of folks from that project in person. I met one developer when I attended a work conference in his city, and we got dinner together. Another developer took time out of his vacation tour of the Midwest to visit and have a drink. I crossed paths with another developer at an open source conference. And I spoke with Pat, who wrote our first kernel, on the phone several times, but we never met in person. + +A few weeks ago, I decided to change that dynamic. We live in an era of ubiquitous video conferencing, even more so in the last few months, as many people have shifted to remote work due to the pandemic. Even though open source work happens virtually, independent of geography, we can still build relationships and put names to faces. Zoom, BlueJeans, Google Hangouts, or Jitsi Meet are the new way to connect while maintaining social distance. + +On June 29, 2020, to celebrate the 26th anniversary of FreeDOS, we held our first online get-together. It was an opportunity to finally actually meet the people I'd been working with for the last 20+ years. + +And it was awesome! At our peak, we had over 16 people on the video meeting. I loved getting to see everyone and talk "in-person." We had almost an hour and a half of engaging conversations with folks from all over the world. Thanks to everyone who participated! + +It's meetings like this when I remember open source is more than just writing code; it's about building a community. And while I've always done well with our virtual community that communicates via email, I really appreciated getting to talk to people without the filter of email—making that real-time connection meant a lot to me. + +This virtual meet-up went so well that I'd love to do it again. In fact, I'm planning another virtual get-together later this summer. I'm hoping to focus the conversation on that one, maybe make it a "working session" to nail down some things for the upcoming FreeDOS 1.3 release. Stay tuned for more details! + +![Screenshot of zoom call participants with names and faces blurred][3] + +*Names and faces blurred for privacy + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/meet-open-source-collaborators + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chat_video_conference_talk_team.png?itok=t2_7fEH0 (Two people chatting via a video conference app) +[2]: https://www.freedos.org/ +[3]: https://opensource.com/sites/default/files/uploads/screenshot_from_2020-06-29_09-29-49.jpg (Screenshot of zoom call participants with names and faces blurred) diff --git a/sources/talk/20200807 Microsoft uses AI to boost its reuse, recycling of server parts.md b/sources/talk/20200807 Microsoft uses AI to boost its reuse, recycling of server parts.md new file mode 100644 index 0000000000..87277777ac --- /dev/null +++ b/sources/talk/20200807 Microsoft uses AI to boost its reuse, recycling of server parts.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Microsoft uses AI to boost its reuse, recycling of server parts) +[#]: via: (https://www.networkworld.com/article/3570451/microsoft-uses-ai-to-boost-its-reuse-recycling-of-server-parts.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Microsoft uses AI to boost its reuse, recycling of server parts +====== +Get ready to hear the term 'circular' a lot more in reference to data center gear. +Monsitj / Getty Images + +Microsoft is bringing artificial intelligence to the task of sorting through millions of servers to determine what can be recycled and where. + +The new initiative calls for the building of so-called Circular Centers at Microsoft data centers around the world, where AI algorithms will be used to sort through parts from decommissioned servers or other hardware and figure out which parts can be reused on the campus. + +**READ MORE:** [How to decommission a data center][1] + +Microsoft says it has more than three million servers and related hardware in its data centers, and that a server's average lifespan is about five years. Plus, Microsoft is expanding globally, so its server numbers should increase. + +Circular Centers are all about quickly sorting through the inventory rather than tying up overworked staff. Microsoft plans to increase its reuse of server parts by 90% by 2025. "Using machine learning, we will process servers and hardware that are being decommissioned onsite," wrote Brad Smith, president of Microsoft, in a [blog post][2] announcing the initiative. "We'll sort the pieces that can be reused and repurposed by us, our customers, or sold." + +Smith notes that today there is no consistent data about the quantity, quality and type of waste, where it is generated, and where it goes. Data about construction and demolition waste, for example, is inconsistent and needs a standardized methodology, better transparency and higher quality. + +"Without more accurate data, it's nearly impossible to understand the impact of operational decisions, what goals to set, and how to assess progress, as well as an industry standard for waste footprint methodology," he wrote. + +A Circular Center pilot in an Amsterdam data center reduced downtime and increased the availability of server and network parts for its own reuse and buy-back by suppliers, according to Microsoft. It also reduced the cost of transporting and shipping servers and hardware to processing facilities, which lowered carbon emissions. + +The term "circular economy" is catching on in tech. It's based on recycling of server hardware, putting equipment that is a few years old but still quite usable back in service somewhere else. ITRenew, a reseller of used hyperscaler servers [that I profiled][3] a few months back, is big on the term. + +The first Microsoft Circular Centers will be built at new, major data-center campuses or regions, the company says. It plans to eventually add these centers to campuses that already exist. + +Microsoft has an expressed goal of being "carbon negative" by 2030, and this is just one of several projects. Recently Microsoft announced it had conducted a test at its system developer's lab in Salt Lake City where a 250kW hydrogen fuel cell system powered a row of server racks for 48 hours straight, something the company says has never been done before. + +"It is the largest computer backup power system that we know that is running on hydrogen and it has run the longest continuous test," Mark Monroe, a principal infrastructure engineer, wrote in a Microsoft [blog post][4]. He says hydrogen fuel cells have plummeted so much in recent years that they are now a viable alternative to diesel-powered backup generators but much cleaner burning. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570451/microsoft-uses-ai-to-boost-its-reuse-recycling-of-server-parts.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3439917/how-to-decommission-a-data-center.html +[2]: https://blogs.microsoft.com/blog/2020/08/04/microsoft-direct-operations-products-and-packaging-to-be-zero-waste-by-2030/ +[3]: https://www.networkworld.com/article/3543810/for-sale-used-low-mileage-hyperscaler-servers.html +[4]: https://news.microsoft.com/innovation-stories/hydrogen-datacenters/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200808 Matrix encrypted chat rolls out across Germany, Project ACRN-s new IoT release, and more open source news.md b/sources/talk/20200808 Matrix encrypted chat rolls out across Germany, Project ACRN-s new IoT release, and more open source news.md new file mode 100644 index 0000000000..e63ea493e5 --- /dev/null +++ b/sources/talk/20200808 Matrix encrypted chat rolls out across Germany, Project ACRN-s new IoT release, and more open source news.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Matrix encrypted chat rolls out across Germany, Project ACRN's new IoT release, and more open source news) +[#]: via: (https://opensource.com/article/20/8/news-aug-8) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +Matrix encrypted chat rolls out across Germany, Project ACRN's new IoT release, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![][1] + +In this week’s edition of our open source news roundup, an open source microfluidics pump, Germany rolls out an encrypted messaging platform based on Matrix, and more open source news. + +### A Reddit user shares his open source microfluidics pump + +As COVID-19 limits access to chemistry and biology labs, one open source user made his own solution. Josh Maceachern shared the model in a thread [on Reddit][2], sharing his microfluidics pump for less than $300 in total.  + +According to the creator, the pump runs on only 3D-printed and common components for less than $300 total. An [article by Hackaday][3] adds that the pump delivers up to 15 mL/min with accuracy to 0.1uL/min. That's enough power for users to do their own genetics or biology projects at home. + +Along with the design files for folks to build their own pumps, Maceachern said on Reddit that he's releasing the pump under the CC BY 4.0 license. He gave his blessing for anyone to use it, asking that they attribute him. + +### Germany prepares for the world's largest deployment of Matrix-based open source software  + +When [Dataport][4] rolls out Element collaboration software this fall, they'll deploy it for half a million users in the German states of Schlesweig-Holstein and Hamburg. According to Element in [this article][5], it will be "...the biggest single messaging and collaboration implementation in the world." + +In an era of videoconferencing dominated by big brands, Germany's choice of a fully open source tool is noteworthy. It's also no accident that this deployment will occur in Europe: Element shared [in a blog post][6] that it's devoted to giving users more control over their data, rather than seeing it stored on overseas systems. + +The post also cited "increasingly anti-encryption" sentiment in the U.S. as another reason to offer end-to-end encryption for European users. Element's forthcoming rollout in Germany will allow users to host their own data and messages. Dataport hopes to [deploy Element][7] as a matrix-based solution by September, in time for the start of term in Germany. + +### Project ACRN release Version 2.0 of its IoT hypervisor + +ACRN is an open source hypervisor supported by the Linux Foundation's [Automotive Grade Linux][8]. The project says its lightweight hypervisor supports IoT functions like graphics, imaging, and audio on less than 40k lines of code. After the initial focus on automotive safety, the Linux Foundation's latest release of [Project ACRN][9] is more focused on IoT applications by balancing safety features with more general purpose Virtual Machines (VMs).  + +[The Project's v2.0][10] expands support to Kata containers and OpenStack. It also supports partition mode and sharing mode in tandem. + +In other news: + + * [Open wearables group buttons down on datasets][11] + * [Microsoft joins Open Source Security Foundation][12] + * [Uniting for better open-source security: The Open Source Security Foundation][13] + * [China unveils AI open-source platform 'Dubhe'][14] + * [System76 reveals an open source PC surprise for AMD Ryzen fans][15] + + + +Thanks, as always, to Opensource.com staff members and [Correspondents][16] for their help this week. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/news-aug-8 + +作者:[Lauren Maffeo][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lmaffeo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/weekly_news_roundup_tv.png?itok=tibLvjBd +[2]: https://www.reddit.com/r/functionalprint/comments/hsevpl/opensource_multichannel_microfluidicsosmm_pump/ +[3]: https://hackaday.com/2020/07/29/an-open-source-microfluidic-pump-for-your-science-needs/ +[4]: https://www.dataport.de/who-we-are/ +[5]: https://www.zdnet.com/article/open-source-is-behind-this-massive-messaging-and-collaboration-project-for-500000-people/ +[6]: https://element.io/blog/element-brings-matrix-to-europe/ +[7]: https://www.dataport.de/was-wir-bewegen/portfolio/projekt-phoenix/ +[8]: https://www.automotivelinux.org/ +[9]: https://github.com/projectacrn +[10]: https://projectacrn.github.io/2.0/ +[11]: https://www.computerweekly.com/blog/Open-Source-Insider/Open-wearables-group-buttons-down-on-datasets +[12]: https://www.microsoft.com/security/blog/2020/08/03/microsoft-open-source-security-foundation-founding-member-securing-open-source-software/ +[13]: https://www.zdnet.com/article/uniting-for-better-open-source-security-the-open-source-security-foundation/#ftag=RSSbaffb68 +[14]: https://news.cgtn.com/news/2020-08-03/China-unveils-AI-open-source-platform-Dubhe--SE3UpfEX5e/index.html +[15]: https://www.forbes.com/sites/jasonevangelho/2020/07/26/system76-reveals-an-open-source-surprise-for-amd-ryzen-fans/#4566bf106e4e +[16]: https://opensource.com/correspondent-program diff --git a/sources/talk/20200813 AI system analyzes code similarities, makes progress toward automated coding.md b/sources/talk/20200813 AI system analyzes code similarities, makes progress toward automated coding.md new file mode 100644 index 0000000000..22ea97cfc4 --- /dev/null +++ b/sources/talk/20200813 AI system analyzes code similarities, makes progress toward automated coding.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (AI system analyzes code similarities, makes progress toward automated coding) +[#]: via: (https://www.networkworld.com/article/3570389/ai-system-analyzes-code-similarities-makes-progress-toward-automated-coding.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +AI system analyzes code similarities, makes progress toward automated coding +====== +Researchers from Intel, MIT and Georgia Tech are working on an AI engine that can analyze code similarities to determine what code actually does, setting the stage for automated software writing. +Monsitj / Getty Images + +With the rapid advances in artificial intelligence (AI), are we getting to the point when computers will be smart enough to write their own code and be done with human coders? New research suggests we might be getting closer to that milestone. + +Researchers from MIT and Georgia Tech teamed with Intel to develop an AI engine, dubbed Machine Inferred Code Similarity (MISIM), that's designed to analyze software code and determine how it's similar to other code. What's most interesting is the potential for the system to learn what bits of code do, and then use that intelligence to change how software is written. Ultimately, a human could explain what it wants a software program to do, and then a machine programming (MP) system could come up with a coded app to accomplish it. + +**READ MORE:** [How AI can create self-driving data centers][1] + +"When fully realized, MP will enable everyone to create software by expressing their intention in whatever fashion that's best for them, whether that's code, natural language or something else," said Justin Gottschlich, principal scientist and director/founder of machine programming research at Intel, in the company's [press release][2]. "That's an audacious goal, and while there's much more work to be done, MISIM is a solid step toward it." + +### How it works + +Neural networks give similarity scores to snippets of code "based on the jobs they are designed to carry out," Intel explains. Two code samples may look completely different but be rated the same because they perform the same function, for example. The algorithm can then determine which code snippet is more efficient. + +Primitive versions of code-similarity systems are used in plagiarism detection, for example. With MISIM, however, the algorithm looks at chunks of code and attempts to ascertain contextually whether the snippets have similar characteristics or are aiming for similar objectives. It can then offer improvements in performance, for example, or general efficiency. + +What's critical with MISIM is the intent of the creator, and it marks an advancement towards intent-based programming, which could enable software to be designed based on what a non-programmer creator wants to achieve. With intent-based programming, an algorithm draws on a pool of open source code rather than relying on the traditional, manual method of compiling a series of step-like programming instructions, line-by-line, telling a computer how to do something. + +"A core differentiation between MISIM and existing code-similarity systems lies in its novel context-aware semantic structure (CASS), which aims to lift out what the code actually does. Unlike other existing approaches, CASS can be configured to a specific context, allowing it to capture information that describes the code at a higher level. CASS can provide more specific insight into what the code does rather than how it does it," Intel explains. + +This is accomplished without a compiler (a stage used in programming that converts human-readable code into the computer program). Conveniently, partial snippets can be executed just to see what happens in that piece of code. Plus, the system gets rid of some of the more tedious parts of software development, like line-by-line bug finding. More details are available in the group's paper ([PDF][3]) + +Intel says the team's MISIM system is 40-times more accurate identifying similar code than previous code similarity systems. + +Heres_your_sign, a Redditor [commenting on blog coverage of MISIM][4], amusingly points out that thankfully the computers aren't writing the requirements too. That would be asking for trouble, the Redditor believes. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570389/ai-system-analyzes-code-similarities-makes-progress-toward-automated-coding.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3568354/how-ai-can-create-self-driving-data-centers.html +[2]: https://newsroom.intel.com/news/intel-mit-georgia-tech-machine-programming-code-similarity-system/#gs.d8qd40 +[3]: https://arxiv.org/pdf/2006.05265.pdf +[4]: https://www.reddit.com/r/technology/comments/i2dxed/this_ai_could_bring_us_computers_that_can_write/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200815 What Does Mozilla Firing 25- of its Workforce Tells us About its Future.md b/sources/talk/20200815 What Does Mozilla Firing 25- of its Workforce Tells us About its Future.md new file mode 100644 index 0000000000..064c99cd1f --- /dev/null +++ b/sources/talk/20200815 What Does Mozilla Firing 25- of its Workforce Tells us About its Future.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What Does Mozilla Firing 25% of its Workforce Tells us About its Future) +[#]: via: (https://itsfoss.com/mozilla-struggle/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What Does Mozilla Firing 25% of its Workforce Tells us About its Future +====== + +Mozilla is in news again but not for good reasons. + +[Mozilla has suddenly fired around 250 employees][1], 25% of its workforce. It also closed operations in Taipei, Taiwan. The Taiwanese team was working on Firefox Lite. + +This is not the first layoff from Mozilla this year. At the beginning of the year, [Mozilla had laid off 70 employees][2]. + +So, what’s going on with Mozilla? Whatever it is, it’s certainly not positive. + +Mozilla has fired entire (or most of) teams working on [DevTools][3], [MDN][4], developer relation, [Servo][5] (browser engine written in Rust) and incident threat management. + +Why did it do that? What lies ahead for Mozilla? Here’s my opinion on the Mozilla crisis. + +### The gradual decline of Mozilla: Ignoring its flagship Firefox browser project + +Mozilla Firefox once had a good user base. It was seen as a superior browser and it looked like it would dethrone Internet Explorer as the most popular web browser. + +That would have happened if it was not for Google Chrome. The tech giant Google and its ‘thinking ahead’ leadership launched Google Chrome in 2008. + +Their aim was to get more and more people to use their search engine. How does a user access search engine? Through a web browser. + +So, instead of being dependent on other web browsers, Google created its own browser and integrated its products with this new browser. Google hired several Mozilla engineers to work on its browser. The current Google CEO, Sundar Pichai, led the team developing the Chrome browser. + +But Google didn’t just stop after creating Chrome in 2008. Google with all its technical might and intelligence, kept on improving the Chrome browser. + +Soon Google Chrome overtook Firefox and later Internet Explorer to become the most popular web browser. + +> The rise and fall of [#opensource][6] web browser Mozilla Firefox. [pic.twitter.com/Co5Xj3dKIQ][7] +> +> — Abhishek Prakash (@abhishek_foss) [March 22, 2017][8] + +But what happened to Mozilla Firefox? It is my opinion that Mozilla lost focus on the Firefox browser. They put time and energy in creating [Firefox mobile OS][9], Rust programming language, Hello video chat application and more. + +It’s not that it didn’t add new features to it, it’s just that Firefox started losing charm. + +Chrome had a faster experience while Firefox felt sluggish and heavy. Google’s evil practice of [deliberately slowing down Google products like YouTube on Firefox][10] also made users dump Firefox. + +Whatever it is. The truth is that Google Chrome is a superior product otherwise people won’t go installing it on their own. Microsoft couldn’t keep Windows users on Internet Explorer/Edge after all. + +### Google holds Mozilla by its neck and can squeeze it at will + +![][11] + +If you didn’t know, Mozilla relies heavily on Google with around 90% of its revenue coming from Google. [Google pays Mozilla a few hundred million US dollars each year][12] to be the default search engine on Firefox. + +The deal was helpful to Google when Firefox had good user base. With Google Chrome’s advent, Firefox has seen steep decline and it now stands at the third position with hardly 8% of the market share. Google Chrome dominates the market. + +Google doesn’t need Firefox’s help to get traffic to its search engine but Mozilla does need Google’s money to stay alive. + +A day after the layoffs, [Google extended the Firefox search deal with Mozilla][13]. Had Google not renewed its deal with Mozilla, it would have been real difficult for Mozilla to go beyond 2020. + +### Mozilla’s renewed focus on products that could make it money + +Mozilla Foundation is a not-for-profit organization but it also has taxable subsidiary in the form of Mozilla Corporation. Firefox browser is developed under Mozilla Foundation. The profit earned by the Mozilla Corporation is reinvested into Mozilla projects. + +Lately, Mozilla is trying hard to create new revenue channels to end its reliance on Google. Its [acquisition of Pocket app][14] and the launch of [Mozilla VPN][15] is part of this strategy. + +The recent layoffs are also part of Mozilla’s new strategy to focus on profitable products and reducing the workforce aimed at reducing the expense. + +But amidst all this, Mozilla must not ignore Firefox. People need a functioning browser and Mozilla should work on improving user experience. If the users have trouble [running Netflix][16] or YouTube or using other streaming services in this age, they will definitely switch. + +Not only it is the flagship project from Mozilla, it is also the biggest hope for people who don’t want Google. Microsoft’s Edge, Opera, Vivaldi, Brave and most of the other popular browsers have switched to Google’s Chromium project. Firefox is one of the rare browsers that doesn’t rely on Chromium. + +I hope that Mozilla rises from the ashes like a Phoenix. + +Those were my views on the Mozilla situation. I welcome yours in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mozilla-struggle/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://thenextweb.com/insights/2020/08/11/mozilla-firefox-layoffs-250-employees/ +[2]: https://www.bizjournals.com/sanjose/c/mountain-view-based-mozilla-laysoff-around-70.html +[3]: https://developer.mozilla.org/en-US/docs/Tools +[4]: https://developer.mozilla.org/en-US/ +[5]: https://servo.org/ +[6]: https://twitter.com/hashtag/opensource?src=hash&ref_src=twsrc%5Etfw +[7]: https://t.co/Co5Xj3dKIQ +[8]: https://twitter.com/abhishek_foss/status/844666818665025537?ref_src=twsrc%5Etfw +[9]: https://en.wikipedia.org/wiki/Firefox_OS +[10]: https://fortune.com/2018/07/25/youtube-slow-mozilla-firefox-chrome/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/mozilla-struggle.jpg?resize=800%2C450&ssl=1 +[12]: https://www.zdnet.com/article/firefox-hits-the-jackpot-with-almost-billion-dollar-google-deal/ +[13]: https://www.theregister.com/2020/08/14/mozilla_google_search/ +[14]: https://blog.mozilla.org/blog/2017/02/27/mozilla-acquires-pocket/ +[15]: https://vpn.mozilla.org/ +[16]: https://itsfoss.com/netflix-firefox-linux/ diff --git a/sources/talk/20200817 What makes Java open source.md b/sources/talk/20200817 What makes Java open source.md new file mode 100644 index 0000000000..4a1d0a6b5a --- /dev/null +++ b/sources/talk/20200817 What makes Java open source.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What makes Java open source?) +[#]: via: (https://opensource.com/article/20/8/open-source-java) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +What makes Java open source? +====== +Clearing up the confusion about developing in Java while staying in the +open source ecosystem. +![Coffee beans][1] + +If you're using [Java][2] to write business applications, you may know that Java Standard Edition (SE) is not open source software. It is not managed by a foundation, like Python or JavaScript, and in January 2019, Oracle changed its policy to require a commercial license for any use of SE, from the developer's local environment to production. + +This change also raised a lot of questions in open source communities about licensing compliance and Java usage. If you're still confused, this article will guide you through how these changes apply to Java developers. + +### Evolving platforms in the Java community + +[OpenJDK][3] (Open Java Development Kit) is a free and open source implementation of Java SE. It is an alternative that allows more than 70% of Java developers to continue stabilizing their Java application environments while remaining within the open source ecosystem. OpenJDK is primarily licensed under the [GNU GPLv2][4]. The freedoms guaranteed by this distribution strategy have made OpenJDK the default choice for Java developers to build desktop applications that are compatible with Java SE. + +Oracle continued developing and maintaining Enterprise Java (Java EE), which is built on the Java SE platform. Java EE includes additional features outside SE's scope to support large-scale, scalable, multi-tier, and secured applications for a variety of enterprise environments. In September 2017, the Java EE platform was transferred to the [Eclipse Foundation][5], leading to the adoption of more agile processes, changing the governance process, and implementing more flexible licensing. One year later, in 2018, the Eclipse Foundation announced a new brand name, [Jakarta EE][6], with a new logo and working groups to support developers transitioning from Java EE to the new platform. The evolution from Java EE to Jakarta EE also impacted many enterprise Java developers in implementing new business logic. + +### Evolving frameworks as Java evolved + +In the meantime, new technologies, such as RESTful APIs (2000), HTTP 2 (2015), and JSON (2017), were being developed alongside fast-changing web architectures. Interest in microservices architectures was growing, but because Java EE was in transition, it did not pick up on these new paradigms as they happened. + +In response, the broader Java community and several vendors (IBM, Red Hat, and Tomitribe) created [MicroProfile][7] in 2016 to optimize the Enterprise Java platform for microservices architectures. MicroProfile [later joined the Eclipse Foundation][8], giving enterprise Java developers two options for implementing microservice architectures: SpringBoot or MicroProfile. MicroProfile allows developers to create portable Java-based microservices across vendor solutions while ensuring compatibility between matching Java/Jakarta EE and MicroProfile APIs in the same application. + +If you are interested in Enterprise Java development, [MicroProfile Starter][9] is a great resource to explore microservices in practice. MicroProfile Starter's graphical user interface requires a few details to generate code to create a monolithic Java application server. + +A MicroProfile runtime supports deploying an application artifact (e.g., a JAR or WAR file) and executing it as a Java application server with a MicroProfile specification. You can choose the cloud-native runtime you prefer (e.g., [Quarkus][10]) from MicroProfle Starter's runtime list, then select specifications to gain additional enterprise features, such as fault tolerance, OpenAPI, OpenTracing, and more. Once you've completed these steps, click on "Download" to begin developing your application. + +![MicroProfile Starter GUI][11] + +(Daniel Oh, [CC BY-SA 4.0][12]) + +### Conclusion + +Navigating Java from an open source perspective can be a bit confusing given the language's long history, acquisitions, and relicenses. Sticking with OpenJDK and Jakarta EE allows Java developers to maintain standard enterprise applications without compromising open source freedoms. If you want to dive in further, take a look at MicroProfile or delve deeper into runtimes by exploring Quarkus. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/open-source-java + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://opensource.com/resources/java +[3]: https://openjdk.java.net/ +[4]: https://openjdk.java.net/legal/gplv2+ce.html +[5]: https://www.eclipse.org/org/ +[6]: https://opensource.com/article/18/5/jakarta-ee +[7]: https://microprofile.io/ +[8]: https://opensource.com/article/18/1/eclipse-microprofile +[9]: https://start.microprofile.io/ +[10]: https://quarkus.io/ +[11]: https://opensource.com/sites/default/files/uploads/microprofile.png (MicroProfile Starter GUI) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/sources/talk/20200818 Amazon Braket lets customers try out quantum computing.md b/sources/talk/20200818 Amazon Braket lets customers try out quantum computing.md new file mode 100644 index 0000000000..3ca1ae3fae --- /dev/null +++ b/sources/talk/20200818 Amazon Braket lets customers try out quantum computing.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Amazon Braket lets customers try out quantum computing) +[#]: via: (https://www.networkworld.com/article/3570251/amazon-braket-lets-customers-try-out-quantum-computing.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Amazon Braket lets customers try out quantum computing +====== +AWS joins IBM, Microsoft, Google and others in growing quantum computing arena +[Glosser.ca / Pete Linforth][1] [(CC BY-SA 3.0)][2] + +AWS has announced the availability of a new service that lets customers tap into and experiment with [quantum computing][3] simulators and access quantum hardware from [D-Wave][4], [IonQ][5], and [Rigetti][6]. + +The managed service, [Amazon Braket][7], offers customers a development environment where they can explore and build quantum algorithms, test them on quantum circuit simulators, and run them on different quantum hardware technologies, AWS said in a [statement][7] about the service. The Braket service includes Jupyter notebooks that come pre-installed with the Amazon Braket SDK and example tutorials. + +**Read more: [What is quantum computing? (and why enterprises should care)][3] ** + +According to AWS, Braket provides access to a fully managed, high-performance, quantum circuit simulator that lets users test and validate circuits with a single line of code. In addition, as a native AWS service, Braket can be managed via the AWS management console. (Related: [Amazon joins the quantum computing crowd with Braket testbed][8]) + +The service is named after the standard notation in quantum mechanics bra-ket, which was introduced by Paul Dirac in 1939 to describe the state of quantum systems and is also known as the [Dirac notation][9]. + +"Quantum computing has the potential to solve computational problems that are beyond the reach of classical computers by harnessing the laws of quantum mechanics to process information in new ways," AWS stated. "This approach to computing could transform areas such as chemical engineering, material science, drug discovery, financial portfolio optimization, and machine learning. But defining those problems and programming quantum computers to solve them requires new skills, which are difficult to acquire without easy access to quantum computing hardware." + +In a blog about Braket, Jeff Barr, Chief Evangelist for AWS, said there are a few things customers should keep in mind about Braket: + + * Quantum computing is an emerging field. "Although some of you are already experts, it will take some time for the rest of us to understand the concepts and the technology, and to figure out how to put them to use." + * The [quantum processing units] QPUs accessed through Amazon Braket support two different paradigms. The IonQ and Rigetti QPUs and the simulator support circuit-based quantum computing, and the D-Wave QPU supports quantum annealing. You cannot run a problem designed for one paradigm on a QPU that supports the other one, so you will need to choose the appropriate QPU early. + * Each task will incur a per-task charge and an additional per-shot charge that is specific to the type of QPU used. Use of the simulator incurs an hourly charge, billed by the second, with a 15 second minimum. For more information, check out [Amazon Braket Pricing][10]  + + + +The Amazon Braket rollout follows similar [quantum service][11] introductions from [IBM][12], [Microsoft][13], [QC Ware, ][14]Google, Honeywell and others in what is becoming a growing market. Researchers at [Tractica][15] for example, forecast that total enterprise quantum computing market revenue will reach $9.1 billion annually by 2030, up from $111.6 million in 2018. "The global market for quantum computing is being driven largely by the desire to increase the capability of modeling and simulating complex data, improve the efficiency or optimization of systems or processes, and solve problems with more precision," Tractica stated. + +Gartner has called quantum computing one of the top potential disruptive technologies in the next five years, stating that the parallel execution and exponential scalability of quantum computers means they excel with problems too complex for a traditional approach or where traditional algorithms would take too long to find a solution. Industries such as automotive, financial, insurance, pharmaceuticals, military and research have the most to gain from the advancements in quantum computing. Most organizations should learn about and monitor QC through 2022 and perhaps exploit it from 2023 or 2025, Gartner stated. + +Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570251/amazon-braket-lets-customers-try-out-quantum-computing.html + +作者:[Michael Cooney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/File:Bloch_Sphere.svg +[2]: https://creativecommons.org/licenses/by-sa/3.0/legalcode +[3]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html +[4]: https://aws.amazon.com/braket/hardware-providers/dwave/ +[5]: https://aws.amazon.com/braket/hardware-providers/ionq/ +[6]: https://aws.amazon.com/braket/hardware-providers/rigetti/ +[7]: https://aws.amazon.com/braket/ +[8]: https://www.networkworld.com/article/3487421/amazon-joins-the-quantum-computing-crowd-with-braket-testbed.html +[9]: https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation +[10]: https://aws.amazon.com/braket/pricing +[11]: https://www.networkworld.com/article/3489098/10-hot-quantum-computing-startups-to-watch.html +[12]: https://www.ibm.com/blogs/research/category/quantcomp/ +[13]: https://www.microsoft.com/en-us/quantum/ +[14]: https://qcware.com/ +[15]: https://tractica.omdia.com/newsroom/press-releases/the-quantum-computing-market-is-poised-for-strong-growth-with-global-revenue-to-reach-9-1-billion-by-2030/ +[16]: https://www.facebook.com/NetworkWorld/ +[17]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200818 IBM details next-gen POWER10 processor.md b/sources/talk/20200818 IBM details next-gen POWER10 processor.md new file mode 100644 index 0000000000..5919492347 --- /dev/null +++ b/sources/talk/20200818 IBM details next-gen POWER10 processor.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IBM details next-gen POWER10 processor) +[#]: via: (https://www.networkworld.com/article/3571415/ibm-details-next-gen-power10-processor.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +IBM details next-gen POWER10 processor +====== +New CPU is optimized for enterprise hybrid cloud and AI inferencing, and it features a new technology for creating petabyte-scale memory clusters. +IBM + +IBM on Monday took the wraps off its latest POWER RISC CPU family, optimized for enterprise hybrid-cloud computing and artificial intelligence (AI) inferencing, along with a number of other improvements. + +Power is the last of the Unix processors from the 1990s, when Sun Microsystems, HP, SGI, and IBM all had competing Unixes and RISC processors to go with them. Unix gave way to Linux and RISC gave way to x86, but IBM holds on. + +This is IBM's first 7-nanometer processor, and IBM claims it will deliver an up-to-three-times improvement in capacity and processor energy efficiency within the same power envelope as its POWER9 predecessor. The processor comes in a 15-core design (actually 16-cores but one is not used) and allows for single or dual chip models, so IBM can put two processors in the same form factor. Each core can have up to eight threads, and each socket supports up to 4TB of memory. + +More interesting is a new memory clustering technology called Memory Inception. This form of clustering allows the system to view memory in another physical server as though it were its own. So instead of putting a lot of memory in each box, servers can literally borrow from their neighbors when there is a spike in demand for memory. Or admins can set up one big server with lots of memory in the middle of a cluster and surround it with low-memory servers that can borrow memory as needed from the high capacity server. + +All of this is done with a latency of 50 to 100 nanoseconds. "This has been a holy grail of the industry for a while now," said William Starke, a distinguished engineer with IBM, on a video conference in advance of the announcement. "Instead of putting a lot of memory in each box, when we have a spike demand for memory I can borrow from my neighbors." + +POWER10 uses something called Open Memory Interfaces (OMI), so the server can use DDR4 now and be upgraded to DDR5 when it hits the market, and it can also use GDDR6 memory used in GPUs. In theory, POWER10 will come with 1TB/sec of memory bandwidth and 1TB/sec of SMP of bandwidth. + +The POWER10 processor has quadruple the number of AES encryption engines per core compared to the POWER9. This enables several security enhancements. First, it means full memory encryption without degradation of performance, so no intruder can scan the contents of memory. + +Second, it enables hardware and software security for containers to provide isolation. This is designed to address new security considerations associated with the higher density of containers. If a container were to be compromised, the POWER10 processor is designed to be able to prevent other containers in the same virtual machine from being affected by the same intrusion. + +Finally, the POWER10 offers in-core AI business inferencing. It achieves this through on-chip support for bfloat16 for training as well as INT8 and INT4, which are commonly used in AI inferencing. This will allow transactional workloads to add AI inferencing in their apps. IBM says the AI inferencing in POWER10 is 20 times that of POWER9. + +Not mentioned in the announcement is operating system support. POWER runs AIX, IBM's flavor of Unix, as well as Linux. That's not too surprising since the news is coming at Hot Chips, the annual semiconductor conference held every year at Stanford University. Hot Chips is focused on the latest chip advances, so software is usually left out. + +IBM generally announces new POWER processors about a year in advance of release, so there is plenty of time for an AIX update. + +Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3571415/ibm-details-next-gen-power10-processor.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20151127 Research log- gene signatures and connectivity map.md b/sources/tech/20151127 Research log- gene signatures and connectivity map.md new file mode 100644 index 0000000000..f4e7faa4bc --- /dev/null +++ b/sources/tech/20151127 Research log- gene signatures and connectivity map.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Research log: gene signatures and connectivity map) +[#]: via: (https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Research log: gene signatures and connectivity map +====== + +Happy Thanksgiving everyone! + +### Context + +This is the third post in my continuing series on my attempts at research. Previously we talked about: + + * [what I’m doing, cell states, and microarrays][1] + * and then [more about microarrays and R][2]. + + + +By the end of last week we had discussed how to get a table of normalized gene expression intensities that looks like this: + +``` +ENSG00000280099_at 0.15484421 +ENSG00000280109_at 0.16881395 +ENSG00000280178_at -0.19621641 +ENSG00000280316_at 0.08622216 +ENSG00000280401_at 0.15966256 +ENSG00000281205_at -0.02085352 +... +``` + +The reason for doing this is to figure out which genes are related, and perhaps more importantly, what a cell is even doing. + +_Summary:_ new post, also, I’m bringing back the short section summaries. + +### Cell lines + +The first thing to do when trying to figure out what cells are doing is to choose a cell. There’s all sorts of cells. Healthy brain cells, cancerous blood cells, bruised skin cells, etc. + +For any experiment, you’ll need a control to eliminate noise and apply statistical tests for validity. If you don’t use a control, the effect you’re seeing may not even exist, and so for any experiment with cells, you will need a control cell. + +Cells often divide, which means that a cell, once chosen, will duplicate itself for you in the presence of the appropriate resources. Not all cells divide ad nauseam which provides some challenges, but many cells under study luckily do. + +So, a _cell line_ is simply a set of cells that have all replicated from a specific chosen initial cell. Any set of cells from a cell line will be as identical as possible (unless you screwed up! geez). They will be the same type of cell with the same traits and behaviors, at least, as much as possible. + +_Summary:_ a cell line is a large amount of cells that are as close to being the same as possible. + +### Perturbagens + +There are many things that might affect what a cell is doing. Drugs, agitation, temperature, disease, cancer, gene splicing, small molecules (maybe you give a cell more iron or calcium or something), hormones, light, Jello, ennui, etc. Given any particular cell line, giving a cell from that cell line one of these _perturbagens_, or, perturbing the cell in a specific way, when compared to a control will say what that cell does differently in the face of that perturbagen. + +If you’d like to find out what exactly a certain type of cell does when you give it lemon lime soda, then you choose the right cell line, leave out some control cells and give the rest of the cells soda. + +Then, you measure gene expression intensities for both the control cells and the perturbed cells. The _differential expression_ of genes between the perturbed cells and the controls cells is likely due to the introduction of the lemon lime soda. + +Genes that end up getting expressed _more_ in the presence of the soda are considered _up-regulated_, whereas genes that end up getting expressed _less_ are considered _down-regulated_. The degree to which a gene is up or down regulated constitutes how much of an effect the soda may have had on that gene. + +Of course, all of this has such a significant amount of experimental noise that you could find pretty much anything. You’ll need to replicate your experiment independently a few times before you publish that lemon lime soda causes increased expression in the [Sonic hedgehog gene][3]. + +_Summary:_ A perturbagen is something you introduce/do to a cell to change its behavior, such as drugs or throwing it at a wall or something. The wall perturbagen. + +### Gene signature + +For a given change or perturbagen to a cell, we now have enough to compute lists of up-regulated and down-regulated genes and the magnitude change in expression for each gene. + +This gene expression pattern for some subset of important genes (perhaps the most changed in expression) is called a _gene signature_, and gene signatures are very useful. By comparing signatures, you can: + + * identify or compare cell states + * find sets of positively or negatively correlated genes + * find similar disease signatures + * find similar drug signatures + * find drug signatures that might counteract opposite disease signatures. + + + +(That last bullet point is essentially where I’m headed with my research.) + +_Summary:_ a gene signature is a short summary of the most important gene expression differences a perturbagen causes in a cell. + +### Drugs! + +The pharmaceutical industry is constantly on the lookout for new breakthrough drugs that might represent huge windfalls in cash, and drugs don’t always work as planned. Many drugs spend years in research and development, only to ultimately find poor efficacy or adoption. Sometimes drugs even become known [much more for their side-effects than their originally intended therapy][4]. + +The practical upshot is that there’s countless FDA-approved drugs that represent decades of work that are simply underused or even unused entirely. These drugs have already cleared many challenging regulatory hurdles, but are simply and quite literally cures looking for a disease. + +If even just one of these drugs can be given a new lease on life for some yet-to-be-cured disease, then perhaps we can give some people new leases on life! + +_Summary:_ instead of developing new drugs, there’s already lots of drugs that aren’t being used. Maybe we can find matching diseases! + +### The Connectivity Map project + +The [Broad Institute’s Connectivity Map project][5] isn’t particularly new anymore, but it represents a ground breaking and promising idea - we can dump a bunch of signatures into a database and construct all sorts of new hypotheses we might not even have thought to check before. + +To prove out the usefulness of this idea, the Connectivity Map (or cmap) project chose 5 different cell lines (all cancer cells, which are easy to get to replicate!) and a library of FDA approved drugs, and then gave some cells these drugs. + +They then constructed a database of all of the signatures they computed for each possible perturbagen they measured. Finally, they constructed a web interface where a user can upload a gene signature and get a result list back of all of the signatures they collected, ordered by the most to least similar. You can totally go sign up and [try it out][5]. + +This simple tool is surprisingly powerful. It allows you to find similar drugs to a drug you know, but it also allows you to find drugs that might counteract a disease you’ve created a signature for. + +Ultimately, the project led to [a number of successful applications][6]. So useful was it that the Broad Institute has doubled down and created the much larger and more comprehensive [LINCS Project][7] that targets an order of magnitude more cell lines (77) and more perturbagens (42,532, compared to cmap’s 6100). You can sign up and use that one too! + +_Summary_: building a system that supports querying signature connections has already proved to be super useful. + +### Whew + +Alright, I wrote most of this on a plane yesterday but since I should now be spending time with family I’m going to cut it short here. + +Stay tuned for next week! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map + +作者:[jtolio.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[2]: https://www.jtolio.com/writing/2015/11/research-log-r-and-more-microarrays/ +[3]: https://en.wikipedia.org/wiki/Sonic_hedgehog +[4]: https://en.wikipedia.org/wiki/Sildenafil#History +[5]: https://www.broadinstitute.org/cmap/ +[6]: https://www.broadinstitute.org/cmap/publications.jsp +[7]: http://www.lincscloud.org/ diff --git a/sources/tech/20160302 Go channels are bad and you should feel bad.md b/sources/tech/20160302 Go channels are bad and you should feel bad.md new file mode 100644 index 0000000000..0ad2a5ed97 --- /dev/null +++ b/sources/tech/20160302 Go channels are bad and you should feel bad.md @@ -0,0 +1,443 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go channels are bad and you should feel bad) +[#]: via: (https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Go channels are bad and you should feel bad +====== + +_Update: If you’re coming to this blog post from a compendium titled “Go is not good,” I want to make it clear that I am ashamed to be on such a list. Go is absolutely the least worst programming language I’ve ever used. At the time I wrote this, I wanted to curb a trend I was seeing, namely, overuse of one of the more warty parts of Go. I still think channels could be much better, but overall, Go is wonderful. It’s like if your favorite toolbox had [this][1] in it; the tool can have uses (even if it could have had more uses), and it can still be your favorite toolbox!_ + +_Update 2: I would be remiss if I didn’t point out this excellent survey of real issues: [Understanding Real-World Concurrency Bugs In Go][2]. A significant finding of this survey is that… Go channels cause lots of bugs._ + +I’ve been using Google’s [Go programming language][3] on and off since mid-to-late 2010, and I’ve had legitimate product code written in Go for [Space Monkey][4] since January 2012 (before Go 1.0!). My initial experience with Go was back when I was researching Hoare’s [Communicating Sequential Processes][5] model of concurrency and the [π-calculus][6] under [Matt Might][7]’s [UCombinator research group][8] as part of my ([now redirected][9]) PhD work to better enable multicore development. Go was announced right then (how serendipitous!) and I immediately started kicking tires. + +It quickly became a core part of Space Monkey development. Our production systems at Space Monkey currently account for over 425k lines of pure Go (_not_ counting all of our vendored libraries, which would make it just shy of 1.5 million lines), so not the most Go you’ll ever see, but for the relatively young language we’re heavy users. We’ve [written about our Go usage][10] before. We’ve open-sourced some fairly heavily used libraries; many people seem to be fans of our [OpenSSL bindings][11] (which are faster than [crypto/tls][12], but please keep openssl itself up-to-date!), our [error handling library][13], [logging library][14], and [metric collection library/zipkin client][15]. We use Go, we love Go, we think it’s the least bad programming language for our needs we’ve used so far. + +Although I don’t think I can talk myself out of mentioning my widely avoided [goroutine-local-storage library][16] here either (which even though it’s a hack that you shouldn’t use, it’s a beautiful hack), hopefully my other experience will suffice as valid credentials that I kind of know what I’m talking about before I explain my deliberately inflamatory post title. + +![][17] + +### Wait, what? + +If you ask the proverbial programmer on the street what’s so special about Go, she’ll most likely tell you that Go is most known for channels and goroutines. Go’s theoretical underpinnings are heavily based in Hoare’s CSP model, which is itself incredibly fascinating and interesting and I firmly believe has much more to yield than we’ve appropriated so far. + +CSP (and the π-calculus) both use communication as the core synchronization primitive, so it makes sense Go would have channels. Rob Pike has been fascinated with CSP (with good reason) for a [considerable][18] [while][19] [now][20]. + +But from a pragmatic perspective (which Go prides itself on), Go got channels wrong. Channels as implemented are pretty much a solid anti-pattern in my book at this point. Why? Dear reader, let me count the ways. + +#### You probably won’t end up using just channels. + +Hoare’s Communicating Sequential Processes is a computational model where essentially the only synchronization primitive is sending or receiving on a channel. As soon as you use a mutex, semaphore, or condition variable, bam, you’re no longer in pure CSP land. Go programmers often tout this model and philosophy through the chanting of the [cached thought][21] “[share memory by communicating][22].” + +So let’s try and write a small program using just CSP in Go! Let’s make a high score receiver. All we will do is keep track of the largest high score value we’ve seen. That’s it. + +First, we’ll make a `Game` struct. + +``` +type Game struct { + bestScore int + scores chan int +} +``` + +`bestScore` isn’t going to be protected by a mutex! That’s fine, because we’ll simply have one goroutine manage its state and receive new scores over a channel. + +``` +func (g *Game) run() { + for score := range g.scores { + if g.bestScore < score { + g.bestScore = score + } + } +} +``` + +Okay, now we’ll make a helpful constructor to start a game. + +``` +func NewGame() (g *Game) { + g = &Game{ + bestScore: 0, + scores: make(chan int), + } + go g.run() + return g +} +``` + +Next, let’s assume someone has given us a `Player` that can return scores. It might also return an error, cause hey maybe the incoming TCP stream can die or something, or the player quits. + +``` +type Player interface { + NextScore() (score int, err error) +} +``` + +To handle the player, we’ll assume all errors are fatal and pass received scores down the channel. + +``` +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +Yay! Okay, we have a `Game` type that can keep track of the highest score a `Player` receives in a thread-safe way. + +You wrap up your development and you’re on your way to having customers. You make this game server public and you’re incredibly successful! Lots of games are being created with your game server. + +Soon, you discover people sometimes leave your game. Lots of games no longer have any players playing, but nothing stopped the game loop. You are getting overwhelmed by dead `(*Game).run` goroutines. + +**Challenge:** fix the goroutine leak above without mutexes or panics. For real, scroll up to the above code and come up with a plan for fixing this problem using just channels. + +I’ll wait. + +For what it’s worth, it totally can be done with channels only, but observe the simplicity of the following solution which doesn’t even have this problem: + +``` +type Game struct { + mtx sync.Mutex + bestScore int +} + +func NewGame() *Game { + return &Game{} +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.mtx.Lock() + if g.bestScore < score { + g.bestScore = score + } + g.mtx.Unlock() + } +} +``` + +Which one would you rather work on? Don’t be deceived into thinking that the channel solution somehow makes this more readable and understandable in more complex cases. Teardown is very hard. This sort of teardown is just a piece of cake with a mutex, but the hardest thing to work out with Go-specific channels only. Also, if anyone replies that channels sending channels is easier to reason about here it will cause me an immediate head-to-desk motion. + +Importantly, this particular case might actually be _easily_ solved _with channels_ with some runtime assistance Go doesn’t provide! Unfortunately, as it stands, there are simply a surprising amount of problems that are solved better with traditional synchronization primitives than with Go’s version of CSP. We’ll talk about what Go could have done to make this case easier later. + +**Exercise:** Still skeptical? Try making both solutions above (channel-only vs. mutex-only) stop asking for scores from `Players` once `bestScore` is 100 or greater. Go ahead and open your text editor. This is a small, toy problem. + +The summary here is that you will be using traditional synchronization primitives in addition to channels if you want to do anything real. + +#### Channels are slower than implementing it yourself + +One of the things I assumed about Go being so heavily based in CSP theory is that there should be some pretty killer scheduler optimizations the runtime can make with channels. Perhaps channels aren’t always the most straightforward primitive, but surely they’re efficient and fast, right? + +![][23] + +As [Dustin Hiatt][24] points out on [Tyler Treat’s post about Go][25], + +> Behind the scenes, channels are using locks to serialize access and provide threadsafety. So by using channels to synchronize access to memory, you are, in fact, using locks; locks wrapped in a threadsafe queue. So how do Go’s fancy locks compare to just using mutex’s from their standard library `sync` package? The following numbers were obtained by using Go’s builtin benchmarking functionality to serially call Put on a single set of their respective types. + +``` +> BenchmarkSimpleSet-8 3000000 391 ns/op +> BenchmarkSimpleChannelSet-8 1000000 1699 ns/o +> +``` + +It’s a similar story with unbuffered channels, or even the same test under contention instead of run serially. + +Perhaps the Go scheduler will improve, but in the meantime, good old mutexes and condition variables are very good, efficient, and fast. If you want performance, you use the tried and true methods. + +#### Channels don’t compose well with other concurrency primitives + +Alright, so hopefully I have convinced you that you’ll at least be interacting with primitives besides channels sometimes. The standard library certainly seems to prefer traditional synchronization primitives over channels. + +Well guess what, it’s actually somewhat challenging to use channels alongside mutexes and condition variables correctly! + +One of the interesting things about channels that makes a lot of sense coming from CSP is that channel sends are synchronous. A channel send and channel receive are intended to be synchronization barriers, and the send and receive should happen at the same virtual time. That’s wonderful if you’re in well-executed CSP-land. + +![][26] + +Pragmatically, Go channels also come in a buffered variety. You can allocate a fixed amount of space to account for possible buffering so that sends and receives are disparate events, but the buffer size is capped. Go doesn’t provide a way to have arbitrarily sized buffers - you have to allocate the buffer size in advance. _This is fine_, I’ve seen people argue on the mailing list, _because memory is bounded anyway._ + +Wat. + +This is a bad answer. There’s all sorts of reasons to use an arbitrarily buffered channel. If we knew everything up front, why even have `malloc`? + +Not having arbitrarily buffered channels means that a naive send on _any_ channel could block at any time. You want to send on a channel and update some other bookkeeping under a mutex? Careful! Your channel send might block! + +``` +// ... +s.mtx.Lock() +// ... +s.ch <- val // might block! +s.mtx.Unlock() +// ... +``` + +This is a recipe for dining philosopher dinner fights. If you take a lock, you should quickly update state and release it and not do anything blocking under the lock if possible. + +There is a way to do a non-blocking send on a channel in Go, but it’s not the default behavior. Assume we have a channel `ch := make(chan int)` and we want to send the value `1` on it without blocking. Here is the minimum amount of typing you have to do to send without blocking: + +``` +select { +case ch <- 1: // it sent +default: // it didn't +} +``` + +This isn’t what naturally leaps to mind for beginning Go programmers. + +The summary is that because many operations on channels block, it takes careful reasoning about philosophers and their dining to successfully use channel operations alongside and under mutex protection, without causing deadlocks. + +#### Callbacks are strictly more powerful and don’t require unnecessary goroutines. + +![][27] + +Whenever an API uses a channel, or whenever I point out that a channel makes something hard, someone invariably points out that I should just spin up a goroutine to read off the channel and make whatever translation or fix I need as it reads of the channel. + +Um, no. What if my code is in a hotpath? There’s very few instances that require a channel, and if your API could have been designed with mutexes, semaphores, and callbacks and no additional goroutines (because all event edges are triggered by API events), then using a channel forces me to add another stack of memory allocation to my resource usage. Goroutines are much lighter weight than threads, yes, but lighter weight doesn’t mean the lightest weight possible. + +As I’ve formerly [argued in the comments on an article about using channels][28] (lol the internet), your API can _always_ be more general, _always_ more flexible, and take drastically less resources if you use callbacks instead of channels. “Always” is a scary word, but I mean it here. There’s proof-level stuff going on. + +If someone provides a callback-based API to you and you need a channel, you can provide a callback that sends on a channel with little overhead and full flexibility. + +If, on the other hand, someone provides a channel-based API to you and you need a callback, you have to spin up a goroutine to read off the channel _and_ you have to hope that no one tries to send more on the channel when you’re done reading so you cause blocked goroutine leaks. + +For a super simple real-world example, check out the [context interface][29] (which incidentally is an incredibly useful package and what you should be using instead of [goroutine-local storage][16]): + +``` +type Context interface { + ... + // Done returns a channel that closes when this work unit should be canceled. + Done() <-chan struct{} + + // Err returns a non-nil error when the Done channel is closed + Err() error + ... +} +``` + +Imagine all you want to do is log the corresponding error when the `Done()` channel fires. What do you have to do? If you don’t have a good place you’re already selecting on a channel, you have to spin up a goroutine to deal with it: + +``` +go func() { + <-ctx.Done() + logger.Errorf("canceled: %v", ctx.Err()) +}() +``` + +What if `ctx` gets garbage collected without closing the channel `Done()` returned? Whoops! Just leaked a goroutine! + +Now imagine we changed `Done`’s signature: + +``` +// Done calls cb when this work unit should be canceled. +Done(cb func()) +``` + +First off, logging is so easy now. Check it out: `ctx.Done(func() { log.Errorf("canceled: %v", ctx.Err()) })`. But lets say you really do need some select behavior. You can just call it like this: + +``` +ch := make(chan struct{}) +ctx.Done(func() { close(ch) }) +``` + +Voila! No expressiveness lost by using a callback instead. `ch` works like the channel `Done()` used to return, and in the logging case we didn’t need to spin up a whole new stack. I got to keep my stack traces (if our log package is inclined to use them); I got to avoid another stack allocation and another goroutine to give to the scheduler. + +Next time you use a channel, ask yourself if there’s some goroutines you could eliminate if you used mutexes and condition variables instead. If the answer is yes, your code will be more efficient if you change it. And if you’re trying to use channels just to be able to use the `range` keyword over a collection, I’m going to have to ask you to put your keyboard away or just go back to writing Python books. + +![more like Zooey De-channel, amirite][30] + +#### The channel API is inconsistent and just cray-cray + +Closing or sending on a closed channel panics! Why? If you want to close a channel, you need to either synchronize its closed state externally (with mutexes and so forth that don’t compose well!) so that other writers don’t write to or close a closed channel, or just charge forward and close or write to closed channels and expect you’ll have to recover any raised panics. + +This is such bizarre behavior. Almost every other operation in Go has a way to avoid a panic (type assertions have the `, ok =` pattern, for example), but with channels you just get to deal with it. + +Okay, so when a send will fail, channels panic. I guess that makes some kind of sense. But unlike almost everything else with nil values, sending to a nil channel won’t panic. Instead, it will block forever! That’s pretty counter-intuitive. That might be useful behavior, just like having a can-opener attached to your weed-whacker might be useful (and found in Skymall), but it’s certainly unexpected. Unlike interacting with nil maps (which do implicit pointer dereferences), nil interfaces (implicit pointer dereferences), unchecked type assertions, and all sorts of other things, nil channels exhibit actual channel behavior, as if a brand new channel was just instantiated for this operation. + +Receives are slightly nicer. What happens when you receive on a closed channel? Well, that works - you get a zero value. Okay that makes sense I guess. Bonus! Receives allow you to do a `, ok =`-style check if the channel was open when you received your value. Thank heavens we get `, ok =` here. + +But what happens if you receive from a nil channel? _Also blocks forever!_ Yay! Don’t try and use the fact that your channel is nil to keep track of if you closed it! + +### What are channels good for? + +Of course channels are good for some things (they are a generic container after all), and there are certain things you can only do with them (`select`). + +#### They are another special-cased generic datastructure + +Go programmers are so used to arguments about generics that I can feel the PTSD coming on just by bringing up the word. I’m not here to talk about it so wipe the sweat off your brow and let’s keep moving. + +Whatever your opinion of generics is, Go’s maps, slices, and channels are data structures that support generic element types, because they’ve been special-cased into the language. + +In a language that doesn’t allow you to write your own generic containers, _anything_ that allows you to better manage collections of things is valuable. Here, channels are a thread-safe datastructure that supports arbitrary value types. + +So that’s useful! That can save some boilerplate I suppose. + +I’m having trouble counting this as a win for channels. + +#### Select + +The main thing you can do with channels is the `select` statement. Here you can wait on a fixed number of inputs for events. It’s kind of like epoll, but you have to know upfront how many sockets you’re going to be waiting on. + +This is truly a useful language feature. Channels would be a complete wash if not for `select`. But holy smokes, let me tell you about the first time you decide you might need to select on multiple things but you don’t know how many and you have to use `reflect.Select`. + +### How could channels be better? + +It’s really tough to say what the most tactical thing the Go language team could do for Go 2.0 is (the Go 1.0 compatibility guarantee is good but hand-tying), but that won’t stop me from making some suggestions. + +#### Select on condition variables! + +We could just obviate the need for channels! This is where I propose we get rid of some sacred cows, but let me ask you this, how great would it be if you could select on any custom synchronization primitive? (A: So great.) If we had that, we wouldn’t need channels at all. + +#### GC could help us? + +In the very first example, we could easily solve the high score server cleanup with channels if we were able to use directionally-typed channel garbage collection to help us clean up. + +![][31] + +As you know, Go has directionally-typed channels. You can have a channel type that only supports reading (`<-chan`) and a channel type that only supports writing (`chan<-`). Great! + +Go also has garbage collection. It’s clear that certain kinds of book keeping are just too onerous and we shouldn’t make the programmer deal with them. We clean up unused memory! Garbage collection is useful and neat. + +So why not help clean up unused or deadlocked channel reads? Instead of having `make(chan Whatever)` return one bidirectional channel, have it return two single-direction channels (`chanReader, chanWriter := make(chan Type)`). + +Let’s reconsider the original example: + +``` +type Game struct { + bestScore int + scores chan<- int +} + +func run(bestScore *int, scores <-chan int) { + // we don't keep a reference to a *Game directly because then we'd be holding + // onto the send side of the channel. + for score := range scores { + if *bestScore < score { + *bestScore = score + } + } +} + +func NewGame() (g *Game) { + // this make(chan) return style is a proposal! + scoreReader, scoreWriter := make(chan int) + g = &Game{ + bestScore: 0, + scores: scoreWriter, + } + go run(&g.bestScore, scoreReader) + return g +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +If garbage collection closed a channel when we could prove no more values are ever coming down it, this solution is completely fixed. Yes yes, the comment in `run` is indicative of the existence of a rather large gun aimed at your foot, but at least the problem is easily solveable now, whereas it really wasn’t before. Furthermore, a smart compiler could probably make appropriate proofs to reduce the damage from said foot-gun. + +#### Other smaller issues + + * **Dup channels?** \- If we could use an equivalent of the `dup` syscall on channels, then we could also solve the multiple producer problem quite easily. Each producer could close their own `dup`-ed channel without ruining the other producers. + * **Fix the channel API!** \- Close isn’t idempotent? Send on closed channel panics with no way to avoid it? Ugh! + * **Arbitrarily buffered channels** \- If we could make buffered channels with no fixed buffer size limit, then we could make channels that don’t block. + + + +### What do we tell people about Go then? + +If you haven’t yet, please go take a look at my current favorite programming post: [What Color is Your Function][32]. Without being about Go specifically, this blog post much more eloquently than I could lays out exactly why goroutines are Go’s best feature (and incidentally one of the ways Go is better than Rust for some applications). + +If you’re still writing code in a programming language that forces keywords like `yield` on you to get high performance, concurrency, or an event-driven model, you are living in the past, whether or not you or anyone else knows it. Go is so far one of the best entrants I’ve seen of languages that implement an M:N threading model that’s not 1:1, and dang that’s powerful. + +So, tell folks about goroutines. + +If I had to pick one other leading feature of Go, it’s interfaces. Statically-typed [duck typing][33] makes extending and working with your own or someone else’s project so fun and amazing it’s probably worth me writing an entirely different set of words about it some other time. + +### So… + +I keep seeing people charge in to Go, eager to use channels to their full potential. Here’s my advice to you. + +**JUST STAHP IT** + +When you’re writing APIs and interfaces, as bad as the advice “never” can be, I’m pretty sure there’s never a time where channels are better, and every Go API I’ve used that used channels I’ve ended up having to fight. I’ve never thought “oh good, there’s a channel here;” it’s always instead been some variant of _**WHAT FRESH HELL IS THIS?**_ + +So, _please, please use channels where appropriate and only where appropriate._ + +In all of my Go code I work with, I can count on one hand the number of times channels were really the best choice. Sometimes they are. That’s great! Use them then. But otherwise just stop. + +![][34] + +_Special thanks for the valuable feedback provided by my proof readers Jeff Wendling, [Andrew Harding][35], [George Shank][36], and [Tyler Treat][37]._ + +If you want to work on Go with us at Space Monkey, please [hit me up][38]! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad + +作者:[jtolio.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://blog.codinghorror.com/content/images/uploads/2012/06/6a0120a85dcdae970b017742d249d5970d-800wi.jpg +[2]: https://songlh.github.io/paper/go-study.pdf +[3]: https://golang.org/ +[4]: http://www.spacemonkey.com/ +[5]: https://en.wikipedia.org/wiki/Communicating_sequential_processes +[6]: https://en.wikipedia.org/wiki/%CE%A0-calculus +[7]: http://matt.might.net +[8]: http://www.ucombinator.org/ +[9]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[10]: https://www.jtolio.com/writing/2014/04/go-space-monkey/ +[11]: https://godoc.org/github.com/spacemonkeygo/openssl +[12]: https://golang.org/pkg/crypto/tls/ +[13]: https://godoc.org/github.com/spacemonkeygo/errors +[14]: https://godoc.org/github.com/spacemonkeygo/spacelog +[15]: https://godoc.org/gopkg.in/spacemonkeygo/monitor.v1 +[16]: https://github.com/jtolds/gls +[17]: https://www.jtolio.com/images/wat/darth-helmet.jpg +[18]: https://en.wikipedia.org/wiki/Newsqueak +[19]: https://en.wikipedia.org/wiki/Alef_%28programming_language%29 +[20]: https://en.wikipedia.org/wiki/Limbo_%28programming_language%29 +[21]: https://lesswrong.com/lw/k5/cached_thoughts/ +[22]: https://blog.golang.org/share-memory-by-communicating +[23]: https://www.jtolio.com/images/wat/jon-stewart.jpg +[24]: https://twitter.com/HiattDustin +[25]: http://bravenewgeek.com/go-is-unapologetically-flawed-heres-why-we-use-it/ +[26]: https://www.jtolio.com/images/wat/obama.jpg +[27]: https://www.jtolio.com/images/wat/yael-grobglas.jpg +[28]: http://www.informit.com/articles/article.aspx?p=2359758#comment-2061767464 +[29]: https://godoc.org/golang.org/x/net/context +[30]: https://www.jtolio.com/images/wat/zooey-deschanel.jpg +[31]: https://www.jtolio.com/images/wat/joel-mchale.jpg +[32]: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ +[33]: https://en.wikipedia.org/wiki/Duck_typing +[34]: https://www.jtolio.com/images/wat/michael-cera.jpg +[35]: https://github.com/azdagron +[36]: https://twitter.com/taterbase +[37]: http://bravenewgeek.com +[38]: https://www.jtolio.com/contact/ diff --git a/sources/tech/20170112 Writing Advanced Web Applications with Go.md b/sources/tech/20170112 Writing Advanced Web Applications with Go.md new file mode 100644 index 0000000000..f46521e8a7 --- /dev/null +++ b/sources/tech/20170112 Writing Advanced Web Applications with Go.md @@ -0,0 +1,658 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Writing Advanced Web Applications with Go) +[#]: via: (https://www.jtolio.com/2017/01/writing-advanced-web-applications-with-go) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Writing Advanced Web Applications with Go +====== + +Web development in many programming environments often requires subscribing to some full framework ethos. With [Ruby][1], it’s usually [Rails][2] but could be [Sinatra][3] or something else. With [Python][4], it’s often [Django][5] or [Flask][6]. With [Go][7], it’s… + +If you spend some time in Go communities like the [Go mailing list][8] or the [Go subreddit][9], you’ll find Go newcomers frequently wondering what web framework is best to use. [There][10] [are][11] [quite][12] [a][13] [few][14] [Go][15] [frameworks][16] ([and][17] [then][18] [some][19]), so which one is best seems like a reasonable question. Without fail, though, the strong recommendation of the Go community is to [avoid web frameworks entirely][20] and just stick with the standard library as long as possible. Here’s [an example from the Go mailing list][21] and here’s [one from the subreddit][22]. + +It’s not bad advice! The Go standard library is very rich and flexible, much more so than many other languages, and designing a web application in Go with just the standard library is definitely a good choice. + +Even when these Go frameworks call themselves minimalistic, they can’t seem to help themselves avoid using a different request handler interface than the default standard library [http.Handler][23], and I think this is the biggest source of angst about why frameworks should be avoided. If everyone standardizes on [http.Handler][23], then dang, all sorts of things would be interoperable! + +Before Go 1.7, it made some sense to give in and use a different interface for handling HTTP requests. But now that [http.Request][24] has the [Context][25] and [WithContext][26] methods, there truly isn’t a good reason any longer. + +I’ve done a fair share of web development in Go and I’m here to share with you both some standard library development patterns I’ve learned and some code I’ve found myself frequently needing. The code I’m sharing is not for use instead of the standard library, but to augment it. + +Overall, if this blog post feels like it’s predominantly plugging various little standalone libraries from my [Webhelp non-framework][27], that’s because it is. It’s okay, they’re little standalone libraries. Only use the ones you want! + +If you’re new to Go web development, I suggest reading the Go documentation’s [Writing Web Applications][28] article first. + +### Middleware + +A frequent design pattern for server-side web development is the concept of _middleware_, where some portion of the request handler wraps some other portion of the request handler and does some preprocessing or routing or something. This is a big component of how [Express][29] is organized on [Node][30], and how Express middleware and [Negroni][17] middleware works is almost line-for-line identical in design. + +Good use cases for middleware are things such as: + + * making sure a user is logged in, redirecting if not, + * making sure the request came over HTTPS, + * making sure a session is set up and loaded from a session database, + * making sure we logged information before and after the request was handled, + * making sure the request was routed to the right handler, + * and so on. + + + +Composing your web app as essentially a chain of middleware handlers is a very powerful and flexible approach. It allows you to avoid a lot of [cross-cutting concerns][31] and have your code factored in very elegant and easy-to-maintain ways. By wrapping a set of handlers with middleware that ensures a user is logged in prior to actually attempting to handle the request, the individual handlers no longer need mistake-prone copy-and-pasted code to ensure the same thing. + +So, middleware is good. However, if Negroni or other frameworks are any indication, you’d think the standard library’s `http.Handler` isn’t up to the challenge. Negroni adds its own `negroni.Handler` just for the sake of making middleware easier. There’s no reason for this. + +Here is a full middleware implementation for ensuring a user is logged in, assuming a `GetUser(*http.Request)` function but otherwise just using the standard library: + +``` +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if user == nil { + http.Error(w, "unauthorized", http.StatusUnauthorized) + return + } + h.ServeHTTP(w, req) + }) +} +``` + +Here’s how it’s used (just wrap another handler!): + +``` +func main() { + http.ListenAndServe(":8080", RequireUser(http.HandlerFunc(myHandler))) +} +``` + +Express, Negroni, and other frameworks expect this kind of signature for a middleware-supporting handler: + +``` +type Handler interface { + // don't do this! + ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc) +} +``` + +There’s really no reason for adding the `next` argument - it reduces cross-library compatibility. So I say, don’t use `negroni.Handler` (or similar). Just use `http.Handler`! + +### Composability + +Hopefully I’ve sold you on middleware as a good design philosophy. + +Probably the most commonly-used type of middleware is request routing, or muxing (seems like we should call this demuxing but what do I know). Some frameworks are almost solely focused on request routing. [gorilla/mux][32] seems more popular than any other part of the [Gorilla][33] library. I think the reason for this is that even though the Go standard library is completely full featured and has a good [ServeMux][34] implementation, it doesn’t make the right thing the default. + +So! Let’s talk about request routing and consider the following problem. You, web developer extraordinaire, want to serve some HTML from your web server at `/hello/` but also want to serve some static assets from `/static/`. Let’s take a quick stab. + +``` +package main + +import ( + "net/http" +) + +func hello(w http.ResponseWriter, req *http.Request) { + w.Write([]byte("hello, world!")) +} + +func main() { + mux := http.NewServeMux() + mux.Handle("/hello/", http.HandlerFunc(hello)) + mux.Handle("/static/", http.FileServer(http.Dir("./static-assets"))) + http.ListenAndServe(":8080", mux) +} +``` + +If you visit `http://localhost:8080/hello/`, you’ll be rewarded with a friendly “hello, world!” message. + +If you visit `http://localhost:8080/static/` on the other hand (assuming you have a folder of static assets in `./static-assets`), you’ll be surprised and frustrated. This code tries to find the source content for the request `/static/my-file` at `./static-assets/static/my-file`! There’s an extra `/static` in there! + +Okay, so this is why `http.StripPrefix` exists. Let’s fix it. + +``` +mux.Handle("/static/", http.StripPrefix("/static", + http.FileServer(http.Dir("./static-assets")))) +``` + +`mux.Handle` combined with `http.StripPrefix` is such a common pattern that I think it should be the default. Whenever a request router processes a certain amount of URL elements, it should strip them off the request so the wrapped `http.Handler` doesn’t need to know its absolute URL and only needs to be concerned with its relative one. + +In [Russ Cox][35]’s recent [TiddlyWeb backend][36], I would argue that every time `strings.TrimPrefix` is needed to remove the full URL from the handler’s incoming path arguments, it is an unnecessary cross-cutting concern, unfortunately imposed by `http.ServeMux`. (An example is [line 201 in tiddly.go][37].) + +I’d much rather have the default `mux` behavior work more like a directory of registered elements that by default strips off the ancestor directory before handing the request to the next middleware handler. It’s much more composable. To this end, I’ve written a simple muxer that works in this fashion called [whmux.Dir][38]. It is essentially `http.ServeMux` and `http.StripPrefix` combined. Here’s the previous example reworked to use it: + +``` +package main + +import ( + "net/http" + + "gopkg.in/webhelp.v1/whmux" +) + +func hello(w http.ResponseWriter, req *http.Request) { + w.Write([]byte("hello, world!")) +} + +func main() { + mux := whmux.Dir{ + "hello": http.HandlerFunc(hello), + "static": http.FileServer(http.Dir("./static-assets")), + } + http.ListenAndServe(":8080", mux) +} +``` + +There are other useful mux implementations inside the [whmux][39] package that demultiplex on various aspects of the request path, request method, request host, or pull arguments out of the request and place them into the context, such as a [whmux.IntArg][40] or [whmux.StringArg][41]. This brings us to [contexts][42]. + +### Contexts + +Request contexts are a recent addition to the Go 1.7 standard library, but the idea of [contexts has been around since mid-2014][43]. As of Go 1.7, they were added to the standard library ([“context”][42]), but are available for older Go releases in the original location ([“golang.org/x/net/context”][44]). + +First, here’s the definition of the `context.Context` type that `(*http.Request).Context()` returns: + +``` +type Context interface { + Done() <-chan struct{} + Err() error + Deadline() (deadline time.Time, ok bool) + + Value(key interface{}) interface{} +} +``` + +Talking about `Done()`, `Err()`, and `Deadline()` are enough for an entirely different blog post, so I’m going to ignore them at least for now and focus on `Value(interface{})`. + +As a motivating problem, let’s say that the `GetUser(*http.Request)` method we assumed earlier is expensive, and we only want to call it once per request. We certainly don’t want to call it once to check that a user is logged in, and then again when we actually need the `*User` value. With `(*http.Request).WithContext` and `context.WithValue`, we can pass the `*User` down to the next middleware precomputed! + +Here’s the new middleware: + +``` +type userKey int + +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if user == nil { + http.Error(w, "unauthorized", http.StatusUnauthorized) + return + } + ctx := r.Context() + ctx = context.WithValue(ctx, userKey(0), user) + h.ServeHTTP(w, req.WithContext(ctx)) + }) +} +``` + +Now, handlers that are protected by this `RequireUser` handler can load the previously computed `*User` value like this: + +``` +if user, ok := req.Context().Value(userKey(0)).(*User); ok { + // there's a valid user! +} +``` + +Contexts allow us to pass optional values to handlers down the chain in a way that is relatively type-safe and flexible. None of the above context logic requires anything outside of the standard library. + +#### Aside about context keys + +There was a curious piece of code in the above example. At the top, we defined a `type userKey int`, and then always used it as `userKey(0)`. + +One of the possible problems with contexts is the `Value()` interface lends itself to a global namespace where you can stomp on other context users and use conflicting key names. Above, we used `type userKey` because it’s an unexported type in your package. It will never compare equal (without a cast) to any other type, including `int`, in Go. This gives us a way to namespace keys to your package, even though the `Value()` method is still a sort of global namespace. + +Because the need for this is so common, the `webhelp` package defines a [GenSym()][45] helper that will create a brand new, never-before-seen, unique value for use as a context key. + +If we used [GenSym()][45], then `type userKey int` would become `var userKey = webhelp.GenSym()` and `userKey(0)` would simply become `userKey`. + +#### Back to whmux.StringArg + +Armed with this new context behavior, we can now present a `whmux.StringArg` example: + +``` +package main + +import ( + "fmt" + "net/http" + + "gopkg.in/webhelp.v1/whmux" +) + +var ( + pageName = whmux.NewStringArg() +) + +func page(w http.ResponseWriter, req *http.Request) { + name := pageName.Get(req.Context()) + + fmt.Fprintf(w, "Welcome to %s", name) +} + +func main() { + // pageName.Shift pulls the next /-delimited string out of the request's + // URL.Path and puts it into the context instead. + pageHandler := pageName.Shift(http.HandlerFunc(page)) + + http.ListenAndServe(":8080", whmux.Dir{ + "wiki": pageHandler, + }) +} +``` + +### Pre-Go-1.7 support + +Contexts let you do some pretty cool things. But let’s say you’re stuck with something before Go 1.7 (for instance, App Engine is currently Go 1.6). + +That’s okay! I’ve backported all of the neat new context features to Go 1.6 and earlier in a forwards compatible way! + +With the [whcompat][46] package, `req.Context()` becomes `whcompat.Context(req)`, and `req.WithContext(ctx)` becomes `whcompat.WithContext(req, ctx)`. The `whcompat` versions work with all releases of Go. Yay! + +There’s a bit of unpleasantness behind the scenes to make this happen. Specifically, for pre-1.7 builds, a global map indexed by `req.URL` is kept, and a finalizer is installed on `req` to clean up. So don’t change what `req.URL` points to and this will work fine. In practice it’s not a problem. + +`whcompat` adds additional backwards-compatibility helpers. In Go 1.7 and on, the context’s `Done()` channel is closed (and `Err()` is set), whenever the request is done processing. If you want this behavior in Go 1.6 and earlier, just use the [whcompat.DoneNotify][47] middleware. + +In Go 1.8 and on, the context’s `Done()` channel is closed when the client goes away, even if the request hasn’t completed. If you want this behavior in Go 1.7 and earlier, just use the [whcompat.CloseNotify][48] middleware, though beware that it costs an extra goroutine. + +### Error handling + +How you handle errors can be another cross-cutting concern, but with good application of context and middleware, it too can be beautifully cleaned up so that the responsibilities lie in the correct place. + +Problem statement: your `RequireUser` middleware needs to handle an authentication error differently between your HTML endpoints and your JSON API endpoints. You want to use `RequireUser` for both types of endpoints, but with your HTML endpoints you want to return a user-friendly error page, and with your JSON API endpoints you want to return an appropriate JSON error state. + +In my opinion, the right thing to do is to have contextual error handlers, and luckily, we have a context for contextual information! + +First, we need an error handler interface. + +``` +type ErrHandler interface { + HandleError(w http.ResponseWriter, req *http.Request, err error) +} +``` + +Next, let’s make a middleware that registers the error handler in the context: + +``` +var errHandler = webhelp.GenSym() // see the aside about context keys + +func HandleErrWith(eh ErrHandler, h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + ctx := context.WithValue(whcompat.Context(req), errHandler, eh) + h.ServeHTTP(w, whcompat.WithContext(req, ctx)) + }) +} +``` + +Last, let’s make a function that will use the registered error handler for errors: + +``` +func HandleErr(w http.ResponseWriter, req *http.Request, err error) { + if handler, ok := whcompat.Context(req).Value(errHandler).(ErrHandler); ok { + handler.HandleError(w, req, err) + return + } + log.Printf("error: %v", err) + http.Error(w, "internal server error", http.StatusInternalServerError) +} +``` + +Now, as long as everything uses `HandleErr` to handle errors, our JSON API can handle errors with JSON responses, and our HTML endpoints can handle errors with HTML responses. + +Of course, the [wherr][49] package implements this all for you, and the [whjson][49] package even implements a friendly JSON API error handler. + +Here’s how you might use it: + +``` +var userKey = webhelp.GenSym() + +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + wherr.Handle(w, req, wherr.InternalServerError.New("failed to get user")) + return + } + if user == nil { + wherr.Handle(w, req, wherr.Unauthorized.New("no user found")) + return + } + ctx := r.Context() + ctx = context.WithValue(ctx, userKey, user) + h.ServeHTTP(w, req.WithContext(ctx)) + }) +} + +func userpage(w http.ResponseWriter, req *http.Request) { + user := req.Context().Value(userKey).(*User) + w.Header().Set("Content-Type", "text/html") + userpageTmpl.Execute(w, user) +} + +func username(w http.ResponseWriter, req *http.Request) { + user := req.Context().Value(userKey).(*User) + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(map[string]interface{}{"user": user}) +} + +func main() { + http.ListenAndServe(":8080", whmux.Dir{ + "api": wherr.HandleWith(whjson.ErrHandler, + RequireUser(whmux.Dir{ + "username": http.HandlerFunc(username), + })), + "user": RequireUser(http.HandlerFunc(userpage)), + }) +} +``` + +#### Aside about the spacemonkeygo/errors package + +The default [wherr.Handle][50] implementation understands all of the [error classes defined in the wherr top level package][51]. + +These error classes are implemented using the [spacemonkeygo/errors][52] library and the [spacemonkeygo/errors/errhttp][53] extensions. You don’t have to use this library or these errors, but the benefit is that your error instances can be extended to include HTTP status code messages and information, which once again, provides for a nice elimination of cross-cutting concerns in your error handling logic. + +See the [spacemonkeygo/errors][52] package for more details. + +_**Update 2018-04-19:** After a few years of use, my friend condensed some lessons we learned and the best parts of `spacemonkeygo/errors` into a new, more concise, better library, over at [github.com/zeebo/errs][54]. Consider using that instead!_ + +### Sessions + +Go’s standard library has great support for cookies, but cookies by themselves aren’t usually what a developer thinks of when she thinks about sessions. Cookies are unencrypted, unauthenticated, and readable by the user, and perhaps you don’t want that with your session data. + +Further, sessions can be stored in cookies, but could also be stored in a database to provide features like session revocation and querying. There’s lots of potential details about the implementation of sessions. + +Request handlers, however, probably don’t care too much about the implementation details of the session. Request handlers usually just want a bucket of keys and values they can store safely and securely. + +The [whsess][55] package implements middleware for registering an arbitrary session store (a default cookie-based session store is provided), and implements helpers for retrieving and saving new values into the session. + +The default cookie-based session store implements encryption and authentication via the excellent [nacl/secretbox][56] package. + +Usage is like this: + +``` +func handler(w http.ResponseWriter, req *http.Request) { + ctx := whcompat.Context(req) + sess, err := whsess.Load(ctx, "namespace") + if err != nil { + wherr.Handle(w, req, err) + return + } + if loggedIn, _ := sess.Values["logged_in"].(bool); loggedIn { + views, _ := sess.Values["views"].(int64) + sess.Values["views"] = views + 1 + sess.Save(w) + } +} + +func main() { + http.ListenAndServe(":8080", whsess.HandlerWithStore( + whsess.NewCookieStore(secret), http.HandlerFunc(handler))) +} +``` + +### Logging + +The Go standard library by default doesn’t log incoming requests, outgoing responses, or even just what port the HTTP server is listening on. + +The [whlog][57] package implements all three. The [whlog.LogRequests][58] middleware will log requests as they start. The [whlog.LogResponses][59] middleware will log requests as they end, along with status code and timing information. [whlog.ListenAndServe][60] will log the address the server ultimately listens on (if you specify “:0” as your address, a port will be randomly chosen, and [whlog.ListenAndServe][60] will log it). + +[whlog.LogResponses][59] deserves special mention for how it does what it does. It uses the [whmon][61] package to instrument the outgoing `http.ResponseWriter` to keep track of response information. + +Usage is like this: + +``` +func main() { + whlog.ListenAndServe(":8080", whlog.LogResponses(whlog.Default, handler)) +} +``` + +#### App engine logging + +App engine logging is unconventional crazytown. The standard library logger doesn’t work by default on App Engine, because App Engine logs _require_ the request context. This is unfortunate for libraries that don’t necessarily run on App Engine all the time, as their logging information doesn’t make it to the App Engine request-specific logger. + +Unbelievably, this is fixable with [whgls][62], which uses my terrible, terrible (but recently improved) [Goroutine-local storage library][63] to store the request context on the current stack, register a new log output, and fix logging so standard library logging works with App Engine again. + +### Template handling + +Go’s standard library [html/template][64] package is excellent, but you’ll be unsurprised to find there’s a few tasks I do with it so commonly that I’ve written additional support code. + +The [whtmpl][65] package really does two things. First, it provides a number of useful helper methods for use within templates, and second, it takes some friction out of managing a large number of templates. + +When writing templates, one thing you can do is call out to other registered templates for small values. A good example might be some sort of list element. You can have a template that renders the list element, and then your template that renders your list can use the list element template in turn. + +Use of another template within a template might look like this: + +``` +
      + {{ range .List }} + {{ template "list_element" . }} + {{ end }} +
    +``` + +You’re now rendering the `list_element` template with the list element from `.List`. But what if you want to also pass the current user `.User`? Unfortunately, you can only pass one argument from one template to another. If you have two arguments you want to pass to another template, with the standard library, you’re out of luck. + +The [whtmpl][65] package adds three helper functions to aid you here, `makepair`, `makemap`, and `makeslice` (more docs under the [whtmpl.Collection][66] type). `makepair` is the simplest. It takes two arguments and constructs a [whtmpl.Pair][67]. Fixing our example above would look like this now: + +``` +
      + {{ $user := .User }} + {{ range .List }} + {{ template "list_element" (makepair . $user) }} + {{ end }} +
    +``` + +The second thing [whtmpl][65] does is make defining lots of templates easy, by optionally automatically naming templates after the name of the file the template is defined in. + +For example, say you have three files. + +Here’s `pkg.go`: + +``` +package views + +import "gopkg.in/webhelp.v1/whtmpl" + +var Templates = whtmpl.NewCollection() +``` + +Here’s `landing.go`: + +``` +package views + +var _ = Templates.MustParse(`{{ template "header" . }} + +

    Landing!

    `) +``` + +And here’s `header.go`: + +``` +package views + +var _ = Templates.MustParse(`My website!`) +``` + +Now, you can import your new `views` package and render the `landing` template this easily: + +``` +func handler(w http.ResponseWriter, req *http.Request) { + views.Templates.Render(w, req, "landing", map[string]interface{}{}) +} +``` + +### User authentication + +I’ve written two Webhelp-style authentication libraries that I end up using frequently. + +The first is an OAuth2 library, [whoauth2][68]. I’ve written up [an example application that authenticates with Google, Facebook, and Github][69]. + +The second, [whgoth][70], is a wrapper around [markbates/goth][71]. My portion isn’t quite complete yet (some fixes are still necessary for optional App Engine support), but will support more non-OAuth2 authentication sources (like Twitter) when it is done. + +### Route listing + +Surprise! If you’ve used [webhelp][27] based handlers and middleware for your whole app, you automatically get route listing for free, via the [whroute][72] package. + +My web serving code’s `main` method often has a form like this: + +``` +switch flag.Arg(0) { +case "serve": + panic(whlog.ListenAndServe(*listenAddr, routes)) +case "routes": + whroute.PrintRoutes(os.Stdout, routes) +default: + fmt.Printf("Usage: %s \n", os.Args[0]) +} +``` + +Here’s some example output: + +``` +GET /auth/_cb/ +GET /auth/login/ +GET /auth/logout/ +GET / +GET /account/apikeys/ +POST /account/apikeys/ +GET /project// +GET /project//control// +POST /project//control//sample/ +GET /project//control/ + Redirect: f(req) +POST /project//control/ +POST /project//control_named//sample/ +GET /project//control_named/ + Redirect: f(req) +GET /project//sample// +GET /project//sample//similar[/<*>] +GET /project//sample/ + Redirect: f(req) +POST /project//search/ +GET /project/ + Redirect: / +POST /project/ +``` + +### Other little things + +[webhelp][27] has a number of other subpackages: + + * [whparse][73] assists in parsing optional request arguments. + * [whredir][74] provides some handlers and helper methods for doing redirects in various cases. + * [whcache][75] creates request-specific mutable storage for caching various computations and database loaded data. Mutability helps helper functions that aren’t used as middleware share data. + * [whfatal][76] uses panics to simplify early request handling termination. Probably avoid this package unless you want to anger other Go developers. + + + +### Summary + +Designing your web project as a collection of composable middlewares goes quite a long way to simplify your code design, eliminate cross-cutting concerns, and create a more flexible development environment. Use my [webhelp][27] package if it helps you. + +Or don’t! Whatever! It’s still a free country last I checked. + +#### Update + +Peter Kieltyka points me to his [Chi framework][77], which actually does seem to do the right things with respect to middleware, handlers, and contexts - certainly much more so than all the other frameworks I’ve seen. So, shoutout to Peter and the team at Pressly! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2017/01/writing-advanced-web-applications-with-go + +作者:[jtolio.com][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.ruby-lang.org/ +[2]: http://rubyonrails.org/ +[3]: http://www.sinatrarb.com/ +[4]: https://www.python.org/ +[5]: https://www.djangoproject.com/ +[6]: http://flask.pocoo.org/ +[7]: https://golang.org/ +[8]: https://groups.google.com/d/forum/golang-nuts +[9]: https://www.reddit.com/r/golang/ +[10]: https://revel.github.io/ +[11]: https://gin-gonic.github.io/gin/ +[12]: http://iris-go.com/ +[13]: https://beego.me/ +[14]: https://go-macaron.com/ +[15]: https://github.com/go-martini/martini +[16]: https://github.com/gocraft/web +[17]: https://github.com/urfave/negroni +[18]: https://godoc.org/goji.io +[19]: https://echo.labstack.com/ +[20]: https://medium.com/code-zen/why-i-don-t-use-go-web-frameworks-1087e1facfa4 +[21]: https://groups.google.com/forum/#!topic/golang-nuts/R_lqsTTBh6I +[22]: https://www.reddit.com/r/golang/comments/1yh6gm/new_to_go_trying_to_select_web_framework/ +[23]: https://golang.org/pkg/net/http/#Handler +[24]: https://golang.org/pkg/net/http/#Request +[25]: https://golang.org/pkg/net/http/#Request.Context +[26]: https://golang.org/pkg/net/http/#Request.WithContext +[27]: https://godoc.org/gopkg.in/webhelp.v1 +[28]: https://golang.org/doc/articles/wiki/ +[29]: https://expressjs.com/ +[30]: https://nodejs.org/en/ +[31]: https://en.wikipedia.org/wiki/Cross-cutting_concern +[32]: https://github.com/gorilla/mux +[33]: https://github.com/gorilla/ +[34]: https://golang.org/pkg/net/http/#ServeMux +[35]: https://swtch.com/~rsc/ +[36]: https://github.com/rsc/tiddly +[37]: https://github.com/rsc/tiddly/blob/8f9145ac183e374eb95d90a73be4d5f38534ec47/tiddly.go#L201 +[38]: https://godoc.org/gopkg.in/webhelp.v1/whmux#Dir +[39]: https://godoc.org/gopkg.in/webhelp.v1/whmux +[40]: https://godoc.org/gopkg.in/webhelp.v1/whmux#IntArg +[41]: https://godoc.org/gopkg.in/webhelp.v1/whmux#StringArg +[42]: https://golang.org/pkg/context/ +[43]: https://blog.golang.org/context +[44]: https://godoc.org/golang.org/x/net/context +[45]: https://godoc.org/gopkg.in/webhelp.v1#GenSym +[46]: https://godoc.org/gopkg.in/webhelp.v1/whcompat +[47]: https://godoc.org/gopkg.in/webhelp.v1/whcompat#DoneNotify +[48]: https://godoc.org/gopkg.in/webhelp.v1/whcompat#CloseNotify +[49]: https://godoc.org/gopkg.in/webhelp.v1/wherr +[50]: https://godoc.org/gopkg.in/webhelp.v1/wherr#Handle +[51]: https://godoc.org/gopkg.in/webhelp.v1/wherr#pkg-variables +[52]: https://godoc.org/github.com/spacemonkeygo/errors +[53]: https://godoc.org/github.com/spacemonkeygo/errors/errhttp +[54]: https://github.com/zeebo/errs +[55]: https://godoc.org/gopkg.in/webhelp.v1/whsess +[56]: https://godoc.org/golang.org/x/crypto/nacl/secretbox +[57]: https://godoc.org/gopkg.in/webhelp.v1/whlog +[58]: https://godoc.org/gopkg.in/webhelp.v1/whlog#LogRequests +[59]: https://godoc.org/gopkg.in/webhelp.v1/whlog#LogResponses +[60]: https://godoc.org/gopkg.in/webhelp.v1/whlog#ListenAndServe +[61]: https://godoc.org/gopkg.in/webhelp.v1/whmon +[62]: https://godoc.org/gopkg.in/webhelp.v1/whgls +[63]: https://godoc.org/github.com/jtolds/gls +[64]: https://golang.org/pkg/html/template/ +[65]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl +[66]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl#Collection +[67]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl#Pair +[68]: https://godoc.org/gopkg.in/go-webhelp/whoauth2.v1 +[69]: https://github.com/go-webhelp/whoauth2/blob/v1/examples/group/main.go +[70]: https://godoc.org/gopkg.in/go-webhelp/whgoth.v1 +[71]: https://github.com/markbates/goth +[72]: https://godoc.org/gopkg.in/webhelp.v1/whroute +[73]: https://godoc.org/gopkg.in/webhelp.v1/whparse +[74]: https://godoc.org/gopkg.in/webhelp.v1/whredir +[75]: https://godoc.org/gopkg.in/webhelp.v1/whcache +[76]: https://godoc.org/gopkg.in/webhelp.v1/whfatal +[77]: https://github.com/pressly/chi diff --git a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md deleted file mode 100644 index aaa5a6ca00..0000000000 --- a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md +++ /dev/null @@ -1,146 +0,0 @@ -An introduction to the GNU Core Utilities -====== - -![Introduction to the GNU Core Utilities](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/core-utils.jpg?itok=YTkmsnyy "Introduction to the GNU Core Utilities") - -Image credits :  - -[Bella67][1] via Pixabay. [CC0][2]. - -Two sets of utilities—the [GNU Core Utilities][3] and util-linux—comprise many of the Linux system administrator's most basic and regularly used tools. Their basic functions allow sysadmins to perform many of the tasks required to administer a Linux computer, including management and manipulation of text files, directories, data streams, storage media, process controls, filesystems, and much more. - -These tools are indispensable because, without them, it is impossible to accomplish any useful work on a Unix or Linux computer. Given their importance, let's examine them. - -### GNU coreutils - -The Linux Terminal - -* [Top 7 terminal emulators for Linux][4] -* [10 command-line tools for data analysis in Linux][5] -* [Download Now: SSH cheat sheet][6] -* [Advanced Linux commands cheat sheet][7] - -To understand the origins of the GNU Core Utilities, we need to take a short trip in the Wayback machine to the early days of Unix at Bell Labs. [Unix was written][8] so Ken Thompson, Dennis Ritchie, Doug McIlroy, and Joe Ossanna could continue with something they had started while working on a large multi-tasking and multi-user computer project called [Multics][9]. That little something was a game called Space Travel. As remains true today, it always seems to be the gamers who drive forward the technology of computing. This new operating system was much more limited than Multics, as only two users could log in at a time, so it was called Unics. This name was later changed to Unix. - -Over time, Unix turned out to be such a success that Bell Labs began essentially giving it away it to universities and later to companies for the cost of the media and shipping. Back in those days, system-level software was shared between organizations and programmers as they worked to achieve common goals within the context of system administration. - -Eventually, the [PHBs][10] at AT&T decided they should make money on Unix and started using more restrictive—and expensive—licensing. This was taking place at a time when software was becoming more proprietary, restricted, and closed. It was becoming impossible to share software with other users and organizations. - -Some people did not like this and fought it with free software. Richard M. Stallman, aka RMS, led a group of rebels who were trying to write an open and freely available operating system they called the GNU Operating System. This group created the GNU Utilities but didn't produce a viable kernel. - -When Linus Torvalds first wrote and compiled the Linux kernel, he needed a set of very basic system utilities to even begin to perform marginally useful work. The kernel does not provide commands or any type of command shell such as Bash. It is useless by itself. So, Linus used the freely available GNU Core Utilities and recompiled them for Linux. This gave him a complete, if quite basic, operating system. - -You can learn about all the individual programs that comprise the GNU Utilities by entering the command info coreutils at a terminal command line. The following list of the core utilities is part of that info page. The utilities are grouped by function to make specific ones easier to find; in the terminal, highlight the group you want more information on and press the Enter key. - -``` -* Output of entire files::       cat tac nl od base32 base64 -* Formatting file contents::     fmt pr fold -* Output of parts of files::     head tail split csplit -* Summarizing files::            wc sum cksum b2sum md5sum sha1sum sha2 -* Operating on sorted files::    sort shuf uniq comm ptx tsort -* Operating on fields::          cut paste join -* Operating on characters::      tr expand unexpand -* Directory listing::            ls dir vdir dircolors -* Basic operations::             cp dd install mv rm shred -* Special file types::           mkdir rmdir unlink mkfifo mknod ln link readlink -* Changing file attributes::     chgrp chmod chown touch -* Disk usage::                   df du stat sync truncate -* Printing text::                echo printf yes -* Conditions::                   false true test expr -* Redirection::                  tee -* File name manipulation::       dirname basename pathchk mktemp realpath -* Working context::              pwd stty printenv tty -* User information::             id logname whoami groups users who -* System context::               date arch nproc uname hostname hostid uptime -* SELinux context::              chcon runcon -* Modified command invocation::  chroot env nice nohup stdbuf timeout -* Process control::              kill -* Delaying::                     sleep -* Numeric operations::           factor numfmt seq -``` - -There are 102 utilities on this list. It covers many of the functions necessary to perform basic tasks on a Unix or Linux host. However, many basic utilities are missing. For example, the mount and umount commands are not in this list. Those and many of the other commands that are not in the GNU coreutils can be found in the util-linux collection. - -### util-linux - -The util-linix package of utilities contains many of the other common commands that sysadmins use. These utilities are distributed by the Linux Kernel Organization, and virtually every one of these 107 commands were originally three separate collections—fileutils, shellutils, and textutils—which were [combined into the single package][11] util-linux in 2003. - -``` -agetty          fsck.minix      mkfs.bfs        setpriv -blkdiscard      fsfreeze        mkfs.cramfs     setsid -blkid           fstab           mkfs.minix      setterm -blockdev        fstrim          mkswap          sfdisk -cal             getopt          more            su -cfdisk          hexdump         mount           sulogin -chcpu           hwclock         mountpoint      swaplabel -chfn            ionice          namei           swapoff -chrt            ipcmk           newgrp          swapon -chsh            ipcrm           nologin         switch_root -colcrt          ipcs            nsenter         tailf -col             isosize         partx           taskset -colrm           kill            pg              tunelp -column          last            pivot_root      ul -ctrlaltdel      ldattach        prlimit         umount -ddpart          line            raw             unshare -delpart         logger          readprofile     utmpdump -dmesg           login           rename          uuidd -eject           look            renice          uuidgen -fallocate       losetup         reset           vipw -fdformat        lsblk           resizepart      wall -fdisk           lscpu           rev             wdctl -findfs          lslocks         RTC Alarm       whereis -findmnt         lslogins        runuser         wipefs -flock           mcookie         script          write -fsck            mesg            scriptreplay    zramctl -fsck.cramfs     mkfs            setarch -``` - -Some of these utilities have been deprecated and will likely fall out of the collection at some point in the future. You should check [Wikipedia's util-linux page][12] for information on many of the utilities, and the man pages also provide details on the commands. - -### Summary - -These two collections of Linux utilities, the GNU Core Utilities and util-linux, together provide the basic utilities required to administer a Linux system. As I researched this article, I found several interesting utilities I never knew about. Many of these commands are seldom needed, but when you need them, they are indispensable. - -Between these two collections, there are over 200 Linux utilities. While Linux has many more commands, these are the ones needed to manage the basic functions of a typical Linux host. - -### About the author - -[![](https://opensource.com/sites/default/files/styles/profile_pictures/public/david-crop.jpg?itok=oePpOpyV)][13] - -David Both \- David Both is a Linux and Open Source advocate who resides in Raleigh, North Carolina. He has been in the IT industry for over forty years and taught OS/2 for IBM where he worked for over 20 years. While at IBM, he wrote the first training course for the original IBM PC in 1981. He has taught RHCE classes for Red Hat and has worked at MCI Worldcom, Cisco, and the State of North Carolina. He has been working with Linux and Open Source Software for almost 20 years. David has written articles for... [more about David Both][14] - -[More about me][15] - -* [Learn how you can contribute][16] - ---- - -via: [https://opensource.com/article/18/4/gnu-core-utilities][17] - -作者: [David Both][18] 选题者: [@lujun9972][19] 译者: [译者ID][20] 校对: [校对者ID][21] - -本文由 [LCTT][22] 原创编译,[Linux中国][23] 荣誉推出 - -[1]: https://pixabay.com/en/tiny-people-core-apple-apple-half-700921/ -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.gnu.org/software/coreutils/coreutils.html -[4]: https://opensource.com/life/17/10/top-terminal-emulators?intcmp=7016000000127cYAAQ -[5]: https://opensource.com/article/17/2/command-line-tools-data-analysis-linux?intcmp=7016000000127cYAAQ -[6]: https://opensource.com/downloads/advanced-ssh-cheat-sheet?intcmp=7016000000127cYAAQ -[7]: https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=7016000000127cYAAQ -[8]: https://en.wikipedia.org/wiki/History_of_Unix -[9]: https://en.wikipedia.org/wiki/Multics -[10]: https://en.wikipedia.org/wiki/Pointy-haired_Boss -[11]: https://en.wikipedia.org/wiki/GNU_Core_Utilities -[12]: https://en.wikipedia.org/wiki/Util-linux -[13]: https://opensource.com/users/dboth -[14]: https://opensource.com/users/dboth -[15]: https://opensource.com/users/dboth -[16]: https://opensource.com/participate -[17]: https://opensource.com/article/18/4/gnu-core-utilities -[18]: https://opensource.com/users/dboth -[19]: https://github.com/lujun9972 -[20]: https://github.com/译者ID -[21]: https://github.com/校对者ID -[22]: https://github.com/LCTT/TranslateProject -[23]: https://linux.cn/ diff --git a/sources/tech/20180612 Systemd Services- Reacting to Change.md b/sources/tech/20180612 Systemd Services- Reacting to Change.md deleted file mode 100644 index a004f123c8..0000000000 --- a/sources/tech/20180612 Systemd Services- Reacting to Change.md +++ /dev/null @@ -1,275 +0,0 @@ -Systemd Services: Reacting to Change -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/webcam.png?itok=zzYUs5VK) - -[I have one of these Compute Sticks][1] (Figure 1) and use it as an all-purpose server. It is inconspicuous and silent and, as it is built around an x86 architecture, I don't have problems getting it to work with drivers for my printer, and that’s what it does most days: it interfaces with the shared printer and scanner in my living room. - -![ComputeStick][3] - -An Intel ComputeStick. Euro coin for size. - -[Used with permission][4] - -Most of the time it is idle, especially when we are out, so I thought it would be good idea to use it as a surveillance system. The device doesn't come with its own camera, and it wouldn't need to be spying all the time. I also didn't want to have to start the image capturing by hand because this would mean having to log into the Stick using SSH and fire up the process by writing commands in the shell before rushing out the door. - -So I thought that the thing to do would be to grab a USB webcam and have the surveillance system fire up automatically just by plugging it in. Bonus points if the surveillance system fired up also after the Stick rebooted, and it found that the camera was connected. - -In prior installments, we saw that [systemd services can be started or stopped by hand][5] or [when certain conditions are met][6]. Those conditions are not limited to when the OS reaches a certain state in the boot up or powerdown sequence but can also be when you plug in new hardware or when things change in the filesystem. You do that by combining a Udev rule with a systemd service. - -### Hotplugging with Udev - -Udev rules live in the _/etc/udev/rules_ directory and are usually a single line containing _conditions_ and _assignments_ that lead to an _action_. - -That was a bit cryptic. Let's try again: - -Typically, in a Udev rule, you tell systemd what to look for when a device is connected. For example, you may want to check if the make and model of a device you just plugged in correspond to the make and model of the device you are telling Udev to wait for. Those are the _conditions_ mentioned earlier. - -Then you may want to change some stuff so you can use the device easily later. An example of that would be to change the read and write permissions to a device: if you plug in a USB printer, you're going to want users to be able to read information from the printer (the user's printing app would want to know the model, make, and whether it is ready to receive print jobs or not) and write to it, that is, send stuff to print. Changing the read and write permissions for a device is done using one of the _assignments_ you read about earlier. - -Finally, you will probably want the system to do something when the conditions mentioned above are met, like start a backup application to copy important files when a certain external hard disk drive is plugged in. That is an example of an _action_ mentioned above. - -With that in mind, ponder this: - -``` -ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="e207", -SYMLINK+="mywebcam", TAG+="systemd", MODE="0666", ENV{SYSTEMD_WANTS}="webcam.service" -``` - -The first part of the rule, - -``` -ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", -ATTRS{idProduct}=="e207" [etc... ] -``` - -shows the conditions that the device has to meet before doing any of the other stuff you want the system to do. The device has to be added (`ACTION=="add"`) to the machine, it has to be integrated into the `video4linux` subsystem. To make sure the rule is applied only when the correct device is plugged in, you have to make sure Udev correctly identifies the manufacturer (`ATTRS{idVendor}=="03f0"`) and a model (`ATTRS{idProduct}=="e207"`) of the device. - -In this case, we're talking about this device (Figure 2): - -![webcam][8] - -The HP webcam used in this experiment. - -[Used with permission][4] - -Notice how you use `==` to indicate that these are a logical operation. You would read the above snippet of the rule like this: - -``` -if the device is added and the device controlled by the video4linux subsystem -and the manufacturer of the device is 03f0 and the model is e207, then... -``` - -But where do you get all this information? Where do you find the action that triggers the event, the manufacturer, model, and so on? You will probably have to use several sources. The `IdVendor` and `idProduct` you can get by plugging the webcam into your machine and running `lsusb`: - -``` -lsusb -Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub -Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub -Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub -Bus 003 Device 003: ID 03f0:e207 Hewlett-Packard -Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub -Bus 001 Device 003: ID 04f2:b1bb Chicony Electronics Co., Ltd -Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub -Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub -``` - -The webcam I’m using is made by HP, and you can only see one HP device in the list above. The `ID` gives you the manufacturer and the model numbers separated by a colon (`:`). If you have more than one device by the same manufacturer and not sure which is which, unplug the webcam, run `lsusb` again and check what's missing. - -OR... - -Unplug the webcam, wait a few seconds, run the command `udevadmin monitor --environment` and then plug the webcam back in again. When you do that with the HP webcam, you get: - -``` -udevadmin monitor --environment -UDEV [35776.495221] add /devices/pci0000:00/0000:00:1c.3/0000:04:00.0 -  /usb3/3-1/3-1:1.0/input/input21/event11 (input) -.MM_USBIFNUM=00 -ACTION=add -BACKSPACE=guess -DEVLINKS=/dev/input/by-path/pci-0000:04:00.0-usb-0:1:1.0-event -  /dev/input/by-id/usb-Hewlett_Packard_HP_Webcam_HD_2300-event-if00 -DEVNAME=/dev/input/event11 -DEVPATH=/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/ -  usb3/3-1/3-1:1.0/input/input21/event11 -ID_BUS=usb -ID_INPUT=1 -ID_INPUT_KEY=1 -ID_MODEL=HP_Webcam_HD_2300 -ID_MODEL_ENC=HP\x20Webcam\x20HD\x202300 -ID_MODEL_ID=e207 -ID_PATH=pci-0000:04:00.0-usb-0:1:1.0 -ID_PATH_TAG=pci-0000_04_00_0-usb-0_1_1_0 -ID_REVISION=1020 -ID_SERIAL=Hewlett_Packard_HP_Webcam_HD_2300 -ID_TYPE=video -ID_USB_DRIVER=uvcvideo -ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:030000: -ID_USB_INTERFACE_NUM=00 -ID_VENDOR=Hewlett_Packard -ID_VENDOR_ENC=Hewlett\x20Packard -ID_VENDOR_ID=03f0 -LIBINPUT_DEVICE_GROUP=3/3f0/e207:usb-0000:04:00.0-1/button -MAJOR=13 -MINOR=75 -SEQNUM=3162 -SUBSYSTEM=input -USEC_INITIALIZED=35776495065 -XKBLAYOUT=es -XKBMODEL=pc105 -XKBOPTIONS= -XKBVARIANT= -``` - -That may look like a lot to process, but, check this out: the `ACTION` field early in the list tells you what event just happened, i.e., that a device got added to the system. You can also see the name of the device spelled out on several of the lines, so you can be pretty sure that it is the device you are looking for. The output also shows the manufacturer's ID number (`ID_VENDOR_ID=03f0`) and the model number (`ID_VENDOR_ID=03f0`). - -This gives you three of the four values the condition part of the rule needs. You may be tempted to think that it a gives you the fourth, too, because there is also a line that says: - -``` -SUBSYSTEM=input -``` - -Be careful! Although it is true that a USB webcam is a device that provides input (as does a keyboard and a mouse), it is also belongs to the _usb_ subsystem, and several others. This means that your webcam gets added to several subsystems and looks like several devices. If you pick the wrong subsystem, your rule may not work as you want it to, or, indeed, at all. - -So, the third thing you have to check is all the subsystems the webcam has got added to and pick the correct one. To do that, unplug your webcam again and run: - -``` -ls /dev/video* -``` - -This will show you all the video devices connected to the machine. If you are using a laptop, most come with a built-in webcam and it will probably show up as `/dev/video0`. Plug your webcam back in and run `ls /dev/video*` again. - -Now you should see one more video device (probably `/dev/video1`). - -Now you can find out all the subsystems it belongs to by running `udevadm info -a /dev/video1`: - -``` -udevadm info -a /dev/video1 - -Udevadm info starts with the device specified by the devpath and then -walks up the chain of parent devices. It prints for every device -found, all possible attributes in the udev rules key format. -A rule to match, can be composed by the attributes of the device -and the attributes from one single parent device. - - looking at device '/devices/pci0000:00/0000:00:1c.3/0000:04:00.0 -  /usb3/3-1/3-1:1.0/video4linux/video1': - KERNEL=="video1" - SUBSYSTEM=="video4linux" - DRIVER=="" - ATTR{dev_debug}=="0" - ATTR{index}=="0" - ATTR{name}=="HP Webcam HD 2300: HP Webcam HD" - -[etc...] -``` - -The output goes on for quite a while, but what you're interested is right at the beginning: `SUBSYSTEM=="video4linux"`. This is a line you can literally copy and paste right into your rule. The rest of the output (not shown for brevity) gives you a couple more nuggets, like the manufacturer and mode IDs, again in a format you can copy and paste into your rule. - -Now you have a way of identifying the device and what event should trigger the action univocally, it is time to tinker with the device. - -The next section in the rule, `SYMLINK+="mywebcam", TAG+="systemd", MODE="0666"` tells Udev to do three things: First, you want to create symbolic link from the device to (e.g. _/dev/video1_ ) to _/dev/mywebcam_. This is because you cannot predict what the system is going to call the device by default. When you have an in-built webcam and you hotplug a new one, the in-built webcam will usually be _/dev/video0_ while the external one will become _/dev/video1_. However, if you boot your computer with the external USB webcam plugged in, that could be reversed and the internal webcam can become _/dev/video1_ and the external one _/dev/video0_. What this is telling you is that, although your image-capturing script (which you will see later on) always needs to point to the external webcam device, you can't rely on it being _/dev/video0_ or _/dev/video1_. To solve this problem, you tell Udev to create a symbolic link which will never change in the moment the device is added to the _video4linux_ subsystem and you will make your script point to that. - -The second thing you do is add `"systemd"` to the list of Udev tags associated with this rule. This tells Udev that the action that the rule will trigger will be managed by systemd, that is, it will be some sort of systemd service. - -Notice how in both cases you use `+=` operator. This adds the value to a list, which means you can add more than one value to `SYMLINK` and `TAG`. - -The `MODE` values, on the other hand, can only contain one value (hence you use the simple `=` assignment operator). What `MODE` does is tell Udev who can read from or write to the device. If you are familiar with `chmod` (and, if you are reading this, you should be), you will also be familiar of [how you can express permissions using numbers][9]. That is what this is: `0666` means " _give read and write privileges to the device to everybody_ ". - -At last, `ENV{SYSTEMD_WANTS}="webcam.service"` tells Udev what systemd service to run. - -Save this rule into file called _90-webcam.rules_ (or something like that) in _/etc/udev/rules.d_ and you can load it either by rebooting your machine, or by running: - -``` -sudo udevadm control --reload-rules && udevadm trigger -``` - -## Service at Last - -The service the Udev rule triggers is ridiculously simple: - -``` -# webcam.service - -[Service] -Type=simple -ExecStart=/home/[user name]/bin/checkimage.sh -``` - -Basically, it just runs the _checkimage.sh_ script stored in your personal _bin/_ and pushes it the background. [This is something you saw how to do in prior installments][5]. It may seem something little, but just because it is called by a Udev rule, you have just created a special kind of systemd unit called a _device_ unit. Congratulations. - -As for the _checkimage.sh_ script _webcam.service_ calls, there are several ways of grabbing an image from a webcam and comparing it to a prior one to check for changes (which is what _checkimage.sh_ does), but this is how I did it: - -``` -#!/bin/bash -# This is the checkimage.sh script - -mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device= -  /dev/mywebcam &>/dev/null -mv 00000001.png /home/[user name]/monitor/monitor.png - -while true -do - mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device=/dev/mywebcam &>/dev/null - mv 00000001.png /home/[user name]/monitor/temp.png - - imagediff=`compare -metric mae /home/[user name]/monitor/monitor.png /home/[user name] -  /monitor/temp.png /home/[user name]/monitor/diff.png 2>&1 > /dev/null | cut -f 1 -d " "` - if [ `echo "$imagediff > 700.0" | bc` -eq 1 ] - then - mv /home/[user name]/monitor/temp.png /home/[user name]/monitor/monitor.png - fi - - sleep 0.5 -done -``` - -Start by using [MPlayer][10] to grab a frame ( _00000001.png_ ) from the webcam. Notice how we point `mplayer` to the `mywebcam` symbolic link we created in our Udev rule, instead of to `video0` or `video1`. Then you transfer the image to the _monitor/_ directory in your home directory. Then run an infinite loop that does the same thing again and again, but also uses [Image Magick's _compare_ tool][11] to see if there any differences between the last image captured and the one that is already in the _monitor/_ directory. - -If the images are different, it means something has moved within the webcam's frame. The script overwrites the original image with the new image and continues comparing waiting for some more movement. - -### Plugged - -With all the bits and pieces in place, when you plug your webcam in, your Udev rule will be triggered and will start the _webcam.service_. The _webcam.service_ will execute _checkimage.sh_ in the background, and _checkimage.sh_ will start taking pictures every half a second. You will know because your webcam's LED will start flashing indicating every time it takes a snap. - -As always, if something goes wrong, run - -``` -systemctl status webcam.service -``` - -to check what your service and script are up to. - -### Coming up - -You may be wondering: Why overwrite the original image? Surely you would want to see what's going on if the system detects any movement, right? You would be right, but as you will see in the next installment, leaving things as they are and processing the images using yet another type of systemd unit makes things nice, clean and easy. - -Just wait and see. - -Learn more about Linux through the free ["Introduction to Linux" ][12]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting-change - -作者:[Paul Brown][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.intel.com/content/www/us/en/products/boards-kits/compute-stick/stk1a32sc.html -[2]: https://www.linux.com/files/images/fig01png -[3]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig01.png?itok=cfEHN5f1 (ComputeStick) -[4]: https://www.linux.com/licenses/category/used-permission -[5]: https://www.linux.com/blog/learn/intro-to-linux/2018/5/writing-systemd-services-fun-and-profit -[6]: https://www.linux.com/blog/learn/2018/5/systemd-services-beyond-starting-and-stopping -[7]: https://www.linux.com/files/images/fig02png -[8]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig02.png?itok=esFv4BdM (webcam) -[9]: https://chmod-calculator.com/ -[10]: https://mplayerhq.hu/design7/news.html -[11]: https://www.imagemagick.org/script/compare.php -[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/tech/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md b/sources/tech/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md deleted file mode 100644 index d305b716d6..0000000000 --- a/sources/tech/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md +++ /dev/null @@ -1,499 +0,0 @@ -50 Best Ubuntu Apps You Should Be Using Right Now -====== -**Brief: A comprehensive list of best Ubuntu apps for all kind of users. These software will help you in getting a better experience with your Linux desktop.** - -I have written about [things to do after installing Ubuntu][1] several times in the past. Each time I suggest installing the essential applications in Ubuntu. - -But the question arises, what are the essential Ubuntu applications? There is no set answer here. It depends on your need and the kind of work you do on your Ubuntu desktop. - -Still, I have been asked to suggest some good Ubuntu apps by a number of readers. This is the reason I have created this comprehensive list of Ubuntu applications you can use regularly. - -The list has been divided into respective categories for ease of reading and ease of comprehension. - -### Best Ubuntu apps for a better Ubuntu experience - -![Best Ubuntu Apps][2] - -Of course, you don’t have to use all of these applications. Just go through this list of essential Ubuntu software, read the description and then install the ones you need or are inclined to use. Just keep this page bookmarked for future reference or simply search on Google with term ‘best ubuntu apps itsfoss’. - -The best Ubuntu application list is intended for average Ubuntu user. Therefore not all the applications here are open source. I have also marked the slightly complicated applications that might not be suitable for a beginner. The list should be valid for Ubuntu 16.04,18.04 and other versions. - -Unless exclusively mentioned, the software listed here are available in Ubuntu Software Center. - -If you don’t find any application in the software center or if it is missing installation instruction, let me know and I’ll add the installation procedure. - -Enough talk! Let’s see what are the best apps for Ubuntu. - -#### Web Browser - -Ubuntu comes with Firefox as the default web browser. Since the Quantum release, Firefox has improved drastically. Personally, I always use more than one web browser for the sake of distinguishing between different type of works. - -##### Google Chrome - -![Google Chrome Logo][3] - -Google Chrome is the most used web browser on the internet for a reason. With your Google account, it allows you seamless syncing across devices. Plenty of extensions and apps further enhance its capabilities. You can [download Chrome in Ubuntu from its website][4]. - -##### Brave - -![brave browser][5] - -Google Chrome might be the most used web browser but it’s a privacy invader. An [alternative browser][6] is [Brave][7] that blocks ads and tracking scripts by default. This provides you with a faster and secure web browsing experience. - -#### Music applications - -![best music apps ubuntu][8] - -Ubuntu has Rhythmbox as the default music player which is not at all a bad choice for the default music player. However, you can definitely install a better music player. - -##### Sayonara - -[Sayonara][9] is a small, lightweight music player with a nice dark user interface. It comes with all the essential features you would expect in a standard music player. It integrates well with the Ubuntu desktop environment and doesn’t eat up your RAM. - -##### Audacity - -[Audacity][10] is more of an audio editor than an audio player. You can record and edit audio with this free and open source tool. It is available for Linux, Windows and macOS. You can install it from the Software Center. - -##### MusicBrainz Picard - -[Picard][11] is not a music player, it is a music tagger. If you have tons of local music files, Picard allows you to automatically update the music files with correct tracks, album, artist info and album cover art. - -#### Streaming Music Applications - -![Streaming Music app Ubuntu][12] - -In this age of the internet, music listening habit has surely changed. People these days rely more on streaming music players rather than storing hundreds of local music files. Let’s see some apps you can use for streaming music. - -##### Spotify - -[Spotify][13] is the king of streaming music. And the good thing is that it has a native Linux app. The [Spotify app on Ubuntu][14] integrates well with the media key and sound menu along with the desktop notification. Do note that Spotify may or may not be available in your country. - -##### Nuvola music player - -[Nuvola][15] is not a streaming music service like Spotify. It is a desktop music player that allows you to use several streaming music services in one application. You can use Spotify, Deezer, Google Play Music, Amazon Cloud Player and many more such services. - -#### Video Players - -![Video players for Linux][16] - -Ubuntu has the default GNOME video player (previously known as Totem) which is okay but it doesn’t support various media codecs. There are certainly other video players better than the GNOME video player. - -##### VLC - -The free and open source software [VLC][17] is the king of video players. It supports almost all possible media codecs. It also allows you to increase the volume up to 200%. It can also resume playing from the last known position. There are so many [VLC tricks][18] you can use to get the most of it. - -##### MPV - -[MPV][19] is a video player that deserves more attention. A sleek minimalist GUI and plenty of features, MPV has everything you would expect from a good video player. You can even use it in the command line. If you are not happy with VLC, you should surely give MPV a try. - -#### Cloud Storage Service - -Local backups are fine but cloud storage gives an additional degree of freedom. You don’t have to carry a USB key with you all the time or worry about a hard disk crash with cloud services. - -##### Dropbox - -![Dropbox logo][20] - -[Dropbox][21] is one of the most popular Cloud service providers. You get 2GB of free storage with the option to get more by referring others. Dropbox provides a native Linux client and you can download it from its website. It creates a local folder on your system that is synced with the cloud servers. - -##### pCloud - -![pCloud icon][22] - -[pCloud][23] is another good cloud storage service for Linux. It also has a native Linux client that you can download from its website. You get up to 20GB of free storage and if you need more, the pricing is better than Dropbox. pCloud is based in Switzerland, a country renowned for strict data privacy laws. - -#### Image Editors - -I am sure that you would need a photo editor at some point in time. Here are some of the best Ubuntu apps for editing images. - -##### GIMP - -![gimp icon][24] - -[GIMP][25] is a free and open source image editor available for Linux, Windows and macOS. It’s the best alternative for Adobe Photoshop in Linux. You can use it for all kind of image editing. There are plenty of resources available on the internet to help you with Gimp. - -##### Inkscape - -![inkscape icon][26] - -[Inkscape][27] is also a free and open source image editor specifically focusing on vector graphics. You can design vector arts and logo on it. You can compare it to Adobe Illustrator. Like Gimp, Inkscape too has plenty of tutorials available online. - -#### Paint applications - -Painting applications are not the same as image editors though their functionalities overlap at times. Here are some paint apps you can use in Ubuntu. -![Painting apps for Ubuntu Linux][28] - -##### Krita - -[Krita][29] is a free and open source digital painting application. You can create digital art, comics and animation with it. It’s a professional grade software and is even used as the primary software in art schools. - -##### Pinta - -[Pinta][30] might not be as feature rich as Krita but that’s deliberate. You can think of Pinta as Microsoft Paint for Linux. You can draw, paint, add text and do other such small tasks you do in a paint application. - -#### Photography applications - -Amateur photographer or a professional? You have plenty of [photography tools][31] at your disposal. Here are some recommended applications. - -##### digiKam - -![digikam][32] - -With open source software [digiKam][33], you can handle your high-end camera images in a professional manner. digiKam provides all the tools required for viewing, managing, editing, enhancing, organizing, tagging and sharing photographs. - -##### Darktable - -![Darktable icon][34] - -[darktable][35] is an open source photography workflow application with a special focus on raw image development. This is the best alternative you can get for Adobe Lightroom. It is also available for Windows and macOS. - -#### Video editors - -![Video editors Ubuntu][36] - -There is no dearth of [video editors for Linux][37] but I won’t go in detail here. Take a look at some of the feature-rich yet relatively simple to use video editors for Ubuntu. - -##### Kdenlive - -[Kdenlive][38] is the best all-purpose video editor for Linux. It has enough features that compare it to iMovie or Movie Maker. - -##### Shotcut - -[Shotcut][39] is another good choice for a video editor. It is an open source software with all the features you can expect in a standard video editor. - -#### Image and video converter - -If you need to [convert the file format][40] of your images and videos, here are some of my recommendations. - -##### Xnconvert - -![xnconvert logo][41] - -[Xnconvert][42] is an excellent batch image conversion tool. You can bulk resize images, convert the file type and rename them. - -##### Handbrake - -![Handbrake Logo][43] - -[HandBrake][44] is an easy to use open source tool for converting videos from a number of formats to a few modern, popular formats. - -#### Screenshot and screen recording tools - -![Screenshot and recorders Ubuntu][45] - -Here are the best Ubuntu apps for taking screenshots and recording your screen. - -##### Shutter - -[Shutter][46] is my go-to tool for taking screenshots. You can also do some quick editing to those screenshots such as adding arrows, text or resizing the images. The screenshots you see on It’s FOSS have been edited with Shutter. Definitely one of the best apps for Ubuntu. - -##### Kazam - -[Kazam][47] is my favorite [screen recorder for Linux][48]. It’s a tiny tool that allows you to record the entire window, an application window or a selected area. You can also use shortcuts to pause or resume recording. The tutorials on [It’s FOSS YouTube channel][49] have been recorded with Kazam. - -#### Office suites - -I cannot imagine that you could use a computer without a document editor. And why restrict yourself to just one document editor? Go for a complete office suite. - -##### LibreOffice - -![LibreOffice logo][50] - -[LibreOffice][51] comes preinstalled on Ubuntu and it is undoubtedly the [best open source office software][52]. It’s a complete package comprising of a document editor, spreadsheet tool, presentation software, maths tool and a graphics tool. You can even edit some PDF files with LibreOffice. - -##### WPS Office - -![WPS Office logo][53] - -[WPS Office][54] has gained popularity for being a Microsoft Office clone. It has an interface identical to Microsoft Office and it claims to be more compatible with MS Office. If you are looking for something similar to the Microsoft Office, WPS Office is a good choice. - -#### Downloading tools - -![Downloading software Ubuntu][55] - -If you often download videos or other big files from the internet, these tools will help you. - -##### youtube-dl - -This is one of the rare Ubuntu application on the list that is command line based. If you want to download videos from YouTube, DailyMotion or other video websites, youtube-dl is an excellent choice. It provides plenty of [advanced option for video downloading][56]. - -##### uGet - -[uGet][57] is a feature rich [download manager for Linux][58]. It allows you to pause and resume your downloads, schedule your downloads, monitor clipboard for downloadable content. A perfect tool if you have a slow, inconsistent internet or daily data limit. - -#### Code Editors - -![Coding apps for Ubuntu][59] - -If you are into programming, the default Gedit text editor might not be sufficient for your coding needs. Here are some of the better code editors for you. - -##### Atom - -[Atom][60] is a free and [open source code editor][61] from GitHub. Even before it was launched its first stable version, it became a hot favorite among coders for its UI, features and vast range of plugins. - -##### Visual Studio Code - -[VS Code][62] is an open source code editor from Microsoft. Don’t worry about Microsoft, VS Code is an awesome editor for web development. It also supports a number of other programming languages. - -#### PDF and eBooks related applications - -![eBook Management tools in Ubuntu][63] - -In this digital age, you cannot only rely on the real paper books especially when there are plenty of free eBooks available. Here are some Ubuntu apps for managing PDFs and eBooks. - -##### Calibre - -If you are a bibliophile and collect eBooks, you should use [Calibre][64]. It is an eBook manager with all the necessary software for [creating eBooks][65], converting eBook formats and managing an eBook library. - -##### Okular - -Okular is mostly a PDF viewer with options for editing PDF files. You can do some basic [PDF editing on Linux][66] with Okular such as adding pop-ups notes, inline notes, freehand line drawing, highlighter, stamp etc. - -#### Messaging applications - -![Messaging apps for Ubuntu][67] - -I believe you use at least one [messaging app on Linux][68]. Here are my recommendations. - -##### Skype - -[Skype][69] is the most popular video chatting application. It is also used by many companies and businesses for interviews and meetings. This makes Skype one of the must-have applications for Ubuntu. - -##### Rambox - -[Rambox][70] is not a messaging application on its own. But it allows you to use Skype, Viber, Facebook Messanger, WhatsApp, Slack and a number of other messaging applications from a single application window. - -#### Notes and To-do List applications - -Need a to-do list app or simple an app for taking notes? Have a look at these: - -##### Simplenote - -![Simplenote logo][71] - -[Simplenote][72] is a free and open source note taking application from WordPress creators [Automattic][73]. It is available for Windows, Linux, macOS, iOS and Android. Your notes are synced to a cloud server and you can access them on any device. You can download the DEB file from its website. - -##### Remember The Milk - -![Remember The Milk logo][74] - -[Remember The Milk][75] is a popular to-do list application. It is available for Windows, Linux, macOS, iOS and Android. Your to-do list is accessible on all the devices you own. You can also access it from a web browser. It also has an official native application for Linux that you can download from its website. - -#### Password protection and encryption - -![Encryption software Ubuntu][76] - -If there are other people regularly using your computer perhaps you would like to add an extra layer of security by password protecting files and folders. - -##### EncryptPad - -[EncryptPad][77] is an open source text editor that allows you to lock your files with a password. You can choose the type of encryption. There is also a command line version of this tool. - -##### Gnome Encfs Manager - -Gnome Encfs Manager allows you to [lock folders with a password in Linux][78]. You can keep whatever files you want in a secret folder and then lock it with a password. - -#### Gaming - -![Gaming on Ubuntu][79] - -[Gaming on Linux][80] is a lot better than what it used to be a few years ago. You can enjoy plenty of games on Linux without going back to Windows. - -##### Steam - -[Steam][81] is a digital distribution platform that allows you to purchase (if required) games. Steam has over 1500 [games for Linux][82]. You can download the Steam client from the Software Center. - -##### PlayOnLinux - -[PlayOnLinux][83] allows you to run Windows games on Linux over WINE compatibility layer. Don’t expect too much out of it because not every game will run flawlessly with PlayOnLinux. - -#### Package Managers [Intermediate to advanced users] - -![Package Management tools Ubuntu][84] - -Ubuntu Software Center is more than enough for an average Ubuntu user’s software needs but you can have more control on it using these applications. - -##### Gdebi - -Gedbi is a tiny packagae manager that you can use for installing DEB files. It is faster than the Software Center and it also handles dependency issues. - -##### Synaptic - -Synaptic was the default GUI package manager for most Linux distributions a decade ago. It still is in some Linux distributions. This powerful package manager is particularly helpful in [finding installed applications and removing them][85]. - -#### Backup and Recovery tools - -![Backup and data recovery tools for Ubuntu][86] - -Backup and recovery tools are must-have software for any system. Let’s see what softwares you must have on Ubuntu. - -##### Timeshift - -Timeshift is a tool that allows you to [take a snapshot of your system][87]. This allows you to restore your system to a previous state in case of an unfortunate incident when your system configuration is messed up. Note that it’s not the best tool for your personal data backup though. For that, you can use Ubuntu’s default Deja Dup (also known as Backups) tool. - -##### TestDisk [Intermediate Users] - -This is another command line tool on this list of best Ubuntu application. [TestDisk][88] allows you to [recover data on Linux][89]. If you accidentally deleted files, there are still chances that you can get it back using TestDisk. - -#### System Tweaking and Management Tools - -![System Maintenance apps Ubuntu][90] - -##### GNOME/Unity Tweak Tool - -These Tweak tools are a must for every Ubuntu user. They allow you to access some advanced system settings. Best of all, you can [change themes in Ubuntu][91] using these tweak tools. - -##### UFW Firewall - -[UFW][92] stands for Uncomplicated Firewall and rightly so. UFW has predefined firewall settings for Home, Work and Public networks. - -##### Stacer - -If you want to free up space on Ubuntu, try Stacer. This graphical tool allows you to [optimize your Ubuntu system][93] by removing unnecessary files and completely uninstalling software. Download Stacer from [its website][94]. - -#### Other Utilities - -![Utilities Ubuntu][95] - -In the end, I’ll list some of my other favorite Ubuntu apps that I could not put into a certain category. - -##### Neofetch - -One more command line tool! Neofetch displays your system information such as [Ubuntu version][96], desktop environment, theme, icons, RAM etc info along with [ASCII logo of the distribution][97]. Use this command for installing Neofetch. -``` -sudo apt install neofetch - -``` - -##### Etcher - -Ubuntu has a live USB creator tool installed already but Etcher is a better application for this task. It is also available for Windows and macOS. You can download it [from its website][98]. - -##### gscan2pdf - -I use this tiny tool for the sole purpose of [converting images into PDF][99]. You can use it for combining multiple images into one PDF file as well. - -##### Audio Recorder - -Another tiny yet essential Ubuntu application for [recording audio on Ubuntu][100]. You can use it to record sound from system microphone, from music player or from any other source. - -### Your suggestions for essential Ubuntu applications? - -I would like to conclude my list of best Ubuntu apps here. I know that you might not need or use all of them but I am certain that you would like most of the software listed here. - -Did you find some useful applications that you didn’t know about before? If you would have to suggest your favorite Ubuntu application, which one would it be? - -In the end, if you find this article useful, please share it on social media, Reddit, Hacker News or other community or forums you visit regularly. This way you help us grow :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-ubuntu-apps/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[1]:https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ -[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/best-ubuntu-apps-featured.jpeg -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/google-chrome.jpeg -[4]:https://www.google.com/chrome/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/brave-browser-icon.jpeg -[6]:https://itsfoss.com/open-source-browsers-linux/ -[7]:https://brave.com/ -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/music-apps-ubuntu.jpeg -[9]:https://itsfoss.com/sayonara-music-player/ -[10]:https://www.audacityteam.org/ -[11]:https://itsfoss.com/musicbrainz-picard/ -[12]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/streaming-music-apps-ubuntu.jpeg -[13]:https://www.spotify.com// -[14]:https://itsfoss.com/install-spotify-ubuntu-1404/ -[15]:https://tiliado.eu/nuvolaplayer/ -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/Video-Players-linux.jpg -[17]:https://www.videolan.org/index.html -[18]:https://itsfoss.com/vlc-pro-tricks-linux/ -[19]:https://mpv.io/ -[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/dropbox-icon.jpeg -[21]:https://www.dropbox.com/ -[22]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/pcloud-icon.jpeg -[23]:https://itsfoss.com/recommends/pcloud/ -[24]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/gimp-icon.jpeg -[25]:https://www.gimp.org/ -[26]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/inkscape-icon.jpeg -[27]:https://inkscape.org/en/ -[28]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/paint-apps-ubuntu.jpeg -[29]:https://krita.org/en/ -[30]:https://pinta-project.com/pintaproject/pinta/ -[31]:https://itsfoss.com/image-applications-ubuntu-linux/ -[32]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/digikam-icon.jpeg -[33]:https://www.digikam.org/ -[34]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/darktable-icon.jpeg -[35]:https://www.darktable.org/ -[36]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/video-editing-apps-ubuntu.jpeg -[37]:https://itsfoss.com/best-video-editing-software-linux/ -[38]:https://kdenlive.org/en/ -[39]:https://shotcut.org/ -[40]:https://itsfoss.com/format-factory-alternative-linux/ -[41]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/xnconvert-logo.jpeg -[42]:https://www.xnview.com/en/xnconvert/ -[43]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/handbrake-logo.jpeg -[44]:https://handbrake.fr/ -[45]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/screen-recording-ubuntu-apps.jpeg -[46]:http://shutter-project.org/ -[47]:https://launchpad.net/kazam -[48]:https://itsfoss.com/best-linux-screen-recorders/ -[49]:https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[50]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/libre-office-logo.jpeg -[51]:https://www.libreoffice.org/download/download/ -[52]:https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/ -[53]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/wps-office-logo.jpeg -[54]:http://wps-community.org/ -[55]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/download-apps-ubuntu.jpeg -[56]:https://itsfoss.com/download-youtube-linux/ -[57]:http://ugetdm.com/ -[58]:https://itsfoss.com/4-best-download-managers-for-linux/ -[59]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/coding-apps-ubuntu.jpeg -[60]:https://atom.io/ -[61]:https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ -[62]:https://itsfoss.com/install-visual-studio-code-ubuntu/ -[63]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/pdf-management-apps-ubuntu.jpeg -[64]:https://calibre-ebook.com/ -[65]:https://itsfoss.com/create-ebook-calibre-linux/ -[66]:https://itsfoss.com/pdf-editors-linux/ -[67]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/messaging-apps-ubuntu.jpeg -[68]:https://itsfoss.com/best-messaging-apps-linux/ -[69]:https://www.skype.com/en/ -[70]:https://rambox.pro/ -[71]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/simplenote-logo.jpeg -[72]:http://simplenote.com/ -[73]:https://automattic.com/ -[74]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/remember-the-milk-logo.jpeg -[75]:https://itsfoss.com/remember-the-milk-linux/ -[76]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/encryption-apps-ubuntu.jpeg -[77]:https://itsfoss.com/encryptpad-encrypted-text-editor-linux/ -[78]:https://itsfoss.com/password-protect-folder-linux/ -[79]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/gaming-ubuntu.jpeg -[80]:https://itsfoss.com/linux-gaming-guide/ -[81]:https://store.steampowered.com/ -[82]:https://itsfoss.com/free-linux-games/ -[83]:https://www.playonlinux.com/en/ -[84]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/package-management-apps-ubuntu.jpeg -[85]:https://itsfoss.com/how-to-add-remove-programs-in-ubuntu/ -[86]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/backup-recovery-tools-ubuntu.jpeg -[87]:https://itsfoss.com/backup-restore-linux-timeshift/ -[88]:https://www.cgsecurity.org/wiki/TestDisk -[89]:https://itsfoss.com/recover-deleted-files-linux/ -[90]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/system-maintenance-apps-ubuntu.jpeg -[91]:https://itsfoss.com/install-themes-ubuntu/ -[92]:https://wiki.ubuntu.com/UncomplicatedFirewall -[93]:https://itsfoss.com/optimize-ubuntu-stacer/ -[94]:https://github.com/oguzhaninan/Stacer -[95]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/utilities-apps-ubuntu.jpeg -[96]:https://itsfoss.com/how-to-know-ubuntu-unity-version/ -[97]:https://itsfoss.com/display-linux-logo-in-ascii/ -[98]:https://etcher.io/ -[99]:https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/ -[100]:https://itsfoss.com/record-streaming-audio/ diff --git a/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md b/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md deleted file mode 100644 index 32a6a7dd3e..0000000000 --- a/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md +++ /dev/null @@ -1,232 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Different Ways To Update Linux Kernel For Ubuntu) -[#]: via: (https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -Different Ways To Update Linux Kernel For Ubuntu -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/ubuntu-linux-kernel-720x340.png) - -In this guide, we have given 7 different ways to update Linux kernel for Ubuntu. Among the 7 methods, five methods requires system reboot to apply the new Kernel and two methods don’t. Before updating Linux Kernel, it is **highly recommended to backup your important data!** All methods mentioned here are tested on Ubuntu OS only. We are not sure if they will work on other Ubuntu flavors (Eg. Xubuntu) and Ubuntu derivatives (Eg. Linux Mint). - -### Part A – Kernel Updates with reboot - -The following methods requires you to reboot your system to apply the new Linux Kernel. All of the following methods are recommended for personal or testing systems. Again, please backup your important data, configuration files and any other important stuff from your Ubuntu system. - -#### Method 1 – Update the Linux Kernel with dpkg (The manual way) - -This method helps you to manually download and install the latest available Linux kernel from **[kernel.ubuntu.com][1]** website. If you want to install most recent version (either stable or release candidate), this method will help. Download the Linux kernel version from the above link. As of writing this guide, the latest available version was **5.0-rc1** and latest stable version was **v4.20**. - -![][3] - -Click on the Linux Kernel version link of your choice and find the section for your architecture (‘Build for XXX’). In that section, download the two files with these patterns (where X.Y.Z is the highest version): - - 1. linux-image-*X.Y.Z*-generic-*.deb - 2. linux-modules-X.Y.Z*-generic-*.deb - - - -In a terminal, change directory to where the files are and run this command to manually install the kernel: - -``` -$ sudo dpkg --install *.deb -``` - -Reboot to use the new kernel: - -``` -$ sudo reboot -``` - -Check the kernel is as expected: - -``` -$ uname -r -``` - -For step by step instructions, please check the section titled under “Install Linux Kernel 4.15 LTS On DEB based systems” in the following guide. - -+ [Install Linux Kernel 4.15 In RPM And DEB Based Systems](https://www.ostechnix.com/install-linux-kernel-4-15-rpm-deb-based-systems/) - -The above guide is specifically written for 4.15 version. However, all the steps are same for installing latest versions too. - -**Pros:** No internet needed (You can download the Linux Kernel from any system). - -**Cons:** Manual update. Reboot necessary. - -#### Method 2 – Update the Linux Kernel with apt-get (The recommended method) - -This is the recommended way to install latest Linux kernel on Ubuntu-like systems. Unlike the previous method, this method will download and install latest Kernel version from Ubuntu official repositories instead of **kernel.ubuntu.com** website.. - -To update the whole system including the Kernel, just do: - -``` -$ sudo apt-get update - -$ sudo apt-get upgrade -``` - -If you want to update the Kernel only, run: - -``` -$ sudo apt-get upgrade linux-image-generic -``` - -**Pros:** Simple. Recommended method. - -**Cons:** Internet necessary. Reboot necessary. - -Updating Kernel from official repositories will mostly work out of the box without any problems. If it is the production system, this is the recommended way to update the Kernel. - -Method 1 and 2 requires user intervention to update Linux Kernels. The following methods (3, 4 & 5) are mostly automated. - -#### Method 3 – Update the Linux Kernel with Ukuu - -**Ukuu** is a Gtk GUI and command line tool that downloads the latest main line Linux kernel from **kernel.ubuntu.com** , and install it automatically in your Ubuntu desktop and server editions. Ukku is not only simplifies the process of manually downloading and installing new Kernels, but also helps you to safely remove the old and unnecessary Kernels. For more details, refer the following guide. - -+ [Ukuu – An Easy Way To Install And Upgrade Linux Kernel In Ubuntu-based Systems](https://www.ostechnix.com/ukuu-an-easy-way-to-install-and-upgrade-linux-kernel-in-ubuntu-based-systems/) - -**Pros:** Easy to install and use. Automatically installs main line Kernel. - -**Cons:** Internet necessary. Reboot necessary. - -#### Method 4 – Update the Linux Kernel with UKTools - -Just like Ukuu, the **UKTools** also fetches the latest stable Kernel from from **kernel.ubuntu.com** site and installs it automatically on Ubuntu and its derivatives like Linux Mint. More details about UKTools can be found in the link given below. - -+ [UKTools – Upgrade Latest Linux Kernel In Ubuntu And Derivatives](https://www.ostechnix.com/uktools-upgrade-latest-linux-kernel-in-ubuntu-and-derivatives/) - -**Pros:** Simple. Automated. - -**Cons:** Internet necessary. Reboot necessary. - -#### Method 5 – Update the Linux Kernel with Linux Kernel Utilities - -**Linux Kernel Utilities** is yet another program that makes the process of updating Linux kernel easy in Ubuntu-like systems. It is actually a set of BASH shell scripts used to compile and/or update latest Linux kernels for Debian and derivatives. It consists of three utilities, one for manually compiling and installing Kernel from source from [**http://www.kernel.org**][4] website, another for downloading and installing pre-compiled Kernels from from **** website. and third script is for removing the old kernels. For more details, please have a look at the following link. - -+ [Linux Kernel Utilities – Scripts To Compile And Update Latest Linux Kernel For Debian And Derivatives](https://www.ostechnix.com/linux-kernel-utilities-scripts-compile-update-latest-linux-kernel-debian-derivatives/) - -**Pros:** Simple. Automated. - -**Cons:** Internet necessary. Reboot necessary. - - -### Part B – Kernel Updates without reboot - -As I already said, all of above methods need you to reboot the server before the new kernel is active. If they are personal systems or testing machines, you could simply reboot and start using the new Kernel. But, what if they are production systems that requires zero downtime? No problem. This is where **Livepatching** comes in handy! - -The **livepatching** (or hot patching) allows you to install Linux updates or patches without rebooting, keeping your server at the latest security level, without any downtime. This is attractive for ‘always-on’ servers, such as web hosts, gaming servers, in fact, any situation where the server needs to stay on all the time. Linux vendors maintain patches only for security fixes, so this approach is best when security is your main concern. - -The following two methods doesn’t require system reboot and useful for updating Linux Kernel on production and mission-critical Ubuntu servers. - -#### Method 6 – Update the Linux Kernel Canonical Livepatch Service - -![][5] - -[**Canonical Livepatch Service**][6] applies Kernel updates, patches and security hotfixes automatically without rebooting the Ubuntu systems. It reduces the Ubuntu systems downtime and keep them secure. Canonical Livepatch Service can be set up either during or after installation. If you are using desktop Ubuntu, the Software Updater will automatically check for kernel patches and notify you. In a console-based system, it is up to you to run apt-get update regularly. It will install kernel security patches only when you run the command “apt-get upgrade”, hence is semi-automatic. - -Livepatch is free for three systems. If you have more than three, you need to upgrade to enterprise support solution named **Ubuntu Advantage** suite. This suite includes **Kernel Livepatching** and other services such as, - - * Extended Security Maintenance – critical security updates after Ubuntu end-of-life. - * Landscape – the systems management tool for using Ubuntu at scale. - * Knowledge Base – A private collection of articles and tutorials written by Ubuntu experts. - * Phone and web-based support. - - - -**Cost** - -Ubuntu Advantage includes three paid plans namely, Essential, Standard and Advanced. The basic plan (Essential plan) starts from **225 USD per year for one physical node** and **75 USD per year for one VPS**. It seems there is no monthly subscription for Ubuntu servers and desktops. You can view detailed information on all plans [**here**][7]. - -**Pros:** Simple. Semi-automatic. No reboot necessary. Free for 3 systems. - -**Cons:** Expensive for 4 or more hosts. No patch rollback. - -**Enable Canonical Livepatch Service** - -If you want to setup Livepatch service after installation, just do the following steps. - -Get a key at [**https://auth.livepatch.canonical.com/**][8]. - -``` -$ sudo snap install canonical-livepatch - -$ sudo canonical-livepatch enable your-key -``` - -#### Method 7 – Update the Linux Kernel with KernelCare - -![][9] - -[**KernelCare**][10] is the newest of all the live patching solutions. It is the product of [CloudLinux][11]. KernelCare runs on Ubuntu and other flavors of Linux. It checks for patch releases every 4 hours and will install them without confirmation. Patches can be rolled back if there are problems. - -**Cost** - -Fees, per server: **4 USD per month** , **45 USD per year**. - -Compared to Ubuntu Livepatch, kernelCare seems very cheap and affordable. Good thing is **monthly subscriptions are also available**. Another notable feature is it supports other Linux distributions, such as Red Hat, CentOS, Debian, Oracle Linux, Amazon Linux and virtualization platforms like OpenVZ, Proxmox etc. - -You can read all the features and benefits of KernelCare [**here**][12] and check all available plan details [**here**][13]. - -**Pros:** Simple. Fully automated. Wide OS coverage. Patch rollback. No reboot necessary. Free license for non-profit organizations. Low cost. - -**Cons:** Not free (except for 30 day trial). - -**Enable KernelCare Service** - -Get a 30-day trial key at [**https://cloudlinux.com/kernelcare-free-trial5**][14]. - -Run the following commands to enable KernelCare and register the key. - -``` -$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash - -$ sudo /usr/bin/kcarectl --register KEY -``` - -If you’re looking for an affordable and reliable commercial service to keep the Linux Kernel updated on your Linux servers, KernelCare is good to go. - -*with inputs from **Paul A. Jacobs** , a Technical Evangelist and Content Writer from Cloud Linux.* - -**Suggested read:** - -And, that’s all for now. Hope this was useful. If you believe any other tools/methods should include in this list, feel free to let us know in the comment section below. I will check and update this guide accordingly. - -More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: http://kernel.ubuntu.com/~kernel-ppa/mainline/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/Ubuntu-mainline-kernel.png -[4]: http://www.kernel.org -[5]: http://www.ostechnix.com/wp-content/uploads/2019/01/Livepatch.png -[6]: https://www.ubuntu.com/livepatch -[7]: https://www.ubuntu.com/support/plans-and-pricing -[8]: https://auth.livepatch.canonical.com/ -[9]: http://www.ostechnix.com/wp-content/uploads/2019/01/KernelCare.png -[10]: https://www.kernelcare.com/ -[11]: https://www.cloudlinux.com/ -[12]: https://www.kernelcare.com/update-kernel-linux/ -[13]: https://www.kernelcare.com/pricing/ -[14]: https://cloudlinux.com/kernelcare-free-trial5 diff --git a/sources/tech/20190116 Best Audio Editors For Linux.md b/sources/tech/20190116 Best Audio Editors For Linux.md deleted file mode 100644 index 3b14f5b366..0000000000 --- a/sources/tech/20190116 Best Audio Editors For Linux.md +++ /dev/null @@ -1,156 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MFGJT) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Best Audio Editors For Linux) -[#]: via: (https://itsfoss.com/best-audio-editors-linux) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Best Audio Editors For Linux -====== - -You’ve got a lot of choices when it comes to audio editors for Linux. No matter whether you are a professional music producer or just learning to create awesome music, the audio editors will always come in handy. - -Well, for professional-grade usage, a [DAW][1] (Digital Audio Workstation) is always recommended. However, not everyone needs all the functionalities, so you should know about some of the most simple audio editors as well. - -In this article, we will talk about a couple of DAWs and basic audio editors which are available as **free and open source** solutions for Linux and (probably) for other operating systems. - -### Top Audio Editors for Linux - -![Best audio editors and DAW for Linux][2] - -We will not be focusing on all the functionalities that DAWs offer – but the basic audio editing capabilities. You may still consider this as the list of best DAW for Linux. - -**Installation instruction:** You will find all the mentioned audio editors or DAWs in your AppCenter or Software center. In case, you do not find them listed, please head to their official website for more information. - -#### 1\. Audacity - -![audacity audio editor][3] - -Audacity is one of the most basic yet a capable audio editor available for Linux. It is a free and open-source cross-platform tool. A lot of you must be already knowing about it. - -It has improved a lot when compared to the time when it started trending. I do recall that I utilized it to “try” making karaokes by removing the voice from an audio file. Well, you can still do it – but it depends. - -**Features:** - -It also supports plug-ins that include VST effects. Of course, you should not expect it to support VST Instruments. - - * Live audio recording through a microphone or a mixer - * Export/Import capability supporting multiple formats and multiple files at the same time - * Plugin support: LADSPA, LV2, Nyquist, VST and Audio Unit effect plug-ins - * Easy editing with cut, paste, delete and copy functions. - * Spectogram view mode for analyzing frequencies - - - -#### 2\. LMMS - -![][4] - -LMMS is a free and open source (cross-platform) digital audio workstation. It includes all the basic audio editing functionalities along with a lot of advanced features. - -You can mix sounds, arrange them, or create them using VST instruments. It does support them. Also, it comes baked in with some samples, presets, VST Instruments, and effects to get started. In addition, you also get a spectrum analyzer for some advanced audio editing. - -**Features:** - - * Note playback via MIDI - * VST Instrument support - * Native multi-sample support - * Built-in compressor, limiter, delay, reverb, distortion and bass enhancer - - - -#### 3\. Ardour - -![Ardour audio editor][5] - -Ardour is yet another free and open source digital audio workstation. If you have an audio interface, Ardour will support it. Of course, you can add unlimited multichannel tracks. The multichannel tracks can also be routed to different mixer tapes for the ease of editing and recording. - -You can also import a video to it and edit the audio to export the whole thing. It comes with a lot of built-in plugins and supports VST plugins as well. - -**Features:** - - * Non-linear editing - * Vertical window stacking for easy navigation - * Strip silence, push-pull trimming, Rhythm Ferret for transient and note onset-based editing - - - -#### 4\. Cecilia - -![cecilia audio editor][6] - -Cecilia is not an ordinary audio editor application. It is meant to be used by sound designers or if you are just in the process of becoming one. It is technically an audio signal processing environment. It lets you create ear-bending sound out of them. - -You get in-build modules and plugins for sound effects and synthesis. It is tailored for a specific use – if that is what you were looking for – look no further! - -**Features:** - - * Modules to achieve more (UltimateGrainer – A state-of-the-art granulation processing, RandomAccumulator – Variable speed recording accumulator, -UpDistoRes – Distortion with upsampling and resonant lowpass filter) - * Automatic Saving of modulations - - - -#### 5\. Mixxx - -![Mixxx audio DJ ][7] - -If you want to mix and record something while being able to have a virtual DJ tool, [Mixxx][8] would be a perfect tool. You get to know the BPM, key, and utilize the master sync feature to match the tempo and beats of a song. Also, do not forget that it is yet another free and open source application for Linux! - -It supports custom DJ equipment as well. So, if you have one or a MIDI – you can record your live mixes using this tool. - -**Features** - - * Broadcast and record DJ Mixes of your song - * Ability to connect your equipment and perform live - * Key detection and BPM detection - - - -#### 6\. Rosegarden - -![rosegarden audio editor][9] - -Rosegarden is yet another impressive audio editor for Linux which is free and open source. It is neither a fully featured DAW nor a basic audio editing tool. It is a mixture of both with some scaled down functionalities. - -I wouldn’t recommend this for professionals but if you have a home studio or just want to experiment, this would be one of the best audio editors for Linux to have installed. - -**Features:** - - * Music notation editing - * Recording, Mixing, and samples - - - -### Wrapping Up - -These are some of the best audio editors you could find out there for Linux. No matter whether you need a DAW, a cut-paste editing tool, or a basic mixing/recording audio editor, the above-mentioned tools should help you out. - -Did we miss any of your favorite? Let us know about it in the comments below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-audio-editors-linux - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Digital_audio_workstation -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors-800x450.jpeg?resize=800%2C450&ssl=1 -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/audacity-audio-editor.jpg?fit=800%2C591&ssl=1 -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/lmms-daw.jpg?fit=800%2C472&ssl=1 -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/ardour-audio-editor.jpg?fit=800%2C639&ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/cecilia.jpg?fit=800%2C510&ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/mixxx.jpg?fit=800%2C486&ssl=1 -[8]: https://itsfoss.com/dj-mixxx-2/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/rosegarden.jpg?fit=800%2C391&ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors.jpeg?fit=800%2C450&ssl=1 diff --git a/sources/tech/20190204 Getting started with Git- Terminology 101.md b/sources/tech/20190204 Getting started with Git- Terminology 101.md new file mode 100644 index 0000000000..0b76cd3a43 --- /dev/null +++ b/sources/tech/20190204 Getting started with Git- Terminology 101.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Git: Terminology 101) +[#]: via: (https://opensource.com/article/19/2/git-terminology) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Getting started with Git: Terminology 101 +====== +Want to learn Git? Check out this quick summary of the most important +terms and commands. +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +Version control is an important tool for anyone looking to track their changes these days. It's especially helpful for programmers, sysadmins, and site reliability engineers (SREs) alike. The promise of recovering from mistakes to a known good state is a huge win and a touch friendlier than the previous strategy of adding **`.old`** to a copied file. + +But learning Git is often oversimplified by well-meaning peers telling everyone to "get into open source." Before you know it, someone asks for a _pull request_ or *merge request *where you _rebase_ from _upstream_ before they can merge from your _remote_—and be sure to remove _merge commits_. Whatever well-working contribution you want to give back to an open source project feels much further from being added when you look at all these words you don't know. + +![Git Cheat Sheet cover image][2] + +[Download][3] our +Git cheat sheet. + +If you have a month or two and enough curiosity, [Git SCM][4] is the definitive source for all the terms you need to learn. If you're looking for a summary from the trenches, keep reading. + +### Reminder: What's a commit? + +The toughest part of Git for me to internalize was the simplest idea of Git: _a commit is a collection of content, a message about how you got there, and the commits that came before it_. There's no inherent code release strategy or even strong opinions built in. The content doesn't even have to be code—it is _anything_ you want to add to the repository. The commit message annotates that content. + +I like to think of a commit message as a gift to your future self: it may mention the files you edited, but more importantly it reminds you of your intention for changing those files. Adding more about why you have edited what you have helps anyone who uses your repository, even when that person is you. + +### There's no place like 'origin/master' + +Knowing where you are in a Git project starts with thinking of a tree. All Git projects have a root, similar to the idea of a filesystem's root directory. All commits branch off from that root. In this way, a branch is only a pointer to a commit. By convention, **master** is the default name for the default branch in your root directory. + +Since Git is a distributed version control system, where the same codebase is distributed to multiple locations, people often use the term "repository" as a way of talking about all copies of the same project. There is the _local repository_, where you edit your code (more on that in a minute), and the _remote repository_, the place where you want to send it after you're finished. Remotes can be anywhere, even on the same computer where your local repository is located, but they are often hosted on repository services like GitLab or GitHub. + +### What's the pwd of Git commands? + +While it's not an official selling point, being lost is part of the fun of a Git repository. You can find your way by running through this reliable set of commands: + + * `git branch`—to find which branch you're on + + * `git log`—to see what commit you're on + + * `git status`—to see what edits you've made since the last commit + + * `git remote`—to see what remote repository you're tracking + + + + +Orienting yourself using these commands will give you a sense of direction when you're stuck. + +### Have I stashed or cached my commit? + +The code local to your computer is colloquially called your _workspace_. What is not immediately obvious is that you have two (yes, two!) other locations local to you when you are in a Git repository: _index_ and _stash_. When you write some content and then **add** it, you are adding it to the index, which is the cached content that is ready to commit. There are times when you have files in the index that you are not ready to commit, but you want to view another branch. That's where the stash comes in handy. You can store indexed-but-not-yet-committed files to the stash using `git stash`. When you're ready to retrieve the file, run `git stash pop` to bring changes back into the index. + +Here are some commands you'll need to use your stash and cache. + + * `git diff ..origin/master`—to show the difference between the most recent local commit and the remote called "origin" and its branch called "master" + + * `git diff --cached`—to show any differences between the most recent local commit and what has been added to the local index + + * `git stash`—to place indexed (added but not committed) files in the stash stack + + * `git stash list`—to show what changes are in the stash stack + + * `git stash pop`—to take the most recent change off the stash stack + + + + +### HEADless horseman + +Git is a collection of all kinds of metaphors. When I think of where the HEAD is, I think of train lines. If you end up in a _detached HEAD_ mode, it means you're off the metaphorical rails. + +HEAD is a pointer to your most recent commit in the currently checked-out branch. The default "checkout" is when you create a Git repository and land on the **master** branch. Every time you create or change to another branch, you are on that branch line. If you `git checkout ` somewhere in your current branch, HEAD will move to that commit. If there is no commit history connecting your current commit to the commit you checked out, then you'll be in a detached HEAD state. If you ever lose your head finding where HEAD is, you can always `git reset --hard origin/master` to delete changes and get back to a known state. _Warning: this will delete any changes you have made since you last pushed to master._ + +### Are you upstream or downstream? + +The local copy of your project is considered your local repository. It may or may not have a remote repository—the place where you have a copy of your repository for collaboration or safekeeping. There may also be an _upstream_ repository where a third copy of the project is hosted and maintained by a different set of contributors. + +For instance, let's say I want to contribute to Kubernetes. I would first fork the **kubernetes/kubernetes** project to my account, **mbbroberg/kubernetes**. I would then clone my project to my local workspace. In this scenario, my local clone is my local repository, **mbbroberg/kubernetes** is my remote repository, and **kubernetes/kubernetes** is the upstream. + +### Merging the metaphors + +The visual of a root system merges with the train tracks image when you get deeper into Git branches. Branches are often used as ways of developing a new feature that you eventually want to _merge_ into the master branch. When doing this, Git keeps the common history of commits in order then appends the new commits for your branch to the history. There are a ton of nuances to this process—whether to rebase or not, whether to add a merge commit or not—which [Brent Laster][5] explores in greater detail in "[How to reset, revert, and return to previous states in Git][6]." + +### I think I Git it now + +There is a ton of terminology and a lot to explore to master the world of Git commands. I hope this first-person exploration of how I use the terms day-to-day helps you acclimate to it all. If you ever feel stuck or frustrated, feel free to reach out to me on Twitter [@mbbroberg][7]. + +#### To review: + + * **Commit**—stores the current contents of the index in a new commit along with a log message from the user describing the changes + + * **Branch**—a pointer to a commit + + * **Master**—the default name for the first branch + + * **HEAD**—a pointer to the most recent commit on the current branch + + * **Merge**—joining two or more commit histories + + * **Workspace**—the colloquial name for your local copy of a Git repository + + * **Working tree**—the current branch in your workspace; you see this in `git status` output all the time + + * **Cache**—a space intended to temporarily store uncommitted changes + + * **Index**—the cache where changes are stored before they are committed + + * **Tracked and untracked files**—files either in the index cache or not yet added to it + + * **Stash**—another cache, that acts as a stack, where changes can be stored without committing them + + * **Origin**—the default name for a remote repository + + * **Local repository**—another term for where you keep your copy of a Git repository on your workstation + + * **Remote repository**—a secondary copy of a Git repository where you push changes for collaboration or backup + + * **Upstream repository**—the colloquial term for a remote repository that you track + + * **Pull request**—a GitHub-specific term to let others know about changes you've pushed to a branch in a repository + + * **Merge request**—a GitLab-specific term to let others know about changes you've pushed to a branch in a repository + + * **'origin/master'**—the default setting for a remote repository and its primary branch + + + + +Postscript: Puns are one of the best parts of Git. Have fun with them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/git-terminology + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://opensource.com/sites/default/files/uploads/git_cheat_sheet_cover.jpg (Git Cheat Sheet cover image) +[3]: https://opensource.com/downloads/cheat-sheet-git +[4]: https://git-scm.com/about +[5]: https://opensource.com/users/bclaster +[6]: https://opensource.com/article/18/6/git-reset-revert-rebase-commands +[7]: https://twitter.com/mbbroberg diff --git a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md deleted file mode 100644 index e8722c63cc..0000000000 --- a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) -[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Installing Kali Linux on VirtualBox: Quickest & Safest Way -====== - -_**This tutorial shows you how to install Kali Linux on Virtual Box in Windows and Linux in the quickest way possible.**_ - -[Kali Linux][1] is one of the [best Linux distributions for hacking][2] and security enthusiasts. - -Since it deals with a sensitive topic like hacking, it’s like a double-edged sword. We have discussed it in the detailed Kali Linux review in the past so I am not going to bore you with the same stuff again. - -While you can install Kali Linux by replacing the existing operating system, using it via a virtual machine would be a better and safer option. - -With Virtual Box, you can use Kali Linux as a regular application in your Windows/Linux system. It’s almost the same as running VLC or a game in your system. - -Using Kali Linux in a virtual machine is also safe. Whatever you do inside Kali Linux will NOT impact your ‘host system’ (i.e. your original Windows or Linux operating system). Your actual operating system will be untouched and your data in the host system will be safe. - -![][3] - -### How to install Kali Linux on VirtualBox - -I’ll be using [VirtualBox][4] here. It is a wonderful open source virtualization solution for just about anyone (professional or personal use). It’s available free of cost. - -In this tutorial, we will talk about Kali Linux in particular but you can install almost any other OS whose ISO file exists or a pre-built virtual machine save file is available. - -**Note:** _The same steps apply for Windows/Linux running VirtualBox._ - -As I already mentioned, you can have either Windows or Linux installed as your host. But, in this case, I have Windows 10 installed (don’t hate me!) where I try to install Kali Linux in VirtualBox step by step. - -And, the best part is – even if you happen to use a Linux distro as your primary OS, the same steps will be applicable! - -Wondering, how? Let’s see… - -[Subscribe to Our YouTube Channel for More Linux Videos][5] - -### Step by Step Guide to install Kali Linux on VirtualBox - -_We are going to use a custom Kali Linux image made for VirtualBox specifically. You can also download the ISO file for Kali Linux and create a new virtual machine – but why do that when you have an easy alternative?_ - -#### 1\. Download and install VirtualBox - -The first thing you need to do is to download and install VirtualBox from Oracle’s official website. - -[Download VirtualBox][6] - -Once you download the installer, just double click on it to install VirtualBox. It’s the same for [installing VirtualBox on Ubuntu][7]/Fedora Linux as well. - -#### 2\. Download ready-to-use virtual image of Kali Linux - -After installing it successfully, head to [Offensive Security’s download page][8] to download the VM image for VirtualBox. If you change your mind to utilize [VMware][9], that is available too. - -![][10] - -As you can see the file size is well over 3 GB, you should either use the torrent option or download it using a [download manager][11]. - -[Kali Linux Virtual Image][8] - -#### 3\. Install Kali Linux on Virtual Box - -Once you have installed VirtualBox and downloaded the Kali Linux image, you just need to import it to VirtualBox in order to make it work. - -Here’s how to import the VirtualBox image for Kali Linux: - -**Step 1** : Launch VirtualBox. You will notice an **Import** button – click on it - -![Click on Import button][12] - -**Step 2:** Next, browse the file you just downloaded and choose it to be imported (as you can see in the image below). The file name should start with ‘kali linux‘ and end with . **ova** extension. - -![Importing Kali Linux image][13] - -**S** Once selected, proceed by clicking on **Next**. - -**Step 3** : Now, you will be shown the settings for the virtual machine you are about to import. So, you can customize them or not – that is your choice. It is okay if you go with the default settings. - -You need to select a path where you have sufficient storage available. I would never recommend the **C:** drive on Windows. - -![Import hard drives as VDI][14] - -Here, the hard drives as VDI refer to virtually mount the hard drives by allocating the storage space set. - -After you are done with the settings, hit **Import** and wait for a while. - -**Step 4:** You will now see it listed. So, just hit **Start** to launch it. - -You might get an error at first for USB port 2.0 controller support, you can disable it to resolve it or just follow the on-screen instruction of installing an additional package to fix it. And, you are done! - -![Kali Linux running in VirtualBox][15] - -The default username in Kali Linux is root and the default password is toor. You should be able to login to the system with it. - -Do note that you should [update Kali Linux][16] before trying to install a new applications or trying to hack your neighbor’s WiFi. - -I hope this guide helps you easily install Kali Linux on Virtual Box. Of course, Kali Linux has a lot of useful tools in it for penetration testing – good luck with that! - -**Tip** : Both Kali Linux and Ubuntu are Debian-based. If you face any issues or error with Kali Linux, you may follow the tutorials intended for Ubuntu or Debian on the internet. - -### Bonus: Free Kali Linux Guide Book - -If you are just starting with Kali Linux, it will be a good idea to know how to use Kali Linux. - -Offensive Security, the company behind Kali Linux, has created a guide book that explains the basics of Linux, basics of Kali Linux, configuration, setups. It also has a few chapters on penetration testing and security tools. - -Basically, it has everything you need to get started with Kali Linux. And the best thing is that the book is available to download for free. - -[Download Kali Linux Revealed for FREE][17] - -Let us know in the comments below if you face an issue or simply share your experience with Kali Linux on VirtualBox. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-kali-linux-virtualbox/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.kali.org/ -[2]: https://itsfoss.com/linux-hacking-penetration-testing/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1 -[4]: https://www.virtualbox.org/ -[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[6]: https://www.virtualbox.org/wiki/Downloads -[7]: https://itsfoss.com/install-virtualbox-ubuntu/ -[8]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/ -[9]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1 -[11]: https://itsfoss.com/4-best-download-managers-for-linux/ -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1 -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1 -[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1 -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1 -[16]: https://linuxhandbook.com/update-kali-linux/ -[17]: https://kali.training/downloads/Kali-Linux-Revealed-1st-edition.pdf diff --git a/sources/tech/20190212 Top 10 Best Linux Media Server Software.md b/sources/tech/20190212 Top 10 Best Linux Media Server Software.md index 8fcea6343a..79b9dcb3bc 100644 --- a/sources/tech/20190212 Top 10 Best Linux Media Server Software.md +++ b/sources/tech/20190212 Top 10 Best Linux Media Server Software.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (kodark) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md b/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md deleted file mode 100644 index 615f7620ed..0000000000 --- a/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md +++ /dev/null @@ -1,135 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to build a WiFi picture frame with a Raspberry Pi) -[#]: via: (https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi) -[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) - -How to build a WiFi picture frame with a Raspberry Pi -====== -DIY a digital photo frame that streams photos from the cloud. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) - -Digital picture frames are really nice because they let you enjoy your photos without having to print them out. Plus, adding and removing digital files is a lot easier than opening a traditional frame and swapping the picture inside when you want to display a new photo. Even so, it's still a bit of overhead to remove your SD card, USB stick, or other storage from a digital picture frame, plug it into your computer, and copy new pictures onto it. - -An easier option is a digital picture frame that gets its pictures over WiFi, for example from a cloud service. Here's how to make one. - -### Gather your materials - - * Old [TFT][1] LCD screen - * HDMI-to-DVI cable (as the TFT screen supports DVI) - * Raspberry Pi 3 - * Micro SD card - * Raspberry Pi power supply - * Keyboard - * Mouse (optional) - - - -Connect the Raspberry Pi to the display using the cable and attach the power supply. - -### Install Raspbian - -**sudo raspi-config**. There I change the hostname (e.g., to **picframe** ) in Network Options and enable SSH to work remotely on the Raspberry Pi in Interfacing Options. Connect to the Raspberry Pi using (for example) . - -### Build and install the cloud client - -Download and flash Raspbian to the Micro SD card by following these [directions][2] . Plug the Micro SD card into the Raspberry Pi, boot it up, and configure your WiFi. My first action after a new Raspbian installation is usually running. There I change the hostname (e.g., to) in Network Options and enable SSH to work remotely on the Raspberry Pi in Interfacing Options. Connect to the Raspberry Pi using (for example) - -I use [Nextcloud][3] to synchronize my pictures, but you could use NFS, [Dropbox][4], or whatever else fits your needs to upload pictures to the frame. - -If you use Nextcloud, get a client for Raspbian by following these [instructions][5]. This is handy for placing new pictures on your picture frame and will give you the client application you may be familiar with on a desktop PC. When connecting the client application to your Nextcloud server, make sure to select only the folder where you'll store the images you want to be displayed on the picture frame. - -### Set up the slideshow - -The easiest way I've found to set up the slideshow is with a [lightweight slideshow project][6] built for exactly this purpose. There are some alternatives, like configuring a screensaver, but this application appears to be the simplest to set up. - -On your Raspberry Pi, download the binaries from the latest release, unpack them, and move them to an executable folder: - -``` -wget https://github.com/NautiluX/slide/releases/download/v0.9.0/slide_pi_stretch_0.9.0.tar.gz -tar xf slide_pi_stretch_0.9.0.tar.gz -mv slide_0.9.0/slide /usr/local/bin/ -``` - -Install the dependencies: - -``` -sudo apt install libexif12 qt5-default -``` - -Run the slideshow by executing the command below (don't forget to modify the path to your images). If you access your Raspberry Pi via SSH, set the **DISPLAY** variable to start the slideshow on the display attached to the Raspberry Pi. - -``` -DISPLAY=:0.0 slide -p /home/pi/nextcloud/picframe -``` - -### Autostart the slideshow - -To autostart the slideshow on Raspbian Stretch, create the following folder and add an **autostart** file to it: - -``` -mkdir -p /home/pi/.config/lxsession/LXDE/ -vi /home/pi/.config/lxsession/LXDE/autostart -``` - -Insert the following commands to autostart your slideshow. The **slide** command can be adjusted to your needs: - -``` -@xset s noblank -@xset s off -@xset -dpms -@slide -p -t 60 -o 200 -p /home/pi/nextcloud/picframe -``` - -Disable screen blanking, which the Raspberry Pi normally does after 10 minutes, by editing the following file: - -``` -vi /etc/lightdm/lightdm.conf -``` - -and adding these two lines to the end: - -``` -[SeatDefaults] -xserver-command=X -s 0 -dpms -``` - -### Configure a power-on schedule - -You can schedule your picture frame to turn on and off at specific times by using two simple cronjobs. For example, say you want it to turn on automatically at 7 am and turn off at 11 pm. Run **crontab -e** and insert the following two lines. - -``` -0 23 * * * /opt/vc/bin/tvservice -o - -0 7 * * * /opt/vc/bin/tvservice -p && sudo systemctl restart display-manager -``` - -Note that this won't turn the Raspberry Pi power's on and off; it will just turn off HDMI, which will turn the screen off. The first line will power off HDMI at 11 pm. The second line will bring the display back up and restart the display manager at 7 am. - -### Add a final touch - -By following these simple steps, you can create your own WiFi picture frame. If you want to give it a nicer look, build a wooden frame for the display. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi - -作者:[Manuel Dewald][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ntlx -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Thin-film-transistor_liquid-crystal_display -[2]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md -[3]: https://nextcloud.com/ -[4]: http://dropbox.com/ -[5]: https://github.com/nextcloud/client_theming#building-on-debian -[6]: https://github.com/NautiluX/slide/releases/tag/v0.9.0 diff --git a/sources/tech/20190218 Talk, then code.md b/sources/tech/20190218 Talk, then code.md deleted file mode 100644 index 18ed81e43c..0000000000 --- a/sources/tech/20190218 Talk, then code.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Talk, then code) -[#]: via: (https://dave.cheney.net/2019/02/18/talk-then-code) -[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) - -Talk, then code -====== - -The open source projects that I contribute to follow a philosophy which I describe as _talk, then code_. I think this is generally a good way to develop software and I want to spend a little time talking about the benefits of this methodology. - -### Avoiding hurt feelings - -The most important reason for discussing the change you want to make is it avoids hurt feelings. Often I see a contributor work hard in isolation on a pull request only to find their work is rejected. This can be for a bunch of reasons; the PR is too large, the PR doesn’t follow the local style, the PR fixes an issue which wasn’t important to the project or was recently fixed indirectly, and many more. - -The underlying cause of all these issues is a lack of communication. The goal of the _talk, then code_ philosophy is not to impede or frustrate, but to ensure that a feature lands correctly the first time, without incurring significant maintenance debt, and neither the author of the change, or the reviewer, has to carry the emotional burden of dealing with hurt feelings when a change appears out of the blue with an implicit “well, I’ve done the work, all you have to do is merge it, right?” - -### What does discussion look like? - -Every new feature or bug fix should be discussed with the maintainer(s) of the project before work commences. It’s fine to experiment privately, but do not send a change without discussing it first. - -The definition of _talk_ for simple changes can be as little as a design sketch in a GitHub issue. If your PR fixes a bug, you should link to the bug it fixes. If there isn’t one, you should raise a bug and wait for the maintainers to acknowledge it before sending a PR. This might seem a little backward–who wouldn’t want a bug fixed–but consider the bug could be a misunderstanding in how the software works or it could be a symptom of a larger problem that needs further investigation. - -For more complicated changes, especially feature requests, I recommend that a design document be circulated and agreed upon before sending code. This doesn’t have to be a full blown document, a sketch in an issue may be sufficient, but the key is to reach agreement using words, before locking it in stone with code. - -In all cases you shouldn’t proceed to send code until there is a positive agreement from the maintainer that the approach is one they are happy with. A pull request is for life, not just for Christmas. - -### Code review, not design by committee - -A code review is not the place for arguments about design. This is for two reasons. First, most code review tools are not suitable for long comment threads, GitHub’s PR interface is very bad at this, Gerrit is better, but few have a team of admins to maintain a Gerrit instance. More importantly, disagreements at the code review stage suggests there wasn’t agreement on how the change should be implemented. - -* * * - -Talk about what you want to code, then code what you talked about. Please don’t do it the other way around. - -### Related posts: - - 1. [How to include C code in your Go package][1] - 2. [Let’s talk about logging][2] - 3. [The value of TDD][3] - 4. [Suggestions for contributing to an Open Source project][4] - - - --------------------------------------------------------------------------------- - -via: https://dave.cheney.net/2019/02/18/talk-then-code - -作者:[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://dave.cheney.net/2013/09/07/how-to-include-c-code-in-your-go-package (How to include C code in your Go package) -[2]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) -[3]: https://dave.cheney.net/2016/04/11/the-value-of-tdd (The value of TDD) -[4]: https://dave.cheney.net/2016/03/12/suggestions-for-contributing-to-an-open-source-project (Suggestions for contributing to an Open Source project) diff --git a/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md b/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md index 80ddb77264..ab1207cc30 100644 --- a/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md +++ b/sources/tech/20190325 Reducing sysadmin toil with Kubernetes controllers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chen-ni) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -140,7 +140,7 @@ via: https://opensource.com/article/19/3/reducing-sysadmin-toil-kubernetes-contr 作者:[Paul Czarkowski][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[chen-ni](https://github.com/chen-ni) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 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 deleted file mode 100644 index 4d46fef81f..0000000000 --- a/sources/tech/20190510 Learn to change history with git rebase.md +++ /dev/null @@ -1,597 +0,0 @@ -Translating by Scoutydren.... - - -[#]: collector: (lujun9972) -[#]: translator: (Scoutydren) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn to change history with git rebase!) -[#]: via: (https://git-rebase.io/) -[#]: author: (git-rebase https://git-rebase.io/) - -Learn to change history with git rebase! -====== -One of Git 's core value-adds is the ability to edit history. Unlike version control systems that treat the history as a sacred record, in git we can change history to suit our needs. This gives us a lot of powerful tools and allows us to curate a good commit history in the same way we use refactoring to uphold good software design practices. These tools can be a little bit intimidating to the novice or even intermediate git user, but this guide will help to demystify the powerful git-rebase . - -``` -A word of caution : changing the history of public, shared, or stable branches is generally advised against. Editing the history of feature branches and personal forks is fine, and editing commits that you haven't pushed yet is always okay. Use git push -f to force push your changes to a personal fork or feature branch after editing your commits. -``` - -Despite the scary warning, it's worth mentioning that everything mentioned in this guide is a non-destructive operation. It's actually pretty difficult to permanently lose data in git. Fixing things when you make mistakes is covered at the end of this guide. - -### Setting up a sandbox - -We don't want to mess up any of your actual repositories, so throughout this guide we'll be working with a sandbox repo. Run these commands to get started: - -``` -git init /tmp/rebase-sandbox -cd /tmp/rebase-sandbox -git commit --allow-empty -m"Initial commit" -``` - -If you run into trouble, just run rm -rf /tmp/rebase-sandbox and run these steps again to start over. Each step of this guide can be run on a fresh sandbox, so it's not necessary to re-do every task. - - -### Amending your last commit - -Let's start with something simple: fixing your most recent commit. Let's add a file to our sandbox - and make a mistake: - -``` -echo "Hello wrold!" >greeting.txt - git add greeting.txt - git commit -m"Add greeting.txt" -``` - -Fixing this mistake is pretty easy. We can just edit the file and commit with `--amend`, like so: - -``` -echo "Hello world!" >greeting.txt - git commit -a --amend -``` - -Specifying `-a` automatically stages (i.e. `git add`'s) all files that git already knows about, and `--amend` will squash the changes into the most recent commit. Save and quit your editor (you have a chance to change the commit message now if you'd like). You can see the fixed commit by running `git show`: - -``` -commit f5f19fbf6d35b2db37dcac3a55289ff9602e4d00 (HEAD -> master) -Author: Drew DeVault -Date: Sun Apr 28 11:09:47 2019 -0400 - - Add greeting.txt - -diff --git a/greeting.txt b/greeting.txt -new file mode 100644 -index 0000000..cd08755 ---- /dev/null -+++ b/greeting.txt -@@ -0,0 +1 @@ -+Hello world! -``` - -### Fixing up older commits - -Amending only works for the most recent commit. What happens if you need to correct an older commit? Let's start by setting up our sandbox accordingly: - -``` -echo "Hello!" >greeting.txt -git add greeting.txt -git commit -m"Add greeting.txt" - -echo "Goodbye world!" >farewell.txt -git add farewell.txt -git commit -m"Add farewell.txt" -``` - -Looks like `greeting.txt` is missing "world". Let's write a commit normally which fixes that: - -``` -echo "Hello world!" >greeting.txt -git commit -a -m"fixup greeting.txt" -``` - -So now the files look correct, but our history could be better - let's use the new commit to "fixup" the last one. For this, we need to introduce a new tool: the interactive rebase. We're going to edit the last three commits this way, so we'll run `git rebase -i HEAD~3` (`-i` for interactive). This'll open your text editor with something like this: - -``` -pick 8d3fc77 Add greeting.txt -pick 2a73a77 Add farewell.txt -pick 0b9d0bb fixup greeting.txt - -# Rebase f5f19fb..0b9d0bb onto f5f19fb (3 commands) -# -# Commands: -# p, pick = use commit -# f, fixup = like "squash", but discard this commit's log message -``` - -This is the rebase plan, and by editing this file you can instruct git on how to edit history. I've trimmed the summary to just the details relevant to this part of the rebase guide, but feel free to skim the full summary in your text editor. - -When we save and close our editor, git is going to remove all of these commits from its history, then execute each line one at a time. By default, it's going to pick each commit, summoning it from the heap and adding it to the branch. If we don't edit this file at all, we'll end up right back where we started, picking every commit as-is. We're going to use one of my favorite features now: fixup. Edit the third line to change the operation from "pick" to "fixup" and move it to immediately after the commit we want to "fix up": - -``` -pick 8d3fc77 Add greeting.txt -fixup 0b9d0bb fixup greeting.txt -pick 2a73a77 Add farewell.txt -``` - -**Tip** : We can also abbreviate this with just "f" to speed things up next time. - -Save and quit your editor - git will run these commands. We can check the log to verify the result: - -``` -$ git log -2 --oneline -fcff6ae (HEAD -> master) Add farewell.txt -a479e94 Add greeting.txt -``` - -### Squashing several commits into one - -As you work, you may find it useful to write lots of commits as you reach small milestones or fix bugs in previous commits. However, it may be useful to "squash" these commits together, to make a cleaner history before merging your work into master. For this, we'll use the "squash" operation. Let's start by writing a bunch of commits - just copy and paste this if you want to speed it up: - -``` -git checkout -b squash -for c in H e l l o , ' ' w o r l d; do - echo "$c" >>squash.txt - git add squash.txt - git commit -m"Add '$c' to squash.txt" -done -``` - -That's a lot of commits to make a file that says "Hello, world"! Let's start another interactive rebase to squash them together. Note that we checked out a branch to try this on, first. Because of that, we can quickly rebase all of the commits since we branched by using `git rebase -i master`. The result: - -``` -pick 1e85199 Add 'H' to squash.txt -pick fff6631 Add 'e' to squash.txt -pick b354c74 Add 'l' to squash.txt -pick 04aaf74 Add 'l' to squash.txt -pick 9b0f720 Add 'o' to squash.txt -pick 66b114d Add ',' to squash.txt -pick dc158cd Add ' ' to squash.txt -pick dfcf9d6 Add 'w' to squash.txt -pick 7a85f34 Add 'o' to squash.txt -pick c275c27 Add 'r' to squash.txt -pick a513fd1 Add 'l' to squash.txt -pick 6b608ae Add 'd' to squash.txt - -# Rebase 1af1b46..6b608ae onto 1af1b46 (12 commands) -# -# Commands: -# p, pick = use commit -# s, squash = use commit, but meld into previous commit -``` - -**Tip** : your local master branch evolves independently of the remote master branch, and git stores the remote branch as `origin/master`. Combined with this trick, `git rebase -i origin/master` is often a very convenient way to rebase all of the commits which haven't been merged upstream yet! - -We're going to squash all of these changes into the first commit. To do this, change every "pick" operation to "squash", except for the first line, like so: - -``` -pick 1e85199 Add 'H' to squash.txt -squash fff6631 Add 'e' to squash.txt -squash b354c74 Add 'l' to squash.txt -squash 04aaf74 Add 'l' to squash.txt -squash 9b0f720 Add 'o' to squash.txt -squash 66b114d Add ',' to squash.txt -squash dc158cd Add ' ' to squash.txt -squash dfcf9d6 Add 'w' to squash.txt -squash 7a85f34 Add 'o' to squash.txt -squash c275c27 Add 'r' to squash.txt -squash a513fd1 Add 'l' to squash.txt -squash 6b608ae Add 'd' to squash.txt -``` - -When you save and close your editor, git will think about this for a moment, then open your editor again to revise the final commit message. You'll see something like this: - -``` -# This is a combination of 12 commits. -# This is the 1st commit message: - -Add 'H' to squash.txt - -# This is the commit message #2: - -Add 'e' to squash.txt - -# This is the commit message #3: - -Add 'l' to squash.txt - -# This is the commit message #4: - -Add 'l' to squash.txt - -# This is the commit message #5: - -Add 'o' to squash.txt - -# This is the commit message #6: - -Add ',' to squash.txt - -# This is the commit message #7: - -Add ' ' to squash.txt - -# This is the commit message #8: - -Add 'w' to squash.txt - -# This is the commit message #9: - -Add 'o' to squash.txt - -# This is the commit message #10: - -Add 'r' to squash.txt - -# This is the commit message #11: - -Add 'l' to squash.txt - -# This is the commit message #12: - -Add 'd' to squash.txt - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit. -# -# Date: Sun Apr 28 14:21:56 2019 -0400 -# -# interactive rebase in progress; onto 1af1b46 -# Last commands done (12 commands done): -# squash a513fd1 Add 'l' to squash.txt -# squash 6b608ae Add 'd' to squash.txt -# No commands remaining. -# You are currently rebasing branch 'squash' on '1af1b46'. -# -# Changes to be committed: -# new file: squash.txt -# -``` - -This defaults to a combination of all of the commit messages which were squashed, but leaving it like this is almost always not what you want. The old commit messages may be useful for reference when writing the new one, though. - -**Tip** : the "fixup" command you learned about in the previous section can be used for this purpose, too - but it discards the messages of the squashed commits. - -Let's delete everything and replace it with a better commit message, like this: - -``` -Add squash.txt with contents "Hello, world" - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit. -# -# Date: Sun Apr 28 14:21:56 2019 -0400 -# -# interactive rebase in progress; onto 1af1b46 -# Last commands done (12 commands done): -# squash a513fd1 Add 'l' to squash.txt -# squash 6b608ae Add 'd' to squash.txt -# No commands remaining. -# You are currently rebasing branch 'squash' on '1af1b46'. -# -# Changes to be committed: -# new file: squash.txt -# -``` - -Save and quit your editor, then examine your git log - success! - -``` -commit c785f476c7dff76f21ce2cad7c51cf2af00a44b6 (HEAD -> squash) -Author: Drew DeVault -Date: Sun Apr 28 14:21:56 2019 -0400 - - Add squash.txt with contents "Hello, world" -``` - -Before we move on, let's pull our changes into the master branch and get rid of this scratch one. We can use `git rebase` like we use `git merge`, but it avoids making a merge commit: - -``` -git checkout master -git rebase squash -git branch -D squash -``` - -We generally prefer to avoid using git merge unless we're actually merging unrelated histories. If you have two divergent branches, a git merge is useful to have a record of when they were... merged. In the course of your normal work, rebase is often more appropriate. - -### Splitting one commit into several - -Sometimes the opposite problem happens - one commit is just too big. Let's look into splitting it up. This time, let's write some actual code. Start with a simple C program2 (you can still copy+paste this snippet into your shell to do this quickly): - -``` -cat <main.c -int main(int argc, char *argv[]) { - return 0; -} -EOF -``` - -We'll commit this first. - -``` -git add main.c -git commit -m"Add C program skeleton" -``` - -Next, let's extend the program a bit: - -``` -cat <main.c -#include <stdio.h> - -const char *get_name() { - static char buf[128]; - scanf("%s", buf); - return buf; -} - -int main(int argc, char *argv[]) { - printf("What's your name? "); - const char *name = get_name(); - printf("Hello, %s!\n", name); - return 0; -} -EOF -``` - -After we commit this, we'll be ready to learn how to split it up. - -``` -git commit -a -m"Flesh out C program" -``` - -The first step is to start an interactive rebase. Let's rebase both commits with `git rebase -i HEAD~2`, giving us this rebase plan: - -``` -pick 237b246 Add C program skeleton -pick b3f188b Flesh out C program - -# Rebase c785f47..b3f188b onto c785f47 (2 commands) -# -# Commands: -# p, pick = use commit -# e, edit = use commit, but stop for amending -``` - -Change the second commit's command from "pick" to "edit", then save and close your editor. Git will think about this for a second, then present you with this: - -``` -Stopped at b3f188b... Flesh out C program -You can amend the commit now, with - - git commit --amend - -Once you are satisfied with your changes, run - - git rebase --continue -``` - -We could follow these instructions to add new changes to the commit, but instead let's do a "soft reset"3 by running `git reset HEAD^`. If you run `git status` after this, you'll see that it un-commits the latest commit and adds its changes to the working tree: - -``` -Last commands done (2 commands done): - pick 237b246 Add C program skeleton - edit b3f188b Flesh out C program -No commands remaining. -You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. - (Once your working directory is clean, run "git rebase --continue") - -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git checkout -- ..." to discard changes in working directory) - - modified: main.c - -no changes added to commit (use "git add" and/or "git commit -a") -``` - -To split this up, we're going to do an interactive commit. This allows us to selectively commit only specific changes from the working tree. Run `git commit -p` to start this process, and you'll be presented with the following prompt: - -``` -diff --git a/main.c b/main.c -index b1d9c2c..3463610 100644 ---- a/main.c -+++ b/main.c -@@ -1,3 +1,14 @@ -+#include <stdio.h> -+ -+const char *get_name() { -+ static char buf[128]; -+ scanf("%s", buf); -+ return buf; -+} -+ - int main(int argc, char *argv[]) { -+ printf("What's your name? "); -+ const char *name = get_name(); -+ printf("Hello, %s!\n", name); - return 0; - } -Stage this hunk [y,n,q,a,d,s,e,?]? -``` - -Git has presented you with just one "hunk" (i.e. a single change) to consider committing. This one is too big, though - let's use the "s" command to "split" up the hunk into smaller parts. - -``` -Split into 2 hunks. -@@ -1 +1,9 @@ -+#include -+ -+const char *get_name() { -+ static char buf[128]; -+ scanf("%s", buf); -+ return buf; -+} -+ - int main(int argc, char *argv[]) { -Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? -``` - -**Tip** : If you're curious about the other options, press "?" to summarize them. - -This hunk looks better - a single, self-contained change. Let's hit "y" to answer the question (and stage that "hunk"), then "q" to "quit" the interactive session and proceed with the commit. Your editor will pop up to ask you to enter a suitable commit message. - -``` -Add get_name function to C program - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit. -# -# interactive rebase in progress; onto c785f47 -# Last commands done (2 commands done): -# pick 237b246 Add C program skeleton -# edit b3f188b Flesh out C program -# No commands remaining. -# You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. -# -# Changes to be committed: -# modified: main.c -# -# Changes not staged for commit: -# modified: main.c -# -``` - -Save and close your editor, then we'll make the second commit. We could do another interactive commit, but since we just want to include the rest of the changes in this commit we'll just do this: - -``` -git commit -a -m"Prompt user for their name" -git rebase --continue -``` - -That last command tells git that we're done editing this commit, and to continue to the next rebase command. That's it! Run `git log` to see the fruits of your labor: - -``` -$ git log -3 --oneline -fe19cc3 (HEAD -> master) Prompt user for their name -659a489 Add get_name function to C program -237b246 Add C program skeleton -``` - -### Reordering commits - -This one is pretty easy. Let's start by setting up our sandbox: - -``` -echo "Goodbye now!" >farewell.txt -git add farewell.txt -git commit -m"Add farewell.txt" - -echo "Hello there!" >greeting.txt -git add greeting.txt -git commit -m"Add greeting.txt" - -echo "How're you doing?" >inquiry.txt -git add inquiry.txt -git commit -m"Add inquiry.txt" -``` - -The git log should now look like this: - -``` -f03baa5 (HEAD -> master) Add inquiry.txt -a4cebf7 Add greeting.txt -90bb015 Add farewell.txt -``` - -Clearly, this is all out of order. Let's do an interactive rebase of the past 3 commits to resolve this. Run `git rebase -i HEAD~3` and this rebase plan will appear: - -``` -pick 90bb015 Add farewell.txt -pick a4cebf7 Add greeting.txt -pick f03baa5 Add inquiry.txt - -# Rebase fe19cc3..f03baa5 onto fe19cc3 (3 commands) -# -# Commands: -# p, pick = use commit -# -# These lines can be re-ordered; they are executed from top to bottom. -``` - -The fix is now straightforward: just reorder these lines in the order you wish for the commits to appear. Should look something like this: - -``` -pick a4cebf7 Add greeting.txt -pick f03baa5 Add inquiry.txt -pick 90bb015 Add farewell.txt -``` - -Save and close your editor and git will do the rest for you. Note that it's possible to end up with conflicts when you do this in practice - click here for help resolving conflicts. - -### git pull --rebase - -If you've been writing some commits on a branch which has been updated upstream, normally `git pull` will create a merge commit. In this respect, `git pull`'s behavior by default is equivalent to: - -``` -git fetch origin -git merge origin/master -``` - -There's another option, which is often more useful and leads to a much cleaner history: `git pull --rebase`. Unlike the merge approach, this is equivalent to the following: - -``` -git fetch origin -git rebase origin/master -``` - -The merge approach is simpler and easier to understand, but the rebase approach is almost always what you want to do if you understand how to use git rebase. If you like, you can set it as the default behavior like so: - -``` -git config --global pull.rebase true -``` - -When you do this, technically you're applying the procedure we discuss in the next section... so let's explain what it means to do that deliberately, too. - -### Using git rebase to... rebase - -Ironically, the feature of git rebase that I use the least is the one it's named for: rebasing branches. Say you have the following branches: - -``` -o--o--o--o--> master - \--o--o--> feature-1 - \--o--> feature-2 -``` - -It turns out feature-2 doesn't depend on any of the changes in feature-1, so you can just base it off of master. The fix is thus: - -``` -git checkout feature-2 -git rebase master -``` - -The non-interactive rebase does the default operation for all implicated commits ("pick")4, which simply rolls your history back to the last common anscestor and replays the commits from both branches. Your history now looks like this: - -``` -o--o--o--o--> master - | \--o--> feature-2 - \--o--o--> feature-1 -``` - -### Resolving conflicts - -The details on resolving merge conflicts are beyond the scope of this guide - keep your eye out for another guide for this in the future. Assuming you're familiar with resolving conflicts in general, here are the specifics that apply to rebasing. - -The details on resolving merge conflicts are beyond the scope of this guide - keep your eye out for another guide for this in the future. Assuming you're familiar with resolving conflicts in general, here are the specifics that apply to rebasing. - -Sometimes you'll get a merge conflict when doing a rebase, which you can handle just like any other merge conflict. Git will set up the conflict markers in the affected files, `git status` will show you what you need to resolve, and you can mark files as resolved with `git add` or `git rm`. However, in the context of a git rebase, there are two options you should be aware of. - -The first is how you complete the conflict resolution. Rather than `git commit` like you'll use when addressing conflicts that arise from `git merge`, the appropriate command for rebasing is `git rebase --continue`. However, there's another option available to you: `git rebase --skip`. This will skip the commit you're working on, and it won't be included in the rebase. This is most common when doing a non-interactive rebase, when git doesn't realize that a commit it's pulled from the "other" branch is an updated version of the commit that it conflicts with on "our" branch. - -### Help! I broke it! - -No doubt about it - rebasing can be hard sometimes. If you've made a mistake and in so doing lost commits which you needed, then `git reflog` is here to save the day. Running this command will show you every operation which changed a ref, or reference - that is, branches and tags. Each line shows you what the old reference pointed to, and you can `git cherry-pick`, `git checkout`, `git show`, or use any other operation on git commits once thought lost. - - --------------------------------------------------------------------------------- - -via: https://git-rebase.io/ - -作者:[git-rebase][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://git-rebase.io/ -[b]: https://github.com/lujun9972 diff --git a/sources/tech/20190523 Run your blog on GitHub Pages with Python.md b/sources/tech/20190523 Run your blog on GitHub Pages with Python.md deleted file mode 100644 index da6c13a20e..0000000000 --- a/sources/tech/20190523 Run your blog on GitHub Pages with Python.md +++ /dev/null @@ -1,235 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Run your blog on GitHub Pages with Python) -[#]: via: (https://opensource.com/article/19/5/run-your-blog-github-pages-python) -[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani) - -Run your blog on GitHub Pages with Python -====== -Create a blog with Pelican, a Python-based blogging platform that works -well with GitHub. -![Raspberry Pi and Python][1] - -[GitHub][2] is a hugely popular web service for source code control that uses [Git][3] to synchronize local files with copies kept on GitHub's servers so you can easily share and back up your work. - -In addition to providing a user interface for code repositories, GitHub also enables users to [publish web pages][4] directly from a repository. The website generation package GitHub recommends is [Jekyll][5], written in Ruby. Since I'm a bigger fan of [Python][6], I prefer [Pelican][7], a Python-based blogging platform that works well with GitHub. - -Pelican and Jekyll both transform content written in [Markdown][8] or [reStructuredText][9] into HTML to generate static websites, and both generators support themes that allow unlimited customization. - -In this article, I'll describe how to install Pelican, set up your GitHub repository, run a quickstart helper, write some Markdown files, and publish your first page. I'll assume that you have a [GitHub account][10], are comfortable with [basic Git commands][11], and want to publish a blog using Pelican. - -### Install Pelican and create the repo - -First things first, Pelican (and **ghp-import** ) must be installed on your local machine. This is super easy with [pip][12], the Python package installation tool (you have pip right?): - - -``` -`$ pip install pelican ghp-import` -``` - -Next, open a browser and create a new repository on GitHub for your sweet new blog. Name it as follows (substituting your GitHub username for here and throughout this tutorial): - - -``` -`https://GitHub.com/username/username.github.io` -``` - -Leave it empty; we will fill it with compelling blog content in a moment. - -Using a command line (you command line right?), clone your empty Git repository to your local machine: - - -``` -$ git clone blog -$ cd blog -``` - -### That one weird trick… - -Here's a not-super-obvious trick about publishing web content on GitHub. For user pages (pages hosted in repos named _username.github.io_ ), the content is served from the **master** branch. - -I strongly prefer not to keep all the Pelican configuration files and raw Markdown files in **master** , rather just the web content. So I keep the Pelican configuration and the raw content in a separate branch I like to call **content**. (You can call it whatever you want, but the following instructions will call it **content**.) I like this structure since I can throw away all the files in **master** and re-populate it with the **content** branch. - - -``` -$ git checkout -b content -Switched to a new branch 'content' -``` - -### Configure Pelican - -Now it's time for content configuration. Pelican provides a great initialization tool called **pelican-quickstart** that will ask you a series of questions about your blog. - - -``` -$ pelican-quickstart -Welcome to pelican-quickstart v3.7.1. - -This script will help you create a new Pelican-based website. - -Please answer the following questions so this script can generate the files -needed by Pelican. - -> Where do you want to create your new web site? [.] -> What will be the title of this web site? Super blog -> Who will be the author of this web site? username -> What will be the default language of this web site? [en] -> Do you want to specify a URL prefix? e.g., (Y/n) n -> Do you want to enable article pagination? (Y/n) -> How many articles per page do you want? [10] -> What is your time zone? [Europe/Paris] US/Central -> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y -> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y -> Do you want to upload your website using FTP? (y/N) n -> Do you want to upload your website using SSH? (y/N) n -> Do you want to upload your website using Dropbox? (y/N) n -> Do you want to upload your website using S3? (y/N) n -> Do you want to upload your website using Rackspace Cloud Files? (y/N) n -> Do you want to upload your website using GitHub Pages? (y/N) y -> Is this your personal page (username.github.io)? (y/N) y -Done. Your new project is available at /Users/username/blog -``` - -You can take the defaults on every question except: - - * Website title, which should be unique and special - * Website author, which can be a personal username or your full name - * Time zone, which may not be in Paris - * Upload to GitHub Pages, which is a "y" in our case - - - -After answering all the questions, Pelican leaves the following in the current directory: - - -``` -$ ls -Makefile content/ develop_server.sh* -fabfile.py output/ pelicanconf.py -publishconf.py -``` - -You can check out the [Pelican docs][13] to find out how to use those files, but we're all about getting things done _right now_. No, I haven't read the docs yet either. - -### Forge on - -Add all the Pelican-generated files to the **content** branch of the local Git repo, commit the changes, and push the local changes to the remote repo hosted on GitHub by entering: - - -``` -$ git add . -$ git commit -m 'initial pelican commit to content' -$ git push origin content -``` - -This isn't super exciting, but it will be handy if we need to revert edits to one of these files. - -### Finally getting somewhere - -OK, now you can get bloggy! All of your blog posts, photos, images, PDFs, etc., will live in the **content** directory, which is initially empty. To begin creating a first post and an About page with a photo, enter: - - -``` -$ cd content -$ mkdir pages images -$ cp /Users/username/SecretStash/HotPhotoOfMe.jpg images -$ touch first-post.md -$ touch pages/about.md -``` - -Next, open the empty file **first-post.md** in your favorite text editor and add the following: - - -``` -title: First Post on My Sweet New Blog -date: -author: Your Name Here - -# I am On My Way To Internet Fame and Fortune! - -This is my first post on my new blog. While not super informative it -should convey my sense of excitement and eagerness to engage with you, -the reader! -``` - -The first three lines contain metadata that Pelican uses to organize things. There are lots of different metadata you can put there; again, the docs are your best bet for learning more about the options. - -Now, open the empty file **pages/about.md** and add this text: - - -``` -title: About -date: - -![So Schmexy][my_sweet_photo] - -Hi, I am and I wrote this epic collection of Interweb -wisdom. In days of yore, much of this would have been deemed sorcery -and I would probably have been burned at the stake. - -😆 - -[my_sweet_photo]: {filename}/images/HotPhotoOfMe.jpg -``` - -You now have three new pieces of web content in your content directory. Of the content branch. That's a lot of content. - -### Publish - -Don't worry; the payoff is coming! - -All that's left to do is: - - * Run Pelican to generate the static HTML files in **output** : [code]`$ pelican content -o output -s publishconf.py` -``` -* Use **ghp-import** to add the contents of the **output** directory to the **master** branch: [code]`$ ghp-import -m "Generate Pelican site" --no-jekyll -b master output` -``` - * Push the local master branch to the remote repo: [code]`$ git push origin master` -``` - * Commit and push the new content to the **content** branch: [code] $ git add content -$ git commit -m 'added a first post, a photo and an about page' -$ git push origin content -``` - - - -### OMG, I did it! - -Now the exciting part is here, when you get to view what you've published for everyone to see! Open your browser and enter: - - -``` -`https://username.github.io` -``` - -Congratulations on your new blog, self-published on GitHub! You can follow this pattern whenever you want to add more pages or articles. Happy blogging. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/5/run-your-blog-github-pages-python - -作者:[Erik O'Shaughnessy][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Raspberry Pi and Python) -[2]: https://github.com/ -[3]: https://git-scm.com -[4]: https://help.github.com/en/categories/github-pages-basics -[5]: https://jekyllrb.com -[6]: https://python.org -[7]: https://blog.getpelican.com -[8]: https://guides.github.com/features/mastering-markdown -[9]: http://docutils.sourceforge.net/docs/user/rst/quickref.html -[10]: https://github.com/join?source=header-home -[11]: https://git-scm.com/docs -[12]: https://pip.pypa.io/en/stable/ -[13]: https://docs.getpelican.com diff --git a/sources/tech/20190612 How to write a loop in Bash.md b/sources/tech/20190612 How to write a loop in Bash.md deleted file mode 100644 index f63bff9cd3..0000000000 --- a/sources/tech/20190612 How to write a loop in Bash.md +++ /dev/null @@ -1,282 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to write a loop in Bash) -[#]: via: (https://opensource.com/article/19/6/how-write-loop-bash) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/goncasousa/users/howtopamm/users/howtopamm/users/seth/users/wavesailor/users/seth) - -How to write a loop in Bash -====== -Automatically perform a set of actions on multiple files with for loops -and find commands. -![bash logo on green background][1] - -A common reason people want to learn the Unix shell is to unlock the power of batch processing. If you want to perform some set of actions on many files, one of the ways to do that is by constructing a command that iterates over those files. In programming terminology, this is called _execution control,_ and one of the most common examples of it is the **for** loop. - -A **for** loop is a recipe detailing what actions you want your computer to take _for_ each data object (such as a file) you specify. - -### The classic for loop - -An easy loop to try is one that analyzes a collection of files. This probably isn't a useful loop on its own, but it's a safe way to prove to yourself that you have the ability to handle each file in a directory individually. First, create a simple test environment by creating a directory and placing some copies of some files into it. Any file will do initially, but later examples require graphic files (such as JPEG, PNG, or similar). You can create the folder and copy files into it using a file manager or in the terminal: - - -``` -$ mkdir example -$ cp ~/Pictures/vacation/*.{png,jpg} example -``` - -Change directory to your new folder, then list the files in it to confirm that your test environment is what you expect: - - -``` -$ cd example -$ ls -1 -cat.jpg -design_maori.png -otago.jpg -waterfall.png -``` - -The syntax to loop through each file individually in a loop is: create a variable ( **f** for file, for example). Then define the data set you want the variable to cycle through. In this case, cycle through all files in the current directory using the ***** wildcard character (the ***** wildcard matches _everything_ ). Then terminate this introductory clause with a semicolon ( **;** ). - - -``` -`$ for f in * ;` -``` - -Depending on your preference, you can choose to press **Return** here. The shell won't try to execute the loop until it is syntactically complete. - -Next, define what you want to happen with each iteration of the loop. For simplicity, use the **file** command to get a little bit of data about each file, represented by the **f** variable (but prepended with a **$** to tell the shell to swap out the value of the variable for whatever the variable currently contains): - - -``` -`do file $f ;` -``` - -Terminate the clause with another semi-colon and close the loop: - - -``` -`done` -``` - -Press **Return** to start the shell cycling through _everything_ in the current directory. The **for** loop assigns each file, one by one, to the variable **f** and runs your command: - - -``` -$ for f in * ; do -> file $f ; -> done -cat.jpg: JPEG image data, EXIF standard 2.2 -design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -otago.jpg: JPEG image data, EXIF standard 2.2 -waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -``` - -You can also write it this way: - - -``` -$ for f in *; do file $f; done -cat.jpg: JPEG image data, EXIF standard 2.2 -design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -otago.jpg: JPEG image data, EXIF standard 2.2 -waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -``` - -Both the multi-line and single-line formats are the same to your shell and produce the exact same results. - -### A practical example - -Here's a practical example of how a loop can be useful for everyday computing. Assume you have a collection of vacation photos you want to send to friends. Your photo files are huge, making them too large to email and inconvenient to upload to your [photo-sharing service][2]. You want to create smaller web-versions of your photos, but you have 100 photos and don't want to spend the time reducing each photo, one by one. - -First, install the **ImageMagick** command using your package manager on Linux, BSD, or Mac. For instance, on Fedora and RHEL: - - -``` -`$ sudo dnf install ImageMagick` -``` - -On Ubuntu or Debian: - - -``` -`$ sudo apt install ImageMagick` -``` - -On BSD, use **ports** or [pkgsrc][3]. On Mac, use [Homebrew][4] or [MacPorts][5]. - -Once you install ImageMagick, you have a set of new commands to operate on photos. - -Create a destination directory for the files you're about to create: - - -``` -`$ mkdir tmp` -``` - -To reduce each photo to 33% of its original size, try this loop: - - -``` -`$ for f in * ; do convert $f -scale 33% tmp/$f ; done` -``` - -Then look in the **tmp** folder to see your scaled photos. - -You can use any number of commands within a loop, so if you need to perform complex actions on a batch of files, you can place your whole workflow between the **do** and **done** statements of a **for** loop. For example, suppose you want to copy each processed photo straight to a shared photo directory on your web host and remove the photo file from your local system: - - -``` -$ for f in * ; do -convert $f -scale 33% tmp/$f -scp -i seth_web tmp/$f [seth@example.com][6]:~/public_html -trash tmp/$f ; -done -``` - -For each file processed by the **for** loop, your computer automatically runs three commands. This means if you process just 10 photos this way, you save yourself 30 commands and probably at least as many minutes. - -### Limiting your loop - -A loop doesn't always have to look at every file. You might want to process only the JPEG files in your example directory: - - -``` -$ for f in *.jpg ; do convert $f -scale 33% tmp/$f ; done -$ ls -m tmp -cat.jpg, otago.jpg -``` - -Or, instead of processing files, you may need to repeat an action a specific number of times. A **for** loop's variable is defined by whatever data you provide it, so you can create a loop that iterates over numbers instead of files: - - -``` -$ for n in {0..4}; do echo $n ; done -0 -1 -2 -3 -4 -``` - -### More looping - -You now know enough to create your own loops. Until you're comfortable with looping, use them on _copies_ of the files you want to process and, as often as possible, use commands with built-in safeguards to prevent you from clobbering your data and making irreparable mistakes, like accidentally renaming an entire directory of files to the same name, each overwriting the other. - -For advanced **for** loop topics, read on. - -### Not all shells are Bash - -The **for** keyword is built into the Bash shell. Many similar shells use the same keyword and syntax, but some shells, like [tcsh][7], use a different keyword, like **foreach** , instead. - -In tcsh, the syntax is similar in spirit but more strict than Bash. In the following code sample, do not type the string **foreach?** in lines 2 and 3. It is a secondary prompt alerting you that you are still in the process of building your loop. - - -``` -$ foreach f (*) -foreach? file $f -foreach? end -cat.jpg: JPEG image data, EXIF standard 2.2 -design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -otago.jpg: JPEG image data, EXIF standard 2.2 -waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -``` - -In tcsh, both **foreach** and **end** must appear alone on separate lines, so you cannot create a **for** loop on one line as you can with Bash and similar shells. - -### For loops with the find command - -In theory, you could find a shell that doesn't provide a **for** loop function, or you may just prefer to use a different command with added features. - -The **find** command is another way to implement the functionality of a **for** loop, as it offers several ways to define the scope of which files to include in your loop as well as options for [Parallel][8] processing. - -The **find** command is meant to help you find files on your hard drives. Its syntax is simple: you provide the path of the location you want to search, and **find** finds all files and directories: - - -``` -$ find . -. -./cat.jpg -./design_maori.png -./otago.jpg -./waterfall.png -``` - -You can filter the search results by adding some portion of the name: - - -``` -$ find . -name "*jpg" -./cat.jpg -./otago.jpg -``` - -The great thing about **find** is that each file it finds can be fed into a loop using the **-exec** flag. For instance, to scale down only the PNG photos in your example directory: - - -``` -$ find . -name "*png" -exec convert {} -scale 33% tmp/{} \; -$ ls -m tmp -design_maori.png, waterfall.png -``` - -In the **-exec** clause, the bracket characters **{}** stand in for whatever item **find** is processing (in other words, any file ending in PNG that has been located, one at a time). The **-exec** clause must be terminated with a semicolon, but Bash usually tries to use the semicolon for itself. You "escape" the semicolon with a backslash ( **\;** ) so that **find** knows to treat that semicolon as its terminating character. - -The **find** command is very good at what it does, and it can be too good sometimes. For instance, if you reuse it to find PNG files for another photo process, you will get a few errors: - - -``` -$ find . -name "*png" -exec convert {} -flip -flop tmp/{} \; -convert: unable to open image `tmp/./tmp/design_maori.png': -No such file or directory @ error/blob.c/OpenBlob/2643. -... -``` - -It seems that **find** has located all the PNG files—not only the ones in your current directory ( **.** ) but also those that you processed before and placed in your **tmp** subdirectory. In some cases, you may want **find** to search the current directory plus all other directories within it (and all directories in _those_ ). It can be a powerful recursive processing tool, especially in complex file structures (like directories of music artists containing directories of albums filled with music files), but you can limit this with the **-maxdepth** option. - -To find only PNG files in the current directory (excluding subdirectories): - - -``` -`$ find . -maxdepth 1 -name "*png"` -``` - -To find and process files in the current directory plus an additional level of subdirectories, increment the maximum depth by 1: - - -``` -`$ find . -maxdepth 2 -name "*png"` -``` - -Its default is to descend into all subdirectories. - -### Looping for fun and profit - -The more you use loops, the more time and effort you save, and the bigger the tasks you can tackle. You're just one user, but with a well-thought-out loop, you can make your computer do the hard work. - -You can and should treat looping like any other command, keeping it close at hand for when you need to repeat a single action or two on several files. However, it's also a legitimate gateway to serious programming, so if you have to accomplish a complex task on any number of files, take a moment out of your day to plan out your workflow. If you can achieve your goal on one file, then wrapping that repeatable process in a **for** loop is relatively simple, and the only "programming" required is an understanding of how variables work and enough organization to separate unprocessed from processed files. With a little practice, you can move from a Linux user to a Linux user who knows how to write a loop, so get out there and make your computer work for you! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/how-write-loop-bash - -作者:[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/goncasousa/users/howtopamm/users/howtopamm/users/seth/users/wavesailor/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) -[2]: http://nextcloud.com -[3]: http://pkgsrc.org -[4]: http://brew.sh -[5]: https://www.macports.org -[6]: mailto:seth@example.com -[7]: https://en.wikipedia.org/wiki/Tcsh -[8]: https://opensource.com/article/18/5/gnu-parallel diff --git a/sources/tech/20190612 Why use GraphQL.md b/sources/tech/20190612 Why use GraphQL.md deleted file mode 100644 index ad0d3a0056..0000000000 --- a/sources/tech/20190612 Why use GraphQL.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why use GraphQL?) -[#]: via: (https://opensource.com/article/19/6/why-use-graphql) -[#]: author: (Zach Lendon https://opensource.com/users/zachlendon/users/goncasousa/users/patrickhousley) - -Why use GraphQL? -====== -Here's why GraphQL is gaining ground on standard REST API technology. -![][1] - -[GraphQL][2], as I wrote [previously][3], is a next-generation API technology that is transforming both how client applications communicate with backend systems and how backend systems are designed. - -As a result of the support that began with the organization that founded it, Facebook, and continues with the backing of other technology giants such as Github, Twitter, and AirBnB, GraphQL's place as a linchpin technology for application systems seems secure; both now and long into the future. - -### GraphQL's ascent - -The rise in importance of mobile application performance and organizational agility has provided booster rockets for GraphQL's ascent to the top of modern enterprise architectures. - -Given that [REST][4] is a wildly popular architectural style that already allows mechanisms for data interaction, what advantages does this new technology provide over [REST][4]? The ‘QL’ in GraphQL stands for query language, and that is a great place to start. - -The ease at which different client applications within an organization can query only the data they need with GraphQL usurps alternative REST approaches and delivers real-world application performance boosts. With traditional [REST][4] API endpoints, client applications interrogate a server resource, and receive a response containing all the data that matches the request. If a successful response from a [REST][4] API endpoint returns 35 fields, the client application receives 35 fields - -### Fetching problems - -[REST][4] APIs traditionally provide no clean way for client applications to retrieve or update only the data they care about. This is often described as the “over-fetching” problem. With the prevalence of mobile applications in people’s day to day lives, the over-fetching problem has real world consequences. Every request a mobile application needs to make, every byte it has to send and receive, has an increasingly negative performance impact for end users. Users with slower data connections are particularly affected by suboptimal API design choices. Customers who experience poor performance using mobile applications are more likely to not purchase products and use services. Inefficient API designs cost companies money. - -“Over-fetching” isn’t alone - it has a partner in crime - “under-fetching”. Endpoints that, by default, return only a portion of the data a client actually needs require clients to make additional calls to satisfy their data needs - which requires additional HTTP requests. Because of the over and under fetching problems and their impact on client application performance, an API technology that facilitates efficient fetching has a chance to catch fire in the marketplace - and GraphQL has boldly jumped in and filled that void. - -### REST's response - -[REST][4] API designers, not willing to go down without a fight, have attempted to counter the mobile application performance problem through a mix of: - - * “include” and “exclude” query parameters, allowing client applications to specify which fields they want through a potentially long query format. - * “Composite” services, which combine multiple endpoints in a way that allow client applications to be more efficient in the number of requests they make and the data they receive. - - - -While these patterns are a valiant attempt by the [REST][4] API community to address challenges mobile clients face, they fall short in a few key regards, namely: - - * Include and exclude query key/value pairs quickly get messy, in particular for deeper object graphs that require a nested dot notation syntax (or similar) to target data to include and exclude. Additionally, debugging issues with the query string in this model often requires manually breaking up a URL. - * Server implementations for include and exclude queries are often custom, as there is no standard way for server-based applications to handle the use of include and exclude queries, just as there is no standard way for include and exclude queries to be defined. - * The rise of composite services creates more tightly coupled back-end and front-end systems, requiring increasing coordination to deliver projects and turning once agile projects back to waterfall. This coordination and coupling has the painful side effect of slowing organizational agility. Additionally, composite services are by definition, not RESTful. - - - -### GraphQL's genesis - -For Facebook, GraphQL’s genesis was a response to pain felt and experiences learned from an HTML5-based version of their flagship mobile application back in 2011-2012. Understanding that improved performance was paramount, Facebook engineers realized that they needed a new API design to ensure peak performance. Likely taking the above [REST][4] limitations into consideration, and with needing to support different needs of a number of API clients, one can begin to understand the early seeds of what led co-creators Lee Byron and Dan Schaeffer, Facebook employees at the time, to create what has become known as GraphQL. - -With what is often a single GraphQL endpoint, through the GraphQL query language, client applications are able to reduce, often significantly, the number of network calls they need to make, and ensure that they only are retrieving the data they need. In many ways, this harkens back to earlier models of web programming, where client application code would directly query back-end systems - some might remember writing SQL queries with JSTL on JSPs 10-15 years ago for example! - -The biggest difference now is with GraphQL, we have a specification that is implemented across a variety of client and server languages and libraries. And with GraphQL being an API technology, we have decoupled the back-end and front-end application systems by introducing an intermediary GraphQL application layer that provides a mechanism to access organizational data in a manner that aligns with an organization’s business domain(s). - -Beyond solving technical challenges experienced by software engineering teams, GraphQL has also been a boost to organizational agility, in particular in the enterprise. GraphQL-enabled organizational agility increases are commonly attributable to the following: - - * Rather than creating new endpoints when 1 or more new fields are needed by clients, GraphQL API designers and developers are able to include those fields in existing graph implementations, exposing new capabilities in a fashion that requires less development effort and less change across application systems. - * By encouraging API design teams to focus more on defining their object graph and be less focused on what client applications are delivering, the speed at which front-end and back-end software teams deliver solutions for customers has increasingly decoupled. - - - -### Considerations before adoption - -Despite GraphQL’s compelling benefits, GraphQL is not without its implementation challenges. A few examples include: - - * Caching mechanisms around [REST][4] APIs are much more mature. - * The patterns used to build APIs using [REST][4] are much more well established. - * While engineers may be more attracted to newer technologies like GraphQL, the talent pool in the marketplace is much broader for building [REST][4]-based solutions vs. GraphQL. - - - -### Conclusion - -By providing both a boost to performance and organizational agility, GraphQL's adoption by companies has skyrocketed in the past few years. It does, however, have some maturing to do in comparison to the RESTful ecosystem of API design. - -One of the great benefits of GraphQL is that it’s not designed as a wholesale replacement for alternative API solutions. Instead, GraphQL can be implemented to complement or enhance existing APIs. As a result, companies are encouraged to explore incrementally adopting GraphQL where it makes the most sense for them - where they find it has the greatest positive impact on application performance and organizational agility. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/why-use-graphql - -作者:[Zach Lendon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/zachlendon/users/goncasousa/users/patrickhousley -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_graph_stats_blue.png?itok=OKCc_60D -[2]: https://graphql.org/ -[3]: https://opensource.com/article/19/6/what-is-graphql -[4]: https://en.wikipedia.org/wiki/Representational_state_transfer diff --git a/sources/tech/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md b/sources/tech/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md deleted file mode 100644 index 724c97bc01..0000000000 --- a/sources/tech/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md +++ /dev/null @@ -1,337 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use OpenSSL: Hashes, digital signatures, and more) -[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-2) -[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) - -How to use OpenSSL: Hashes, digital signatures, and more -====== -Dig deeper into the details of cryptography with OpenSSL: Hashes, -digital signatures, digital certificates, and more -![A person working.][1] - -The [first article in this series][2] introduced hashes, encryption/decryption, digital signatures, and digital certificates through the OpenSSL libraries and command-line utilities. This second article drills down into the details. Let’s begin with hashes, which are ubiquitous in computing, and consider what makes a hash function _cryptographic_. - -### Cryptographic hashes - -The download page for the OpenSSL source code () contains a table with recent versions. Each version comes with two hash values: 160-bit SHA1 and 256-bit SHA256. These values can be used to verify that the downloaded file matches the original in the repository: The downloader recomputes the hash values locally on the downloaded file and then compares the results against the originals. Modern systems have utilities for computing such hashes. Linux, for instance, has **md5sum** and **sha256sum**. OpenSSL itself provides similar command-line utilities. - -Hashes are used in many areas of computing. For example, the Bitcoin blockchain uses SHA256 hash values as block identifiers. To mine a Bitcoin is to generate a SHA256 hash value that falls below a specified threshold, which means a hash value with at least N leading zeroes. (The value of N can go up or down depending on how productive the mining is at a particular time.) As a point of interest, today’s miners are hardware clusters designed for generating SHA256 hashes in parallel. During a peak time in 2018, Bitcoin miners worldwide generated about 75 million terahashes per second—yet another incomprehensible number. - -Network protocols use hash values as well—often under the name **checksum**—to support message integrity; that is, to assure that a received message is the same as the one sent. The message sender computes the message’s checksum and sends the results along with the message. The receiver recomputes the checksum when the message arrives. If the sent and the recomputed checksum do not match, then something happened to the message in transit, or to the sent checksum, or to both. In this case, the message and its checksum should be sent again, or at least an error condition should be raised. (Low-level network protocols such as UDP do not bother with checksums.) - -Other examples of hashes are familiar. Consider a website that requires users to authenticate with a password, which the user enters in their browser. Their password is then sent, encrypted, from the browser to the server via an HTTPS connection to the server. Once the password arrives at the server, it's decrypted for a database table lookup. - -What should be stored in this lookup table? Storing the passwords themselves is risky. It’s far less risky is to store a hash generated from a password, perhaps with some _salt_ (extra bits) added to taste before the hash value is computed. Your password may be sent to the web server, but the site can assure you that the password is not stored there. - -Hash values also occur in various areas of security. For example, hash-based message authentication code ([HMAC][3]) uses a hash value and a secret cryptographic key to authenticate a message sent over a network. HMAC codes, which are lightweight and easy to use in programs, are popular in web services. An X509 digital certificate includes a hash value known as the _fingerprint_, which can facilitate certificate verification. An in-memory truststore could be implemented as a lookup table keyed on such fingerprints—as a _hash map_, which supports constant-time lookups. The fingerprint from an incoming certificate can be compared against the truststore keys for a match. - -What special property should a _cryptographic hash function_ have? It should be _one-way_, which means very difficult to invert. A cryptographic hash function should be relatively straightforward to compute, but computing its inverse—the function that maps the hash value back to the input bitstring—should be computationally intractable. Here is a depiction, with **chf** as a cryptographic hash function and my password **foobar** as the sample input: - - -``` -        +---+ -foobar—>|chf|—>hash value ## straightforward -        +--–+ -``` - -By contrast, the inverse operation is infeasible: - - -``` -            +-----------+ -hash value—>|chf inverse|—>foobar ## intractable -            +-----------+ -``` - -Recall, for example, the SHA256 hash function. For an input bitstring of any length N > 0, this function generates a fixed-length hash value of 256 bits; hence, this hash value does not reveal even the input bitstring’s length N, let alone the value of each bit in the string. By the way, SHA256 is not susceptible to a [_length extension attack_][4]. The only effective way to reverse engineer a computed SHA256 hash value back to the input bitstring is through a brute-force search, which means trying every possible input bitstring until a match with the target hash value is found. Such a search is infeasible on a sound cryptographic hash function such as SHA256. - -Now, a final review point is in order. Cryptographic hash values are statistically rather than unconditionally unique, which means that it is unlikely but not impossible for two different input bitstrings to yield the same hash value—a _collision_. The [_birthday problem_][5] offers a nicely counter-intuitive example of collisions. There is extensive research on various hash algorithms’ _collision resistance_. For example, MD5 (128-bit hash values) has a breakdown in collision resistance after roughly 221 hashes. For SHA1 (160-bit hash values), the breakdown starts at about 261 hashes. - -A good estimate of the breakdown in collision resistance for SHA256 is not yet in hand. This fact is not surprising. SHA256 has a range of 2256 distinct hash values, a number whose decimal representation has a whopping 78 digits! So, can collisions occur with SHA256 hashing? Of course, but they are extremely unlikely. - -In the command-line examples that follow, two input files are used as bitstring sources: **hashIn1.txt** and **hashIn2.txt**. The first file contains **abc** and the second contains **1a2b3c**. - -These files contain text for readability, but binary files could be used instead. - -Using the Linux **sha256sum** utility on these two files at the command line—with the percent sign (**%**) as the prompt—produces the following hash values (in hex): - - -``` -% sha256sum hashIn1.txt -9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 hashIn1.txt - -% sha256sum hashIn2.txt -3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 hashIn2.txt -``` - -The OpenSSL hashing counterparts yield the same results, as expected: - - -``` -% openssl dgst -sha256 hashIn1.txt -SHA256(hashIn1.txt)= 9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 - -% openssl dgst -sha256 hashIn2.txt -SHA256(hashIn2.txt)= 3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 -``` - -This examination of cryptographic hash functions sets up a closer look at digital signatures and their relationship to key pairs. - -### Digital signatures - -As the name suggests, a digital signature can be attached to a document or some other electronic artifact (e.g., a program) to vouch for its authenticity. Such a signature is thus analogous to a hand-written signature on a paper document. To verify the digital signature is to confirm two things. First, that the vouched-for artifact has not changed since the signature was attached because it is based, in part, on a cryptographic _hash_ of the document. Second, that the signature belongs to the person (e.g., Alice) who alone has access to the private key in a pair. By the way, digitally signing code (source or compiled) has become a common practice among programmers. - -Let’s walk through how a digital signature is created. As mentioned before, there is no digital signature without a public and private key pair. When using OpenSSL to create these keys, there are two separate commands: one to create a private key, and another to extract the matching public key from the private one. These key pairs are encoded in base64, and their sizes can be specified during this process. - -The private key consists of numeric values, two of which (a _modulus_ and an _exponent_) make up the public key. Although the private key file contains the public key, the extracted public key does _not_ reveal the value of the corresponding private key. - -The resulting file with the private key thus contains the full key pair. Extracting the public key into its own file is practical because the two keys have distinct uses, but this extraction also minimizes the danger that the private key might be publicized by accident. - -Next, the pair’s private key is used to process a hash value for the target artifact (e.g., an email), thereby creating the signature. On the other end, the receiver’s system uses the pair’s public key to verify the signature attached to the artifact. - -Now for an example. To begin, generate a 2048-bit RSA key pair with OpenSSL: - -**openssl genpkey -out privkey.pem -algorithm rsa 2048** - -We can drop the **-algorithm rsa** flag in this example because **genpkey** defaults to the type RSA. The file’s name (**privkey.pem**) is arbitrary, but the Privacy Enhanced Mail (PEM) extension **pem** is customary for the default PEM format. (OpenSSL has commands to convert among formats if needed.) If a larger key size (e.g., 4096) is in order, then the last argument of **2048** could be changed to **4096**. These sizes are always powers of two. - -Here’s a slice of the resulting **privkey.pem** file, which is in base64: - - -``` -\-----BEGIN PRIVATE KEY----- -MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANnlAh4jSKgcNj/Z -JF4J4WdhkljP2R+TXVGuKVRtPkGAiLWE4BDbgsyKVLfs2EdjKL1U+/qtfhYsqhkK -… -\-----END PRIVATE KEY----- -``` - -The next command then extracts the pair’s public key from the private one: - -**openssl rsa -in privkey.pem -outform PEM -pubout -out pubkey.pem** - -The resulting **pubkey.pem** file is small enough to show here in full: - - -``` -\-----BEGIN PUBLIC KEY----- -MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZ5QIeI0ioHDY/2SReCeFnYZJY -z9kfk11RrilUbT5BgIi1hOAQ24LMilS37NhHYyi9VPv6rX4WLKoZCmkeYaWk/TR5 -4nbH1E/AkniwRoXpeh5VncwWMuMsL5qPWGY8fuuTE27GhwqBiKQGBOmU+MYlZonO -O0xnAKpAvysMy7G7qQIDAQAB -\-----END PUBLIC KEY----- -``` - -Now, with the key pair at hand, the digital signing is easy—in this case with the source file **client.c** as the artifact to be signed: - -**openssl dgst -sha256 -sign privkey.pem -out sign.sha256 client.c** - -The digest for the **client.c** source file is SHA256, and the private key resides in the **privkey.pem** file created earlier. The resulting binary signature file is **sign.sha256**, an arbitrary name. To get a readable (if base64) version of this file, the follow-up command is: - -**openssl enc -base64 -in sign.sha256 -out sign.sha256.base64** - -The file **sign.sha256.base64** now contains: - - -``` -h+e+3UPx++KKSlWKIk34fQ1g91XKHOGFRmjc0ZHPEyyjP6/lJ05SfjpAJxAPm075 -VNfFwysvqRGmL0jkp/TTdwnDTwt756Ej4X3OwAVeYM7i5DCcjVsQf5+h7JycHKlM -o/Jd3kUIWUkZ8+Lk0ZwzNzhKJu6LM5KWtL+MhJ2DpVc= -``` - -Or, the executable file **client** could be signed instead, and the resulting base64-encoded signature would differ as expected: - - -``` -VMVImPgVLKHxVBapJ8DgLNJUKb98GbXgehRPD8o0ImADhLqlEKVy0HKRm/51m9IX -xRAN7DoL4Q3uuVmWWi749Vampong/uT5qjgVNTnRt9jON112fzchgEoMb8CHNsCT -XIMdyaPtnJZdLALw6rwMM55MoLamSc6M/MV1OrJnk/g= -``` - -The final step in this process is to verify the digital signature with the public key. The hash used to sign the artifact (in this case, the executable **client** program) should be recomputed as an essential step in the verification since the verification process should indicate whether the artifact has changed since being signed. - -There are two OpenSSL commands used for this purpose. The first decodes the base64 signature: - -**openssl enc -base64 -d -in sign.sha256.base64 -out sign.sha256** - -The second verifies the signature: - -**openssl dgst -sha256 -verify pubkey.pem -signature sign.sha256 client** - -The output from this second command is, as it should be: - - -``` -`Verified OK` -``` - -To understand what happens when verification fails, a short but useful exercise is to replace the executable **client** file in the last OpenSSL command with the source file **client.c** and then try to verify. Another exercise is to change the **client** program, however slightly, and try again. - -### Digital certificates - -A digital certificate brings together the pieces analyzed so far: hash values, key pairs, digital signatures, and encryption/decryption. The first step toward a production-grade certificate is to create a certificate signing request (CSR), which is then sent to a certificate authority (CA). To do this for the example with OpenSSL, run: - -**openssl req -out myserver.csr -new -newkey rsa:4096 -nodes -keyout myserverkey.pem** - -This example generates a CSR document and stores the document in the file **myserver.csr** (base64 text). The purpose here is this: the CSR document requests that the CA vouch for the identity associated with the specified domain name—the common name (CN) in CA-speak. - -A new key pair also is generated by this command, although an existing pair could be used. Note that the use of **server** in names such as **myserver.csr** and **myserverkey.pem** hints at the typical use of digital certificates: as vouchers for the identity of a web server associated with a domain such as [www.google.com][6]. - -The same command, however, creates a CSR regardless of how the digital certificate might be used. It also starts an interactive question/answer session that prompts for relevant information about the domain name to link with the requester’s digital certificate. This interactive session can be short-circuited by providing the essentials as part of the command, with backslashes as continuations across line breaks. The **-subj** flag introduces the required information: - - -``` -% openssl req -new --newkey rsa:2048 -nodes -keyout privkeyDC.pem --out myserver.csr --subj "/C=US/ST=Illinois/L=Chicago/O=Faulty Consulting/OU=IT/CN=myserver.com" -``` - -The resulting CSR document can be inspected and verified before being sent to a CA. This process creates the digital certificate with the desired format (e.g., X509), signature, validity dates, and so on: - -**openssl req -text -in myserver.csr -noout -verify** - -Here’s a slice of the output: - - -``` -verify OK -Certificate Request: -Data: -Version: 0 (0x0) -Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com -Subject Public Key Info: -Public Key Algorithm: rsaEncryption -Public-Key: (2048 bit) -Modulus: -00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e🇩🇪73: -… -Exponent: 65537 (0x10001) -Attributes: -a0:00 -Signature Algorithm: sha256WithRSAEncryption -… -``` - -### A self-signed certificate - -During the development of an HTTPS web site, it is convenient to have a digital certificate on hand without going through the CA process. A self-signed certificate fills the bill during the HTTPS handshake’s authentication phase, although any modern browser warns that such a certificate is worthless. Continuing the example, the OpenSSL command for a self-signed certificate—valid for a year and with an RSA public key—is: - -**openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:4096 -keyout myserver.pem -out myserver.crt** - -The OpenSSL command below presents a readable version of the generated certificate: - -**openssl x509 -in myserver.crt -text -noout** - -Here’s part of the output for the self-signed certificate: - - -``` -Certificate: -Data: -Version: 3 (0x2) -Serial Number: 13951598013130016090 (0xc19e087965a9055a) -Signature Algorithm: sha256WithRSAEncryption -Issuer: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com -Validity -Not Before: Apr 11 17:22:18 2019 GMT -Not After : Apr 10 17:22:18 2020 GMT -Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com -Subject Public Key Info: -Public Key Algorithm: rsaEncryption -Public-Key: (4096 bit) -Modulus: -00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e🇩🇪73: -… -Exponent: 65537 (0x10001) -X509v3 extensions: -X509v3 Subject Key Identifier: -3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 -X509v3 Authority Key Identifier: -keyid:3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 - -        X509v3 Basic Constraints: -            CA:TRUE -Signature Algorithm: sha256WithRSAEncryption -     3a:eb:8d:09:53:3b:5c:2e:48:ed:14:ce:f9:20:01:4e:90:c9: -     ... -``` - -As mentioned earlier, an RSA private key contains values from which the public key is generated. However, a given public key does _not_ give away the matching private key. For an introduction to the underlying mathematics, see . - -There is an important correspondence between a digital certificate and the key pair used to generate the certificate, even if the certificate is only self-signed: - - * The digital certificate contains the _exponent_ and _modulus_ values that make up the public key. These values are part of the key pair in the originally-generated PEM file, in this case, the file **myserver.pem**. - * The exponent is almost always 65,537 (as in this case) and so can be ignored. - * The modulus from the key pair should match the modulus from the digital certificate. - - - -The modulus is a large value and, for readability, can be hashed. Here are two OpenSSL commands that check for the same modulus, thereby confirming that the digital certificate is based upon the key pair in the PEM file: - - -``` -% openssl x509 -noout -modulus -in myserver.crt | openssl sha1 ## modulus from CRT -(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 - -% openssl rsa -noout -modulus -in myserver.pem | openssl sha1 ## modulus from PEM -(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 -``` - -The resulting hash values match, thereby confirming that the digital certificate is based upon the specified key pair. - -### Back to the key distribution problem - -Let’s return to an issue raised at the end of Part 1: the TLS handshake between the **client** program and the Google web server. There are various handshake protocols, and even the Diffie-Hellman version at work in the **client** example offers wiggle room. Nonetheless, the **client** example follows a common pattern. - -To start, during the TLS handshake, the **client** program and the web server agree on a cipher suite, which consists of the algorithms to use. In this case, the suite is **ECDHE-RSA-AES128-GCM-SHA256**. - -The two elements of interest now are the RSA key-pair algorithm and the AES128 block cipher used for encrypting and decrypting messages if the handshake succeeds. Regarding encryption/decryption, this process comes in two flavors: symmetric and asymmetric. In the symmetric flavor, the _same_ key is used to encrypt and decrypt, which raises the _key distribution problem_ in the first place: How is the key to be distributed securely to both parties? In the asymmetric flavor, one key is used to encrypt (in this case, the RSA public key) but a different key is used to decrypt (in this case, the RSA private key from the same pair). - -The **client** program has the Google web server’s public key from an authenticating certificate, and the web server has the private key from the same pair. Accordingly, the **client** program can send an encrypted message to the web server, which alone can readily decrypt this message. - -In the TLS situation, the symmetric approach has two significant advantages: - - * In the interaction between the **client** program and the Google web server, the authentication is one-way. The Google web server sends three certificates to the **client** program, but the **client** program does not send a certificate to the web server; hence, the web server has no public key from the client and can’t encrypt messages to the client. - * Symmetric encryption/decryption with AES128 is nearly a _thousand times faster_ than the asymmetric alternative using RSA keys. - - - -The TLS handshake combines the two flavors of encryption/decryption in a clever way. During the handshake, the **client** program generates random bits known as the pre-master secret (PMS). Then the **client** program encrypts the PMS with the server’s public key and sends the encrypted PMS to the server, which in turn decrypts the PMS message with its private key from the RSA pair: - - -``` -              +-------------------+ encrypted PMS  +--------------------+ -client PMS--->|server’s public key|--------------->|server’s private key|--->server PMS -              +-------------------+                +--------------------+ -``` - -At the end of this process, the **client** program and the Google web server now have the same PMS bits. Each side uses these bits to generate a _master secret_ and, in short order, a symmetric encryption/decryption key known as the _session key_. There are now two distinct but identical session keys, one on each side of the connection. In the **client** example, the session key is of the AES128 variety. Once generated on both the **client** program’s and Google web server’s sides, the session key on each side keeps the conversation between the two sides confidential. A handshake protocol such as Diffie-Hellman allows the entire PMS process to be repeated if either side (e.g., the **client** program) or the other (in this case, the Google web server) calls for a restart of the handshake. - -### Wrapping up - -The OpenSSL operations illustrated at the command line are available, too, through the API for the underlying libraries. These two articles have emphasized the utilities to keep the examples short and to focus on the cryptographic topics. If you have an interest in security issues, OpenSSL is a fine place to start—and to stay. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 - -作者:[Marty Kalin][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mkalindepauledu -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) -[2]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 -[3]: https://en.wikipedia.org/wiki/HMAC -[4]: https://en.wikipedia.org/wiki/Length_extension_attack -[5]: https://en.wikipedia.org/wiki/Birthday_problem -[6]: http://www.google.com diff --git a/sources/tech/20190624 Book Review- A Byte of Vim.md b/sources/tech/20190624 Book Review- A Byte of Vim.md deleted file mode 100644 index e221a3bc6f..0000000000 --- a/sources/tech/20190624 Book Review- A Byte of Vim.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Book Review: A Byte of Vim) -[#]: via: (https://itsfoss.com/book-review-a-byte-of-vim/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Book Review: A Byte of Vim -====== - -[Vim][1] is a tool that is both simple and very powerful. Most new users will be intimidated by it because it doesn’t ‘work’ like regular graphical text editors. The ‘unusual’ keyboard shortcuts makes people wonder about [how to save and exit Vim][2]. But once you master Vim, there is nothing like it. - -There are numerous [Vim resources available online][3]. We have covered some Vim tricks on It’s FOSS as well. Apart from online resources, plenty of books have been dedicated to this editor as well. Today, we will look at one of such book that is designed to make Vim easy for most users to understand. The book we will be discussing is [A Byte of Vim][4] by [Swaroop C H][5]. - -The author [Swaroop C H][6] has worked in computing for over a decade. He previously worked at Yahoo and Adobe. Out of college, he made money by selling Linux CDs. He started a number of businesses, including an iPod charger named ion. He is currently an engineering manager for the AI team at [Helpshift][7]. - -### A Byte of Vim - -![][8] - -Like all good books, A Byte of Vim starts by talking about what Vim is: “a computer program used for writing any kind of text”. He does on to say, “What makes Vim special is that it is one of those few software which is both simple and powerful.” - -Before diving into telling how to use Vim, Swaroop tells the reader how to install Vim for Windows, Mac, Linux, and BSD. Once the installation is complete, he runs you through how to launch Vim and how to create your first file. - -Next, Swaroop discusses the different modes of Vim and how to navigate around your document using Vim’s keyboard shortcuts. This is followed by the basics of editing a document with Vim, including the Vim version of cut/copy/paste and undo/redo. - -Once the editing basics are covered, Swaroop talks about using Vim to edit multiple parts of a single document. You can also multiple tabs and windows to edit multiple documents at the same time. - -[][9] - -Suggested read  Bring Your Old Computer Back to Life With 4MLinux - -The book also covers extending the functionality of Vim through scripting and installing plugins. There are two ways to using scripts in Vim, use Vim’s built-in scripting language or using a programming language like Python or Perl to access Vim’s internals. There are five types of Vim plugins that can be written or downloaded: vimrc, global plugin, filetype plugin, syntax highlighting plugin, and compiler plugin. - -In a separate section, Swaroop C H covers the features of Vim that make it good for programming. These features include syntax highlighting, smart indentation, support for shell commands, omnicompletion, and the ability to be used as an IDE. - -#### Getting the ‘A Byte of Vim’ book and contributing to it - -A Byte of Book is licensed under [Creative Commons 4.0][10]. You can read an online version of the book for free on [the author’s website][4]. You can also download a [PDF][11], [Epub][12], or [Mobi][13] for free. - -[Get A Byte of Vim for FREE][4] - -If you prefer reading a [hard copy][14], you have that option, as well. - -Please note that the _**original version of A Byte of Vim was written in 2008**_ and converted to PDf. Unfortunately, Swaroop C H lost the original source files and he is working to convert the book to [Markdown][15]. If you would like to help, please visit the [book’s GitHub page][16]. - -Preview | Product | Price | ----|---|---|--- -![Mastering Vim Quickly: From WTF to OMG in no time][17] ![Mastering Vim Quickly: From WTF to OMG in no time][17] | [Mastering Vim Quickly: From WTF to OMG in no time][18] | $34.00[][19] | [Buy on Amazon][20] - -#### Conclusion - -When I first stared into the angry maw that is Vim, I did not have a clue what to do. I wish that I had known about A Byte of Vim then. This book is a good resource for anyone learning about Linux, especially if you are getting into the command line. - -Have you read [A Byte of Vim][4] by Swaroop C H? If yes, how do you find it? If not, what is your favorite book on an open source topic? Let us know in the comments below. - -[][21] - -Suggested read  Iridium Browser: A Browser for the Privacy Conscious - -If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][22]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/book-review-a-byte-of-vim/ - -作者:[John Paul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/john/ -[b]: https://github.com/lujun9972 -[1]: https://www.vim.org/ -[2]: https://itsfoss.com/how-to-exit-vim/ -[3]: https://linuxhandbook.com/basic-vim-commands/ -[4]: https://vim.swaroopch.com/ -[5]: https://swaroopch.com/ -[6]: https://swaroopch.com/about/ -[7]: https://www.helpshift.com/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/Byte-of-vim-book.png?resize=800%2C450&ssl=1 -[9]: https://itsfoss.com/4mlinux-review/ -[10]: https://creativecommons.org/licenses/by/4.0/ -[11]: https://www.gitbook.com/download/pdf/book/swaroopch/byte-of-vim -[12]: https://www.gitbook.com/download/epub/book/swaroopch/byte-of-vim -[13]: https://www.gitbook.com/download/mobi/book/swaroopch/byte-of-vim -[14]: https://swaroopch.com/buybook/ -[15]: https://itsfoss.com/best-markdown-editors-linux/ -[16]: https://github.com/swaroopch/byte-of-vim#status-incomplete -[17]: https://i2.wp.com/images-na.ssl-images-amazon.com/images/I/41itW8furUL._SL160_.jpg?ssl=1 -[18]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Mastering Vim Quickly: From WTF to OMG in no time) -[19]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) -[20]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Buy on Amazon) -[21]: https://itsfoss.com/iridium-browser-review/ -[22]: http://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md b/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md deleted file mode 100644 index 0fd04ee54a..0000000000 --- a/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md +++ /dev/null @@ -1,136 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hj24) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (One CI/CD pipeline per product to rule them all) -[#]: via: (https://opensource.com/article/19/7/cicd-pipeline-rule-them-all) -[#]: author: (Willy-Peter Schaub https://opensource.com/users/wpschaub/users/bclaster/users/matt-micene/users/barkerd427) - -One CI/CD pipeline per product to rule them all -====== -Is the idea of a unified continuous integration and delivery pipeline a -pipe dream? -![An intersection of pipes.][1] - -When I joined the cloud ops team, responsible for cloud operations and engineering process streamlining, at WorkSafeBC, I shared my dream for one instrumented pipeline, with one continuous integration build and continuous deliveries for every product. - -According to Lukas Klose, [flow][2] (within the context of software engineering) is "the state of when a system produces value at a steady and predictable rate." I think it is one of the greatest challenges and opportunities, especially in the complex domain of emergent solutions. Strive towards a continuous and incremental delivery model with consistent, efficient, and quality solutions, building the right things and delighting our users. Find ways to break down our systems into smaller pieces that are valuable on their own, enabling teams to deliver value incrementally. This requires a change of mindset for both business and engineering. - -### Continuous integration and delivery (CI/CD) pipeline - -The CI/CD pipeline is a DevOps practice for delivering code changes more often, consistently, and reliably. It enables agile teams to increase _deployment frequency_ and decrease _lead time for change_, _change-failure rate_, and _mean time to recovery_ key performance indicators (KPIs), thereby improving _quality_ and delivering _value_ faster. The only prerequisites are a solid development process, a mindset for quality and accountability for features from ideation to deprecation, and a comprehensive pipeline (as illustrated below). - -![Prerequisites for a solid development process][3] - -It streamlines the engineering process and products to stabilize infrastructure environments; optimize flow; and create consistent, repeatable, and automated tasks. This enables us to turn complex tasks into complicated tasks, as outlined by Dave Snowden's [Cynefin Sensemaking][4] model, reducing maintenance costs and increasing quality and reliability. - -Part of streamlining our flow is to minimize waste for the [wasteful practice types][5] Muri (overloaded), Mura (variation), and Muda (waste). - - * **Muri:** avoid over-engineering, features that do not link to business value, and excessive documentation - * **Mura:** improve approval and validation processes (e.g., security signoffs); drive the [shift-left][6] initiative to push unit testing, security vulnerability scanning, and code quality inspection; and improve risk assessment - * **Muda:** avoid waste such as technical debt, bugs, and upfront, detailed documentation - - - -It appears that 80% of the focus and intention is on products that provide an integrated and collaborative engineering system that can take an idea and plan, develop, test, and monitor your solutions. However, a successful transformation and engineering system is only 5% about products, 15% about process, and 80% about people. - -There are many products at our disposal. For example, Azure DevOps offers rich support for continuous integration (CI), continuous delivery (CD), extensibility, and integration with open source and commercial off-the-shelve (COTS) software as a service (SaaS) solutions such as Stryker, SonarQube, WhiteSource, Jenkins, and Octopus. For engineers, it is always a temptation to focus on products, but remember that they are only 5% of our journey. - -![5% about products, 15% about process, 80% about people][7] - -The biggest challenge is breaking down a process based on decades of rules, regulations, and frustrating areas of comfort: "_It is how we have always done it; why change?_"  - -The friction between people in development and operation results in a variety of fragmented, duplicated, and incessant integration and delivery pipelines. Development wants access to everything, to iterate continuously, to enable users, and to release continuously and fast. Operations wants to lock down everything to protect the business and users and drive quality. This inadvertently and often entails processes and governance that are hard to automate, which results in slower-than-expected release cycles. - -Let us explore the pipeline with snippets from a recent whiteboard discussion. - -The variation of pipelines is difficult and costly to support; the inconsistency of versioning and traceability complicates live site incidents, and continuous streamlining of the development process and pipelines is a challenge. - -![Improving quality and visibility of pipelines][8] - -I advocate a few principles that enable one universal pipeline per product: - - * Automate everything automatable - * Build once - * Maintain continuous integration and delivery - * Maintain continuous streamlining and improvement - * Maintain one build definition - * Maintain one release pipeline definition - * Scan for vulnerabilities early and often, and _fail fast_ - * Test early and often, and _fail fast_ - * Maintain traceability and observability of releases - - - -If I poke the hornet's nest, however, the most important principle is to _keep it simple_. If you cannot explain the reason (_what_, _why_) and the process (_how_) of your pipelines, you do not understand your engineering process. Most of us are not looking for the best, ultramodern, and revolutionary pipeline—we need one that is functional, valuable, and an enabler for engineering. Tackle the 80%—the culture, people, and their mindset—first. Ask your CI/CD knights in shining armor, with their TLA (two/three-lettered acronym) symbols on their shield, to join the might of practical and empirical engineering. - -### Unified pipeline - -Let us walk through one of our design practice whiteboard sessions. - -![CI build/CD release pipeline][9] - -Define one CI/CD pipeline with one build definition per application that is used to trigger _pull-request pre-merge validation_ and _continuous integration_ builds. Generate a _release_ build with debug information and upload to the [Symbol Server][10]. ****This enables developers to debug locally and remotely in production without having to worry which build and symbols they need to load—the symbol server performs that magic for us. - -![Breaking down the CI build pipeline][11] - -Perform as many validations as possible in the build—_shift left_—allowing feature teams to fail fast, continuously raise the overall product quality, and include invaluable evidence for the reviewers with every pull request. Do you prefer a pull request with a gazillion commits? Or a pull request with a couple of commits and supporting evidence such as security vulnerabilities, test coverage, code quality, and [Stryker][12] mutant remnants? Personally, I vote for the latter. - -![Breaking down the CD release pipeline][13] - -Do not use build transformation to generate multiple, environment-specific builds. Create one build and perform release-time _transformation_, _tokenization_, and/or XML/JSON _value replacement_. In other words, _shift-right_ the environment-specific configuration. - -![Shift-right the environment-specific configuration][14] - -Securely store release configuration data and make it available to both Dev and Ops teams based on the level of _trust_ and _sensitivity_ of the data. Use the open source Key Manager, Azure Key Vault, AWS Key Management Service, or one of many other products—remember, there are many hammers in your toolkit! - -![Dev-QA-production pipeline][15] - -Use _groups_ instead of _users_ to move approver management from multiple stages across multiple pipelines to simple group membership. - -![Move approver management to simple group membership][16] - -Instead of duplicating pipelines to give teams access to their _areas of interest_, create one pipeline and grant access to _specific stages_ of the delivery environments. - -![Pipeline with access to specific delivery stages][17] - -Last, but not least, embrace pull requests to help raise insight and transparency into your codebase, improve the overall quality, collaborate, and release pre-validation builds into selected environments; e.g., the Dev environment. - -Here is a more formal view of the whole whiteboard sketch. - -![The full pipeline][18] - -So, what are your thoughts and learnings with CI/CD pipelines? Is my dream of _one pipeline to rule them all_ a pipe dream? - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all - -作者:[Willy-Peter Schaub][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/wpschaub/users/bclaster/users/matt-micene/users/barkerd427 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) -[2]: https://continuingstudies.sauder.ubc.ca/courses/agile-delivery-methods/ii861 -[3]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-2.png (Prerequisites for a solid development process) -[4]: https://en.wikipedia.org/wiki/Cynefin_framework -[5]: https://www.lean.org/lexicon/muda-mura-muri -[6]: https://en.wikipedia.org/wiki/Shift_left_testing -[7]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-3.png (5% about products, 15% about process, 80% about people) -[8]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-4_0.png (Improving quality and visibility of pipelines) -[9]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-5_0.png (CI build/CD release pipeline) -[10]: https://en.wikipedia.org/wiki/Microsoft_Symbol_Server -[11]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-6.png (Breaking down the CI build pipeline) -[12]: https://stryker-mutator.io/ -[13]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-7.png (Breaking down the CD release pipeline) -[14]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-8.png (Shift-right the environment-specific configuration) -[15]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-9.png (Dev-QA-production pipeline) -[16]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-10.png (Move approver management to simple group membership) -[17]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-11.png (Pipeline with access to specific delivery stages) -[18]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-12.png (The full pipeline) diff --git a/sources/tech/20190712 What is Silverblue.md b/sources/tech/20190712 What is Silverblue.md deleted file mode 100644 index c23a45b9f8..0000000000 --- a/sources/tech/20190712 What is Silverblue.md +++ /dev/null @@ -1,98 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is Silverblue?) -[#]: via: (https://fedoramagazine.org/what-is-silverblue/) -[#]: author: (Tomáš Popela https://fedoramagazine.org/author/tpopela/) - -What is Silverblue? -====== - -![][1] - -Fedora Silverblue is becoming more and more popular inside and outside the Fedora world. So based on feedback from the community, here are answers to some interesting questions about the project. If you do have any other Silverblue related questions, please leave it in the comments section and we will try to answer them in a future article. - -### What is Silverblue? - -Silverblue is a codename for the new generation of the desktop operating system, previously known as Atomic Workstation. The operating system is delivered in images that are created by utilizing the _[rpm-ostree][2]_ [project][2]. The main benefits of the system are speed, security, atomic updates and immutability. - -### What does “Silverblue” actually mean? - -“Team Silverblue” or “Silverblue” in short doesn’t have any hidden meaning. It was chosen after roughly two months when the project, previously known as Atomic Workstation was rebranded. There were over 150 words or word combinations reviewed in the process. In the end _Silverblue_ was chosen because it had an available domain as well as the social network accounts. One could think of it as a new take on Fedora’s blue branding, and could be used in phrases like “Go, Team Silverblue!” or “Want to join the team and improve Silverblue?”. - -### What is ostree? - -[OSTree or libostree is a project][3] that combines a “git-like” model for committing and downloading bootable filesystem trees, together with a layer to deploy them and manage the bootloader configuration. OSTree is used by rpm-ostree, a hybrid package/image based system that Silverblue uses. It atomically replicates a base OS and allows the user to “layer” the traditional RPM on top of the base OS if needed. - -### Why use Silverblue? - -Because it allows you to concentrate on your work and not on the operating system you’re running. It’s more robust as the updates of the system are atomic. The only thing you need to do is to restart into the new image. Also, if there’s anything wrong with the currently booted image, you can easily reboot/rollback to the previous working one, if available. If it isn’t, you can download and boot any other image that was generated in the past, using the _ostree_ command. - -Another advantage is the possibility of an easy switch between branches (or, in an old context, Fedora releases). You can easily try the _[Rawhide][4]_ or _[updates-testing][5]_ branch and then return back to the one that contains the current stable release. Also, you should consider Silverblue if you want to try something new and unusual. - -### What are the benefits of an immutable OS? - -One of the main benefits is security. The base operating system is mounted as read-only, and thus cannot be modified by malicious software. The only way to alter the system is through the _rpm-ostree_ utility. - -Another benefit is robustness. It’s nearly impossible for a regular user to get the OS to the state when it doesn’t boot or doesn’t work properly after accidentally or unintentionally removing some system library. Try to think about these kind of experiences from your past, and imagine how Silverblue could help you there. - -### How does one manage applications and packages in Silverblue? - -For graphical user interface applications, [Flatpak][6] is recommended, if the application is available as a flatpak. Users can choose between Flatpaks from either Fedora and built from Fedora packages and in Fedora-owned infrastructure, or Flathub that currently has a wider offering. Users can install them easily through GNOME Software, which already supports Fedora Silverblue. - -One of the first things users find out is there is no _dnf_ preinstalled in the OS. The main reason is that it wouldn’t work on Silverblue — and part of its functionality was replaced by the _rpm-ostree_ command. Users can overlay the traditional packages by using the _rpm-ostree install PACKAGE_. But it should only be used when there is no other way. This is because when the new system images are pulled from the repository, the system image must be rebuilt every time it is altered to accommodate the layered packages, or packages that were removed from the base OS or replaced with a different version. - -Fedora Silverblue comes with the default set of GUI applications that are part of the base OS. The team is working on porting them to Flatpaks so they can be distributed that way. As a benefit, the base OS will become smaller and easier to maintain and test, and users can modify their default installation more easily. If you want to look at how it’s done or help, take a look at the official [documentation][7]. - -### What is Toolbox? - -[_Toolbox_][8] is a project to make containers easily consumable for regular users. It does that by using _podman_’s rootless containers. _Toolbox_ lets you easily and quickly create a container with a regular Fedora installation that you can play with or develop on, separated from your OS. - -### Is there any Silverblue roadmap? - -Formally there isn’t any, as we’re focusing on problems we discover during our testing and from community feedback. We’re currently using Fedora’s [Taiga][9] to do our planning. - -### What’s the release life cycle of the Silverblue? - -It’s the same as regular Fedora Workstation. A new release comes every 6 months and is supported for 13 months. The team plans to release updates for the OS bi-weekly (or longer) instead of daily as they currently do. That way the updates can be more thoroughly tested by QA and community volunteers before they are sent to the rest of the users. - -### What is the future of the immutable OS? - -From our point of view the future of the desktop involves the immutable OS. It’s safest for the user, and Android, ChromeOS, and the last macOS Catalina all use this method under the hood. For the Linux desktop there are still problems with some third party software that expects to write to the OS. HP printer drivers are a good example. - -Another issue is how parts of the system are distributed and installed. Fonts are a good example. Currently in Fedora they’re distributed in RPM packages. If you want to use them, you have to overlay them and then restart to the newly created image that contains them. - -### What is the future of standard Workstation? - -There is a possibility that the Silverblue will replace the regular Workstation. But there’s still a long way to go for Silverblue to provide the same functionality and user experience as the Workstation. In the meantime both desktop offerings will be delivered at the same time. - -### How does Atomic Workstation or Fedora CoreOS relate to any of this? - -Atomic Workstation was the name of the project before it was renamed to Fedora Silverblue. - -Fedora CoreOS is a different, but similar project. It shares some fundamental technologies with Silverblue, such as _rpm-ostree_, _toolbox_ and others. Nevertheless, CoreOS is a more minimal, container-focused and automatically updating OS. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/what-is-silverblue/ - -作者:[Tomáš Popela][a] -选题:[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/tpopela/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/what-is-fedora-silverblue-816x345.jpg -[2]: https://rpm-ostree.readthedocs.io/en/latest/ -[3]: https://ostree.readthedocs.io/en/latest/ -[4]: https://fedoraproject.org/wiki/Releases/Rawhide -[5]: https://fedoraproject.org/wiki/QA:Updates_Testing -[6]: https://flatpak.org/ -[7]: https://docs.fedoraproject.org/en-US/flatpak/tutorial/ -[8]: https://github.com/debarshiray/toolbox -[9]: https://teams.fedoraproject.org/project/silverblue/ diff --git a/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md index b4e1a2667b..b72de600e0 100644 --- a/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md +++ b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md @@ -1,11 +1,11 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn how to Install LXD / LXC Containers in Ubuntu) -[#]: via: (https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/) -[#]: author: (Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/) +[#]: collector: "lujun9972" +[#]: translator: "runningwater " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Learn how to Install LXD / LXC Containers in Ubuntu" +[#]: via: "https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/" +[#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/" Learn how to Install LXD / LXC Containers in Ubuntu ====== @@ -497,7 +497,7 @@ via: https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/ 作者:[Shashidhar Soppin][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md deleted file mode 100644 index fb8e0d3938..0000000000 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ /dev/null @@ -1,257 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Sending custom emails with Python) -[#]: via: (https://opensource.com/article/19/8/sending-custom-emails-python) -[#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbie) - -Sending custom emails with Python -====== -Customize your group emails with Mailmerge, a command-line program that -can handle simple and complex emails. -![Chat via email][1] - -Email remains a fact of life. Despite all its warts, it's still the best way to send information to most people, especially in automated ways that allow messages to queue for recipients. - -One of the highlights of my work as the [Fedora Community Action and Impact Coordinator][2] is giving people good news about travel funding. I often send this information over email. Here, I'll show you how I send custom messages to groups of people using [Mailmerge][3], a command-line Python program that can handle simple and complex emails. - -### Install Mailmerge - -Mailmerge is packaged and available in Fedora, and you can install it from the command line with **sudo dnf install python3-mailmerge**. You can also install it from PyPI using **pip**, as the project's [README explains][4]. - -### Configure your Mailmerge files - -Three files control how Mailmerge works. If you run **mailmerge --sample**, it will create template files for you. The files are: - - * **mailmerge_server.conf:** This contains the configuration details for your SMTP host to send emails. Your password is _not_ stored in this file. - * **mailmerge_database.csv:** This holds the custom data for each email, including the recipients' email addresses. - * **mailmerge_template.txt:** This is your email's text with placeholder fields that will be replaced using the data from **mailmerge_database.csv**. - - - -#### Server.conf - -The sample **mailmerge_server.conf** file includes several examples that should be familiar. If you've ever added email to your phone or set up a desktop email client, you've seen this data before. The big thing to remember is to update your username in the file, especially if you are using one of the example configurations. - -#### Database.csv - -The **mailmerge_database.csv** file is a bit more complicated. It must contain (at minimum) the recipients' email addresses and any other custom details necessary to replace the fields in your email. It is a good idea to write the **mailmerge_template.txt** file at the same time you create the fields list for this file. I find it helpful to use a spreadsheet to capture this data and export it as a CSV file when I am done. This sample file: - - -``` -email,name,number -[myself@mydomain.com][5],"Myself",17 -[bob@bobdomain.com][6],"Bob",42 -``` - -allows you to send emails to two people, using their first name and telling them a number. This file, while not terribly interesting, illustrates an important habit: Always make yourself the first recipient in the file. This enables you to send yourself a test email to verify everything works as expected before you email the entire list. - -If any of your values contain commas, you _**must**_ enclose the entire value in double-quotes (**"**). If you need to include a double-quote in a double-quoted field, use two double-quotes in a row. Quoting rules are fun, so read about [CSVs in Python 3][7] for specifics. - -#### Template.txt - -As part of my work, I get to share news about travel-funding decisions for our Fedora contributor conference, [Flock][8]. A simple email tells people they've been selected for travel funding and their specific funding details. One user-specific detail is how much money we can allocate for their airfare. Here is an abbreviated version of my template file (I've snipped out a lot of the text for brevity): - - -``` -$ cat mailmerge_template.txt -TO: {{Email}} -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> - -Hi {{Name}}, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: {{Travel_Budget}} - -<<snip>> -``` - -The top of the template specifies the recipient, sender, and subject. After the blank line, there's the body of the email. This email needs the recipients' **Email**, **Name**, and **Travel_Budget** from the **database.csv** file. Notice that those fields are surrounded by double curly braces (**{{** and **}}**). The corresponding **mailmerge_database.csv** looks like this: - - -``` -$ cat mailmerge_database.csv -Name,Email,Travel_Budget -Brian,[bexelbie@redhat.com][9],1000 -PersonA,[persona@fedoraproject.org][10],1500 -PèrsonB,[personb@fedoraproject.org][11],500 -``` - -Notice that I listed myself first (for testing) and there are two other people in the file. The second person, PèrsonB, has an accented character in their name; Mailmerge will automatically encode it. - -That's the whole template concept: Write your email and put placeholders in double curly braces. Then create a database that provides those values. Now let's test the email. - -### Test and send simple email merges - -#### Do a dry-run - -Start by doing a dry-run that prints the emails, with the placeholder fields completed, to the screen. By default, if you run the command **mailmerge**, it will do a dry-run of the first email: - - -``` -$ mailmerge ->>> encoding ascii ->>> message 0 -TO: [bexelbie@redhat.com][9] -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -MIME-Version: 1.0 -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit -Date: Sat, 20 Jul 2019 18:17:15 -0000 - -Hi Brian, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: 1000 - -<<snip>> - ->>> sent message 0 DRY RUN ->>> No attachments were sent with the emails. ->>> Limit was 1 messages.  To remove the limit, use the --no-limit option. ->>> This was a dry run.  To send messages, use the --no-dry-run option. -``` - -Reviewing the first email (**message 0**, as counting starts from zero, like many things in computer science), you can see my name and travel budget are correct. If you want to review every email, enter **mailmerge --no-limit** to tell Mailmerge not to limit itself to the first email. Here's the dry-run of the third email, which shows the special character encoding: - - -``` ->>> message 2 -TO: [personb@fedoraproject.org][11] -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -MIME-Version: 1.0 -Content-Type: text/plain; charset="iso-8859-1" -Content-Transfer-Encoding: quoted-printable -Date: Sat, 20 Jul 2019 18:22:48 -0000 - -Hi P=E8rsonB, -``` - -That's not an error; **P=E8rsonB** is the encoded form of **PèrsonB**. - -#### Send a test message - -Now, send a test email with the command **mailmerge --no-dry-run**, which tells Mailmerge to send a message to the first email on the list: - - -``` -$ mailmerge --no-dry-run ->>> encoding ascii ->>> message 0 -TO: [bexelbie@redhat.com][9] -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -MIME-Version: 1.0 -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit -Date: Sat, 20 Jul 2019 18:25:45 -0000 - -Hi Brian, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: 1000 - -<<snip>> - ->>> Read SMTP server configuration from mailmerge_server.conf ->>>   host = smtp.gmail.com ->>>   port = 587 ->>>   username = [bexelbie@redhat.com][9] ->>>   security = STARTTLS ->>> password for [bexelbie@redhat.com][9] on smtp.gmail.com: ->>> sent message 0 ->>> No attachments were sent with the emails. ->>> Limit was 1 messages.  To remove the limit, use the --no-limit option. -``` - -On the fourth to last line, you can see it prompts you for your password. If you're using two-factor authentication or domain-managed logins, you will need to create an application password that bypasses these controls. If you're using Gmail and similar systems, you can do it directly from the interface; otherwise, contact your email system administrator. This will not compromise the security of your email system, but you should still keep the password complex and secret. - -When I checked my email account, I received a beautifully formatted test email. If your test email looks ready, send all the emails by entering **mailmerge --no-dry-run --no-limit**. - -### Send complex emails - -You can really see the power of Mailmerge when you take advantage of [Jinja2 templating][12]. I've found it useful for including conditional text and sending attachments. Here is a complex template and the corresponding database: - - -``` -$ cat mailmerge_template.txt -TO: {{Email}} -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -ATTACHMENT: attachments/{{File}} - -Hi {{Name}}, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: {{Travel_Budget}} -{% if Hotel == "Yes" -%} -Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) -{%- endif %} - -<<snip>> - -$ cat mailmerge_database.csv -Name,Email,Travel_Budget,Hotel,File -Brian,[bexelbie@redhat.com][9],1000,Yes,visa_bex.pdf -PersonA,[persona@fedoraproject.org][10],1500,No,visa_person_a.pdf -PèrsonB,[personb@fedoraproject.org][11],500,Yes,visa_person_b.pdf -``` - -There are two new things in this email. First, there's an attachment. I have to send visa invitation letters to international travelers to help them come to Flock, and the **ATTACHMENT** part of the header specifies which file to attach. To keep my directory clean, I put all of them in my Attachments subdirectory. Second, it includes conditional information about a hotel, because some people receive funding for their hotel stay, and I need to include those details for those who do. This is done with the **if** construction: - - -``` -{% if Hotel == "Yes" -%} -Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) -{%- endif %} -``` - -This works just like an **if** in most programming languages. Jinja2 is very expressive and can do multi-level conditions. Experiment with making your life easier by including database elements that control the contents of the email. Using whitespace is important for email readability. The minus (**-**) symbols in **if** and **endif** are part of how Jinja2 controls [whitespace][13]. There are lots of options, so experiment to see what looks best for you. - -Also note that I extended the database with two fields, **Hotel** and **File**. These are the values that control the inclusion of the hotel text and provide the name of the attachment. In my example, PèrsonB and I got hotel funding, while PersonA didn't. - -Doing a dry-run and sending the emails is the same whether you're using a simple or a complex template. Give it a try! - -You can also experiment with using conditionals (**if** … **endif**) in the header. You can, for example, have an attachment only if one is in the database, or maybe you need to change the sender's name for some emails but not others. - -### Mailmerge's advantages - -The Mailmerge program provides a powerful but simple method of sending lots of customized emails. Everyone gets only the information they need, and extraneous steps and details are omitted. - -Even for simple group emails, I have found this method much more effective than sending one email to a bunch of people using CC or BCC. A lot of people filter their email and delay reading anything not sent directly to them. Using Mailmerge ensures that every person gets their own email. Messages will filter properly for the recipient and no one can accidentally "reply all" to the entire group. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/sending-custom-emails-python - -作者:[Brian "bex" Exelbierd][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bexelbie -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) -[2]: https://docs.fedoraproject.org/en-US/council/fcaic/ -[3]: https://github.com/awdeorio/mailmerge -[4]: https://github.com/awdeorio/mailmerge#install -[5]: mailto:myself@mydomain.com -[6]: mailto:bob@bobdomain.com -[7]: https://docs.python.org/3/library/csv.html -[8]: https://flocktofedora.org/ -[9]: mailto:bexelbie@redhat.com -[10]: mailto:persona@fedoraproject.org -[11]: mailto:personb@fedoraproject.org -[12]: http://jinja.pocoo.org/docs/latest/templates/ -[13]: http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control diff --git a/sources/tech/20190814 9 open source cloud native projects to consider.md b/sources/tech/20190814 9 open source cloud native projects to consider.md deleted file mode 100644 index 8f95262799..0000000000 --- a/sources/tech/20190814 9 open source cloud native projects to consider.md +++ /dev/null @@ -1,266 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 open source cloud native projects to consider) -[#]: via: (https://opensource.com/article/19/8/cloud-native-projects) -[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo) - -9 open source cloud native projects to consider -====== -Work with containers? Get familiar with these projects from the Cloud -Native Computing Foundation -![clouds in the sky with blue pattern][1] - -As the practice of developing applications with containers is getting more popular, [cloud-native applications][2] are also on the rise. By [definition][3]: - -> "Cloud-native technologies are used to develop applications built with services packaged in containers, deployed as microservices, and managed on elastic infrastructure through agile DevOps processes and continuous delivery workflows." - -This description includes four elements that are integral to cloud-native applications: - - 1. Container - 2. Microservice - 3. DevOps - 4. Continuous integration and continuous delivery (CI/CD) - - - -Although these technologies have very distinct histories, they complement each other well and have led to surprisingly exponential growth of cloud-native applications and toolsets in a short time. This [Cloud Native Computing Foundation][4] (CNCF) infographic shows the size and breadth of the cloud-native application ecosystem today. - -![Cloud-Native Computing Foundation applications ecosystem][5] - -Cloud-Native Computing Foundation projects - -I mean, just look at that! And this is just a start. Just as NodeJS’s creation sparked the explosion of endless JavaScript tools, the popularity of container technology started the exponential growth of cloud-native applications. - -The good news is that there are several organizations that oversee and connect these dots together. One is the [**Open Containers Initiative (OCI)**][6], which is a lightweight, open governance structure (or project), "formed under the auspices of the Linux Foundation for the express purpose of creating open industry standards around container formats and runtime." The other is the **CNCF**, "an open source software foundation dedicated to making cloud native computing universal and sustainable." - -In addition to building a community around cloud-native applications generally, CNCF also helps projects set up structured governance around their cloud-native applications. CNCF created the concept of maturity levels—Sandbox, Incubating, or Graduated—which correspond to the Innovators, Early Adopters, and Early Majority tiers on the diagram below. - -![CNCF project maturity levels][7] - -CNCF project maturity levels - -The CNCF has detailed [criteria][8] for each maturity level (included below for readers’ convenience). A two-thirds supermajority of the Technical Oversight Committee (TOC) is required for a project to be Incubating or Graduated. - -### Sandbox stage - -> To be accepted in the sandbox, a project must have at least two TOC sponsors. See the CNCF Sandbox Guidelines v1.0 for the detailed process. - -### Incubating stage - -> Note: The incubation level is the point at which we expect to perform full due diligence on projects. -> -> To be accepted to incubating stage, a project must meet the sandbox stage requirements plus: -> -> * Document that it is being used successfully in production by at least three independent end users which, in the TOC’s judgement, are of adequate quality and scope. -> * Have a healthy number of committers. A committer is defined as someone with the commit bit; i.e., someone who can accept contributions to some or all of the project. -> * Demonstrate a substantial ongoing flow of commits and merged contributions. -> * Since these metrics can vary significantly depending on the type, scope, and size of a project, the TOC has final judgement over the level of activity that is adequate to meet these criteria -> - - -### Graduated stage - -> To graduate from sandbox or incubating status, or for a new project to join as a graduated project, a project must meet the incubating stage criteria plus: -> -> * Have committers from at least two organizations. -> * Have achieved and maintained a Core Infrastructure Initiative Best Practices Badge. -> * Have completed an independent and third party security audit with results published of similar scope and quality as the following example (including critical vulnerabilities addressed): and all critical vulnerabilities need to be addressed before graduation. -> * Adopt the CNCF Code of Conduct. -> * Explicitly define a project governance and committer process. This preferably is laid out in a GOVERNANCE.md file and references an OWNERS.md file showing the current and emeritus committers. -> * Have a public list of project adopters for at least the primary repo (e.g., ADOPTERS.md or logos on the project website). -> * Receive a supermajority vote from the TOC to move to graduation stage. Projects can attempt to move directly from sandbox to graduation, if they can demonstrate sufficient maturity. Projects can remain in an incubating state indefinitely, but they are normally expected to graduate within two years. -> - - -## 9 projects to consider - -While it’s impossible to cover all of the CNCF projects in this article, I’ll describe are nine of most interesting Graduated and Incubating open source projects. - -Name | License | What It Is ----|---|--- -[Kubernetes][9] | Apache 2.0 | Orchestration platform for containers -[Prometheus][10] | Apache 2.0 | Systems and service monitoring tool -[Envoy][11] | Apache 2.0 | Edge and service proxy -[rkt][12] | Apache 2.0 | Pod-native container engine -[Jaeger][13] | Apache 2.0 | Distributed tracing system -[Linkerd][14] | Apache 2.0 | Transparent service mesh -[Helm][15] | Apache 2.0 | Kubernetes package manager -[Etcd][16] | Apache 2.0 | Distributed key-value store -[CRI-O][17] | Apache 2.0 | Lightweight runtime for Kubernetes - -I also created this video tutorial to walk through these projects. - -## Graduated projects - -Graduated projects are considered mature—adopted by many organizations—and must adhere to the CNCF’s guidelines. Following are three of the most popular open source CNCF Graduated projects. (Note that some of these descriptions are adapted and reused from the projects' websites.) - -### Kubernetes - -Ah, Kubernetes. How can we talk about cloud-native applications without mentioning Kubernetes? Invented by Google, Kubernetes is undoubtedly the most famous container-orchestration platform for container-based applications, and it is also an open source tool. - -What is a container orchestration platform? Basically, a container engine on its own may be okay for managing a few containers. However, when you are talking about thousands of containers and hundreds of services, managing those containers becomes super complicated. This is where the container engine comes in. The container-orchestration engine helps scale containers by automating the deployment, management, networking, and availability of containers. - -Docker Swarm and Mesosphere Marathon are other container-orchestration engines, but it is safe to say that Kubernetes has won the race (at least for now). Kubernetes also gave birth to Container-as-a-Service (CaaS) platforms like [OKD][18], the Origin community distribution of Kubernetes that powers [Red Hat OpenShift][19]. - -To get started, visit the [Kubernetes GitHub repository][9], and access its documentation and learning resources from the [Kubernetes documentation][20] page. - -### Prometheus - -Prometheus is an open source system monitoring and alerting toolkit built at SoundCloud in 2012. Since then, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project that is maintained independently of the company. - -![Prometheus’ architecture][21] - -Prometheus’ architecture - -The easiest way to think about Prometheus is to visualize a production system that needs to be up 24 hours a day and 365 days a year. No system is perfect, and there are techniques to reduce failures (called fault-tolerant systems). However, if an issue occurs, the most important thing is to identify it as soon as possible. That is where a monitoring tool like Prometheus comes in handy. Prometheus is more than a container-monitoring tool, but it is most popular among cloud-native application companies. In addition, other open source monitoring tools, including [Grafana][22], leverage Prometheus. - -The best way to get started with Prometheus is to check out its [GitHub repo][10]. Running Prometheus locally is easy, but you need to have a container engine installed. You can access detailed documentation on [Prometheus’ website][23]. - -### Envoy - -Envoy (or Envoy Proxy) is an open source edge and service proxy designed for cloud-native applications. Created at Lyft, Envoy is a high-performance, C++, distributed proxy designed for single services and applications, as well as a communications bus and a universal data plane designed for large microservice service mesh architectures. Built on the learnings of solutions such as Nginx, HAProxy, hardware load balancers, and cloud load balancers, Envoy runs alongside every application and abstracts the network by providing common features in a platform-agnostic manner. - -When all service traffic in an infrastructure flows through an Envoy mesh, it becomes easy to visualize problem areas via consistent observability, tune overall performance, and add substrate features in a single place. Basically, Envoy Proxy is a service mesh tool that helps organizations build a fault-tolerant system for production environments. - -There are numerous alternatives for service mesh applications, such as Uber’s [Linkerd][24] (discussed below) and [Istio][25]. Istio extends Envoy Proxy by deploying as a [Sidecar][26] and leveraging the [Mixer][27] configuration model. Notable Envoy features are: - - * All the "table stakes" features (when paired with a control plane, like Istio) are included - * Low, 99th percentile latencies at scale when running under load - * Acts as an L3/L4 filter at its core with many L7 filters provided out of the box - * Support for gRPC and HTTP/2 (upstream/downstream) - * It’s API-driven and supports dynamic configuration and hot reloads - * Has a strong focus on metric collection, tracing, and overall observability - - - -Understanding Envoy, proving its capabilities, and realizing its full benefits require extensive experience with running production-level environments. You can learn more in its [detailed documentation][28] and by accessing its [GitHub][11] repository. - -## Incubating projects - -Following are six of the most popular open source CNCF Incubating projects. - -### rkt - -rkt, pronounced "rocket," is a pod-native container engine. It has a command-line interface (CLI) for running containers on Linux. In a sense, it is similar to other containers, like [Podman][29], Docker, and CRI-O. - -rkt was originally developed by CoreOS (later acquired by Red Hat), and you can find detailed [documentation][30] on its website and access the source code on [GitHub][12]. - -### Jaeger - -Jaeger is an open source, end-to-end distributed tracing system for cloud-native applications. In one way, it is a monitoring solution like Prometheus. Yet it is different because its use cases extend into: - - * Distributed transaction monitoring - * Performance and latency optimization - * Root-cause analysis - * Service dependency analysis - * Distributed context propagation - - - -Jaeger is an open source technology built by Uber. You can find [detailed documentation][31] on its website and its [source code][13] on GitHub. - -### Linkerd - -Like Lyft with Envoy Proxy, Uber developed Linkerd as an open source solution to maintain its service at the production level. In some ways, Linkerd is just like Envoy, as both are service mesh tools designed to give platform-wide observability, reliability, and security without requiring configuration or code changes. - -However, there are some subtle differences between the two. While Envoy and Linkerd function as proxies and can report over services that are connected, Envoy isn’t designed to be a Kubernetes Ingress controller, as Linkerd is. Notable features of Linkerd include: - - * Support for multiple platforms (Docker, Kubernetes, DC/OS, Amazon ECS, or any stand-alone machine) - * Built-in service discovery abstractions to unite multiple systems - * Support for gRPC, HTTP/2, and HTTP/1.x requests plus all TCP traffic - - - -You can read more about it on [Linkerd’s website][32] and access its source code on [GitHub][14]. - -### Helm - -Helm is basically the package manager for Kubernetes. If you’ve used Apache Maven, Maven Nexus, or a similar service, you will understand Helm’s purpose. Helm helps you manage your Kubernetes application. It uses "Helm Charts" to define, install, and upgrade even the most complex Kubernetes applications. Helm isn’t the only method for this; another concept becoming popular is [Kubernetes Operators][33], which are used by Red Hat OpenShift 4. - -You can try Helm by following the [quickstart guide][34] in its documentation or its [GitHub guide][15]. - -### Etcd - -Etcd is a distributed, reliable key-value store for the most critical data in a distributed system. Its key features are: - - * Well-defined, user-facing API (gRPC) - * Automatic TLS with optional client certificate authentication - * Speed (benchmarked at 10,000 writes per second) - * Reliability (distributed using Raft) - - - -Etcd is used as a built-in default data storage for Kubernetes and many other technologies. That said, it is rarely run independently or as a separate service; instead, it utilizes the one integrated into Kubernetes, OKD/OpenShift, or another service. There is also an [etcd Operator][35] to manage its lifecycle and unlock its API management capabilities: - -You can learn more in [etcd’s documentation][36] and access its [source code][16] on GitHub. - -### CRI-O - -CRI-O is an Open Container Initiative (OCI)-compliant implementation of the Kubernetes runtime interface. CRI-O is used for various functions including: - - * Runtime using runc (or any OCI runtime-spec implementation) and OCI runtime tools - * Image management using containers/image - * Storage and management of image layers using containers/storage - * Networking support through the Container Network Interface (CNI) - - - -CRI-O provides plenty of [documentation][37], including guides, tutorials, articles, and even podcasts, and you can also access its [GitHub page][17]. - -* * * - -Did I miss an interesting open source cloud-native project? Please let me know in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/cloud-native-projects - -作者:[Bryant Son][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) -[2]: https://opensource.com/article/18/7/what-are-cloud-native-apps -[3]: https://thenewstack.io/10-key-attributes-of-cloud-native-applications/ -[4]: https://www.cncf.io -[5]: https://opensource.com/sites/default/files/uploads/cncf_1.jpg (Cloud-Native Computing Foundation applications ecosystem) -[6]: https://www.opencontainers.org -[7]: https://opensource.com/sites/default/files/uploads/cncf_2.jpg (CNCF project maturity levels) -[8]: https://github.com/cncf/toc/blob/master/process/graduation_criteria.adoc -[9]: https://github.com/kubernetes/kubernetes -[10]: https://github.com/prometheus/prometheus -[11]: https://github.com/envoyproxy/envoy -[12]: https://github.com/rkt/rkt -[13]: https://github.com/jaegertracing/jaeger -[14]: https://github.com/linkerd/linkerd -[15]: https://github.com/helm/helm -[16]: https://github.com/etcd-io/etcd -[17]: https://github.com/cri-o/cri-o -[18]: https://www.okd.io/ -[19]: https://www.openshift.com -[20]: https://kubernetes.io/docs/home -[21]: https://opensource.com/sites/default/files/uploads/cncf_3.jpg (Prometheus’ architecture) -[22]: https://grafana.com -[23]: https://prometheus.io/docs/introduction/overview -[24]: https://linkerd.io/ -[25]: https://istio.io/ -[26]: https://istio.io/docs/reference/config/networking/v1alpha3/sidecar -[27]: https://istio.io/docs/reference/config/policy-and-telemetry -[28]: https://www.envoyproxy.io/docs/envoy/latest -[29]: https://podman.io -[30]: https://coreos.com/rkt/docs/latest -[31]: https://www.jaegertracing.io/docs/1.13 -[32]: https://linkerd.io/2/overview -[33]: https://coreos.com/operators -[34]: https://helm.sh/docs -[35]: https://github.com/coreos/etcd-operator -[36]: https://etcd.io/docs/v3.3.12 -[37]: https://github.com/cri-o/cri-o/blob/master/awesome.md diff --git a/sources/tech/20190814 How to install Python on Windows.md b/sources/tech/20190814 How to install Python on Windows.md deleted file mode 100644 index a3b7ea2454..0000000000 --- a/sources/tech/20190814 How to install Python on Windows.md +++ /dev/null @@ -1,203 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install Python on Windows) -[#]: via: (https://opensource.com/article/19/8/how-install-python-windows) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) - -How to install Python on Windows -====== -Install Python, run an IDE, and start coding right from your Microsoft -Windows desktop. -![Hands programming][1] - -So you want to learn to program? One of the most common languages to start with is [Python][2], popular for its unique blend of [object-oriented][3] structure and simple syntax. Python is also an _interpreted_ _language_, meaning you don't need to learn how to compile code into machine language: Python does that for you, allowing you to test your programs sometimes instantly and, in a way, while you write your code. - -Just because Python is easy to learn doesn't mean you should underestimate its potential power. Python is used by [movie][4] [studios][5], financial institutions, IT houses, video game studios, makers, hobbyists, [artists][6], teachers, and many others. - -On the other hand, Python is also a serious programming language, and learning it takes dedication and practice. Then again, you don't have to commit to anything just yet. You can install and try Python on nearly any computing platform, so if you're on Windows, this article is for you. - -If you want to try Python on a completely open source operating system, you can [install Linux][7] and then [try Python][8]. - -### Get Python - -Python is available from its website, [Python.org][9]. Once there, hover your mouse over the **Downloads** menu, then over the **Windows** option, and then click the button to download the latest release. - -![Downloading Python on Windows][10] - -Alternatively, you can click the **Downloads** menu button and select a specific version from the downloads page. - -### Install Python - -Once the package is downloaded, open it to start the installer. - -It is safe to accept the default install location, and it's vital to add Python to PATH. If you don't add Python to your PATH, then Python applications won't know where to find Python (which they require in order to run). This is _not_ selected by default, so activate it at the bottom of the install window before continuing! - -![Select "Add Python 3 to PATH"][11] - -Before Windows allows you to install an application from a publisher other than Microsoft, you must give your approval. Click the **Yes** button when prompted by the **User Account Control** system. - -![Windows UAC][12] - -Wait patiently for Windows to distribute the files from the Python package into the appropriate locations, and when it's finished, you're done installing Python. - -Time to play. - -### Install an IDE - -To write programs in Python, all you really need is a text editor, but it's convenient to have an integrated development environment (IDE). An IDE integrates a text editor with some friendly and helpful Python features. IDLE 3 and NINJA-IDE are two options to consider. - -#### IDLE 3 - -Python comes with an IDE called IDLE. You can write code in any text editor, but using an IDE provides you with keyword highlighting to help detect typos, a **Run** button to test code quickly and easily, and other code-specific features that a plain text editor like [Notepad++][13] normally doesn't have. - -To start IDLE, click the **Start** (or **Window**) menu and type **python** for matches. You may find a few matches, since Python provides more than one interface, so make sure you launch IDLE. - -![IDLE 3 IDE][14] - -If you don't see Python in the Start menu, launch the Windows command prompt by typing **cmd** in the Start menu, then type: - - -``` -`C:\Windows\py.exe` -``` - -If that doesn't work, try reinstalling Python. Be sure to select **Add Python to PATH** in the install wizard. Refer to the [Python docs][15] for detailed instructions. - -#### Ninja-IDE - -If you already have some coding experience and IDLE seems too simple for you, try [Ninja-IDE][16]. Ninja-IDE is an excellent Python IDE. It has keyword highlighting to help detect typos, quotation and parenthesis completion to avoid syntax errors, line numbers (helpful when debugging), indentation markers, and a **Run** button to test code quickly and easily. - -![Ninja-IDE][17] - -To install it, visit the Ninja-IDE website and [download the Windows installer][18]. The process is the same as with Python: start the installer, allow Windows to install a non-Microsoft application, and wait for the installer to finish. - -Once Ninja-IDE is installed, double-click the Ninja-IDE icon on your desktop or select it from the Start menu. - -### Tell Python what to do - -Keywords tell Python what you want it to do. In either IDLE or Ninja-IDE, go to the File menu and create a new file. - -Ninja users: Do not create a new project, just a new file. - -In your new, empty file, type this into IDLE or Ninja-IDE: - - -``` -`print("Hello world.")` -``` - - * If you are using IDLE, go to the Run menu and select the Run Module option. - * If you are using Ninja, click the Run File button in the left button bar. - - - -![Running code in Ninja-IDE][19] - -Any time you run code, your IDE prompts you to save the file you're working on. Do that before continuing. - -The keyword **print** tells Python to print out whatever text you give it in parentheses and quotes. - -That's not very exciting, though. At its core, Python has access to only basic keywords like **print** and **help**, basic math functions, and so on. - -Use the **import** keyword to load more keywords. Start a new file in IDLE or Ninja and name it **pen.py**. - -**Warning**: Do not call your file **turtle.py**, because **turtle.py** is the name of the file that contains the turtle program you are controlling. Naming your file **turtle.py** confuses Python because it thinks you want to import your own file. - -Type this code into your file and run it: - - -``` -`import turtle` -``` - -[Turtle][20] is a fun module to use. Add this code to your file: - - -``` -turtle.begin_fill() -turtle.forward(100) -turtle.left(90) -turtle.forward(100) -turtle.left(90) -turtle.forward(100) -turtle.left(90) -turtle.forward(100) -turtle.end_fill() -``` - -See what shapes you can draw with the turtle module. - -To clear your turtle drawing area, use the **turtle.clear()** keyword. What do you think the keyword **turtle.color("blue")** does? - -Try more complex code: - - -``` -import turtle as t -import time - -t.color("blue") -t.begin_fill() - -counter = 0 - -while counter < 4: -    t.forward(100) -    t.left(90) -    counter = counter+1 - -t.end_fill() -time.sleep(2) -``` - -As a challenge, try changing your script to get this result: - -![Example Python turtle output][21] - -Once you complete that script, you're ready to move on to more exciting modules. A good place to start is this [introductory dice game][22]. - -### Stay Pythonic - -Python is a fun language with modules for practically anything you can think to do with it. As you can see, it's easy to get started with Python, and as long as you're patient with yourself, you may find yourself understanding and writing Python code with the same fluidity as you write your native language. Work through some [Python articles][23] here on Opensource.com, try scripting some small tasks for yourself, and see where Python takes you. To really integrate Python with your daily workflow, you might even try Linux, which is natively scriptable in ways no other operating system is. You might find yourself, given enough time, using the applications you create! - -Good luck, and stay Pythonic. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/how-install-python-windows - -作者:[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/sethhttps://opensource.com/users/greg-p -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) -[2]: https://www.python.org/ -[3]: https://opensource.com/article/19/7/get-modular-python-classes -[4]: https://github.com/edniemeyer/weta_python_db -[5]: https://www.python.org/about/success/ilm/ -[6]: https://opensource.com/article/19/7/rgb-cube-python-scribus -[7]: https://opensource.com/article/19/7/ways-get-started-linux -[8]: https://opensource.com/article/17/10/python-101 -[9]: https://www.python.org/downloads/ -[10]: https://opensource.com/sites/default/files/uploads/win-python-install.jpg (Downloading Python on Windows) -[11]: https://opensource.com/sites/default/files/uploads/win-python-path.jpg (Select "Add Python 3 to PATH") -[12]: https://opensource.com/sites/default/files/uploads/win-python-publisher.jpg (Windows UAC) -[13]: https://notepad-plus-plus.org/ -[14]: https://opensource.com/sites/default/files/uploads/idle3.png (IDLE 3 IDE) -[15]: http://docs.python.org/3/using/windows.html -[16]: http://ninja-ide.org/ -[17]: https://opensource.com/sites/default/files/uploads/win-python-ninja.jpg (Ninja-IDE) -[18]: http://ninja-ide.org/downloads/ -[19]: https://opensource.com/sites/default/files/uploads/ninja_run.png (Running code in Ninja-IDE) -[20]: https://opensource.com/life/15/8/python-turtle-graphics -[21]: https://opensource.com/sites/default/files/uploads/win-python-idle-turtle.jpg (Example Python turtle output) -[22]: https://opensource.com/article/17/10/python-101#python-101-dice-game -[23]: https://opensource.com/sitewide-search?search_api_views_fulltext=Python diff --git a/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md b/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md deleted file mode 100644 index 267a54e8d7..0000000000 --- a/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md +++ /dev/null @@ -1,169 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cockpit and the evolution of the Web User Interface) -[#]: via: (https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/) -[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) - -Cockpit and the evolution of the Web User Interface -====== - -![][1] - -Over 3 years ago the Fedora Magazine published an article entitled [Cockpit: an overview][2]. Since then, the interface has see some eye-catching changes. Today’s Cockpit is cleaner and the larger fonts makes better use of screen real-estate. - -This article will go over some of the changes made to the UI. It will also explore some of the general tools available in the web interface to simplify those monotonous sysadmin tasks. - -### Cockpit installation - -Cockpit can be installed using the **dnf install cockpit** command. This provides a minimal setup providing the basic tools required to use the interface. - -Another option is to install the Headless Management group. This will install additional packages used to extend the usability of Cockpit. It includes extensions for NetworkManager, software packages, disk, and SELinux management. - -Run the following commands to enable the web service on boot and open the firewall port: - -``` -$ sudo systemctl enable --now cockpit.socket -Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket -> /usr/lib/systemd/system/cockpit.socket - -$ sudo firewall-cmd --permanent --add-service cockpit -success -$ sudo firewall-cmd --reload -success -``` - -### Logging into the web interface - -To access the web interface, open your favourite browser and enter the server’s domain name or IP in the address bar followed by the service port (9090). Because Cockpit uses HTTPS, the installation will create a self-signed certificate to encrypt passwords and other sensitive data. You can safely accept this certificate, or request a CA certificate from your sysadmin or a trusted source. - -Once the certificate is accepted, the new and improved login screen will appear. Long-time users will notice the username and password fields have been moved to the top. In addition, the white background behind the credential fields immediately grabs the user’s attention. - -![][3] - -A feature added to the login screen since the previous article is logging in with **sudo** privileges — if your account is a member of the wheel group. Check the box beside _Reuse my password for privileged tasks_ to elevate your rights. - -Another edition to the login screen is the option to connect to remote servers also running the Cockpit web service. Click _Other Options_ and enter the host name or IP address of the remote machine to manage it from your local browser. - -### Home view - -Right off the bat we get a basic overview of common system information. This includes the make and model of the machine, the operating system, if the system is up-to-date, and more. - -![][4] - -Clicking the make/model of the system displays hardware information such as the BIOS/Firmware. It also includes details about the components as seen with **lspci**. - -![][5] - -Clicking on any of the options to the right will display the details of that device. For example, the _% of CPU cores_ option reveals details on how much is used by the user and the kernel. In addition, the _Memory & Swap_ graph displays how much of the system’s memory is used, how much is cached, and how much of the swap partition active. The _Disk I/O_ and _Network Traffic_ graphs are linked to the Storage and Networking sections of Cockpit. These topics will be revisited in an upcoming article that explores the system tools in detail. - -#### Secure Shell Keys and authentication - -Because security is a key factor for sysadmins, Cockpit now has the option to view the machine’s MD5 and SHA256 key fingerprints. Clicking the **Show fingerprints** options reveals the server’s ECDSA, ED25519, and RSA fingerprint keys. - -![][6] - -You can also add your own keys by clicking on your username in the top-right corner and selecting **Authentication**. Click on **Add keys** to validate the machine on other systems. You can also revoke your privileges in the Cockpit web service by clicking on the **X** button to the right. - -![][7] - -#### Changing the host name and joining a domain - -Changing the host name is a one-click solution from the home page. Click the host name currently displayed, and enter the new name in the _Change Host Name_ box. One of the latest features is the option to provide a _Pretty name_. - -Another feature added to Cockpit is the ability to connect to a directory server. Click _Join a domain_ and a pop-up will appear requesting the domain address or name, organization unit (optional), and the domain admin’s credentials. The Domain Membership group provides all the packages required to join an LDAP server including FreeIPA, and the popular Active Directory. - -To opt-out, click on the domain name followed by _Leave Domain_. A warning will appear explaining the changes that will occur once the system is no longer on the domain. To confirm click the red _Leave Domain_ button. - -![][8] - -#### Configuring NTP and system date and time - -Using the command-line and editing config files definitely takes the cake when it comes to maximum tweaking. However, there are times when something more straightforward would suffice. With Cockpit, you have the option to set the system’s date and time manually or automatically using NTP. Once synchronized, the information icon on the right turns from red to blue. The icon will disappear if you manually set the date and time. - -To change the timezone, type the continent and a list of cities will populate beneath. - -![][9] - -#### Shutting down and restarting - -You can easily shutdown and restart the server right from home screen in Cockpit. You can also delay the shutdown/reboot and send a message to warn users. - -![][10] - -#### Configuring the performance profile - -If the _tuned_ and _tuned-utils_ packages are installed, performance profiles can be changed from the main screen. By default it is set to a recommended profile. However, if the purpose of the server requires more performance, we can change the profile from Cockpit to suit those needs. - -![][11] - -### Terminal web console - -A Linux sysadmin’s toolbox would be useless without access to a terminal. This allows admins to fine-tune the server beyond what’s available in Cockpit. With the addition of themes, admins can quickly adjust the text and background colours to suit their preference. - -Also, if you type **exit** by mistake, click the _Reset_ button in the top-right corner*.* This will provide a fresh screen with a flashing cursor. - -![][12] - -### Adding a remote server and the Dashboard overlay - -The Headless Management group includes the Dashboard module (**cockpit-dashboard**). This provides an overview the of the CPU, memory, network, and disk performance in a real-time graph. Remote servers can also be added and managed through the same interface. - -For example, to add a remote computer in Dashboard, click the **+** button. Enter the name or IP address of the server and select the colour of your choice. This helps to differentiate the stats of the servers in the graph. To switch between servers, click on the host name (as seen in the screen-cast below). To remove a server from the list, click the check-mark icon, then click the red trash icon. The example below demonstrates how Cockpit manages a remote machine named _server02.local.lan_. - -![][13] - -### Documentation and finding help - -As always, the _man_ pages are a great place to find documentation. A simple search in the command-line results with pages pertaining to different aspects of using and configuring the web service. - -``` -$ man -k cockpit -cockpit (1) - Cockpit -cockpit-bridge (1) - Cockpit Host Bridge -cockpit-desktop (1) - Cockpit Desktop integration -cockpit-ws (8) - Cockpit web service -cockpit.conf (5) - Cockpit configuration file -``` - -The Fedora repository also has a package called **cockpit-doc**. The package’s description explains it best: - -> The Cockpit Deployment and Developer Guide shows sysadmins how to deploy Cockpit on their machines as well as helps developers who want to embed or extend Cockpit. - -For more documentation visit - -### Conclusion - -This article only touches upon some of the main functions available in Cockpit. Managing storage devices, networking, user account, and software control will be covered in an upcoming article. In addition, optional extensions such as the 389 directory service, and the _cockpit-ostree_ module used to handle packages in Fedora Silverblue. - -The options continue to grow as more users adopt Cockpit. The interface is ideal for admins who want a light-weight interface to control their server(s). - -What do you think about Cockpit? Share your experience and ideas in the comments below. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ - -作者:[Shaun Assam][a] -选题:[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/sassam/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-816x345.jpg -[2]: https://fedoramagazine.org/cockpit-overview/ -[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-login-screen.png -[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-home-screen.png -[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-system-info.gif -[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-ssh-key-fingerprints.png -[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-authentication.png -[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-hostname-domain.gif -[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-date-time.png -[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-power-options.gif -[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-tuned.gif -[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-terminal.gif -[13]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-add-remote-servers.gif diff --git a/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md deleted file mode 100644 index 877845b87a..0000000000 --- a/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md +++ /dev/null @@ -1,197 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Configure SFTP Server with Chroot in Debian 10) -[#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -How to Configure SFTP Server with Chroot in Debian 10 -====== - -**SFTP** stands for Secure File Transfer Protocol / SSH File Transfer Protocol, it is one of the most common method which is used to transfer files securely over ssh from our local system to remote server and vice-versa. The main advantage of sftp is that we don’t need to install any additional package except ‘**openssh-server**’, in most of the Linux distributions ‘openssh-server’ package is the part of default installation. Other benefit of sftp is that we can allow user to use sftp only not ssh. - -[![Configure-sftp-debian10][1]][2] - -Recently Debian 10, Code name ‘Buster’ has been released, in this article we will demonstrate how to configure sftp with Chroot ‘Jail’ like environment in Debian 10 System. Here Chroot Jail like environment means that user’s cannot go beyond from their respective home directories or users cannot change directories from their home directories.  Following are the lab details: - - * OS = Debian 10 - * IP Address = 192.168.56.151 - - - -Let’s jump into SFTP Configuration Steps, - -### Step:1) Create a Group for sftp using groupadd command - -Open the terminal, create a group with a name “**sftp_users**” using below groupadd command, - -``` -root@linuxtechi:~# groupadd sftp_users -``` - -### Step:2) Add Users to Group ‘sftp_users’ and set permissions - -In case you want to create new user and want to add that user to ‘sftp_users’ group, then run the following command, - -**Syntax:** #  useradd -m -G sftp_users <user_name> - -Let’s suppose user name is ’Jonathan’ - -``` -root@linuxtechi:~# useradd -m -G sftp_users jonathan -``` - -set the password using following chpasswd command, - -``` -root@linuxtechi:~# echo "jonathan:" | chpasswd -``` - -In case you want to add existing users to ‘sftp_users’ group then run beneath usermod command, let’s suppose already existing user name is ‘chris’ - -``` -root@linuxtechi:~# usermod -G sftp_users chris -``` - -Now set the required permissions on Users, - -``` -root@linuxtechi:~# chown root /home/jonathan /home/chris/ -``` - -Create an upload folder in both the user’s home directory and set the correct ownership, - -``` -root@linuxtechi:~# mkdir /home/jonathan/upload -root@linuxtechi:~# mkdir /home/chris/upload -root@linuxtechi:~# chown jonathan /home/jonathan/upload -root@linuxtechi:~# chown chris /home/chris/upload -``` - -**Note:** User like Jonathan and Chris can upload files and directories to upload folder from their local systems. - -### Step:3) Edit sftp configuration file (/etc/ssh/sshd_config) - -As we have already stated that sftp operations are done over the ssh, so it’s configuration file is “**/etc/ssh/sshd_config**“, Before making any changes I would suggest first take the backup and then edit this file and add the following content, - -``` -root@linuxtechi:~# cp /etc/ssh/sshd_config /etc/ssh/sshd_config-org -root@linuxtechi:~# vim /etc/ssh/sshd_config -……… -#Subsystem sftp /usr/lib/openssh/sftp-server -Subsystem sftp internal-sftp - -Match Group sftp_users - X11Forwarding no - AllowTcpForwarding no - ChrootDirectory %h - ForceCommand internal-sftp -………… -``` - -Save & exit the file. - -To make above changes into the affect, restart ssh service using following systemctl command - -``` -root@linuxtechi:~# systemctl restart sshd -``` - -In above ‘sshd_config’ file we have commented out the line which starts with “Subsystem” and added new entry “Subsystem       sftp    internal-sftp” and new lines like, - -“**Match Group sftp_users”**  –> It means if a user is a part of ‘sftp_users’ group then apply rules which are mentioned below to this entry. - -“**ChrootDierctory %h**” –> It means users can only change directories within their respective home directories, they cannot go beyond their home directories, or in other words we can say users are not permitted to change directories, they will get jai like environment within their directories and can’t access any other user’s and system’s directories. - -“**ForceCommand internal-sftp**” –> It means users are limited to sftp command only. - -### Step:4) Test and Verify sftp - -Login to any other Linux system which is on the same network of your sftp server and then try to ssh sftp server via the users that we have mapped in ‘sftp_users’ group. - -``` -[root@linuxtechi ~]# ssh root@linuxtechi -root@linuxtechi's password: -Write failed: Broken pipe -[root@linuxtechi ~]# ssh root@linuxtechi -root@linuxtechi's password: -Write failed: Broken pipe -[root@linuxtechi ~]# -``` - -Above confirms that users are not allowed to SSH , now try sftp using following commands, - -``` -[root@linuxtechi ~]# sftp root@linuxtechi -root@linuxtechi's password: -Connected to 192.168.56.151. -sftp> ls -l -drwxr-xr-x 2 root 1001 4096 Sep 14 07:52 debian10-pkgs --rw-r--r-- 1 root 1001 155 Sep 14 07:52 devops-actions.txt -drwxr-xr-x 2 1001 1002 4096 Sep 14 08:29 upload -``` - -Let’s try to download a file using sftp ‘**get**‘ command - -``` -sftp> get devops-actions.txt -Fetching /devops-actions.txt to devops-actions.txt -/devops-actions.txt 100% 155 0.2KB/s 00:00 -sftp> -sftp> cd /etc -Couldn't stat remote file: No such file or directory -sftp> cd /root -Couldn't stat remote file: No such file or directory -sftp> -``` - -Above output confirms that we are able to download file from our sftp server to local machine and apart from this we have also tested that users cannot change directories. - -Let’s try to upload a file under “**upload**” folder, - -``` -sftp> cd upload/ -sftp> put metricbeat-7.3.1-amd64.deb -Uploading metricbeat-7.3.1-amd64.deb to /upload/metricbeat-7.3.1-amd64.deb -metricbeat-7.3.1-amd64.deb 100% 38MB 38.4MB/s 00:01 -sftp> ls -l --rw-r--r-- 1 1001 1002 40275654 Sep 14 09:18 metricbeat-7.3.1-amd64.deb -sftp> -``` - -This confirms that we have successfully uploaded a file from our local system to sftp server. - -Now test the SFTP server with winscp tool, enter the sftp server ip address along user’s credentials, - -[![Winscp-sftp-debian10][1]][3] - -Click on Login and then try to download and upload files - -[![Download-file-winscp-debian10-sftp][1]][4] - -Now try to upload files in upload folder, - -[![Upload-File-using-winscp-Debian10-sftp][1]][5] - -Above window confirms that uploading is also working fine, that’s all from this article. If these steps help you to configure SFTP server with chroot environment in Debian 10 then please do share your feedback and comments. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/configure-sftp-chroot-debian10/ - -作者:[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 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-sftp-debian10.jpg -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Winscp-sftp-debian10.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Download-file-winscp-debian10-sftp.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Upload-File-using-winscp-Debian10-sftp.jpg diff --git a/sources/tech/20191007 20 Linux Command Tips and Tricks That Will Save You A Lot of Time.md b/sources/tech/20191007 20 Linux Command Tips and Tricks That Will Save You A Lot of Time.md new file mode 100644 index 0000000000..da080e65ea --- /dev/null +++ b/sources/tech/20191007 20 Linux Command Tips and Tricks That Will Save You A Lot of Time.md @@ -0,0 +1,307 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (20 Linux Command Tips and Tricks That Will Save You A Lot of Time) +[#]: via: (https://itsfoss.com/linux-command-tricks/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +20 Linux Command Tips and Tricks That Will Save You A Lot of Time +====== + +_**Brief**: Here are some tiny but useful Linux commands, terminal tricks and shortcuts that will save you a lot of time while working with Linux command line._ + +Have you ever encountered a moment when you see your colleague using some simple Linux commands for tasks that took you several keystrokes? And when you saw that you were like, “Wow! I didn’t know it could have been done that easily”. + +In this article, I’ll show you some pro Linux command tricks that will save you a lot of time and in some cases, from plenty of frustration. Not only your friends or colleagues will ‘wow’ at you, it will also help you increase your productivity as you will need fewer keystrokes and even fewer mouse clicks. + +It’s not that these are Linux tips for beginners only. Chances are that even experienced Linux users will find some hidden gems that they were not aware despite using Linux for all these years. + +In any case, you [learn Linux][1] by experience, be it your own or someone else’s :) + +### Cool Linux terminal tricks to save time and increase productivity + +![][2] + +You might already know a few of these Linux command tips or perhaps all of it. In either case, you are welcome to share your favorite tricks in the comment section. + +Some of these tips also depend on how the shell is configured. Let’s begin! + +#### 0\. Using tab for autocompletion + +I’ll start with something really obvious and yet really important: tab completion. + +When you are starting to type something in Linux terminal, you can hit the tab key and it will suggest all the possible options that start with string you have typed so far. + +For example, if you are trying to copy a file named my_best_file_1.txt, you can just type ‘cp m’ and hit tab to see the possible options. + +![Use tab for auto-completion][3] + +You can use tab in completing commands as well. + +[irp posts=”16244″ name=”Difference Between apt and apt-get Explained”] + +#### 1\. Switch back to the last working directory + +Suppose you end up in a long directory path and then you move to another directory in a totally different path. And then you realize that you have to go back to the previous directory you were in. In this case, all you need to do is to type this command: + +``` +cd - +``` + +This will put you back in the last working directory. You don’t need to type the long directory path or copy paste it anymore. + +![Easily switch between directories][4] + +#### 2\. Go back to home directory + +This is way too obvious. You can use the command below to move to your home directory from anywhere in Linux command-line: + +``` +cd ~ +``` + +However, you can also use just cd to go back to home directory: + +``` +cd +``` + +Most modern Linux distributions have the shell pre-configured for this command. Saves you at least two keystrokes here. + +![Move to Home as quickly as possible][5] + +#### 3\. List the contents of a directory + +You must be guessing what’s the trick in the command for listing the contents of a directory. Everyone knows to use the ls -l for this purpose. + +And that’s the thing. Most people use ls -l to list the contents of the directory, whereas the same can be done with the following command: + +``` +ll +``` + +Again, this depends on the Linux distributions and shell configuration, but chances are that you’ll be able to use it in most Linux distributions. + +![Using ll instead of ls -l][6] + +#### 4\. Running multiple commands in one single command + +Suppose, you have to run several commands one after another. Do you wait for the first command to finish running and then execute the next one? + +You can use the ‘;’ separator for this purpose. This way, you can run a number of commands in one line. No need to wait for the previous commands to finish their business. + +``` +command_1; command_2; command_3 +``` + +#### 5\. Running multiple commands in one single command only if the previous command was successful + +In the previous command, you saw how to run several commands in one single command to save time. But what if you have to make sure that commands don’t fail? + +Imagine a situation where you want to build a code and then if the build was successful, run the make? + +You can use && separator for this case. && makes sure that the next command will only run when the previous command was successful. + +``` +command_1 && command_2 +``` + +A good example of this command is when you use sudo apt update && sudo apt upgrade to upgrade your system. + +#### 6\. Easily search and use the commands that you had used in the past + +Imagine a situation where you used a long command couple of minutes/hours ago and you have to use it again. Problem is that you cannot remember the exact command anymore. + +Reverse search is your savior here. You can search for the command in the history using a search term. + +Just use the keys ctrl+r to initiate reverse search and type some part of the command. It will look up into the history and will show you the commands that matches the search term. + +``` +ctrl+r search_term +``` + +By default, it will show just one result. To see more results matching your search term, you will have to use ctrl+r again and again. To quit reverse search, just use Ctrl+C. + +![Reverse search in command history][7] + +Note that in some Bash shells, you can also use Page Up and Down key with your search term and it will autocomplete the command. + +#### 7\. Unfreeze your Linux terminal from accidental Ctrl+S + +You probably are habitual of using Ctrl+S for saving. But if you use that in Linux terminal, you’ll have a frozen terminal. + +Don’t worry, you don’t have to close the terminal, not anymore. Just use Ctrl+Q and you can use the terminal again. + +``` +ctrl+Q +``` + +#### 8\. Move to beginning or end of line + +Suppose you are typing a long command and midway you realize that you had to change something at the beginning. You would use several left arrow keystrokes to move to the start of the line. And similarly for going to the end of the line. + +You can use Home and End keys here of course but alternatively, you can use Ctrl+A to go to the beginning of the line and Ctrl+E to go to the end. + +![Move to the beginning or end of the line][8] + +I find it more convenient than using the home and end keys, especially on my laptop. + +#### 9\. Reading a log file in real time + +In situations where you need to analyze the logs while the application is running, you can use the tail command with -f option. + +``` +tail -f path_to_Log +``` + +You can also use the regular grep options to display only those lines that are meaningful to you: + +``` +tail -f path_to_log | grep search_term +``` + +You can also use the option F here. This will keep the tail running even if the log file is deleted. So if the log file is created again, tail will continue logging. + +#### 10\. Reading compressed logs without extracting + +Server logs are usually gzip compressed to save disk space. It creates an issue for the developer or sysadmin analyzing the logs. You might have to [scp][9] it to your local and then extract it to access the files because, at times, you don’t have write permission to extract the logs. + +Thankfully, z commands save you in such situations. z commands provide alternatives of the regular commands that you use to deal with log files such as less, cat, grep etc. + +So you get zless, zcat, zgrep etc and you don’t even have to explicitly extract the compressed files. Please refer to my earlier article about [using z commands to real compressed logs][10] in detail. + +This was one of the secret finds that won me a coffee from my colleague. + +#### 11\. Use less to read files + +To see the contents of a file, cat is not the best option especially if it is a big file. cat command will display the entire file on your screen. + +You can use Vi, Vim or other terminal based text editors but if you just want to read a file, less command is a far better choice. + +``` +less path_to_file +``` + +You can search for terms inside less, move by page, display with line numbers etc. + +#### 12\. Reuse the last item from the previous command with !$ + +Using the argument of the previous command comes handy in many situations. + +Say you have to create a directory and then go into the newly created directory. There you can use the !$ options. + +![Use !$ to use the argument of last command][11] + +A better way to do the same is to use alt+. . You can use . a number times to shuffle between the options of the last commands. + +#### 13\. Reuse the previous command in present command with !! + +You can call the entire previous command with !!. This comes particularly useful when you have to run a command and realize that it needs root privileges. + +A quick sudo !! saves plenty of keystrokes here. + +![Use !! to use last command as an argument][12] + +#### 14\. Using alias to fix typos + +You probably already know what is an alias command in Linux. What you can do is, to use them to fix typos. + +For example, you might often mistype grep as gerp. If you put an alias in your bashrc in this fashion: + +``` +alias gerp=grep +``` + +This way you won’t have to retype the command again. + +#### 15\. Copy Paste in Linux terminal + +This one is slightly ambiguous because it depends on Linux distributions and terminal applications. But in general, you should be able to copy paste commands with these shortcuts: + + * Select the text for copying and right click for paste (works in Putty and other Windows SSH clients) + * Select the text for copying and middle click (scroll button on the mouse) for paste + * Ctrl+Shift+C for copy and Ctrl+Shift+V for paste + + + +#### 16\. Kill a running command/process + +This one is perhaps way too obvious. If there is a command running in the foreground and you want to exit it, you can press Ctrl+C to stop that running command. + +#### 17\. Using yes command for commands or scripts that need interactive response + +If there are some commands or scripts that need user interaction and you know that you have to enter Y each time it requires an input, you can use Yes command. + +Just use it in the below fashion: + +``` +yes | command_or_script +``` + +#### 18\. Empty a file without deleting it + +If you just want to empty the contents of a text file without deleting the file itself, you can use a command similar to this: + +``` +> filename +``` + +#### 19\. Find if there are files containing a particular text + +There are multiple ways to search and find in Linux command line. But in the case when you just want to see if there are files that contain a particular text, you can use this command: + +``` +grep -Pri Search_Term path_to_directory +``` + +I highly advise mastering find command though. + +#### 20\. Using help with any command + +I’ll conclude this article with one more obvious and yet very important ‘trick’, using help with a command or a command line tool. + +Almost all command and command line tool come with a help page that shows how to use the command. Often using help will tell you the basic usage of the tool/command. + +Just use it in this fashion: + +``` +command_tool --help +``` + +#### Your favorite Linux command line tricks? + +I have deliberately not included commands like [fuck][13] because those are not standard commands that you’ll find everywhere. The tricks discussed here should be usable almost in all Linux distributions and shell without the need of installing a new tool. + +I would also suggest [using alias command in Linux][14] to replace complicated commands with a simple. Saves a lot of time. + +I know that there are more Linux command tricks to save time in the terminal. Why not share some of your experiences with Linux and do share your best trick with rest of the community here? The comment section below is at your disposal. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-command-tricks/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/learn-linux-for-free/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-Tricks-Save-Time.jpeg?resize=800%2C450&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-8.png?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-1.png?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-2.png?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-3.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-4.png?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-5.png?ssl=1 +[9]: http://www.hypexr.org/linux_scp_help.php +[10]: https://itsfoss.com/read-compressed-log-files-linux/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-6.png?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-7.png?ssl=1 +[13]: https://github.com/nvbn/thefuck +[14]: https://linuxhandbook.com/linux-alias-command/ diff --git a/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md b/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md deleted file mode 100644 index 0f15fae6e6..0000000000 --- a/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md +++ /dev/null @@ -1,188 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to make a Halloween lantern with Inkscape) -[#]: via: (https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape) -[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) - -How to make a Halloween lantern with Inkscape -====== -Use open source tools to make a spooky and fun decoration for your -favorite Halloween haunt. -![Halloween - backlit bat flying][1] - -The spooky season is almost here! This year, decorate your haunt with a unique Halloween lantern made with open source! - -Typically, a portion of a lantern's structure is opaque to block the light from within. What makes a lantern a lantern are the parts that are missing: windows cut from the structure so that light can escape. While it's impractical for lighting, a lantern with windows in spooky shapes and lurking silhouettes can be atmospheric and a lot of fun to create. - -This article demonstrates how to create your own lantern using [Inkscape][2]. If you don't have Inkscape, you can install it from your software repository on Linux or download it from the [Inkscape website][3] on MacOS and Windows. - -### Supplies - - * Template ([A4][4] or [Letter][5] size) - * Cardstock (black is traditional) - * Tracing paper (optional) - * Craft knife, ruler, and cutting mat (a craft cutting machine/laser cutter can be used instead) - * Craft glue - * LED tea-light "candle" -_Safety note:_ Only use battery-operated candles for this project. - - - -### Understanding the template - -To begin, download the correct template for your region (A4 or Letter) from the links above and open it in Inkscape. - -* * * - -* * * - -* * * - -**![Lantern template screen][6]** - -The gray-and-white checkerboard background is see-through (in technical terms, it's an _alpha channel_.) - -The black base forms the lantern. Right now, there are no windows for light to shine through; the lantern is a solid black base. You will use the **Union** and **Difference** options in Inkscape to design the windows digitally. - -The dotted blue lines represent fold scorelines. The solid orange lines represent guides. Windows for light should not be placed outside the orange boxes. - -To the left of the template are a few pre-made objects you can use in your design. - -### To create a window or shape - - 1. Create an object that looks like the window style you want. Objects can be created using any of the shape tools in Inkscape's left toolbar. Alternately, you can download Creative Commons- or Public Domain-licensed clipart and import the PNG file into your project. - 2. When you are happy with the shape of the object, turn it into a **Path** (rather than a **Shape**, which Inkscape sees as two different kinds of objects) by selecting **Object > Object to Path** in the top menu. - - - -![Object to path menu][7] - - 3. Place the object on top of the base shape. - 4. Select both the object and the black base by clicking one, pressing and holding the Shift key, then selecting the other. - 5. Select **Object > Difference** from the top menu to remove the shape of the object from the base. This creates what will become a window in your lantern. - - - -![Object > Difference menu][8] - -### To add an object to a window - -After making a window, you can add objects to it to create a scene. - -**Tips:** - - * All objects, including text, must be connected to the base of the lantern. If not, they will fall out after cutting and leave a blank space. - * Avoid small, intricate details. These are difficult to cut, even when using a machine like a laser cutter or a craft plotter. - - - 1. Create or import an object. - 2. Place the object inside the window so that it is touching at least two sides of the base. - 3. With the object selected, choose **Object > Object to Path** from the top menu. - - - -![Object to path menu][9] - - 4. Select the object and the black base by clicking on each one while holding the Shift key). - 5. Select **Object > Union** to join the object and the base. - - - -### Add text - -Text can either be cut out from the base to create a window (as I did with the stars) or added to a window (which blocks the light from within the lantern). If you're creating a window, only follow steps 1 and 2 below, then use **Difference** to remove the text from the base layer. - - 1. Select the Text tool from the left sidebar to create text. Thick, bold fonts work best. - -![Text tool][10] - - 2. Select your text, then choose **Path > Object to Path** from the top menu. This converts the text object to a path. Note that this step means you can no longer edit the text, so perform this step _only after_ you're sure you have the word or words you want. - - 3. After you have converted the text, you can press **F2** on your keyboard to activate the **Node Editor** tool to clearly show the nodes of the text when it is selected with this tool. - - - - -![Text selected with Node editor][11] - - 4. Ungroup the text. - 5. Adjust each letter so that it slightly overlaps its neighboring letter or the base. - - - -![Overlapping the text][12] - - 6. To connect all of the letters to one another and to the base, re-select all the text and the base, then select **Path > Union**. - -![Connecting letters and base with Path > Union][13] - - - - -### Prepare for printing - -The following instructions are for hand-cutting your lantern. If you're using a laser cutter or craft plotter, follow the techniques required by your hardware to prepare your files. - - 1. In the **Layer** panel, click the **Eye** icon beside the **Safety** layer to hide the safety lines. If you don't see the Layer panel, reveal it by selecting **Layer > Layers** from the top menu. - 2. Select the black base. In the **Fill and Stroke** panel, set the fill to **X** (meaning _no fill_) and the **Stroke** to solid black (that's #000000ff to fans of hexes). - - - -![Setting fill and stroke][14] - - 3. Print your pattern with **File > Print**. - - 4. Using a craft knife and ruler, carefully cut around each black line. Lightly score the dotted blue lines, then fold. - -![Cutting out the lantern][15] - - 5. To finish off the windows, cut tracing paper to the size of each window and glue it to the inside of the lantern. - -![Adding tracing paper][16] - - 6. Glue the lantern together at the tabs. - - 7. Turn on a battery-powered LED candle and place it inside your lantern. - - - - -![Completed lantern][17] - -Now your lantern is complete and ready to light up your haunt. Happy Halloween! - -How to make Halloween bottle labels with Inkscape, GIMP, and items around the house. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape - -作者:[Jess Weichler][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cyanide-cupcake -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/halloween_bag_bat_diy.jpg?itok=24M0lX25 (Halloween - backlit bat flying) -[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners -[3]: http://inkscape.org -[4]: https://www.dropbox.com/s/75qzjilg5ak2oj1/papercraft_lantern_A4_template.svg?dl=0 -[5]: https://www.dropbox.com/s/8fswdge49jwx91n/papercraft_lantern_letter_template%20.svg?dl=0 -[6]: https://opensource.com/sites/default/files/uploads/lanterntemplate_screen.png (Lantern template screen) -[7]: https://opensource.com/sites/default/files/uploads/lantern1.png (Object to path menu) -[8]: https://opensource.com/sites/default/files/uploads/lantern2.png (Object > Difference menu) -[9]: https://opensource.com/sites/default/files/uploads/lantern3.png (Object to path menu) -[10]: https://opensource.com/sites/default/files/uploads/lantern4.png (Text tool) -[11]: https://opensource.com/sites/default/files/uploads/lantern5.png (Text selected with Node editor) -[12]: https://opensource.com/sites/default/files/uploads/lantern6.png (Overlapping the text) -[13]: https://opensource.com/sites/default/files/uploads/lantern7.png (Connecting letters and base with Path > Union) -[14]: https://opensource.com/sites/default/files/uploads/lantern8.png (Setting fill and stroke) -[15]: https://opensource.com/sites/default/files/uploads/lantern9.jpg (Cutting out the lantern) -[16]: https://opensource.com/sites/default/files/uploads/lantern10.jpg (Adding tracing paper) -[17]: https://opensource.com/sites/default/files/uploads/lantern11.jpg (Completed lantern) diff --git a/sources/tech/20191031 4 Python tools for getting started with astronomy.md b/sources/tech/20191031 4 Python tools for getting started with astronomy.md deleted file mode 100644 index 79e64651b3..0000000000 --- a/sources/tech/20191031 4 Python tools for getting started with astronomy.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 Python tools for getting started with astronomy) -[#]: via: (https://opensource.com/article/19/10/python-astronomy-open-data) -[#]: author: (Gina Helfrich, Ph.D. https://opensource.com/users/ginahelfrich) - -4 Python tools for getting started with astronomy -====== -Explore the universe with NumPy, SciPy, Scikit-Image, and Astropy. -![Person looking up at the stars][1] - -NumFOCUS is a nonprofit charity that supports amazing open source toolkits for scientific computing and data science. As part of the effort to connect Opensource.com readers with the NumFOCUS community, we are republishing some of the most popular articles from [our blog][2]. To learn more about our mission and programs, please visit [numfocus.org][3]. If you're interested in participating in the NumFOCUS community in person, check out a local [PyData event][4] happening near you. - -* * * - -### Astronomy with Python - -Python is a great language for science, and specifically for astronomy. The various packages such as [NumPy][5], [SciPy][6], [Scikit-Image][7] and [Astropy][8] (to name but a few) are all a great testament to the suitability of Python for astronomy, and there are plenty of use cases. [NumPy, Astropy, and SciPy are NumFOCUS fiscally sponsored projects; Scikit-Image is an affiliated project.] Since leaving the field of astronomical research behind more than 10 years ago to start a second career as software developer, I have always been interested in the evolution of these packages. Many of my former colleagues in astronomy used most if not all of these packages for their research work. I have since worked on implementing professional astronomy software packages for instruments for the Very Large Telescope (VLT) in Chile, for example. - -It struck me recently that the Python packages have evolved to such an extent that it is now fairly easy for anyone to build [data reduction][9] scripts that can provide high-quality data products. Astronomical data is ubiquitous, and what is more, it is almost all publicly available—you just need to look for it. - -For example, ESO, which runs the VLT, offers the data for download on their site. Head over to [www.eso.org/UserPortal][10] and create a user name for their portal. If you look for data from the instrument SPHERE you can download a full dataset for any of the nearby stars that have exoplanet or proto-stellar discs. It is a fantastic and exciting project for any Pythonista to reduce that data and make the planets or discs that are deeply hidden in the noise visible. - -I encourage you to download the ESO or any other astronomy imaging dataset and go on that adventure. Here are a few tips: - - 1. Start off with a good dataset. Have a look at papers about nearby stars with discs or exoplanets and then search, for example: . Notice that some data on this site is marked as red and some as green. The red data is not publicly available yet — it will say under “release date” when it will be available. - 2. Read something about the instrument you are using the data from. Try and get a basic understanding of how the data is obtained and what the standard data reduction should look like. All telescopes and instruments have publicly available documents about this. - 3. You will need to consider the standard problems with astronomical data and correct for them: - 1. Data comes in FITS files. You will need **pyfits** or **astropy** (which contains pyfits) to read them into **NumPy** arrays. In some cases the data comes in a cube and you should to use **numpy.median **along the z-axis to turn them into 2-D arrays. For some SPHERE data you get two copies of the same piece of sky on the same image (each has a different filter) which you will need to extract using **indexing and slicing.** - 2. The master dark and bad pixel map. All instruments will have specific images taken as “dark frames” that contain images with the shutter closed (no light at all). Use these to extract a mask of bad pixels using **NumPy masked arrays** for this. This mask of bad pixels will be very important — you need to keep track of it as you process the data to get a clean combined image in the end. In some cases it also helps to subtract this master dark from all scientific raw images. - 3. Instruments will typically also have a master flat frame. This is an image or series of images taken with a flat uniform light source. You will need to divide all scientific raw images by this (again, using numpy masked array makes this an easy division operation). - 4. For planet imaging, the fundamental technique to make planets visible against a bright star rely on using a coronagraph and a technique known as angular differential imaging. To that end, you need to identify the optical centre on the images. This is one of the most tricky steps and requires finding some artificial helper images embedded in the images using **skimage.feature.blob_dog**. - 4. Be patient. It can take a while to understand the data format and how to handle it. Making some plots and histograms of the pixel data can help you to understand it. It is well worth it to be persistent! You will learn a lot about imaging data and processing. - - - -Using the tools offered by NumPy, SciPy, Astropy, scikit-image and more in combination, with some patience and persistence, it is possible to analyse the vast amount of available astronomical data to produce some stunning results. And who knows, maybe you will be the first one to find a planet that was previously overlooked! Good luck! - -_This article was originally published on the NumFOCUS blog and is republished with permission. It is based on [a talk][11] by [Ole Moeller-Nilsson][12], CTO at Pivigo. If you want to support NumFOCUS, you can donate [here][13] or find your local [PyData event][4] happening around the world._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/python-astronomy-open-data - -作者:[Gina Helfrich, Ph.D.][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ginahelfrich -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars) -[2]: https://numfocus.org/blog -[3]: https://numfocus.org -[4]: https://pydata.org/ -[5]: http://numpy.scipy.org/ -[6]: http://www.scipy.org/ -[7]: http://scikit-image.org/ -[8]: http://www.astropy.org/ -[9]: https://en.wikipedia.org/wiki/Data_reduction -[10]: http://www.eso.org/UserPortal -[11]: https://www.slideshare.net/OleMoellerNilsson/pydata-lonon-finding-planets-with-python -[12]: https://twitter.com/olly_mn -[13]: https://numfocus.org/donate diff --git a/sources/tech/20191125 My top 5 Ansible modules.md b/sources/tech/20191125 My top 5 Ansible modules.md deleted file mode 100644 index 9a76342854..0000000000 --- a/sources/tech/20191125 My top 5 Ansible modules.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My top 5 Ansible modules) -[#]: via: (https://opensource.com/article/19/11/ansible-modules) -[#]: author: (Mark Phillips https://opensource.com/users/markp) - -My top 5 Ansible modules -====== -Learn how to achieve almost anything with these Ansible modules. -![][1] - -When I was growing up, my grandfather had a shed in his garden. He would spend hours in there, making and fixing things. This was way before we had the internet, so I spent a lot of time studying him creating things in that shed. Although the shed was full of many tools, from drills to lathes to electrical gubbins and lots of things I doubt I could identify even today, he made use of only a tiny subset of what he had at hand. Yet there never seemed to be limits to what he could achieve. - -I tell you that story because I feel like my career has been spent in a metaphorical shed. Computers are so many tools, all in a small (virtual?) space. And there are tool sheds within tool sheds—my favourite being Ansible. The recent 2.9 release ships with 3,681 modules! **3,681!** When I first started using Ansible in the summer of 2013, version 1.2.1 had just 113 modules, yet, as [I wrote at the time][2], I could still achieve anything I imagined. - -Modules are the backbone of Ansible, the gears to make light of heavy lifting. They're designed to do one job well, thus realising [the Unix philosophy][3]. This is how we've come to bundle so many of them; Ansible as the conductor of the orchestra now has a lot of instruments at its command. - -Reviewing a Git repository of my Ansible plays and roles over the years reveals that I have used just 35 modules. This small subset was used to build large infrastructures. I wonder what could be achieved with an even smaller subset, though? As I reviewed those 35, I pondered if I could achieve the same results with only five modules at my disposal. So here are my five favourite modules, in a rather tenuous order of precedence. - -### 5. [authorized_key][4] - -Secure shell (SSH) is at the heart of Ansible, at least for almost everything besides Windows. Key (no pun intended) to using SSH efficiently with Ansible is… [keys][5]! Slight aside—there are a lot of very cool things you can do for security with SSH keys. It's worth perusing the **authorized_keys** section of the [sshd manual page][6]. Managing SSH keys can become laborious if you're getting into the realms of granular user access, and although we could do it with either of my next two favourites, I prefer to use the module because it [enables easy management through variables][7]. - -### 4. [file][8] - -Besides the obvious function of placing a file somewhere, the **file** module also sets ownership and permissions. I'd say that's a lot of _bang for your buck_ with one module. I'd proffer a substantial portion of security relates to setting permissions too, so the **file** module plays nicely with **authorized_keys**. - -### 3. [template][9] - -There are so many ways to manipulate the contents of files, and I see lots of folk use **[lineinfile][10]**. I've used it myself for small tasks. However, the **template** module is so much clearer because you maintain the entire file for context. My preference is to write Ansible content in such a way that anyone can understand it _easily_—which to me means not making it hard to understand what is happening. Use of **template** means being able to see the entire file you're putting into place, complete with the variables you are using to change pieces. - -### 2. [uri][11] - -Many modules in the current distribution leverage Ansible as an orchestrator. They talk to another service, rather than doing something specific like putting a file into place. Usually, that talking is over HTTP too. In the days before many of these modules existed, you _could_ program an API directly using the **uri** module. It's a powerful access tool, enabling you to do a lot. I wouldn't be without it in my fictitious Ansible shed. - -### 1. [shell][12] - -The joker card in our pack. The Swiss Army Knife. If you're absolutely stuck for how to control something else, use **shell**. Some will argue we're now talking about making Ansible a Bash script—but, I would say it's still better because with the use of the **name** parameter in your plays and roles, you document every step. To me, that's as big a bonus as anything. Back in the days when I was still consulting, I once helped a database administrator (DBA) migrate to Ansible. The DBA wasn't one for change and pushed back at changing working methods. So, to ease into the Ansible way, we called some existing DB management scripts from Ansible using the **shell** module. With an informative **name** statement to accompany the task. - -You can achieve a lot with these five modules. Yes, modules designed to do a specific task will make your life even easier. But with a smidgen of engineering simplicity, you can achieve a lot with very little. Ansible developer Brian Coca is a master at it, and [his tips and tricks talk][13] is always worth a watch. - -* * * - -What do you think about my top five? What five modules would you pick and why, if you were so limited? Let me know in the comments below! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/ansible-modules - -作者:[Mark Phillips][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/markp -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mandelbrot_set.png?itok=bmPc0np5 -[2]: http://probably.co.uk/post/puppet-vs-chef-vs-ansible/ -[3]: https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well -[4]: https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html -[5]: https://linux.die.net/man/1/ssh-keygen -[6]: https://linux.die.net/man/8/sshd -[7]: https://github.com/phips/ansible-demos/blob/3bf59df1eb2390b31b5c42333197e2fbb7fec93f/roles/ansible-users/tasks/main.yml#L35 -[8]: https://docs.ansible.com/ansible/latest/modules/file_module.html -[9]: https://docs.ansible.com/ansible/latest/modules/template_module.html -[10]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html -[11]: https://docs.ansible.com/ansible/latest/modules/uri_module.html -[12]: https://docs.ansible.com/ansible/latest/modules/shell_module.html -[13]: https://www.ansible.com/ansible-tips-and-tricks diff --git a/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md b/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md deleted file mode 100644 index 8c7ddcb1e5..0000000000 --- a/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md +++ /dev/null @@ -1,164 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use the Fluxbox Linux desktop as your window manager) -[#]: via: (https://opensource.com/article/19/12/fluxbox-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Use the Fluxbox Linux desktop as your window manager -====== -This article is part of a special series of 24 days of Linux desktops. -Fluxbox is very light on system resources, yet it has vital Linux -desktop features to make your user experience easy, blazingly efficient, -and unduly fast. -![Text editor on a browser, in blue][1] - -The concept of a desktop may differ from one computer user to another. Many people see the desktop as a home base, or a comfy living room, or even a literal desktop where they place frequently used notepads, their best pens and pencils, and their favorite coffee mug. KDE, GNOME, Pantheon (and so on) provide that kind of comfort on Linux. - -But for some users, the desktop is just empty monitor space, a side effect of not yet having any free-floating application windows projected directly onto their retina. For these users, the desktop is a void over which they can run applications—whether big office and graphic suites, or a simple terminal window, or docked applets—to manage services. This model of operating a [POSIX][2] computer has a long history, and one branch of that family tree is the *box window managers: Blackbox, Fluxbox, and Openbox. - -[Fluxbox][3] is a window manager for X11 systems that's based on an older project called Blackbox. Blackbox development was waning when I discovered Linux, so I fell into Fluxbox, and I've used it ever since on at least one of my active systems. It is written in C++ and is licensed under the MIT open source license. - -### Installing Fluxbox - -You are likely to find Fluxbox included in the software repository of your Linux distribution, but you can also find it on [Fluxbox.org][4]. If you're already running a different desktop, it's safe to install Fluxbox on the same system because Fluxbox doesn't predetermine any configuration or accompanying applications. - -After installing Fluxbox, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -To override the desktop with GDM: - -![Select your desktop session in GDM][5] - -Or with KDM: - -![Select your desktop session with KDM][6] - -### Configuring the Fluxbox desktop - -When you first log in, the screen is mostly empty because all Fluxbox provides are panels (for a taskbar, system tray, and so on) and window decoration for application windows. - -![Default Fluxbox configuration on CentOS 7][7] - -If your distribution delivers a plain Fluxbox desktop, you can set a background for your desktop using the **feh** command (you may need to install it from your distribution's repository). This command has a few options for setting the background, including **\--bg-fill** to fill the screen with your wallpaper of choice, **\--bg-scale** to scale it to fit, and so on. - - -``` -`$ feh --bg-fill ~/photo/oamaru/leaf-spiral.jpg` -``` - -![Fluxbox with a theme applied][8] - -By default, Fluxbox auto-generates a menu, available with a right-click anywhere on the desktop, that gives you access to applications. Depending on your distribution, this menu may be very minimal, or it may list all the launchers in your **/usr/share/applications** directory. - -Fluxbox configuration is set in text files, and those text files are contained in the **$HOME/.fluxbox** directory. You can: - - * Set keyboard shortcuts in **keys** - * Set startup services and applications in **startup** - * Set desktop preferences (such as the number of workspaces, locations of panels, and so on) in **init** - * Set menu items in **menu** - - - -The text configuration files are easy to reverse-engineer, but you also can (and should) read the Fluxbox [documentation][9]. - -For example, this is my typical menu (or at least the basic structure of it): - - -``` -# to use your own menu, copy this to ~/.fluxbox/menu, then edit -# ~/.fluxbox/init and change the session.menuFile path to ~/.fluxbox/menu - -[begin] (fluxkbox) - [submenu] (apps) {} -  [submenu] (txt) {} -   [exec] (Emacs 23 (text\\)) { x-terminal-emulator -T "Emacs (text)" -e /usr/bin/emacs -nw} <> -   [exec] (Emacs (X11\\)) {/usr/bin/emacs} <> -   [exec] (LibreOffice) {/usr/bin/libreoffice} -  [end] -  [submenu] (code) {} -   [exec] (qtCreator) {/usr/bin/qtcreator} -   [exec] (eclipse) {/usr/bin/eclipse} -  [end] -  [submenu] (graphics) {} -   [exec] (ksnapshot) {/usr/bin/ksnapshot} -   [exec] (gimp) {/usr/bin/gimp} -   [exec] (blender) {/usr/bin/blender} -  [end] -  [submenu] (files) {} -   [exec] (dolphin) {/usr/bin/dolphin} -   [exec] (konqueror) { /usr/bin/kfmclient openURL $HOME } -  [end] -  [submenu] (network) {} -   [exec] (firefox) {/usr/bin/firefox} -   [exec] (konqueror) {/usr/bin/konqueror} -  [end] - [end] -## change window manager or work env -[submenu] (environments) {} - [restart] (flux)  {/usr/bin/startfluxbox} - [restart] (ratpoison)  {/usr/bin/ratpoison} - [exec] (openIndiana) {/home/kenlon/qemu/startSolaris.sh} -[end] - -[config] (config) - [submenu] (styles) {} -  [stylesdir] (/usr/share/fluxbox/styles) -  [stylesdir] (~/.fluxbox/styles) - [end] -[workspaces] (workspaces) -[reconfig] (reconfigure) -[restart] (restart) -[exit] (exeunt) -[end] -``` - -The menu also provides a few preference settings, such as the ability to pick a theme and restart or log out from your Fluxbox session. - -I launch most applications using keyboard shortcuts, which are entered into the **keys** configuration file. Here are some examples (the **Mod4** key is the Super key, which I use to designate global shortcuts): - - -``` -# open apps -Mod4 t :Exec konsole -Mod4 k :Exec konqueror -Mod4 z :Exec fbrun -Mod4 e :Exec emacs -Mod4 f :Exec firefox -Mod4 x :Exec urxvt -Mod4 d :Exec dolphin -Mod4 q :Exec xscreensaver-command -activate -Mod4 3 :Exec ksnapshot -``` - -Between these shortcuts and an open terminal, I have little use for a mouse during most of my workday, so there's no wasted time switching from one controller to another. And because Fluxbox stays well out of the way, there's little distraction. - -### Why you should use Fluxbox - -Fluxbox is very light on system resources, yet it has vital features to make your user experience easy, blazingly efficient, and unduly fast. It's simple to customize, and it allows you to define your own workflow. You don't have to use Fluxbox's panels, because there are other excellent panels out there. You can even middle-click and drag two separate application windows into one another so that they become one window, each in its own tab. - -The possibilities are endless, so try the steady simplicity that is Fluxbox on your Linux box today! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/fluxbox-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) -[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains -[3]: http://fluxbox.org -[4]: http://fluxbox.org/download/ -[5]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) -[6]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) -[7]: https://opensource.com/sites/default/files/advent-fluxbox-default.jpg (Default Fluxbox configuration on CentOS 7) -[8]: https://opensource.com/sites/default/files/advent-fluxbox-green.jpg (Fluxbox with a theme applied) -[9]: http://fluxbox.org/features/ diff --git a/sources/tech/20191216 Relive Linux history with the ROX desktop.md b/sources/tech/20191216 Relive Linux history with the ROX desktop.md deleted file mode 100644 index 215006514f..0000000000 --- a/sources/tech/20191216 Relive Linux history with the ROX desktop.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Relive Linux history with the ROX desktop) -[#]: via: (https://opensource.com/article/19/12/linux-rox-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Relive Linux history with the ROX desktop -====== -This article is part of a special series of 24 days of Linux desktops. -If you're looking for a fun trip back in time, the ROX desktop is well -worth a go. -![Person typing on a 1980's computer][1] - -The [ROX][2] desktop is no longer being actively developed, but its legacy resounds today, and even when it was active, it was a unique take on what a Linux desktop could be. While other desktops felt roughly similar to old Unix or Windows interfaces, ROX belongs solidly in the BeOS, AmigaOS, and [RISC OS][3] desktop camps. - -It focuses on drag-and-drop actions (which makes its accessibility non-optimal for some users), point-and-click actions, pop-up contextual menus, and a unique system of app directories for running local applications with no installation required. - -### Installing ROX - -Today, ROX is mostly abandoned and left in fragments that the user is left to sort out. Luckily, the puzzle is relatively easy to solve, but don't get confused when you find bits and pieces of the ROX desktop in your distribution's repository—but not _every_ bit of the ROX desktop. The popular parts of ROX—the file manager ([ROX-Filer][4]) and the terminal ([ROXTerm][5])—seem to have endured in most of the popular distribution repositories, and you can install (and use) them as standalone applications. However, to run the ROX desktop, you must also install ROX-Session and the libraries it depends on. - -I installed ROX on Slackware 14.2, but it should work on any Linux or BSD system. - -First, you must install [ROX-lib2][6] from its repository. True to its philosophy of minimal installs, all you have to do to install ROX-lib2 is download the tarball, [unarchive it][7], and move the **ROX-Lib** directory to **/usr/local/lib**. - -Next, you have to install [ROX-Session][8]. This probably needs to be compiled from source code, as it's not likely to be in your software repository. The compile process requires build tools, which ship by default on Slackware but are often omitted in other distributions to save space on the initial download. The names of the packages you must install to build from source code vary depending on your distro, so refer to the documentation for specifics. For example, on Debian-based distributions, you can learn about build requirements in [Debian's wiki][9], and on Fedora-based distributions, refer to [Fedora's docs][10]. Once you have the build tools installed, execute the custom ROX-Session build script: - - -``` -`$ ./AppRun` -``` - -This manages its own build and installation and prompts you for root permissions to add itself as an option on your login screen. - -If you have not installed ROX-Filer from your software repository, do that before continuing. - -Together, these components create a complete ROX desktop. To log into your new desktop, log out of your current desktop session. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -With SDDM: - -![][11] - -With GDM: - -![][12] - -### ROX desktop features - -The ROX desktop is simple by default, with a single panel at the bottom of the screen and a shortcut icon to your home directory on the desktop. The panel contains shortcuts to common locations. That's all there is to the ROX desktop, at least as it's configured out of the box. If you want a clock or a calendar or a system tray, you need to find applications that provide them. - -![Default ROX desktop][13] - -There is no taskbar, as such, but when you minimize a window, it becomes a temporary icon on your desktop. You can click the icon to bring its window back to its former size and placement. - -The panel can be modified some, as well. You can place different shortcuts into it and even create your own applets. - -There's no application menu, either, nor are there shortcuts to applications in a contextual menu. Instead, you can navigate manually to **/usr/share/applications**, or you can add your application directory or directories to the ROX panel. - -![ROX desktop][14] - -The ROX desktop's workflow concentrates on being mouse-driven, reminiscent of Mac OS 7.5 and 8. With ROX-filer, you can manage permissions, file management, introspection, script launching, background setting, and nearly anything else you can think of, provided that you're patient enough for the point-and-click style of interaction. For power users, this seems slow, but ROX manages to make it relatively painless and very intuitive. - -### App directories, AppRun, and AppImage - -The ROX desktop has an elegant convention by which a directory containing a script named **AppRun** is executed as if it were an application. This means that in order to make a ROX app, all you have to do is compile code into a directory, place a script called **AppRun** at the root of that directory to execute the binary you've compiled, and then mark the directory executable. ROX-Filer displays a directory configured in the manner you set with a special icon and color. When you click on an app directory, ROX-Filer automatically runs the **AppRun** script inside. It looks and behaves exactly like an application that has been installed, but it's local to the user's home directory and requires no special permissions. - -This is a convenience feature, but it's one of those small features that feels great when you use it because it's so easy to implement. It's by no means essential, and it's only a few steps ahead of building an application locally, hiding the directory somewhere out of the way, and drumming up a quick **.desktop** file to act as your launcher. However, the concept of an application directory has been [cited][15] as an inspiration for the [AppImage][16] packaging system. - -### Why you should try ROX desktop - -Getting ROX set up and usable is somewhat difficult, and it appears to truly be abandoned. However, its legacy lives on in many ways today, and it's a fascinating and fun bit of Linux history. It may not become your primary desktop, but if you're looking for a fun trip back in time, then ROX is well worth a go. Explore it, customize it, and see what clever ideas it contains. There may yet be hidden gems that the open source community can benefit from. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/linux-rox-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) -[2]: http://rox.sourceforge.net/desktop/ -[3]: https://www.riscosopen.org/content/ -[4]: http://rox.sourceforge.net/desktop/ROX-Filer -[5]: http://roxterm.sourceforge.net/ -[6]: http://rox.sourceforge.net/desktop/ROX-Lib -[7]: https://opensource.com/article/17/7/how-unzip-targz-file -[8]: http://rox.sourceforge.net/desktop/ROX-Session.html -[9]: https://wiki.debian.org/BuildingTutorial -[10]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html -[11]: https://opensource.com/sites/default/files/advent-kdm_0.jpg -[12]: https://opensource.com/sites/default/files/advent-gdm_1.jpg -[13]: https://opensource.com/sites/default/files/uploads/advent-rox.jpg (Default ROX desktop) -[14]: https://opensource.com/sites/default/files/uploads/advent-rox-custom.jpg (ROX desktop) -[15]: https://github.com/AppImage/AppImageKit/wiki/AppDir -[16]: https://appimage.org/ diff --git a/sources/tech/20200211 Navigating man pages in Linux.md b/sources/tech/20200211 Navigating man pages in Linux.md deleted file mode 100644 index 662a1d48af..0000000000 --- a/sources/tech/20200211 Navigating man pages in Linux.md +++ /dev/null @@ -1,179 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Navigating man pages in Linux) -[#]: via: (https://www.networkworld.com/article/3519853/navigating-man-pages-in-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Navigating man pages in Linux -====== -The man pages on a Linux system can do more than provide information on particular commands. They can help discover commands you didn't realize were available. -[Hello I'm Nik][1] [(CC0)][2] - -Man pages provide essential information on Linux commands and many users refer to them often, but there’s a lot more to the man pages than many of us realize. - -You can always type a command like “man who” and get a nice description of how the man command works, but exploring commands that you might not know could be even more illuminating. For example, you can use the man command to help identify commands to handle some unusually challenging task or to show options that can help you use a command you already know in new and better ways. - -Let’s navigate through some options and see where we end up. - -[MORE ON NETWORK WORLD: Linux: Best desktop distros for newbies][3] - -### Using man to identify commands - -The man command can help you find commands by topic. If you’re looking for a command to count the lines in a file, for example, you can provide a keyword. In the example below, we’ve put the keyword in quotes and added blanks so that we don’t get commands that deal with “accounts” or “accounting” along with those that do some counting for us. - -``` -$ man -k ' count ' -anvil (8postfix) - Postfix session count and request rate control -cksum (1) - checksum and count the bytes in a file -sum (1) - checksum and count the blocks in a file -timer_getoverrun (2) - get overrun count for a POSIX per-process timer -``` - -To show commands that relate to new user accounts, we might try a command like this: - -``` -$ man -k "new user" -newusers (8) - update and create new users in batch -useradd (8) - create a new user or update default new user information -zshroadmap (1) - informal introduction to the zsh manual The Zsh Manual, … -``` - -Just to be clear, the third item in the list above makes a reference to “new users” liking the material and is not a command for setting up, removing or configuring user accounts. The man command is simply matching words in the command description, acting very much like the apropos command. Notice the numbers in parentheses after each command listed above. These relate to the man page sections that contain the commands. - -### Identifying the manual sections - -The man command sections divide the commands into categories. To list these categories, type “man man” and look for descriptions like those below. You very likely won’t have Section 9 commands on your system. - -[][4] - -``` -1 Executable programs or shell commands -2 System calls (functions provided by the kernel) -3 Library calls (functions within program libraries) -4 Special files (usually found in /dev) -5 File formats and conventions eg /etc/passwd -6 Games -7 Miscellaneous (including macro packages and conventions), e.g. - man(7), groff(7) -8 System administration commands (usually only for root) -9 Kernel routines [Non standard] -``` - -Man pages cover more than what we typically think of as “commands”. As you can see from the above descriptions, they cover system calls, library calls, special files and more. - -The listing below shows where man pages are actually stored on Linux systems. The dates on these directories will vary because, with updates, some of these sections will get new content while others will not. - -``` -$ ls -ld /usr/share/man/man? -drwxr-xr-x 2 root root 98304 Feb 5 16:27 /usr/share/man/man1 -drwxr-xr-x 2 root root 65536 Oct 23 17:39 /usr/share/man/man2 -drwxr-xr-x 2 root root 270336 Nov 15 06:28 /usr/share/man/man3 -drwxr-xr-x 2 root root 4096 Feb 4 10:16 /usr/share/man/man4 -drwxr-xr-x 2 root root 28672 Feb 5 16:25 /usr/share/man/man5 -drwxr-xr-x 2 root root 4096 Oct 23 17:40 /usr/share/man/man6 -drwxr-xr-x 2 root root 20480 Feb 5 16:25 /usr/share/man/man7 -drwxr-xr-x 2 root root 57344 Feb 5 16:25 /usr/share/man/man8 -``` - -Note that the man page files are generally **gzipped** to save space. The man command unzips them as needed whenever you use the man command. - -``` -$ ls -l /usr/share/man/man1 | head -10 -total 12632 -lrwxrwxrwx 1 root root 9 Sep 5 06:38 [.1.gz -> test.1.gz --rw-r--r-- 1 root root 563 Nov 7 05:07 2to3-2.7.1.gz --rw-r--r-- 1 root root 592 Apr 23 2016 411toppm.1.gz --rw-r--r-- 1 root root 2866 Aug 14 10:36 a2query.1.gz --rw-r--r-- 1 root root 2361 Sep 9 15:13 aa-enabled.1.gz --rw-r--r-- 1 root root 2675 Sep 9 15:13 aa-exec.1.gz --rw-r--r-- 1 root root 1142 Apr 3 2018 aaflip.1.gz --rw-r--r-- 1 root root 3847 Aug 14 10:36 ab.1.gz --rw-r--r-- 1 root root 2378 Aug 23 2018 ac.1.gz -``` - -### Listing man pages by section - -Even just looking at the first 10 man pages in Section 1 (as shown above), you are likely to see some commands that are new to you – maybe **a2query** or **aaflip** (shown above). - -An even better strategy for exploring commands is to list commands by section without looking at the files themselves but, instead, using a man command that shows you the commands and provides a brief description of each. - -In the command below, the **-s 1** instructs man to display information on commands in section 1. The **-k .** makes the command work for all commands rather than specifying a particular keyword; without this, the man command would come back and ask “What manual page do you want?” So, use a keyword to select a group of related commands or a dot to show all commands in a section. - -``` -$ man -s 1 -k . -2to3-2.7 (1) - Python2 to Python3 converter -411toppm (1) - convert Sony Mavica .411 image to ppm -as (1) - the portable GNU assembler. -baobab (1) - A graphical tool to analyze disk usage -busybox (1) - The Swiss Army Knife of Embedded Linux -cmatrix (1) - simulates the display from "The Matrix" -expect_dislocate (1) - disconnect and reconnect processes -red (1) - line-oriented text editor -enchant (1) - a spellchecker -… -``` - -### How many man pages are there? - -If you’re curious about how many man pages there are in each section, you can count them by section with a command like this: - -``` -$ for num in {1..8} -> do -> man -s $num -k . | wc -l -> done -2382 -493 -2935 -53 -441 -11 -245 -919 -``` - -The exact number may vary, but most Linux systems will have a similar number of commands. If we use a command that adds these numbers together, we can see that the system that this command is running on has nearly 7,500 man pages. That’s a lot of commands, system calls, etc. - -``` -$ for num in {1..8} -> do -> num=`man -s $num -k . | wc -l` -> tot=`expr $num + $tot` -> echo $tot -> done -2382 -2875 -5810 -5863 -6304 -6315 -6560 -7479 <=== total -``` - -There’s a lot you can learn by reading man pages, but exploring them in other ways can help you become aware of commands you may not have known were available on your system. - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3519853/navigating-man-pages-in-linux.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://unsplash.com/photos/YiRQIglwYig -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.networkworld.com/slideshow/153439/linux-best-desktop-distros-for-newbies.html#tk.nww-infsb -[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md b/sources/tech/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md deleted file mode 100644 index ef41241e35..0000000000 --- a/sources/tech/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md +++ /dev/null @@ -1,1169 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Manage complex Git workspaces with Great Teeming Workspaces) -[#]: via: (https://opensource.com/article/20/2/git-great-teeming-workspaces) -[#]: author: (Daniel Gryniewicz https://opensource.com/users/dang) - -Manage complex Git workspaces with Great Teeming Workspaces -====== -GTWS is a set of scripts that make it easy to have development -environments for different projects and different versions of a project. -![Coding on a computer][1] - -Great Teeming Workspaces ([GTWS][2]) is a complex workspace management package for Git that makes it easy to have development environments for different projects and different versions of a project. - -Somewhat like Python [venv][3], but for languages other than Python, GTWS handles workspaces for multiple versions of multiple projects. You can create, update, enter, and leave workspaces easily, and each project or version combination has (at most) one local origin that syncs to and from the upstream—all other workspaces update from the local origin. - -### Layout - - -``` -${GTWS_ORIGIN}/<project>/<repo>[/<version>] -${GTWS_BASE_SRCDIR}/<project>/<version>/<workspacename>/{<repo>[,<repo>...]} -``` - -Each level in the source tree (plus the homedir for globals) can contain a **.gtwsrc** file that maintains settings and Bash code relevant to that level. Each more specific level overrides the higher levels. - -### Setup - -Check out GTWS with: - - -``` -`git clone https://github.com/dang/gtws.git` -``` - -Set up your **${HOME}/.gtwsrc**. It should include **GTWS_ORIGIN** and optionally **GTWS_SETPROMPT**. - -Add the repo directory to your path: - - -``` -`export PATH="${PATH}:/path/to/gtws` -``` - -### Configuration - -Configuration is via cascading **.gtwsrc** files. It walks the real path down from the root, and each **.gtwsrc** file it finds is sourced in turn. More specific files override less specific files. - -Set the following in your top-level **~/.gtws/.gtwsrc**: - - * **GTWS_BASE_SRCDIR:** This is the base of all the projects' source trees. It defaults to **$HOME/src**. - * **GTWS_ORIGIN:** This sets the location of the origin Git trees. It defaults to **$HOME/origin**. - * **GTWS_SETPROMPT:** This is optional. If it's set, the shell prompt will have the workspace name in it. - * **GTWS_DEFAULT_PROJECT:** This is the project used when no project is given or known. If it is not given, projects must be specified on the command line. - * **GTWS_DEFAULT_PROJECT_VERSION:** This is the default version to check out. It defaults to **master**. - - - -Set the following at the project level of each project: - - * **GTWS_PROJECT:** The name (and base directory) of the project. - * **gtws_project_clone:** This function is used to clone a specific version of a project. If it is not defined, then it is assumed that the origin for the project contains a single directory per version, and that contains a set of Git repos to clone. - * **gtws_project_setup:** This optional function is called after all cloning is done and allows any additional setup necessary for the project, such as setting up workspaces in an IDE. - - - -Set this at the project version level: - - * **GTWS_PROJECT_VERSION:** This is the version of the project. It's used to pull from the origin correctly. In Git, this is likely the branch name. - - - -These things can go anywhere in the tree and can be overridden multiple times, if it makes sense: - - * **GTWS_PATH_EXTRA:** These are extra path elements to be added to the path inside the workspace. - * **GTWS_FILES_EXTRA:** These are extra files not under version control that should be copied into each checkout in the workspace. This includes things like **.git/info/exclude**, and each file is relative to the base of its repo. - - - -### Origin directories - -**GTWS_ORIGIN** (in most scripts) points to the pristine Git checkouts to pull from and push to. - -Layout of **${GTWS_ORIGIN}**: - - * **/<project>** - * This is the base for repos for a project. - * If **gtws_project_clone** is given, this can have any layout you desire. - * If **gtws_project_clone** is not given, this must contain a single subdirectory named **git** that contains a set of bare Git repos to clone. - - - -### Workflow example - -Suppose you have a project named **Foo** that has an upstream repository at **github.com/foo/foo.git**. This repo has a submodule named **bar** with an upstream at **github.com/bar/bar.git**. The Foo project does development in the master branch and uses stable version branches. - -Before you can use GTWS with Foo, first you must set up the directory structure. These examples assume you are using the default directory structure. - - * Set up your top level **.gtwsrc**: - * **cp ${GTWS_LOC}/examples/gtwsrc.top ~/.gtwsrc** - * Edit **~/.gtwsrc** and change as necessary. - * Create top-level directories: - * **mkdir -p ~/origin ~/src** - * Create and set up the project directory: - * **mkdir -p ~/src/foo** -**cp ${GTWS_LOC}/examples/gtwsrc.project ~/src/foo/.gtwsrc** - * Edit **~/src/foo/.gtwsrc** and change as necessary. - * Create and set up the master version directory: - * **mkdir -p ~/src/foo/master** -**cp ${GTWS_LOC}/examples/gtwsrc.version ~/src/foo/master/.gtwsrc** - * Edit **~/src/foo/master/.gtwsrc** and change as necessary. - * Go to the version directory and create a temporary workspace to set up the mirrors: - * **mkdir -p ~/src/foo/master/tmp** -**cd ~/src/foo/master/tmp -git clone --recurse-submodules git://github.com/foo/foo.git -cd foo -gtws-mirror -o ~/origin -p foo** - * This will create **~/origin/foo/git/foo.git** and **~/origin/foo/submodule/bar.git**. - * Future clones will clone from these origins rather than from upstream. - * This workspace can be deleted now. - - - -At this point, work can be done on the master branch of Foo. Suppose you want to fix a bug named **bug1234**. You can create a workspace for this work to keep it isolated from anything else you're working on, and then work within this workspace. - - * Go to the version directory, and create a new workspace: - * **cd ~/src/foo/master -mkws bug1234** - * This creates **bug1234/**, and inside it checks out Foo (and its submodule **bar**) and makes **build/foo** for building it. - * Enter the workspace. There are two ways to do this: - * **cd ~/src/foo/master/bug1234 -startws** -or -**cd ~/src/foo/master/** -**startws bug1234** - * This starts a subshell within the bug1234 workspace. This shell has the GTWS environment plus any environment you set up in your stacked **.gtwsrc** files. It also adds the base of the workspace to your CD path, so you can **cd** into relative paths from that base. - * At this point, you can do work on bug1234, build it, test it, and commit your changes. When you're ready to push to upstream, do this:  -**cd foo -wspush**  - * **wspush** will push the branch associated with your workspace—first to your local origin and then to the upstream. - * If upstream changes. you can sync your local checkout using:  -**git sync** - * This envokes the **git-sync** script in GTWS, which will update your checkout from the local origin. To update the local origin, use:  -**git sync -o**  - * This will update your local origin and submodules' mirrors, then use those to update your checkout. **git-sync** has other nice features. - * When you're done using the workspace, just exit the shell: -**exit** - * You can re-enter the workspace at any time and have multiple shells in the same workspace at the same time. - * When you're done with a workspace, you can remove it using the **rmws** command or just remove its directory tree.  - * There is a script named **tmws** that enters a workspace within tmux, creating a set of windows/panes that are fairly specific to my workflow.  Feel free to modify it to suit your needs. - - - -### The script - - -``` -#!/bin/bash -# Functions for gtws -# - -GTWS_LOC=$(readlink -f $(dirname "${BASH_SOURCE[0]}")) -export GTWS_LOC - -# if is_interactive; then echo "interactive" fi -# -# Check for an interactive shell -is_interactive() { -        case $- in -                *i*) -                        # Don't die in interactive shells -                        return 0 -                        ;; -                *) -                        return 1 -                        ;; -        esac -} - -# if can_die; then exit -# -# Check to see if it's legal to exit during die -can_die() { -        if (( BASH_SUBSHELL > 0 )); then -                debug_print "\t\tbaby shell; exiting" -                return 0 -        fi -        if ! is_interactive; then -                debug_print "\t\tNot interactive; exiting" -                return 0 -        fi -        debug_print "\t\tParent interactive; not exiting" -        return 1 -} - -# In a function: -# command || die "message" || return 1 -# Outside a function: -# command || die "message" -# -# Print a message and exit with failure -die() { -        echo -e "Failed: $1" >&2 -        if [ ! -z "$(declare -F | grep "GTWScleanup")" ]; then -                GTWScleanup -        fi -        if can_die; then -                exit 1 -        fi -        return 1 -} - -# Alternativess for using die properly to handle both interactive and script useage: -# -# Version 1: -# -#testfunc() { -#       command1 || die "${FUNCNAME}: command1 failed" || return 1 -#       command2 || die "${FUNCNAME}: command2 failed" || return 1 -#       command3 || die "${FUNCNAME}: command3 failed" || return 1 -#} -# -# Version 2: -# -#testfunc() { -#       ( -#               command1 || die "${FUNCNAME}: command1 failed" -#               command2 || die "${FUNCNAME}: command2 failed" -#               command3 || die "${FUNCNAME}: command3 failed" -#       ) -#       return $? -#} -# -# Optionally, the return can be replaced with this: -#       local val=$? -#       [[ "${val}" == "0" ]] || die -#       return ${val} -# This will cause the contaning script to abort - -# usage "You need to provide a frobnicator" -# -# Print a message and the usage for the current script and exit with failure. -usage() { -        local myusage; -        if [ -n "${USAGE}" ]; then -                myusage=${USAGE} -        else -                myusage="No usage given" -        fi -        local me; -        if [ -n "${ME}" ]; then -                me=${ME} -        else -                me=$(basename $0) -        fi -        if [ -n "$1" ]; then -                echo "$@" -        fi -        echo "" -        if [ -n "${DESCRIPTION}" ]; then -                echo -e "${me}: ${DESCRIPTION}" -                echo "" -        fi -        echo "Usage:" -        echo "${me} ${myusage}" -        if [ -n "${LONGUSAGE}" ]; then -                echo -e "${LONGUSAGE}" -        fi -        exit 1 -} - -# debug_print "Print debug information" -# -# Print debug information based on GTWS_VERBOSE -debug_print() { -        if [ -n "${GTWS_VERBOSE}" ]; then -                echo -e "${GTWS_INDENT}$@" >&2 -        fi -} - -# debug_trace_start -# -# Start tracing all commands -debug_trace_start() { -        if [ -n "${GTWS_VERBOSE}" ]; then -                set -x -        fi -} - -# debug_trace_stop -# -# Stop tracing all commands -debug_trace_stop() { -        set +x -} - -# cmd_exists ${cmd} -# -# Determine if a command exists on the system -function cmd_exists { -        which $1 > /dev/null 2>&1 -        if [ "$?" == "1" ]; then -                die "You don't have $1 installed, sorry" || return 1 -        fi -} - -# is_git_repo ${dir} -# -# return success if ${dir} is in a git repo, or failure otherwise -is_git_repo() { -        debug_print "is_git_repo $1" -        if [[ $1 == *:* ]]; then -                debug_print "    remote; assume good" -                return 0 -        elif [ ! -d "$1" ]; then -                debug_print "    fail: not dir" -                return 1 -        fi -        cd "$1" -        git rev-parse --git-dir >/dev/null 2>&1 -        local ret=$? -        cd - > /dev/null -        debug_print "    retval: $ret" -        return $ret -} - -# find_git_repo ${basedir} ${repo_name} repo_dir -# -# Find the git repo for ${repo_name} in ${basedir}.  It's one of ${repo_name} -# or ${repo_name}.git -# -# Result will be in the local variable repo_dir  Or: -# -# repo_dir=$(find_git_repo ${basedir} ${repo_name}) -# -function find_git_repo { -        local basedir=$1 -        local repo_name=$2 -        local __resultvar=$3 -        local try="${basedir}/${repo_name}" - -        if ! is_git_repo "${try}" ; then -                try=${try}.git -        fi - -        is_git_repo "${try}" || die "${repo_name} in ${basedir} is not a git repository" || return 1 - -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$try'" -        else -                echo "$try" -        fi -} - -# git_top_dir top -# -# Get the top level of the git repo contaning PWD, or return failure; -# -# Result will be in local variable top  Or: -# -# top = $(git_top_dir) -# -# Result will be in local variable top -function git_top_dir { -        local  __resultvar=$1 -        local __top="$(git rev-parse --show-toplevel 2>/dev/null)" - -        if [ -z "${__top}" ]; then -                die "${PWD} is not a git repo" || return 1 -        fi -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$__top'" -        else -                echo "$__top" -        fi -} - -# is_git_rebase -# -# return success if git repo is in a rebase -is_git_rebase() { -        debug_print "is_git_rebase $1" -        (test -d "$(git rev-parse --git-path rebase-merge)" || \ -                test -d "$(git rev-parse --git-path rebase-apply)" ) -        local ret=$? -        debug_print "    retval: $ret" -        return $ret -} - -# is_docker -# -# return success if process is running inside docker -is_docker() { -        debug_print "is_docker" -        grep -q docker /proc/self/cgroup -        return $? -} - -# is_gtws -# -# return success if process is running inside a workspace -is_gtws() { -        if [ -n "${GTWS_WS_GUARD}" ]; then -                return 0 -        fi -        return 1 -} - -function gtws_rcp { -        rsync --rsh=ssh -avzS --progress --ignore-missing-args --quiet "$@" -} - -function gtws_cpdot { -        local srcdir=$1 -        local dstdir=$2 - -        debug_print "${FUNCNAME} - ${srcdir} to ${dstdir}" -        if [ -d "${srcdir}" ] && [ -d "${dstdir}" ]; then -                shopt -s dotglob -                cp -a "${srcdir}"/* "${dstdir}"/ -                shopt -u dotglob -        fi -} - -# gtws_find_dockerfile dockerfile -# -# Result will be in local variable dockerfile  Or: -# -# dockerfile = $(gtws_find_dockerfile) -# -# Result will be in local variable dockerfile -# -# Get the path to the most-specific Dockerfile -function gtws_find_dockerfile { -        local  __resultvar=$1 -        local __dir="${GTWS_WSPATH}" -        local __file="Dockerfile" - -        debug_print "${FUNCNAME} - trying ${__dir}/${__file}" -        if [ ! -f "${__dir}/${__file}" ]; then -                # Version dir -                __dir=$(dirname "${__dir}") -                debug_print "${FUNCNAME} - trying ${__dir}/${__file}" -        fi -        if [ ! -f "${__dir}/${__file}" ]; then -                # Project dir -                __dir=$(dirname "${__dir}") -                debug_print "${FUNCNAME} - trying ${__dir}/${__file}" -        fi -        if [ ! -f "${__dir}/${__file}" ]; then -                # Top level, flavor -                __dir="${GTWS_LOC}/dockerfiles" -                __file="Dockerfile-${FLAVOR}" -                debug_print "${FUNCNAME} - trying ${__dir}/${__file}" -        fi -        if [ ! -f "${__dir}/${__file}" ]; then -                # Top level, base -                __dir="${GTWS_LOC}/dockerfiles" -                __file="Dockerfile-base" -                debug_print "${FUNCNAME} - trying ${__dir}/${__file}" -        fi -        if [ ! -f "${__dir}/${__file}" ]; then -                die "Could not find a Dockerfile" || return 1 -        fi - -        debug_print "${FUNCNAME} - found ${__dir}/${__file}" -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'${__dir}/${__file}'" -        else -                echo "$__dir" -        fi -} - -# gtws_smopvn ${GTWS_SUBMODULE_ORIGIN:-${GTWS_ORIGIN}} ${GTWS_PROJECT} ${GTWS_PROJECT_VERSION} ${GTWS_WSNAME} smopvn -# -# Result will be in local variable smopvn.  Or: -# -# smopvn = $(gtws_smopvn ${GTWS_SUBMODULE_ORIGIN:-${GTWS_ORIGIN}} ${GTWS_PROJECT} ${GTWS_PROJECT_VERSION} ${GTWS_WSNAME}) -# -# Result will be in local variable smovpn -# -# Get the path to submodules for this workspace -function gtws_smopvn { -        local origin=$1 -        local project=$2 -        local version=$3 -        local name=$4 -        local  __resultvar=$5 -        local __smopv="${origin}/${project}/submodule" - -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$__smopv'" -        else -                echo "$__smopv" -        fi -} - -# gtws_opvn ${GTWS_ORIGIN} ${GTWS_PROJECT} ${GTWS_PROJECT_VERSION} ${GTWS_WSNAME} opvn -# -# Result will be in local variable opvn.  Or: -# -# opvn = $(gtws_opvn ${GTWS_ORIGIN} ${GTWS_PROJECT} ${GTWS_PROJECT_VERSION} ${GTWS_WSNAME}) -# -# Result will be in local variable opvn. -# -# Get the path to git repos for this workspace -function gtws_opvn { -        local origin=$1 -        local project=$2 -        local version=$3 -        local name=$4 -        local  __resultvar=$5 -        local __opv="${origin}/${project}/${version}" - -        if [[ $__opv == *:* ]]; then -                __opv="${__opv}/${name}" -                debug_print "remote; using opvn $__opv" -        elif [ ! -d "${__opv}" ]; then -                __opv="${origin}/${project}/git" -                if [ ! -d "${__opv}" ]; then -                        die "No opvn for ${origin} ${project} ${version}" || return 1 -                fi -        fi -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$__opv'" -        else -                echo "$__opv" -        fi -} - -# gtws_submodule_url ${submodule} url -# -# Result will be in local variable url  Or: -# -# url = $(gtws_submodule_url ${submodule}) -# -# Result will be in local variable url -# -# Get the URL for a submodule -function gtws_submodule_url { -        local sub=$1 -        local  __resultvar=$2 -        local __url=$(git config --list | grep "submodule.*url" | grep "\<${sub}\>" | cut -d = -f 2) - -        if [ -z "${__url}" ]; then -                local rpath=${PWD} -                local subsub=$(basename "${sub}") -                cd "$(dirname "${sub}")" -                debug_print "${FUNCNAME} trying ${PWD}" -                __url=$(git config --list | grep submodule | grep "\<${subsub}\>" | cut -d = -f 2) -                cd "${rpath}" -        fi - -        debug_print "${FUNCNAME} $sub url: $__url" -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$__url'" -        else -                echo "$__url" -        fi -} - -# gtws_submodule_mirror ${smopv} ${submodule} ${sub_sub_basename} mloc -# -# Result will be in local variable mloc  Or: -# -# mloc = $(gtws_submodule_mirror ${smopv} ${submodule} ${sub_sub_basename}) -# -# Result will be in local variable mloc -# -# Get the path to a local mirror of the submodule, if it exists -function gtws_submodule_mirror { -        local smopv=$1 -        local sub=$2 -        local sub_sub=$3 -        local  __resultvar=$4 -        local __mloc="" -        local url=$(gtws_submodule_url ${sub}) -        if [ -n "${url}" ]; then -                local urlbase=$(basename ${url}) -                # XXX TODO - handle remote repositories -                #if [[ ${smopv} == *:* ]]; then -                ## Remote SMOPV means clone from that checkout; I don't cm -                #refopt="--reference ${smopv}/${name}/${sub}" -                if [ -d "${smopv}/${urlbase}" ]; then -                        __mloc="${smopv}/${urlbase}" -                fi -        fi - -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$__mloc'" -        else -                echo "$__mloc" -        fi -} - -# gtws_submodule_paths subpaths -# -# Result will be in local variable subpaths  Or: -# -# subpaths = $(gtws_submodule_paths) -# -# Result will be in local variable subpaths -# -# Get the paths to submodules in a get repo.  Does not recurse -function gtws_submodule_paths { -        local  __resultvar=$1 -        local __subpaths=$(git submodule status | sed 's/^ *//' | cut -d ' ' -f 2) - -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$__subpaths'" -        else -                echo "$__subpaths" -        fi -} - -# gtws_submodule_clone [<base-submodule-path>] [<sub-sub-basename>] -# -# This will set up all the submodules in a repo.  Should be called from inside -# the parent repo -function gtws_submodule_clone { -        local smopv=$1 -        local sub_sub=$2 -        local sub_paths=$(gtws_submodule_paths) -        local rpath="${PWD}" - -        if [ -z "${smopv}" ]; then -                smopv=$(gtws_smopvn "${GTWS_SUBMODULE_ORIGIN:-${GTWS_ORIGIN}}" "${GTWS_PROJECT}" "${GTWS_PROJECT_VERSION}" "${GTWS_WSNAME}") -        fi -        git submodule init || die "${FUNCNAME}: Failed to init submodules" || return 1 -        for sub in ${sub_paths}; do -                local refopt="" -                local mirror=$(gtws_submodule_mirror "${smopv}" "${sub}" "${sub_sub}") -                debug_print "${FUNCNAME} mirror: ${mirror}" -                if [ -n "${mirror}" ]; then -                        refopt="--reference ${mirror}" -                fi -                git submodule update ${refopt} "${sub}" -                # Now see if there are recursive submodules -                cd "${sub}" -                gtws_submodule_clone "${smopv}/${sub}_submodule" "${sub}" || return 1 -                cd "${rpath}" -        done -} - -# gtws_repo_clone <base-repo-path> <repo> <branch> [<base-submodule-path>] [<target-directory>] -function gtws_repo_clone { -        local baserpath=${1%/} -        local repo=$2 -        local branch=$3 -        local basesmpath=$4 -        local rname=${5:-${repo%.git}} -        local rpath="${baserpath}/${repo}" -        local origpath=${PWD} - -        if [[ ${rpath} != *:* ]]; then -                if [ ! -d "${rpath}" ]; then -                        rpath="${rpath}.git" -                fi -        fi -        if [ -z "${basesmpath}" ]; then -                basesmpath="${baserpath}" -        fi -        debug_print "${FUNCNAME}: cloning ${baserpath} - ${repo} : ${branch} into ${GTWS_WSNAME}/${rname} submodules: ${basesmpath}" - -        # Main repo -        #git clone --recurse-submodules -b "${branch}" "${rpath}" || die "failed to clone ${rpath}:${branch}" || return 1 -        git clone -b "${branch}" "${rpath}" ${rname} || die "${FUNCNAME}: failed to clone ${rpath}:${branch}" || return 1 - -        # Update submodules -        cd "${rname}" || die "${FUNCNAME}: failed to cd to ${rpath}" || return 1 -        gtws_submodule_clone "${basesmpath}" || return 1 -        cd "${origpath}" || die "${FUNCNAME}: Failed to cd to ${origpath}" || return 1 - -        # Copy per-repo settings, if they exist -        gtws_cpdot "${baserpath%/git}/extra/repo/${rname}" "${origpath}/${rname}" - -        # Extra files -        for i in ${GTWS_FILES_EXTRA}; do -                local esrc= - -                IFS=':' read -ra ARR <<< "$i" -                if [ -n "${ARR[1]}" ]; then -                        dst="${rname}/${ARR[1]}" -                else -                        dst="${rname}/${ARR[0]}" -                fi - -                if [ -n "${GTWS_REMOTE_IS_WS}" ]; then -                        esrc="${baserpath}/${dst}" -                else -                        esrc="${baserpath%/git}" -                fi - -                gtws_rcp "${esrc}/${ARR[0]}" "${dst}" -        done -} - -# gtws_project_clone_default ${GTWS_ORIGIN} ${GTWS_PROJECT} ${GTWS_PROJECT_VERSION} ${GTWS_WSNAME} [${SUBMODULE_BASE}] -# -# Clone a version of a project into ${GTWS_WSPATH} (which is the current working directory).  This is the default version of this that clones <origin>/<project>/<version>/* -function gtws_project_clone_default { -        local origin=$1 -        local project=$2 -        local version=$3 -        local name=$4 -        local basesmpath=$5 -        local opv=$(gtws_opvn "${origin}" "${project}" "${version}" "${name}") -        local wspath=${PWD} -        local repos= -        local -A branches - -        if [ -z "${GTWS_PROJECT_REPOS}" ]; then -                for i in "${opv}"/*; do -                        repos="$(basename $i) $repos" -                        branches[$i]=${version} -                done -        else -                for i in ${GTWS_PROJECT_REPOS}; do -                        IFS=':' read -ra ARR <<< "$i" -                        repos="${ARR[0]} $repos" -                        if [ -n "${ARR[1]}" ]; then -                                branches[${ARR[0]}]=${ARR[1]} -                        else -                                branches[${ARR[0]}]=${version} -                        fi -                done -        fi - -        if [ -z "${basesmpath}" ] || [ ! -d "${basesmpath}" ]; then -                basesmpath="${opv}" -        fi - -        for repo in ${repos}; do -                gtws_repo_clone "${opv}" "${repo}" "${branches[${repo}]}" "${basesmpath}" -        done - -        # Copy per-WS settings, if they exist -        gtws_cpdot "${opv%/git}/extra/ws" "${wspath}" -} - -# gtws_repo_setup ${wspath} ${repo_path} -# -# The project can define gtws_repo_setup_local taking the same args to do -# project-specific setup.  It will be called last. -# -# Post-clone setup for an individual repo -function gtws_repo_setup { -        local wspath=$1 -        local rpath=$2 -        local savedir="${PWD}" - -        if [ ! -d "${rpath}" ]; then -                return 0 -        fi - -        cd "${rpath}/src" 2>/dev/null \ -                || cd ${rpath} \ -                || die "Couldn't cd to ${rpath}" || return 1 - -        maketags ${GTWS_MAKETAGS_OPTS} > /dev/null 2> /dev/null & - -        cd ${wspath} || die "Couldn't cd to ${wspath}" || return 1 - -        mkdir -p "${wspath}/build/$(basename ${rpath})" - -        cd "${savedir}" - -        if [ -n "$(declare -F | grep "\<gtws_repo_setup_local\>")" ]; then -                gtws_repo_setup_local "${wspath}" "${rpath}" \ -                        || die "local repo setup failed" || return 1 -        fi -} - -# gtws_project_setup${GTWS_WSNAME} ${GTWS_ORIGIN} ${GTWS_PROJECT} ${GTWS_PROJECT_VERSION} -# -# The project can define gtws_project_setup_local taking the same args to do -# project-specific setup.  It will be called last. -# -# Post clone setup of a workspace in ${GTWS_WSPATH} (which is PWD) -function gtws_project_setup { -        local wsname=$1 -        local origin=$2 -        local project=$3 -        local version=$4 -        local wspath=${PWD} -        local opv=$(gtws_opvn "${origin}" "${project}" "${version}" "placeholder") - -        for i in "${wspath}"/*; do -                gtws_repo_setup "${wspath}" "${i}" -        done - -        mkdir "${wspath}"/install -        mkdir "${wspath}"/chroots -        mkdir "${wspath}"/patches - -        if [ -n "$(declare -F | grep "\<gtws_project_setup_local\>")" ]; then -                gtws_project_setup_local "${wsname}" "${origin}" "${project}" \ -                        "${version}" || die "local project setup failed" || return 1 -        fi -} - -# load_rc /path/to/workspace -# -# This should be in the workspace-level gtwsrc file -# Recursively load all RC files, starting at / -function load_rc { -        local BASE=$(readlink -f "${1}") -        # Load base RC first -        debug_print "load_rc: Enter + Top: ${BASE}" -        source "${HOME}"/.gtwsrc -        while [ "${BASE}" !=  "/" ]; do -                if [ -f "${BASE}"/.gtwsrc ]; then -                        load_rc "$(dirname ${BASE})" -                        debug_print "\tLoading ${BASE}/.gtwsrc" -                        source "${BASE}"/.gtwsrc -                        return 0 -                fi -                BASE=$(readlink -f $(dirname "${BASE}")) -        done -        # Stop at / - -        return 1 -} - -# clear_env -# -# Clear the environment of GTWS_* except for the contents of GTWS_SAVEVARS. -# The default values for GTWS_SAVEVARS are below. -function clear_env { -        local savevars=${GTWS_SAVEVARS:-"LOC PROJECT PROJECT_VERSION VERBOSE WSNAME"} -        local verbose="${GTWS_VERBOSE}" -        debug_print "savevars=$savevars" - -        # Reset prompt -        if [ -n "${GTWS_SAVEPS1}" ]; then -                PS1="${GTWS_SAVEPS1}" -        fi -        if [ -n "${GTWS_SAVEPATH}" ]; then -                export PATH=${GTWS_SAVEPATH} -        fi -        unset LD_LIBRARY_PATH -        unset PYTHONPATH -        unset PROMPT_COMMAND -        unset CDPATH -        unset SDIRS - -        # Save variables -        for i in ${savevars}; do -                SRC=GTWS_${i} -                DST=SAVE_${i} -                debug_print "\t $i: ${DST} = ${!SRC}" -                eval ${DST}=${!SRC} -        done - -        # Clear GTWS evironment -        for i in ${!GTWS*} ; do -                if [ -n "${verbose}" ]; then -                        echo -e "unset $i" >&2 -                fi -                unset $i -        done - -        # Restore variables -        for i in ${savevars}; do -                SRC=SAVE_${i} -                DST=GTWS_${i} -                if [ -n "${verbose}" ]; then -                        echo -e "\t $i: ${DST} = ${!SRC}" >&2 -                fi -                if [ -n "${!SRC}" ]; then -                        eval export ${DST}=${!SRC} -                fi -                unset ${SRC} -        done -} - -# save_env ${file} ${nukevars} -# -# Save the environment of GTWS_* to the give file, except for the variables -# given to nuke.  The default values to nuke are given below. -function save_env { -        local fname=${1} -        local nukevars=${2:-"SAVEPATH ORIGIN WS_GUARD LOC SAVEPS1"} -        debug_print "nukevars=$nukevars" - -        for i in ${!GTWS*} ; do -                for j in ${nukevars}; do -                        if [ "${i}" == "GTWS_${j}" ]; then -                                debug_print "skipping $i" -                                continue 2 -                        fi -                done -                debug_print "saving $i" -                echo "export $i=\"${!i}\"" >> "${fname}" -        done -} - -# gtws_tmux_session_name ${PROJECT} ${VERSION} ${WSNAME} sesname -# -# Result will be in local variable sesname  Or: -# -# sesname = $(gtws_tmux_session_name ${PROJECT} ${VERSION} ${WSNAME}) -# -# Result will be in local variable sesname -# -# Get the tmux session name for a given workspace -function gtws_tmux_session_name { -        local project=$1 -        local version=$2 -        local wsname=$3 -        local  __resultvar=$4 -        local sesname="${project//./_}/${version//./_}/${wsname//./_}" - -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$sesname'" -        else -                echo "$sesname" -        fi -} - -# gtws_tmux_session_info ${SESSION_NAME} running attached -# -# Determine if a session is running, and if it is attached -# -# Result will be in local variables running and attached -# -# Test with: -# if $running ; then -#       echo "is running" -# fi - -function gtws_tmux_session_info { -        local ses_name=$1 -        local  __result_running=$2 -        local  __result_attached=$3 - -        local __num_ses=$(tmux ls | grep "^${ses_name}" | wc -l) -        local __attached=$(tmux ls | grep "^${ses_name}" | grep attached) - -        echo "$ses_name ses=${__num_ses}" - -        if [[ "$__result_running" ]]; then -                if [ "${__num_ses}" != "0" ]; then -                        eval $__result_running="true" -                else -                        eval $__result_running="false" -                fi -        fi -        if [[ "$__result_attached" ]]; then -                if [ -n "${__attached}" ]; then -                        eval $__result_attached="true" -                else -                        eval $__result_attached="false" -                fi -        fi -} - -# gtws_tmux_kill ${BASENAME} -# -# Kill all sessiont matching a pattern -function gtws_tmux_kill { -        local basename=$1 -        local old_sessions=$(tmux ls 2>/dev/null | fgrep "${basename}" | cut -f 1 -d:) -        for session in ${old_sessions}; do -                tmux kill-session -t "${session}" -        done -} - -# gtws_tmux_cleanup -# -# Clean up defunct tmux sessions -function gtws_tmux_cleanup { -        local old_sessions=$(tmux ls 2>/dev/null | egrep "^[0-9]{14}.*[0-9]+\\)$" | cut -f 1 -d:) -        for session in ${old_sessions}; do -                tmux kill-session -t "${session}" -        done -} - -# gtws_tmux_attach ${SESSION_NAME} -# -# Attach to a primary session.  It will remain after detaching. -function gtws_tmux_attach { -        local ses_name=$1 - -        tmux attach-session -t "${ses_name}" -} - -# gtws_tmux_slave ${SESSION_NAME} -# -# Create a secondary session attached to the primary session.  It will exit it -# is detached. -function gtws_tmux_slave { -        local ses_name=$1 - -        # Session is is date and time to prevent conflict -        local session=`date +%Y%m%d%H%M%S` -        # Create a new session (without attaching it) and link to base session -        # to share windows -        tmux new-session -d -t "${ses_name}" -s "${session}" -        # Attach to the new session -        gtws_tmux_attach "${session}" -        # When we detach from it, kill the session -        tmux kill-session -t "${session}" -} - -function cdorigin() { -        if [ -n "$(declare -F | grep "gtws_project_cdorigin")" ]; then -                gtws_project_cdorigin $@ -        else -                gtws_cdorigin $@ -        fi -} - -function gtws_get_origin { -        local opv=$1 -        local target=$2 -        local __origin= -        local  __resultvar=$3 - -        # If it's a git repo with a local origin, use that. -        __origin=$(git config --get remote.origin.url) -        if [ ! -d "${__origin}" ]; then -                __origin="${__origin}.git" -        fi -        if [ ! -d "${__origin}" ]; then -                # Try to figure it out -                if [ ! -d "${opv}" ]; then -                        die "No opv for $target" || return 1 -                fi -                find_git_repo "${opv}" "${target}" __origin || return 1 -        fi - -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$__origin'" -        else -                echo "$__origin" -        fi -} - -function gtws_cdorigin() { -        local opv=$(gtws_opvn "${GTWS_ORIGIN}" "${GTWS_PROJECT}" "${GTWS_PROJECT_VERSION}" "${GTWS_WSNAME}") -        local gitdir="" -        local target="" -        if [ -n "$1" ]; then -                target="$@" -        else -                git_top_dir gitdir || return 1 -                target=$(basename $gitdir) -        fi - -        gtws_get_origin $opv $target origin || return 1 -        cd "${origin}" -} - -# Copy files to another machine in the same workspace -function wsrcp { -        local target="${!#}" -        local length=$(($#-1)) -        local base=${PWD} - -        if [ -z "${1}" -o -z "${2}" ]; then -                echo "usage: ${FUNCNAME} <path> [<path>...] <target>" -                return 1 -        fi - -        for path in "${@:1:$length}"; do -                gtws_rcp "${path}" "${target}:${base}/${path}" -        done -} - -# Override "cd" inside the workspace to go to GTWS_WSPATH by default -function cd { -        if [ -z "$@" ]; then -                cd "${GTWS_WSPATH}" -        else -                builtin cd $@ -        fi -} - -# Generate diffs/interdiffs for changes and ship to WS on other boxes -function gtws_interdiff { -        local targets=$@ -        local target= -        local savedir=${PWD} -        local topdir=$(git_top_dir) -        local repo=$(basename ${topdir}) -        local mainpatch="${GTWS_WSPATH}/patches/${repo}-full.patch" -        local interpatch="${GTWS_WSPATH}/patches/${repo}-incremental.patch" - -        if [ -z "${targets}" ]; then -                echo "Usage: ${FUNCNAME} <targethost>" -                die "Must give targethost" || return 1 -        fi -        cd "${topdir}" -        if [ -f "${mainpatch}" ]; then -                git diff | interdiff "${mainpatch}" - > "${interpatch}" -        fi -        git diff > "${mainpatch}" -        for target in ${targets}; do -                gtws_rcp "${mainpatch}" "${interpatch}" \ -                        "${target}:${GTWS_WSPATH}/patches" -        done -        cd "${savedir}" -} - -function gtws_debug { -        local cmd=$1 -        if [ -z "${cmd}" ]; then -                echo "Must give a command" -                echo -                die "${FUNCNAME} <cmd-path>" || return 1 -        fi -        local cmdbase=$(basename $cmd) -        local pid=$(pgrep "${cmdbase}") - -        ASAN_OPTIONS="abort_on_error=1" cgdb ${cmd} ${pid} -} - -# remote_cmd "${target}" "${command}" output -# -# Result will be in local variable output  Or: -# -# output = $(remote_cmd "${target}" "${command}") -# -# Result will be in local variable output -# -# Run a command remotely and capture sdtout.  Make sure to quote the command -# appropriately. -remote_cmd() { -        local target=$1 -        local cmd=$2 -        local  __resultvar=$3 -        local output= - -        if [ -z "${GTWS_VERBOSE}" ]; then -                output=$(ssh "${target}" "${cmd}" 2>/dev/null) -        else -                output=$(ssh "${target}" "${cmd}") -        fi -        local ret=$? - -        if [[ "$__resultvar" ]]; then -                eval $__resultvar="'$output'" -        else -                echo "${output}" -        fi -        return ${ret} -} -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/git-great-teeming-workspaces - -作者:[Daniel Gryniewicz][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/dang -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) -[2]: https://github.com/dang/gtws -[3]: https://docs.python.org/3/library/venv.html diff --git a/sources/tech/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md b/sources/tech/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md deleted file mode 100644 index 6b959364b7..0000000000 --- a/sources/tech/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md +++ /dev/null @@ -1,168 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (mengxinayan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Basic Vim Commands You Need to Know to Work in Vim Editor) -[#]: via: (https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -Basic Vim Commands You Need to Know to Work in Vim Editor -====== - -If you are a system administrator or developer, you may need to edit a file while working on the Linux terminal. - -There are several file editors on Linux, and how to choose the right one for your needs. - -I would like to recommend Vim editor. - -### You may ask, why? - -You may spend more time in the editor to modify an existing file than writing new text. - -In this case, Vim Keyboard shortcuts allow you to efficiently meet your needs. - -The following articles may help you learn about file and directory manipulation. - - * [**L**][1]**[inux Basic – Linux and Unix Commands for File and Directory Manipulation][1]** - * **[10 Methods to View Different File Formats in Linux][2]** - - - -### What’s vim? - -Vim is one of the most popular and powerful text editor that widely used by Linux administrators and developers. - -It’s highly configurable text editor which enables efficient text editing. This is an updated version of the vi editor, which is already installed on most Unix systems. - -Vim is often called a “programmer’s editor,” but it is not limited to it, and is suitable for all types of text editing. - -It comes with many features like multi level undo, multi windows and buffers, syntax highlighting, command line editing, file name completion, visual selection. - -You can easily obtain online help with the “:help” command. - -### Understanding Vim Modes - -Vim has two modes, the details are below: - -**Command Mode:** When you launch Vim Editor, you will default to Command Mode. You can move around the file, and modify some parts of the text, cut, copy, and paste parts of the text and issue commands to do more (press ESC for Command Mode). - -**Insert Mode:** The nsert mode is used to type text in a given given document (Press i for insert mode). - -### How do I know which Vim mode I am on? - -If you are in insert mode, you will see **“INSERT”** at the bottom of the editor. If nothing is shown, or if it shows the file name at the bottom of the editor, you are in “Command Mode”. - -### Cursor Movement in Normal Mode - -These Vim keyboard shortcuts allow you to move your cursor around a file in different ways. - - * `G` – Go to the last line of the file - * `gg` – Go to the first line of the file - * `$` – Go to the end of line. - * `0` (zero) – Go to the beginning of line. - - - * `w` – Jump by start of words - * `W` – Jump by words (spaces separate words) - * `b` – Jump backward by words - * `B` – Jump backward by words (spaces separate words) - - - * `PgDn` Key – Move down page-wise - * `PgUp` Key – Move up page-wise - * `Ctrl+d` – Move half-page down - * `Ctrl+u` – Move half-page up - - - -### Insert mode – insert a text - -These vim keyboard shortcuts allows you to insert a cursor in varies position based on your needs. - - * `i` – Insert before the cursor - * `a` – Insert after the cursor - * `I` – Insert at the beginning of the line, this is useful when you are in the middle of the line. - * `A` – Insert at the end of the line - * `o` – Open a new line below the current line - * `O` – Append a new line above the current line - * `ea` – Insert at the end of the word - - - -### Copy, Paste and Delete a Line - - * `yy` – yank (copy) a line - * `p/P` – Paste after cursor/ put before cursor - * `dd` – delete a line - * `dw` – delete the word - - - -### Search and Replace Pattern in Vim - - * `/pattern` – To search a given pattern - * `?pattern` – To search backward a given pattern - * `n` – To repeat search - * `N` – To repeat backward search - - - * `:%s/old-pattern/new-pattern/g` – Replace all old formats with the new format across the file. - * `:s/old-pattern/new-pattern/g` – Replace all old formats with the new format in the current line. - * `:%s/old-pattern/new-pattern/gc` – Replace all old formats with the new format across the file with confirmations. - - - -### How do I go to a particular line in Vim Editor - -You can do this in two ways, depending on your need. If you don’t know the line number I suggest you go with the first method. - -Add line number by opening a file and running the command below. - -``` -:set number -``` - -Once you have set the line number, press **“: n”** to go to the corresponding line number. For example, if you want to go to **line 15**, enter. - -``` -:15 -``` - -If you already know the line number, use the following method to go directly to the corresponding line. For example, if you want to move to line 20, enter the command below. - -``` -$ vim +20 [File_Name] -``` - -### Undo/Redo/Repeat Operation - - * `u` – Undo the changes - * `Ctrl+r` – Redo the changes - * `.` – Repeat last command - - - -### Saving and Exiting Vim - - * `:w` – Save the changes but don’t exit - * `:wq` – Write and quit - * `:q!` – Force quit - - - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[萌新阿岩](https://github.com/mengxinayan) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/linux-basic-commands-file-directory-manipulation/ -[2]: https://www.2daygeek.com/unix-linux-command-to-view-file/ diff --git a/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md b/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md deleted file mode 100644 index ec5a177314..0000000000 --- a/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md +++ /dev/null @@ -1,245 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install TT-RSS on a Raspberry Pi) -[#]: via: (https://opensource.com/article/20/2/ttrss-raspberry-pi) -[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) - -How to install TT-RSS on a Raspberry Pi -====== -Read your news feeds while keeping your privacy intact with Tiny Tiny -RSS. -![Raspberries with pi symbol overlay][1] - -[Tiny Tiny RSS][2] (TT-RSS) is a free and open source web-based news feed (RSS/Atom) reader and aggregator. It's ideally suited to those who are privacy-focused and still rely on RSS for their daily news. Tiny Tiny RSS is self-hosted software, so you have 100% control of the server, your data, and your overall privacy. It also supports a wide range of plugins, add-ons, and themes, Want a dark mode interface? No problem. Want to filter your incoming news based on keywords? TT-RSS has you covered there, as well. - -![Tiny Tiny RSS screenshot][3] - -Now that you know what TT-RSS is and why you may want to use it, I'll explain everything you need to know about installing it on a Raspberry Pi or a Debian 10 server. - -### Install and configure TT-RSS - -To install TT-RSS on a Raspberry Pi, you must also install and configure the latest version of PHP (7.3 as of this writing), PostgreSQL for the database backend, the Nginx web server, Git, and finally, TT-RSS. - -#### 1\. Install PHP 7 - -Installing PHP 7 is, by far, the most involved part of this process. Thankfully, it's not as difficult as it might appear. Start by installing the following support packages: - - -``` -`$ sudo apt install -y ca-certificates apt-transport-https` -``` - -Now, add the repository PGP key: - - -``` -`$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -` -``` - -Next, add the PHP repository to your apt sources: - - -``` -`$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list` -``` - -Then update your repository index: - - -``` -`$ sudo apt update` -``` - -Finally, install PHP 7.3 (or the latest version) and some common components: - - -``` -`$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl` -``` - -The command above assumes you're using PostgreSQL as your database backend and installs **php7.3-pgsql**. If you'd rather use MySQL or MariaDB, you can easily change this to **php7.3-mysql**. - -Next, verify that PHP is installed and running on your Raspberry Pi: - - -``` -`$ php -v` -``` - -Now it's time to install and configure the webserver. - -#### 2\. Install Nginx - -Nginx can be installed via apt with: - - -``` -`$ sudo apt install -y nginx` -``` - -Modify the default Nginx virtual host configuration so that the webserver will recognize PHP files and know what to do with them: - - -``` -`$ sudo nano /etc/nginx/sites-available/default` -``` - -You can safely delete everything in the original file and replace it with: - - -``` -server { -        listen 80 default_server; -        listen [::]:80 default_server; - -        root /var/www/html; -        index index.html index.htm index.php; -        server_name _; - -        location / { -                try_files $uri $uri/ =404; -        } - -        location ~ \\.php$ { -          include snippets/fastcgi-php.conf; -          fastcgi_pass unix:/run/php/php7.3-fpm.sock; -        } - -} -``` - -Use **Ctrl+O** to save your new configuration file and then **Ctrl+X** to exit Nano. You can test your new configuration with: - - -``` -`$ nginx -t` -``` - -If there are no errors, restart the Nginx service: - - -``` -`$ systemctl restart nginx` -``` - -#### 3\. Install PostgreSQL - -Next up is installing the database server. Installing PostgreSQL on the Raspberry Pi is super easy: - - -``` -`$ sudo apt install -y postgresql postgresql-client postgis` -``` - -Check to see if the database server was successfully installed by entering: - - -``` -`$ psql --version` -``` - -#### 4\. Create the Tiny Tiny RSS database - -Before you can do anything else, you need to create a database that the TT-RSS software will use to store data. First, log into the PostgreSQL server: - - -``` -`sudo -u postgres psql` -``` - -Next, create a new user and assign a password: - - -``` -`CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity';` -``` - -Then create the database that will be used by TT-RSS: - - -``` -`CREATE DATABASE tinyrss;` -``` - -Finally, grant full permissions to the new user: - - -``` -`GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name;` -``` - -That's it for the database. You can exit the **psql** app by typing **\q**. - -#### 5\. Install Git - -Installing TT-RSS requires Git, so install Git with: - - -``` -`$ sudo apt install git -y` -``` - -Now, change directory to wherever Nginx serves web pages: - - -``` -`$ cd /var/www/html` -``` - -Then download the latest source for TT-RSS: - - -``` -`$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss` -``` - -Note that this process creates a new **tt-rss** folder. - -#### 6\. Install and configure Tiny Tiny RSS - -It's finally time to install and configure your new TT-RSS server. First, verify that you can open **** in a web browser. If you get a **403 Forbidden** error, your permissions are not set properly on the **/var/www/html** folder. The following will usually fix this issue: - - -``` -`$ chmod 755 /var/www/html/ -v` -``` - -If everything goes as planned, you'll see the TT-RSS Installer page, and it will ask you for some database information. Just tell it the database username and password that you created earlier; the database name; **localhost** for the hostname; and **5432** for the port. - -Click **Test Configuration** to continue. If all went well, you should see a red button labeled **Initialize Database.** Click on it to begin the installation. Once finished, you'll have a configuration file that you can copy and save as **config.php** in the TT-RSS directory. - -After finishing with the installer, open your TT-RSS installation at **** and log in with the default credentials (username: **admin**, password: **password**). The system will recommend that you change the admin password as soon as you log in. I highly recommend that you follow that advice and change it as soon as possible. - -### Set up TT-RSS - -If all went well, you can start using TT-RSS right away. It's recommended that you create a new non-admin user, log in as the new user, and start importing your feeds, subscribing, and configuring it as you see fit. - -Finally, and this is super important, don't forget to read the [Updating Feeds][4] section on TT-RSS's wiki. It describes how to create a simple systemd service that will update your feeds. If you skip this step, your RSS feeds will not update automatically. - -### Conclusion - -Whew! That was a lot of work, but you did it! You now have your very own RSS aggregation server. Want to learn more about TT-RSS? I recommend checking out the official [FAQ][5], the [support][6] forum, and the detailed [installation][7] notes. Feel free to comment below if you have any questions or issues. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/ttrss-raspberry-pi - -作者:[Patrick H. Mullins][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/pmullins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) -[2]: https://tt-rss.org/ -[3]: https://opensource.com/sites/default/files/uploads/tt-rss.jpeg (Tiny Tiny RSS screenshot) -[4]: https://tt-rss.org/wiki/UpdatingFeeds -[5]: https://tt-rss.org/wiki/FAQ -[6]: https://community.tt-rss.org/c/tiny-tiny-rss/support -[7]: https://tt-rss.org/wiki/InstallationNotes diff --git a/sources/tech/20200223 The Zen of Go.md b/sources/tech/20200223 The Zen of Go.md new file mode 100644 index 0000000000..c4143aed32 --- /dev/null +++ b/sources/tech/20200223 The Zen of Go.md @@ -0,0 +1,414 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Zen of Go) +[#]: via: (https://dave.cheney.net/2020/02/23/the-zen-of-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +The Zen of Go +====== + +_This article was derived from my [GopherCon Israel 2020][1] presentation. It’s also quite long. If you’d prefer a shorter version, head over to [the-zen-of-go.netlify.com][2]_. + +_A recording of the presentation is available on [YouTube][3]._ + +* * * + +### How should I write good code? + +Something that I’ve been thinking about a lot recently, when reflecting on the body of my own work, is a common subtitle, _how should I write good code?_ Given nobody actively seeks to write _bad_ code, this leads to the question; _how do you know when you’ve written good Go code?_ + +If there’s a continuum between good and bad, how to do we know what the good parts are? What are its properties, its attributes, its hallmarks, its patterns, and its idioms? + +### Idiomatic Go + +![][4] + +Which brings me to idiomatic Go. To say that something is idiomatic is to say that it follows the style of the time. If something is not idiomatic, it is not following the prevailing style. It is unfashionable. + +More importantly, to say to someone that their code is not idiomatic does not explain _why_ it’s not idiomatic. Why is this? Like all truths, the answer is found in the dictionary. + +> idiom (noun): a group of words established by usage as having a meaning not deducible from those of the individual words. + +Idioms are hallmarks of shared values. Idiomatic Go is not something you learn from a book, it’s something that you acquire by being part of a community. + +![][5] + +My concern with the mantra of idiomatic Go is, in many ways, it can be exclusionary. It’s saying “you can’t sit with us.” After all, isn’t that what we mean when critique of someone’s work as non-idiomatic? They didn’t do It right. It doesn’t look right. It doesn’t follow the style of time. + +I offer that idiomatic Go is not a suitable mechanism for teaching how to write good Go code because it is defined, fundamentally, by telling someone they did it wrong. Wouldn’t it be better if the advice we gave didn’t alienate the author right at the point they were most willing to accept it? + +### Proverbs + +Stepping away problematic idioms, what other cultural artefacts do Gophers have? Perhaps we can turn to Rob Pike’s wonderful [Go Proverbs][6]. Are these suitable teaching tools? Will these tell newcomers how to write good Go code? + +In general, I don’t think so. This is not to dismiss Pike’s work, it is just that the Go Proverbs, like Segoe Kensaku’s original, are observations, not statements of value. Again, the dictionary comes to the rescue: + +> proverb (noun): a short, well-known pithy saying, stating a general truth or piece of advice. + +The goal of the Go Proverbs are to reveal a deeper truth about the design of the language, but how useful is advice like the _empty interface says nothing_ to a novice from a language that doesn’t have structural typing? + +It’s important to recognise that, in a growing community, at any time the people learning Go far outnumber those who claim to have mastered the language. Thus proverbs are perhaps not the best teaching tool in this scenario. + +### Engineering Values + +Dan Luu found [an old presentation][7] by Mark Lucovsky about the engineering culture of the windows team around the windows NT-windows 2000 timeframe. The reason I mention it is Lukovsky’s description of a culture as a common way of evaluating designs and making tradeoffs. + +![][8] + +There are many ways of discussing culture, but with respect to an engineering culture Lucovsky’s description is apt. The central idea is _values guide decisions in an unknown design space_. The values of the NT team were; portability, reliability, security, and extensibility. Engineering values are, crudely translated, the way things are done around here. + +### Go’s values + +What are the explicit values of Go? What are the core beliefs or philosophy that define the way a Go programmer interprets the world? How are they promulgated? How are they taught? How are they enforced? How do they change over time? + +How will you, as a newly minted Go programmer, inculcate the engineering values of Go? Or, how will you, a seasoned Go professional promulgate your values to a future generations? And just so we’re clear, this process of knowledge transfer is not optional. Without new blood and new ideas, our community become myopic and wither. + +#### The values of other languages + +To set the scene for what I’m getting at we can look to other languages we see examples of their engineering values. + +For example, C++ (and by extension Rust) believe that a programmer _should not have to pay for a feature they do not use_. If a program does not use some computationally expensive feature of the language, then it shouldn’t be forced to shoulder the cost of that feature. This value extends from the language, to its standard library, and is used as a yardstick for judging the design of all code written in C++. + +In Java, and Ruby, and Smalltalk, the core value that _everything is an object_ drives the design of programs around message passing, information hiding, and polymorphism. Designs that shoehorn a procedural style, or even a functional style, into these languages are considered to be wrong–or as Gophers would say, non idiomatic. + +Turning to our own community, what are the engineering values that bind Go programmers? Discourse in our community is often fractious, so deriving a set of values from first principles would be a formidable challenge. Consensus is critical, but exponentially more difficult as the number of contributors to the discussion increases. But what if someone had done the hard work for us. + +### The Zen of ~~Python~~ Go + +Several decades ago Tim Peters sat down and penned _[PEP-20][9]_, the Zen of Python. Peters’ attempted to document the engineering values that he saw Guido van Rossum apply in his role as BDFL for Python. + +For the remainder of this article, I’m going to look towards the Zen of Python and ask, is there anything that can inform the engineering values of Go programmers? + +### A good package starts with a good name + +Let’s start with something spicy, + +> “Namespaces are one honking great idea–let’s do more of those!” + +The Zen of Python, Item 19 + +This is pretty unequivocal, Python programmers should use namespaces. Lots of them. + +In Go parlance a namespace is a package. I doubt there is any question that grouping things into packages is good for design and potentially reuse. But there might be some confusion, especially if you’re coming with a decade of experience in another language, about the right way to do this. + +In Go each package should have a purpose, and the best way to know a package’s purpose is by its name—a noun. A package’s name describes what it provides. So too reinterpret Peters’ words, every Go package should have a single purpose. + +This is not a new idea, [I’ve been saying this a while][10], but why should you do this rather than approach where packages are used for fine grained taxonomy? Why, because change. + +> “Design is the art of arranging code to work today, and be changeable forever.” + +Sandi Metz + +Change is the name of the game we’re in. What we do as programmers is manage change. When we do that well we call it design, or architecture. When we do it badly we call it technical debt, or legacy code. + +If you are writing a program that works perfectly, one time, for one fixed set of inputs then nobody cares if the code is good or bad because ultimately the output of the program is all the business cares about. + +But this is _never_ true. Software has bugs, requirements change, inputs change, and very few programs are written solely to be executed once, thus your program _will_ change over time. Maybe it’s you who’ll be tasked with this, more likely it will be someone else, but someone has to change that code. Someone has to maintain that code. + +So, how can we make it easy to for programs to change? Interfaces everywhere? Make everything mockable? Pernicious dependency injection? Well, maybe, for some classes of programs, but not many, those techniques will be useful. However, for the majority of programs, designing something to be flexible up front is over engineering. + +What if, instead, we take a position that rather than enhancing components, we replace them. Then the best way to know when something needs to be replaced, is when it doesn’t do what it says on the tin. + +A good package starts with choosing a good name. Think of your package’s name as an elevator pitch, using just one word, to describe what it provides. When the name no longer matches the requirement, find a replacement. + +### Simplicity matters + +> “Simple is better than complex.” + +The Zen of Python, Item 3 + +PEP-20 says simple is better than complex, I couldn’t agree more. A couple of years ago I made this tweet; + +> Most programming languages start out aiming to be simple, but end up just settling for being powerful. +> +> — Dave Cheney (@davecheney) [December 2, 2014][11] + +My observation, at least at the time, was that I couldn’t think of a language introduced in my life time that didn’t purport to be simple. Each new language offered as a justification, and an enticement, their inherent simplicity. But as I researched, I found that simplicity was not a core value of the many of the languages considered Go’s contemporaries. [1][12] Maybe this is just a cheap shot, but could it be that either these languages aren’t simple, or they don’t _think_ of themselves as being simple. They don’t consider simplicity to be a core value. + +Call me old fashioned, but when did being simple fall out of style? Why does the commercial software development industry continually, gleefully, forget this fundamental truth? + +> “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” + +C. A. R. Hoare, The Emperor’s Old Clothes, 1980 Turing Award Lecture + +Simple does not mean easy, we know that. Often it is more work to make something simple to use, than easy to build. + +> “Simplicity is prerequisite for reliability.” + +Edsger W Dijkstra, EWD498, 18 June 1975 + +Why should we strive for simplicity? Why is important that Go programs be simple? Simple doesn’t mean crude, it means readable and maintainable. Simple doesn’t mean unsophisticated, it means reliable, relatable, and understandable. + +> “Controlling complexity is the essence of computer programming.” + +Brian W. Kernighan, _Software Tools_ (1976) + +Whether Python abides by its mantra of simplicity is a matter for debate, but Go holds simplicity as a core value. I think that we can all agree that when it comes to Go, simple code is preferable to clever code. + +### Avoid package level state + +> “Explicit is better than implicit.” + +_The Zen of Python, Item_ 2 + +This is a place where I think Peters’ was more aspirational than factual. Many things in Python are not explicit; decorators, dunder methods, and so on. Without doubt they are powerful, there’s a reason those features exists. Each feature is something someone cared enough about to do the work to implement it, especially the complicated ones. But heavy use of those features makes is harder for the reader to predict the cost of an operation. + +The good news is we have a choice, as Go programmers, to choose to make our code explicit. Explicit could mean many things, perhaps you may be thinking explicit is just a nice way of saying bureaucratic and long winded, but that’s a superficial interpretation. It’s a misnomer to focus only on the syntax on the page, to fret about line lengths and DRYing up expressions. The more valuable, in my opinon, place to be explicit are to do with coupling and with state. + +Coupling is a measure of the amount one thing depends on another. If two things are tightly coupled, they move together. An action that affects one is directly reflected in another. Imagine a train, each carriage joined–ironically the correct word is coupled–together; where the engine goes, the carriages follow. + +Another way to describe coupling is the word cohesion. Cohesion measures how well two things naturally belong together. We talk about a cohesive argument, or a cohesive team; all their parts fit together as if they were designed that way. + +Why does coupling matter? Because just like trains, when you need to change a piece of code, all the code that is tightly coupled to it must change. A prime example, someone release a new version of their API and now your code doesn’t compile. + +APIs are an unavoidable source of coupling but there are more insidious forms of coupling. Clearly everyone knows that if an API’s signature changes the data passing into and out of that call changes. It’s right there in the signature of the function; I take values of these types and return values of other types. But what if the API passed data another way? What if every time you called this API the result was based on the previous time you called that API even though you didn’t change your parameters. + +This is state, and management of state is _the_ problem in computer science. + +``` +package counter + +var count int + +func Increment(n int) int { + count += n + return count +} +``` + +Suppose we have this simple `counter` package. You can call `Increment` to increment the counter, you can even get the value back if you `Increment` with a value of zero. + +Suppose you had to test this code, how would you reset the counter after each test? Suppose you wanted to run those tests in parallel, could you do it? Now suppose that you wanted to count more than one thing per program, could you do it? + +No, of course not. Clearly the answer is to encapsulate the `count` variable in a type. + +``` +package counter + +type Counter struct { + count int +} + +func (c *Counter) Increment(n int) int { + c.count += n + return c.count +} +``` + +Now imagine that this problem isn’t restricted to just counters, but your applications main business logic. Can you test it in isolation? Can you test it in parallel? Can you use more than one instance at a time? If the answer those question is _no_, the reason is package level state. + +Avoid package level state. Reduce coupling and spooky action at a distance by providing the dependencies a type needs as fields on that type rather than using package variables. + +### Plan for failure, not success + +> “Errors should never pass silently.” + +_The Zen of Python, Item 1_0 + +It’s been said of languages that favour exception handling follow the Samurai principle; _return victorious or not at all_. In exception based languages functions only return valid results. If they don’t succeed then control flow takes an entirely different path. + +Unchecked exceptions are clearly an unsafe model to program in. How can you possibly write code that is robust in the presence of errors when you don’t know which statements could throw an exception? Java tried to make exceptions safer by introducing the notion of a checked exception which, to the best of my knowledge, has not been repeated in another mainstream language. There are plenty of languages which use exceptions but they all, with the singular exception of Java, do so in the unchecked variety. + +Obviously Go chose a different path. Go programmers believe that robust programs are composed from pieces that handle the failure cases _before_ they handle the happy path. In the space that Go was designed for; server programs, multi threaded programs, programs that handle input over the network, dealing with unexpected data, timeouts, connection failures and corrupted data must be front and centre of the programmer’s mind if they are to produce robust programs. + +> “I think that error handling should be explicit, this should be a core value of the language.” + +Peter Bourgon, [GoTime #91][13] + +I want to echo Peter’s assertion, as it was the impetus for this article. I think so much of the success of Go is due to the explicit way errors are handled. Go programmers thinks about the failure case first. We solve the “what if…​” case first. This leads to programs where failures are handled at the point of writing, rather than the point they occur in production. + +The verbosity of + +``` +if err != nil { + return err +} +``` + +is outweighed by the value of deliberately handling each failure condition at the point at which they occur. Key to this is the cultural value of handling each and every error explicitly. + +### Return early rather than nesting deeply + +> “Flat is better than nested.” + +The Zen of Python, Item 5 + +This is sage advice coming from a language where indentation is the primary form of control flow. How can we interpret this advice in terms of Go? `gofmt` controls the overall whitespace of a Go program so there’s not thing doing there. + +I wrote earlier about package names, and there is probably some advice here about avoiding a complicated package hierarchy. In my experience the more a programmer tries to subdivide and taxonimise their Go codebase the more they risk hitting the dead end that is package import loops. + +I think the best application of item 5’s advice is the control flow _within_ a function. Simply put, avoid control flow that requires deep indentation. + +> “Line of sight is a straight line along which an observer has unobstructed vision.” + +May Ryer, [Code: Align the happy path to the left edge][14] + +Mat Ryer describes this idea as line of sight coding. Light of sight coding means things like: + + * Using guard clauses to return early if a precondition is not met. + * Placing the successful return statement at the end of the function rather than inside a conditional block. + * Reducing the overall indentation level of the function by extracting functions and methods. + + + +Key to this advice is the thing that you care about, the thing that the function does, is never in danger of sliding out of sight to the right of your screen. This style has a bonus side effect that you’ll avoid pointless arguments about line lengths on your team. + +Every time you indent you add another precondition to the programmers stack, consuming one of their 7 ±2 short term memory slots. Rather than nesting deeply, keep the successful path of the function close to the left hand side of your screen. + +### If you think it’s slow, prove it with a benchmark + +> “In the face of ambiguity, refuse the temptation to guess.” + +The Zen of Python, Item 12 + +Programming is based on mathematics and logic, two concepts which rarely involve the element of chance. But there are many things we, as programmers, guess about every day. What does this variable do? What does this parameter do? What happens if I pass `nil` here? What happens if I call `Register` twice? There’s actually a lot of guesswork in modern programming, especially when it comes to using libraries you didn’t write. + +> “APIs should be easy to use and hard to misuse.” + +Josh Bloch + +One of the best ways I know to help a programmer avoid having to guess is to, when building an API, [focus on the default use case][15]. Make it as easy as you can for the caller to do the most common thing. However, I’ve written and talked a lot about API design in the past, so instead my interpretation of item 12 is; _don’t guess about performance_. + +Despite how you may feel about Knuth’s advice, one of the drivers of Go’s success is its efficient execution. You can write efficient programs in Go and thus people _will_ choose Go because of this. There are a lot of misconceptions about performance, so my request is, when you’re looking to performance tune your code or you’re facing some dogmatic advice like defer is slow, CGO is expensive, or always use atomics not mutexes, don’t guess. + +Don’t complicate your code because of outdated dogma, and, if you think something is slow, first prove it with a benchmark. Go has excellent benchmarking and profiling tools that come in the distribution for free. Use them to find your bottlenecks. + +### Before you launch a goroutine, know when it will stop + +At this point I think I think I’ve mined the valuable points from PEP-20 and possibly stretched its reinterpretation beyond the point of good taste. I think that’s fine, because although this was a useful rhetorical device, ultimately we are talking about two different languages. + +> “You type g o, a space, and then a function call. Three keystrokes, you can’t make it much shorter than that. Three keystrokes and you’ve just started a sub process.” + +Rob Pike, [Simplicity is Complicated][16], dotGo 2015 + +The next two suggestions I’ll dedicate to goroutines. Goroutines are the signature feature of the language, our answer for first class concurrency. They are so easy to use, just put the word `go` in front of the statement and you’ve launched that function asynchronously. It’s so simple, no threads, no stack sizes, no thread pool executors, no ID’s, no tracking completion status. + +Goroutines are cheap. Because of the runtime’s ability to multiplex goroutines onto a small pool of threads (which you don’t have to manage), hundreds of thousands, millions of goroutines are easily accommodated. This opens up designs that would be not be practical under competing concurrency models like threads or evented callbacks. + +But as cheap as goroutines are, they’re not free. At a minimum there’s a few kilobytes for their stack, which, when you’re getting up into the 10^6 goroutines, does start to add up. This is not to say you shouldn’t use millions of goroutines if that is what the design calls for, but when you do, it’s critical that you keep track of them because 10^6 of anything can consume a non trivial amount of resources in aggregate. + +Goroutines are the key to resource ownership in Go. To be useful a goroutine has to do something, and that means it almost always holds reference to, or ownership of, a resource; a lock, a network connection, a buffer with data, the sending end of a channel. While that goroutine is alive, the lock is held, the network connection remains open, the buffer retained and the receivers of the channel will continue to wait for more data. + +The simplest way to free those resources is to tie them to the lifetime of the goroutine–when the goroutine exits, the resource has been freed. So while it’s near trivial to start a goroutine, before you write those three letters, g o and a space, make sure you have an answer to these questions: + + * **Under what condition will a goroutine stop?** Go doesn’t have a way to tell a goroutine to exit. There is no stop or kill function, for good reason. If we cannot command a goroutine to stop, we must instead ask it, politely. Almost always this comes down to a channel operation. Range loops over a channel exit when the channel is closed. A channel will become selectable if it is closed. The signal from one goroutine to another is best expressed as a closed channel. + * **What is required for that condition to arise?** If channels are both the vehicle to communicate between goroutines and the mechanism for them to signal completion, the next question to the programmer becomes, who will close the channel, when will that happen? + * **What signal will you use to know the goroutine has stopped?** When you signal a goroutine to stop, that stopping will happen at some time in the future relative to the goroutine’s frame of reference. It might happen quickly in terms of human perception, but computers execute billions of instructions every second, and from the point of view of each goroutine, their execution of instructions is unsynchronised. The solution is often to use a channel to signal back or a waitgroup where a fan in approach is needed. + + + +### Leave concurrency to the caller + +It is likely that in any serious Go program you write there will be concurrency involved. This raises the problem, many of the libraries and code that we write fall into this a one goroutine per connection, or worker pattern. How will you manage the lifetime of those goroutines? + +`net/http` is a prime example. Shutting down the server owning the listening socket is relatively straight forward, but what about a goroutines spawned from that accepting socket? `net/http` does provide a context object inside the request object which can be used to signal–to code that is listening–that the request should be canceled, thereby terminating the goroutine, however it is less clear how to know when all of these things have been done. It’s one thing to call `context.Cancel`, its another to know that the cancellation has completed.[2][17] + +The point I want to make about `net/http` is that its a counter example to good practice. Because each connection is handled by a goroutine spawned inside the `net/http.Server` type, the program, living outside the `net/http` package, does not have an ability to control the goroutines spawned for the accepting socket. + +This is an area of design that is still evolving, with efforts like go-kit’s `run.Group` and the Go team’s [`ErrGroup`][18] which provide a framework to execute, cancel and wait on functions run asynchronously. + +The bigger design maxim here is for library writers, or anyone writing code that could be run asynchronously, leave the responsibility of starting to goroutine to your caller. Let the caller choose how they want to start, track, and wait on your functions execution. + +### Write tests to lock in the behaviour of your package’s API + +Perhaps you were hoping to read an article from me where I didn’t rant about testing. Sadly, today is not that day. + +Your tests are the contract about what your software does and does not do. Unit tests at the package level should lock in the behaviour of the package’s API. They describe, in code, what the package promises to do. If there is a unit test for each input permutation, you have defined the contract for what the code will do _in code_, not documentation. + +This is a contract you can assert as simply as typing `go test`. At any stage, you can _know_ with a high degree of confidence, that the behaviour people relied on before your change continues to function after your change. + +Tests lock in api behaviour. Any change that adds, modifies or removes a public api must include changes to its tests. + +### Moderation is a virtue + +Go is a simple language, only 25 keywords. In some ways this makes the features that are built into the language stand out. Equally these are the features that the language sells itself on, lightweight concurrency, structural typing. + +I think all of us have experienced the confusion that comes from trying to use all of Go’s features at once. Who was so excited to use channels that they used them as much as they could, as often as they could? Personally for me I found the result was hard to test, fragile, and ultimately overcomplicated. Am I alone? + +I had the same experience with goroutines, attempting to break the work into tiny units I created a hard to manage hurd of Goroutines and ultimately missed the observation that most of my goroutines were always blocked waiting for their predecessor– the code was ultimately sequential and I had added a lot of complexity for little real world benefit. Who has experienced something like this? + +I had the same experience with embedding. Initially I mistook it for inheritance. Then later I recreated the fragile base class problem by composing complicated types, which already had several responsibilities, into more complicated mega types. + +This is potentially the least actionable piece of advice, but one I think is important enough to mention. The advice is always the same, all things in moderation, and Go’s features are no exception. If you can, don’t reach for a goroutine, or a channel, or embed a struct, anonymous functions, going overboard with packages, interfaces for everything, instead prefer simpler approach rather than the clever approach. + +### Maintainability counts + +I want to close with one final item from PEP-20, + +> “Readability Counts.” + +The Zen of Python, Item 7 + +So much has been said, about the importance of readability, not just in Go, but all programming languages. People like me who stand on stages advocating for Go use words like simplicity, readability, clarity, productivity, but ultimately they are all synonyms for one word–_maintainability_. + +The real goal is to write maintainable code. Code that can live on after the original author. Code that can exist not just as a point in time investment, but as a foundation for future value. It’s not that readability doesn’t matter, maintainability matters _more_. + +Go is not a language that optimises for clever one liners. Go is not a language which optimises for the least number of lines in a program. We’re not optimising for the size of the source code on disk, nor how long it takes to type the program into an editor. Rather, we want to optimise our code to be clear to the reader. Because its the reader who’s going to have to maintain this code. + +If you’re writing a program for yourself, maybe it only has to run once, or you’re the only person who’ll ever see it, then do what ever works for you. But if this is a piece of software that more than one person will contribute to, or that will be used by people over a long enough time that requirements, features, or the environment it runs in may change, then your goal must be for your program to be maintainable. If software cannot be maintained, then it will be rewritten; and that could be the last time your company will invest in Go. + +Can the thing you worked hard to build be maintained after you’re gone? What can you do today to make it easier for someone to maintain your code tomorrow? + +##### [the-zen-of-go.netlify.com][2] + + 1. This part of the talk had several screenshots of the landing pages for the websites for [Ruby][19], [Swift][20], [Elm][21], [Go][22], [NodeJS][23], [Python][24], [Rust][25], highlighting how the language described itself.[][26] + 2. I tend to pick on `net/http` a lot, and this is not because it is bad, in fact it is the opposite, it is the most successful, oldest, most used API in the Go codebase. And because of that its design, evolution, and shortcoming have been thoroughly picked over. Think of this as flattery, not criticism.[][27] + + + +#### Related posts: + + 1. [Never start a goroutine without knowing how it will stop][28] + 2. [Simplicity Debt][29] + 3. [Curious Channels][30] + 4. [Let’s talk about logging][31] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/02/23/the-zen-of-go + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://www.gophercon.org.il +[2]: https://the-zen-of-go.netlify.com +[3]: https://www.youtube.com/watch?v=yd_rtwYaXps +[4]: https://dave.cheney.net/wp-content/uploads/2020/02/1011226.jpg +[5]: https://dave.cheney.net/wp-content/uploads/2020/02/mean-girls-you-cant-sit-with-us-main.jpg +[6]: http://go-proverbs.github.io +[7]: https://danluu.com/microsoft-culture/ +[8]: https://dave.cheney.net/wp-content/uploads/2020/02/Lucovsky.001.jpeg +[9]: https://www.python.org/dev/peps/pep-0020/ +[10]: https://dave.cheney.net/2019/01/08/avoid-package-names-like-base-util-or-common +[11]: https://twitter.com/davecheney/status/539576755254611968?ref_src=twsrc%5Etfw +[12]: tmp.iUoDiQyXMU#easy-footnote-bottom-1-3936 (This part of the talk had several screenshots of the landing pages for the websites for Ruby, Swift, Elm, Go, NodeJS, Python, Rust, highlighting how the language described itself.) +[13]: https://changelog.com/gotime/91 +[14]: https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88 +[15]: http://sweng.the-davies.net/Home/rustys-api-design-manifesto +[16]: https://www.youtube.com/watch?v=rFejpH_tAHM +[17]: tmp.iUoDiQyXMU#easy-footnote-bottom-2-3936 (I tend to pick on net/http a lot, and this is not because it is bad, in fact it is the opposite, it is the most successful, oldest, most used API in the Go codebase. And because of that its design, evolution, and shortcoming have been thoroughly picked over. Think of this as flattery, not criticism.) +[18]: https://godoc.org/golang.org/x/sync/errgroup +[19]: https://www.ruby-lang.org/en/ +[20]: https://swift.org +[21]: https://elm-lang.org +[22]: https://golang.org +[23]: https://nodejs.org/en/ +[24]: https://www.python.org +[25]: https://www.rust-lang.org +[26]: tmp.iUoDiQyXMU#easy-footnote-1-3936 +[27]: tmp.iUoDiQyXMU#easy-footnote-2-3936 +[28]: https://dave.cheney.net/2016/12/22/never-start-a-goroutine-without-knowing-how-it-will-stop (Never start a goroutine without knowing how it will stop) +[29]: https://dave.cheney.net/2017/06/15/simplicity-debt (Simplicity Debt) +[30]: https://dave.cheney.net/2013/04/30/curious-channels (Curious Channels) +[31]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) diff --git a/sources/tech/20200228 Getting started with Linux firewalls.md b/sources/tech/20200228 Getting started with Linux firewalls.md deleted file mode 100644 index c77d60b618..0000000000 --- a/sources/tech/20200228 Getting started with Linux firewalls.md +++ /dev/null @@ -1,128 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Linux firewalls) -[#]: via: (https://opensource.com/article/20/2/firewall-cheat-sheet) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Getting started with Linux firewalls -====== -A firewall is your computer's first line of defense against network -intrusion. Download our cheat sheet to make sure you're secure. -![Cheat Sheet cover image][1] - -A sensible firewall is your computer's first line of defense against network intrusion. When you're at home, you're probably behind a firewall built into the router supplied by your internet service provider. When you're away from home, though, the only firewall you have is the one running on your computer, so it's important to configure and control the firewall on your Linux computer. If you run a Linux server, it's just as important to know how to manage your firewall so that you can protect it from unwanted traffic both locally and remotely. - -### Install a firewall - -Many Linux distributions ship with a firewall already installed, and traditionally that was **iptables**. It is extremely effective and customizable, but it can be complex to configure. Luckily, developers have produced several frontends to help users control their firewall without writing lengthy iptables rules. - -On Fedora, CentOS, Red Hat, and similar distributions, the firewall software installed by default is **firewalld**, which is configured and controlled with the **firewall-cmd** command. On Debian and most other distributions, firewalld is available to install from your software repository. Ubuntu ships with the Uncomplicated Firewall (ufw), so to use firewalld, you must enable the **universe** repository: - - -``` -$ sudo add-apt-repository universe -$ sudo apt install firewalld -``` - -You must also deactivate ufw: - - -``` -`$ sudo systemctl disable ufw` -``` - -There's no reason _not_ to use ufw. It's an excellent firewall frontend. However, this article focuses on firewalld because of its wide availability and integration into systemd, which is shipped with nearly every distribution. - -Regardless of your distribution, for a firewall to be effective, it must be active, and it should be loaded at boot time: - - -``` -`$ sudo systemctl enable --now firewalld` -``` - -### Understanding firewall zones - -Firewalld aims to make firewall configuration as simple as possible. It does this by establishing _zones_. A zone is a set of sensible, common rules that suit the everyday needs of most users. There are nine by default: - - * **trusted:** All network connections are accepted. This is the least paranoid firewall setting and should only be used in a trusted environment, such as a test lab or in a family home where everyone on the local network is known to be friendly. - * **home, work, internal:** In these three zones, most incoming connections are accepted. They each exclude traffic on ports that usually expect no activity. Any of them is a reasonable setting for use in a home setting where there is no reason to expect network traffic to obscure ports, and you generally trust the other users on the network. - * **public:** For use in public areas. This is a paranoid setting, intended for times when you do not trust other computers on the network. Only selected common and mostly safe incoming connections are accepted. - * **dmz:** DMZ stands for demilitarized zone. This zone is intended for computers that are publically accessible, located on an organization's external network with limited access to the internal network. For personal computers, this is usually not a useful zone, but it is an important option for certain types of servers. - * **external:** For use on external networks with masquerading enabled (meaning the addresses of your private network are mapped to and hidden behind a public IP address). Similar to the dmz zone, only selected incoming connections are accepted, including SSH. - * **block:** Only network connections initiated within this system are possible, and all incoming network connections are rejected with an **icmp-host-prohibited** message. This is an extremely paranoid setting and is an important option for certain types of servers or personal computers in an untrusted or hostile environment. - * **drop:** Any and all incoming network packets are dropped with no reply. Only outgoing network connections are possible. The only setting more paranoid than this one is turning off your WiFi and unplugging your Ethernet cable. - - - -You can read about each zone and any other zones defined by your distribution or sysadmin by looking at the configuration files in **/usr/lib/firewalld/zones**. For instance, here's the FedoraWorkstation zone that ships with Fedora 31: - - -``` -$ cat /usr/lib/firewalld/zones/FedoraWorkstation.xml -<?xml version="1.0" encoding="utf-8"?> -<zone> -  <short>Fedora Workstation</short> -  <description>Unsolicited incoming network packets are rejected from port 1 to 1024, except for select network services. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description> -  <service name="dhcpv6-client"/> -  <service name="ssh"/> -  <service name="samba-client"/> -  <port protocol="udp" port="1025-65535"/> -  <port protocol="tcp" port="1025-65535"/> -</zone> -``` - -### Getting your current zone - -You can see what zone you're in at any time with the **\--get-active-zones** option: - - -``` -`$ sudo firewall-cmd --get-active-zones` -``` - -In response, you receive the name of the active zone along with the network interface assigned to it. On a laptop, that usually means you have a WiFi card in the default zone: - - -``` -FedoraWorkstation -  interfaces: wlp61s0 -``` - -### Change your current zone - -To change your zone, reassign your network interface to a different zone. For instance, to change the example **wlp61s0** card to the public zone: - - -``` -$ sudo firewall-cmd --change-interface=wlp61s0 \ -\--zone=public -``` - -You can change the active zone for an interface any time you please and for any reason—whether you're going out to a café and feel the need to increase your laptop's security policy, or you're going to work and need to open up some ports to get on the intranet, or for any other reason. The options for **firewall-cmd** auto-complete when you press the **Tab** key, so as long as you remember the keywords "change" and "zone," you can stumble through the command until you learn it by memory. - -### Learn more - -There's a lot more you can do with your firewall, including customizing existing zones, setting a default zone, and more. The more comfortable with firewalls you get, the more secure your online activities are, so we've created a [cheat sheet][2] for quick and easy reference. - -### Download your [firewall cheat sheet][2] - -David Both shares how he replaced his dedicated network firewall computer with a Raspberry Pi 2. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/firewall-cheat-sheet - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) -[2]: https://opensource.com/downloads/firewall-cmd-cheat-sheet diff --git a/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md b/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md deleted file mode 100644 index 6050adebfa..0000000000 --- a/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with the Gutenberg editor in Drupal) -[#]: via: (https://opensource.com/article/20/3/gutenberg-editor-drupal) -[#]: author: (MaciejLukianski https://opensource.com/users/maciejlukianski) - -Getting started with the Gutenberg editor in Drupal -====== -Learn how to use the WYSIWYG editor, made popular in WordPress, with -Drupal. -![Text editor on a browser, in blue][1] - -Since 2017, WordPress has had a really great WYSIWYG editor in the [Gutenberg][2] plugin. But the Drupal community hasn't yet reached consensus on the best approach to the content management system's (CMS) editorial experience. But a strong new option appeared when, with a lot of community effort, [Gutenberg was integrated with Drupal][3]. - -Previously, there were two main approaches to content creation in Drupal 8: - - * In the [**Paragraph-based approach**][4], content is assembled out of entities called paragraphs. Currently, approximately 100,000 websites use the Paragraphs module (according to Drupal). - * The [**Layout-Builder approach**][5] uses an editorial tool shipped with Drupal 8.5. It is still undergoing improvements, but it is the next strong contender because it is really well integrated with the Drupal core. Stats on usage are not available since Layout Builder is part of Drupal. - - - -At the end of 2018, the Drupal community, lead by Fronkom (a Norwegian digital agency strongly focused on open source solutions), ported the WordPress Gutenberg project as a contributed module into Drupal. Let's take a look at how Gutenberg works in Drupal (including some cool Drupal-specific integrations). - -### Installation - -Installing the [Gutenberg module][6] is as straightforward as installing any Drupal module, and it has good [installation documentation][7]. - -### Configuration - -Gutenberg is integrated into Drupal's default content-entity creation workflow. You can use it on any of the content types you choose, provided that the content type has at least one text area field, which is where the Gutenberg editor's output will be saved. - -To enable the Gutenberg project on a content type in Drupal, you have to navigate to its settings: **Structure > Content types** and, from the dropdown next to the content type where you want to use Gutenberg, click **Edit**. - -![Drupal settings][8] - -In the form that appears, scroll down and select the **Gutenberg experience** tab on the left, where you can find the settings described below. Select the **Enable Gutenberg experience** box. - -![Drupal Gutenberg settings][9] - -#### Template - -This is one of the cool features that is not available in WordPress out of the box. It enables you to define a template for a new page in a JSON structure. This will pre-populate all newly created articles with dummy placeholder content, which will help editors structure content correctly. In the screenshot above, I added a heading and a paragraph. Note that any double-quotes have to be escaped. - -#### Template lock - -This setting allows you to define whether users are allowed to delete the placeholder content, add new blocks, or just edit the existing, pre-populated content. - -#### Allowed Gutenberg and Drupal blocks - -This is another super-cool feature on the Drupal side of Gutenberg. Drupal allows users to create various types of blocks to design a page. For example, you could create a block with a list of the five latest blog posts, the most recent comments, or a form to collect users' emails. - -Gutenberg's deep integration with Drupal allows users to select which Drupal blocks are available to users while they are editing (e.g., limit embeds to YouTube) and use blocks as inline content. This is a very handy feature that allows granular control of the user experience. - -There's not much to choose from in a blank Drupal installation, but a live site usually has many blocks that provide various functionalities. In the screenshot below, the **Search form** Drupal block is selected. - -![Drupal Gutenberg blocks][10] - -After you finish the configuration, hit **Save content type**. - -### Publishing content with Drupal Gutenberg - -When Gutenberg is enabled for a content type, it takes over most of the editorial experience. - -![Drupal Gutenberg content screen][11] - -In the main window, you can see the dummy placeholder content I added in the Template configuration above. - -#### Drupal-specific options - -On the right-hand side, there are a few fields and settings that Drupal provides. For example, the **Title** field is a required separate field in Drupal, and therefore it is not on the main Gutenberg screen. - -Underneath the **Title**, there are additional settings that can vary, depending on the modules installed and options set up in Drupal. You can see **Revision log messages**, **Menu settings**, **Comment settings**, and a place to add a **URL alias**. - -Typically, Drupal content types are composed of several text fields, such as tags, categories, checkboxes, image fields for teasers, etc. When you enable Gutenberg for a content type, these additional fields are available in the **More settings** tab. - -You can now add your content—it works the same as it does in WordPress Gutenberg, with the additional option to add Drupal blocks. - -In the screenshot below, you can see what happens when I add some text to replace the placeholder text, a search block from Drupal, a title, tags, and a custom URL alias. - -![Drupal Gutenberg entering text][12] - -After you hit **Save**, your content will be published. - -![Drupal Gutenberg output][13] - -And that is it. It works like a charm! - -### Working together for better software experiences - -Gutenberg in Drupal works well. It is an alternative option that allows editors to control the look and feel of their websites down to the tiniest details. Adoption is growing well, with over 1,000 installations as of this writing and 50 new ones every month. The Drupal integration adds other cool features like fine-grained permissions, placeholder content, and the ability to include Drupal blocks inline, which aren't available in the WordPress plugin. - -It is great to see the communities of two separate projects working together to achieve the common goal of giving people better software. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/gutenberg-editor-drupal - -作者:[MaciejLukianski][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/maciejlukianski -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) -[2]: https://wordpress.org/plugins/gutenberg/ -[3]: https://drupalgutenberg.org/ -[4]: https://www.droptica.com/blog/flexible-and-easy-content-creation-drupal-paragraphs-module/ -[5]: https://www.droptica.com/blog/layout-builder-building-drupal-8-layouts/ -[6]: https://www.drupal.org/project/gutenberg -[7]: https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules -[8]: https://opensource.com/sites/default/files/uploads/gutenberg_edit.png (Drupal settings) -[9]: https://opensource.com/sites/default/files/uploads/gutenberg_settings.png (Drupal Gutenberg settings) -[10]: https://opensource.com/sites/default/files/uploads/gutenberg_blocks.png (Drupal Gutenberg blocks) -[11]: https://opensource.com/sites/default/files/uploads/gutenberg_contentwindow.png (Drupal Gutenberg content screen) -[12]: https://opensource.com/sites/default/files/uploads/gutenberg_entry.png (Drupal Gutenberg entering text) -[13]: https://opensource.com/sites/default/files/uploads/gutenberg-demo.png (Drupal Gutenberg output) diff --git a/sources/tech/20200309 Fish - A Friendly Interactive Shell.md b/sources/tech/20200309 Fish - A Friendly Interactive Shell.md deleted file mode 100644 index b091fea171..0000000000 --- a/sources/tech/20200309 Fish - A Friendly Interactive Shell.md +++ /dev/null @@ -1,194 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fish – A Friendly Interactive Shell) -[#]: via: (https://fedoramagazine.org/fish-a-friendly-interactive-shell/) -[#]: author: (Michal Konečný https://fedoramagazine.org/author/zlopez/) - -Fish – A Friendly Interactive Shell -====== - -![Fish — A Friendly Interactive Shell][1] - -Are you looking for an alternative to bash? Are you looking for something more user-friendly? Then look no further because you just found the golden fish! - -Fish (friendly interactive shell) is a smart and user-friendly command line shell that works on Linux, MacOS, and other operating systems. Use it for everyday work in your terminal and for scripting. Scripts written in fish are less cryptic than their equivalent bash versions. - -### Fish’s user-friendly features - - * **Suggestions** -Fish will suggest commands that you have written before. This boosts productivity when typing same commands often. - * **Sane scripting** -Fish avoids using cryptic characters. This provides a clearer and friendlier syntax. - * **Completion based on man pages** -Fish will autocomplete parameters based on the the command’s man page. - * **Syntax highlighting** -Fish will highlight command syntax to make it visually friendly. - - - -### Installation - -#### Fedora Workstation - -Use the _dnf_ command to install fish: - -``` -$ sudo dnf install fish -``` - -Make fish your default shell by installing the _util-linux-user_ package and then running the _chsh_ (change shell) command with the appropriate parameters: - -``` -$ sudo dnf install util-linux-user -$ chsh -s /usr/bin/fish -``` - -You will need to log out and back in for this change to take effect. - -#### Fedora Silverblue - -Because this is not GUI application, you will need to layer it using _rpm-ostree_. Use the following command to install fish on Fedora Silverblue: - -``` -$ rpm-ostree install fish -``` - -On Fedora Silverblue you will need to reboot your PC to switch to the new ostree image. - -If you want to make fish your main shell on Fedora Silverblue, the easiest way is to update the _/etc/passwd_ file. Find your user and change _/bin/bash_ to _/usr/bin/fish_. - -You will need [root privileges][2] to edit the _/etc/passwd_ file. Also you will need to log out and back in for this change to take effect. - -### Configuration - -The per-user configuration file for fish is _~/.config/fish/config.fish_. To make configuration changes for all users, edit _/etc/fish/config.fish_ instead. - -The per-user configuration file must be created manually. The installation scripts will not create _~/.config/fish/config.fish_. - -Here are a couple configuration examples shown alongside their bash equivalents to get you started: - -#### Creating aliases - - * _~/.bashrc_: alias ll='ls -lh' - * _~/.config/fish/config.fish_: alias ll='ls -lh' - - - -#### Setting environment variables - - * _~/.bashrc_: export PATH=$PATH:~/bin - * _~/.config/fish/config.fish_: set -gx PATH $PATH ~/bin - - - -### Working with fish - -When fish is configured as your default shell, the command prompt will look similar to what is shown in the below image. If you haven’t configured fish to be your default shell, just run the _fish_ command to start it in your current terminal session. - -![][3] - -As you start typing commands, you will notice the syntax highlighting: - -![][4] - -Cool, isn’t it? 🙂 - -You will also see commands being suggested as you type. For example, start typing the previous command a second time: - -![][5] - -Notice the gray text that appears as you type. The gray text is fish suggesting the command you wrote before. To autocomplete it, just press **CTRL+F**. - -Get argument suggestions based on the preceding command’s man page by typing a dash (**–**) and then the **TAB** key: - -![][6] - -If you press **TAB** once, it will show you the first few suggestions (or every suggestion, if there are only a few arguments available). If you press **TAB** a second time, it will show you all suggestions. If you press **TAB** three times consecutively, it will switch to interactive mode and you can select an argument using the arrow keys. - -Otherwise, fish works similar to most other shells. The remaining differences are well documented. So it shouldn’t be difficult to find other features that you may be interested in. - -### Make fish even more powerful - -Make the fish even more powerful with [powerline][7]. Powerline adds command execution time, colored git status, current git branch and much more to fish’s interface. - -Before installing powerline for fish, you must install [Oh My Fish][8]. Oh My Fish extends fish’s core infrastructure to enable the installation of additional plugins. The easiest way to install Oh My Fish is to use the _curl_ command: - -``` -> curl -L https://get.oh-my.fish | fish -``` - -If you don’t want to pipe the installation commands directly to _curl_, see the installation section of Oh My Fish’s [README][9] for alternative installation methods. - -Fish’s powerline plugin is [bobthefish][7]. Bobthefish requires the _powerline-fonts_ package. - -**On Fedora Workstation**: - -``` -> sudo dnf install powerline-fonts -``` - -**On Fedora Silverblue**: - -``` -> rpm-ostree install powerline-fonts -``` - -On Fedora Silverblue you will have to reboot to complete the installation of the fonts. - -After you have installed the _powerline-fonts_ package, install _bobthefish_: - -``` -> omf install bobthefish -``` - -Now you can experience the full awesomeness of fish with powerline: - -![][10] - -### Additional resources - -Check out these web pages to learn even more about fish: - - * [Official page][11] - * [Documentation][12] - * [Tutorial][13] - * [FAQ][14] - * [Web playground][15] - * [Mailing lists][16] - * [GitHub][17] - - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/fish-a-friendly-interactive-shell/ - -作者:[Michal Konečný][a] -选题:[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/zlopez/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/fish-816x345.jpg -[2]: https://fedoramagazine.org/howto-use-sudo/ -[3]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-00-35.png -[4]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-19-24.png -[5]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-25-31.png -[6]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-58-07.png -[7]: https://github.com/oh-my-fish/theme-bobthefish -[8]: https://github.com/oh-my-fish/oh-my-fish -[9]: https://github.com/oh-my-fish/oh-my-fish/blob/master/README.md#installation -[10]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-15-38-07.png -[11]: https://fishshell.com/ -[12]: https://fishshell.com/docs/current/index.html -[13]: https://fishshell.com/docs/current/tutorial.html -[14]: https://fishshell.com/docs/current/faq.html -[15]: https://rootnroll.com/d/fish-shell/ -[16]: https://sourceforge.net/projects/fish/lists/fish-users -[17]: https://github.com/fish-shell/fish-shell/ diff --git a/sources/tech/20200311 Directing Kubernetes traffic with Traefik.md b/sources/tech/20200311 Directing Kubernetes traffic with Traefik.md deleted file mode 100644 index 76a457be59..0000000000 --- a/sources/tech/20200311 Directing Kubernetes traffic with Traefik.md +++ /dev/null @@ -1,394 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Directing Kubernetes traffic with Traefik) -[#]: via: (https://opensource.com/article/20/3/kubernetes-traefik) -[#]: author: (Lee Carpenter https://opensource.com/users/carpie) - -Directing Kubernetes traffic with Traefik -====== -A step-by-step walkthrough on ingressing traffic into a -Kubernetes-Raspberry Pi cluster. -![Digital creative of a browser on the internet][1] - -In this article, we will deploy a couple of simple websites and learn how to ingress traffic from the outside world into our cluster using Traefik. After that, we will learn how to remove Kubernetes resources as well. Let’s get started! - -### Materials needed - -To follow along with the article, you only need [the k3s Raspberry Pi cluster][2] we built in a previous article. Since your cluster will be pulling images from the web, the cluster will need to be able to access the internet. - -Some configuration files and sample HTML files will be shown in this article for explanation purposes. All sample files can be downloaded [here][3]. - -### Deploying a simple website - -Previously, we did a direct deploy with **kubectl**. This is not the typical way to deploy things, however. Generally, YAML configuration files are used, and that is what we will use in this article. We will start at the top and create our configuration files in a top-down approach. - -### Deployment configuration - -First up is the deployment configuration. The configuration is shown below, and the explanation follows. I typically use the samples from the [Kubernetes documentation][4] as a starting point and then modify them to suit my needs. For example, the configuration below was modified after copying the sample from the [deployment docs][5]. - -Create a file, **mysite.yaml**, with the following contents: - - -``` -apiVersion: apps/v1 -kind: Deployment -metadata: -  name: mysite-nginx -  labels: -    app: mysite-nginx -spec: -  replicas: 1 -  selector: -    matchLabels: -      app: mysite-nginx -  template: -    metadata: -      labels: -        app: mysite-nginx -    spec: -      containers: -      - name: nginx -        image: nginx -        ports: -        - containerPort: 80 -``` - -Most of this is boilerplate. The important parts, we have named our deployment **mysite-nginx** with an **app** label of **mysite-nginx **as well. We have specified that we want one **replica** which means there will only be one pod created. We also specified **one container**, which we named **nginx**. We specified the **image** to be **nginx**. This means, on deployment, k3s will download the **nginx** image from DockerHub and create a pod from it. Finally, we specified a **containerPort** of **80**, which just means that inside the container the pod will listen on port **80**. - -I emphasized "inside the container" above because it is an important distinction. As we have the container configured, it is only accessible inside the container, and it is further restricted to an internal network. This is necessary to allow multiple containers to listen on the same container ports. In other words, with this configuration, some other pod could listen on its container port 80 as well and not conflict with this one. To provide formal access to this pod, we need a **service** configuration. - -### Service configuration - -In Kubernetes, a **service** is an abstraction. It provides a means to access a pod or set of pods. One connects to the service and the service routes to a single pod or load balances to multiple pods if multiple pod replicas are defined. - -The service can be specified in the same configuration file, and that is what we will do here. Separate configuration areas with **`---`**. Add the following to **mysite.yaml**: - - -``` -\--- -apiVersion: v1 -kind: Service -metadata: -  name: mysite-nginx-service -spec: -  selector: -    app: mysite-nginx -  ports: -    - protocol: TCP -      port: 80 -``` - -In this configuration, we have named our service **mysite-nginx-service**. We provided a `selector` of **app: mysite-nginx**. This is how the service chooses the application containers it routes to. Remember, we provided an **app** label for our container as **mysite-nginx**. This is what the service will use to find our container. Finally, we specified that the service protocol is **TCP** and the service listens on port **80**. - -### Ingress configuration - -The ingress configuration specifies how to get traffic from outside our cluster to services inside our cluster. Remember, k3s comes pre-configured with Traefik as an ingress controller. Therefore, we will write our ingress configuration specific to Traefik. Add the following to **mysite.yaml **( and don’t forget to separate with **`---`**): - - -``` -\--- -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: -  name: mysite-nginx-ingress -  annotations: -    kubernetes.io/ingress.class: "traefik" -spec: -  rules: -  - http: -      paths: -      - path: / -        backend: -          serviceName: mysite-nginx-service -          servicePort: 80 -``` - -In this configuration, we have named the ingress record **mysite-nginx-ingress**. And we told Kubernetes that we expect **traefik** to be our ingress controller with the **kubernetes.io/ingress.class** annotation. - -In the **rules** section, we are basically saying, when **http** traffic comes in, and the **path** matches **`/`** (or anything below that), route it to the **backend** service specified by the **serviceName mysite-nginx-service**, and route it to **servicePort 80**. This connects incoming HTTP traffic to the service we defined earlier. - -### Something to deploy - -That is really it as far as configuration goes. If we deployed now, we would get the default **nginx** page, but that is not what we want. Let’s create something simple but custom to deploy. Create the file **index.html** with the following contents: - - -``` -<html> -<head><title>K3S!</title> -  <style> -    html { -      font-size: 62.5%; -    } -    body { -      font-family: sans-serif; -      background-color: midnightblue; -      color: white; -      display: flex; -      flex-direction: column; -      justify-content: center; -      height: 100vh; -    } -    div { -      text-align: center; -      font-size: 8rem; -      text-shadow: 3px 3px 4px dimgrey; -    } -  </style> -</head> -<body> -  <div>Hello from K3S!</div> -</body> -</html> -``` - -We have not yet covered storage mechanisms in Kubernetes, so we are going to cheat a bit and just store this file in a Kubernetes config map. This is not the recommended way to deploy a website, but it will work for our purposes. Run the following: - - -``` -`kubectl create configmap mysite-html --from-file index.html` -``` - -This command creates a `configmap` resource named **mysite-html** from the local file **index.html**. This essentially stores a file (or set of files) inside a Kubernetes resource that we can call out in configuration. It is typically used to store configuration files (hence the name), so we are abusing it a bit here. In a later article, we will discuss proper storage solutions in Kubernetes. - -With the config map created, let’s mount it inside our **nginx** container. We do this in two steps. First, we need to specify a **volume**, calling out the config map. Then we need to mount the volume into the **nginx** container. Complete the first step by adding the following under the **spec** label, just after **containers** in **mysite.yaml**: - - -``` -      volumes: -      - name: html-volume -        configMap: -          name: mysite-html -``` - -This tells Kubernetes that we want to define a **volume**, with the name **html-volume** and that volume should contain the contents of the **configMap** named **html-volume** (which we created in the previous step). - -Next, in the **nginx** container specification, just under **ports**, add the following: - - -``` -        volumeMounts: -        - name: html-volume -          mountPath: /usr/share/nginx/html -``` - -This tells Kubernetes, for the **nginx** container, we want to mount a **volume** named **html-volume** at the path (in the container) **/usr/share/nginx/html**. Why **/usr/share/nginx/html**? That is where the **nginx** image serves HTML from. By mounting our volume at that path, we have replaced the default contents with our volume contents. - -For reference, the **deployment** section of the configuration file should now look like this: - - -``` -apiVersion: apps/v1 -kind: Deployment -metadata: -  name: mysite-nginx -  labels: -    app: mysite-nginx -spec: -  replicas: 1 -  selector: -    matchLabels: -      app: mysite-nginx -  template: -    metadata: -      labels: -        app: mysite-nginx -    spec: -      containers: -      - name: nginx -        image: nginx -        ports: -        - containerPort: 80 -        volumeMounts: -        - name: html-volume -          mountPath: /usr/share/nginx/html -      volumes: -      - name: html-volume -        configMap: -          name: mysite-html -``` - -### Deploy it! - -Now we are ready to deploy! We can do that with: - - -``` -`kubectl apply -f mysite.yaml` -``` - -You should see something similar to the following: - - -``` -deployment.apps/mysite-nginx created -service/mysite-nginx-service created -ingress.networking.k8s.io/mysite-nginx-ingress created -``` - -This means that Kubernetes created resources for each of the three configurations we specified. Check on the status of the pods with: - - -``` -`kubectl get pods` -``` - -If you see a status of **ContainerCreating**, give it some time and run **kubectl get pods** again. Typically, the first time, it will take a while because k3s has to download the **nginx** image to create the pod. After a while, you should get a status of **Running**. - -### Try it! - -Once the pod is running, it is time to try it. Open up a browser and type **kmaster** into the address bar. - -![][6] - -Congratulations! You’ve deployed a website on your k3s cluster! - -### Another one - -So now we have a whole k3s cluster running a single website. But we can do more! What if we have another website we want to serve on the same cluster? Let’s see how to do that. - -Again, we need something to deploy. It just so happens that my dog has a message she has wanted the world to know for some time. So, I crafted some HTML just for her (available from the samples zip file). Again, we will use the config map trick to host our HTML. This time we are going to poke a whole directory (the **html** directory) into a config map, but the invocation is the same. - - -``` -`kubectl create configmap mydog-html --from-file html` -``` - -Now we need to create a configuration file for this site. It is almost exactly the same as the one for **mysite.yaml**, so start by copying **mysite.yaml** to **mydog.yaml**. Now edit **mydog.yaml** to be: - - -``` -apiVersion: apps/v1 -kind: Deployment -metadata: -  name: mydog-nginx -  labels: -    app: mydog-nginx -spec: -  replicas: 1 -  selector: -    matchLabels: -      app: mydog-nginx -  template: -    metadata: -      labels: -        app: mydog-nginx -    spec: -      containers: -      - name: nginx -        image: nginx -        ports: -        - containerPort: 80 -        volumeMounts: -        - name: html-volume -          mountPath: /usr/share/nginx/html -      volumes: -      - name: html-volume -        configMap: -          name: mydog-html -\--- -apiVersion: v1 -kind: Service -metadata: -  name: mydog-nginx-service -spec: -  selector: -    app: mydog-nginx -  ports: -    - protocol: TCP -      port: 80 -\--- -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: -  name: mydog-nginx-ingress -  annotations: -    kubernetes.io/ingress.class: "traefik" -    traefik.frontend.rule.type: PathPrefixStrip -spec: -  rules: -  - http: -      paths: -      - path: /mydog -        backend: -          serviceName: mydog-nginx-service -          servicePort: 80 -``` - -We can do most of the edits by simply doing a search and replace of **mysite** to **mydog**. The two other edits are in the ingress section. We changed **path** to **/mydog **and we added an annotation, **traefik.frontend.rule.type: PathPrefixStrip**. - -The specification of the path **/mydog** instructs Traefik to route any incoming request that requests a path starting with **/mydog** to the **mydog-nginx-service**. Any other path will continue to be routed to **mysite-nginx-service.** - -The new annotation, **PathPrefixStrip**, tells Traefik to strip off the prefix **/mydog** before sending the request to **mydog-nginx-service**. We did this because the **mydog-nginx** application doesn’t expect a prefix. This means we could change where the service was mounted simply by changing the prefix in the ingress record. - -Now we can deploy like we did before: - - -``` -`kubectl apply -f mydog.yaml` -``` - -And now, my dog’s message should be available at . - -![][7] - -Phew! The message is out! Maybe we can all get some sleep tonight. - -So now, we have a k3s cluster hosting two websites with Traefik making decisions, based on path names, as to which service to pass the request to! We are not limited to path-based routing, however. We could use hostname based routing as well, which we will explore in a future article. - -Also, the websites we just hosted are standard unencrypted HTML sites. Everything these days is encrypted with SSL/TLS. In our next article, we will add support to our k3s cluster to host SSL/TLS HTTPS sites as well! - -### Cleaning up - -Before you go, since this article mostly dealt with sample sites, I would like to show you how to delete things in case you don’t want the samples hanging around on your cluster. - -For most configurations, you can undo the configuration simply by running the **delete** command with the same configuration file you deployed with. So let’s clean up both **mysite** and **mydog**. - - -``` -kubectl delete -f mysite.yaml -kubectl delete -f mydog.yaml -``` - -Since we manually created the config maps, we’ll need to delete those manually as well. - - -``` -kubectl delete configmap mysite-html -kubectl delete configmap mydog-html -``` - -Now if we do a **kubectl get pods**, we should see that our nginx pods are no longer around. - - -``` -$ kubectl get pods -No resources found in default namespace. -``` - -Everything is cleaned up. - -Tell me what thoughts you have on this project in the comments below. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/kubernetes-traefik - -作者:[Lee Carpenter][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/carpie -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) -[2]: https://opensource.com/article/20/3/kubernetes-raspberry-pi -[3]: https://gitlab.com/carpie/ingressing_with_k3s/-/archive/master/ingressing_with_k3s-master.zip -[4]: https://kubernetes.io/docs/ -[5]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#creating-a-deployment -[6]: https://opensource.com/sites/default/files/uploads/mysite.jpg -[7]: https://opensource.com/sites/default/files/uploads/mydog.jpg diff --git a/sources/tech/20200311 What you need to know about variables in Emacs.md b/sources/tech/20200311 What you need to know about variables in Emacs.md deleted file mode 100644 index d66ba374f4..0000000000 --- a/sources/tech/20200311 What you need to know about variables in Emacs.md +++ /dev/null @@ -1,243 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What you need to know about variables in Emacs) -[#]: via: (https://opensource.com/article/20/3/variables-emacs) -[#]: author: (Clemens Radermacher https://opensource.com/users/clemera) - -What you need to know about variables in Emacs -====== -Learn how Elisp deals with variables and to use them in your scripts and -configurations. -![Programming keyboard.][1] - -GNU Emacs is written in C and Emacs Lisp (Elisp), a dialect of the Lisp programming language. Because it's a text editor that happens to be an Elisp sandbox, it is helpful to understand how basic programming concepts work in Elisp. - -If you're new to [Emacs][2], visit Sacha Chua's excellent list of [resources for Emacs beginners][3]. This article assumes you're familiar with common Emacs terminology and that you know how to read and evaluate basic snippets of Elisp code. Ideally, you should also have heard of variable scope and how it works in another programming language. The examples also assume you use a fairly recent Emacs version ([v.25 or later][4]). - -The [Elisp manual][5] includes everything there is to know, but it is written for people who already know what they are looking for (and it is really great for that). But many people want resources that explain Elisp concepts at a higher level and reduce the amount of information to the most useful bits. This article is my attempt to respond to that—to give readers a good grasp of the basics so they can use them for their configuration and make it easier for people to look up some detail in the manual. - -### Global variables - -User options defined with **defcustom** and variables defined with **defvar** or **defconst** are global. One important aspect of variables declared by **defcustom** or **defvar** is that reevaluating them won't reset a variable if it is already bound. For example, if you establish a binding for **my-var** in your init file like this: - - -``` -`(setq my-var nil)` -``` - -evaluating the following form won't reset the variable to **t**: - - -``` -`(defvar my-var t)` -``` - -Note that there is _one exception_: If you evaluate the declaration above with **C-M-x** that calls **eval-defun**, the value will be reset to **t**. This way, you can enforce setting the value if you need to. This behavior is intentional: As you might know, many features in Emacs load only on demand (i.e., they are autoloaded). If the declarations in those files reset variables to their default value, this would override any settings in your init. - -### User options - -A user option is simply a global variable that is declared with **defcustom**. Unlike variables declared with **defvar**, such a variable is configurable with the  **M-x customize** interface. As far as I know, most people don't use it much because it feels clunky. Once you know how to set variables in your init file, there's no compelling reason to use it. One detail many users aren't aware of is that setting user options with **customize** might execute code, and this is sometimes used to run additional setup instructions: - - -``` -(defcustom my-option t -  "My user option." -  :set (lambda (sym val) -         (set-default sym val) -         (message "Set %s to %s" sym val))) -``` - -If you evaluate this code and change the value using the **customize** interface with **M-x customize-option RET my-option RET **the lambda will be called, and the message in the echo area will tell you the symbol and value of the option. - -If you use **setq** in your init file, to change the value of such an option, the setter function will _not_ run. To set such an option correctly with Elisp, you need to use the function **customize-set-variable**. Alternatively, people use various versions of **csetq** macros in their configs to automatically take care of this (you can use GitHub code search to discover more sophisticated variants if you like): - - -``` -(defmacro csetq (sym val) -  `(funcall (or (get ',sym 'custom-set) 'set-default) ',sym ,val)) -``` - -If you are using the [use-package][6] macro, the **:custom** keyword will handle this for you. - -After putting the code above into your init file, you can use **csetq** to set variables in a way that respects any existing setter functions. You can prove this by watching the message in the echo area when using this macro to change the option defined above: - - -``` -`(csetq my-option nil)` -``` - -### Dynamic binding and lexical binding - -If you use other programming languages, you may not be aware of the differences between dynamic and lexical binding. Most programming languages today use lexical binding, and there is no need to know the difference when you learn about variable scope/lookup. - -Emacs Lisp is special in this regard because dynamic binding is the default, and lexical binding must be enabled explicitly. There are historical reasons for this, and in practice, you should _always_ enable lexical binding because it is faster and less error-prone. To enable it, simply put the following comment line as the first line in your Emacs Lisp file: - - -``` -`;;; -*- lexical-binding: t; -*-` -``` - -Alternatively, you can call M-x **add-file-local-variable-prop-line**, which will insert the comment line above when you choose the variable **lexical-binding** with value **t**. - -When a file with such a specially formatted line is loaded, Emacs sets the variable accordingly, which means the code in that buffer is loaded with lexical binding enabled. Interactively, you can use **M-x eval-buffer**, which takes the lexical binding setting into account. - -Now that you know how to enable lexical binding, it's smart to learn what the terms mean. With dynamic binding, the last binding established during program execution is used for variable lookup. You can test this by putting the following code in an empty buffer and executing **M-x eval-buffer**: - - -``` -(defun a-exists-only-in-my-body (a) -  (other-function)) - -(defun other-function () -  (message "I see `a', its value is %s" a)) - -(a-exists-only-in-my-body t) -``` - -You may be surprised to see that the lookup of variable **a** in the **other-function** is successful. - -If you retry the preceding example with the special lexical-binding comment at the top, the code will throw a "variable is void" error because **other-function** does not know about the **a** variable. If you're coming from another programming language, this is the behavior you would expect. - -With lexical binding, the scope is defined by the surrounding source code. This is not only for performance reasons—experience and time have shown that this behavior is preferred. - -### Special variables and dynamic binding - -As you may know, **let** is used to temporary establish local bindings: - - -``` -(let ((a "I'm a") -      (b "I'm b")) -  (message "Hello, %s. Hello %s" a b)) -``` - -Here is the thing: Variables declared with **defcustom**, **defvar**, or **defconst** are called _special variables_, and they continue to use dynamic binding regardless of whether lexical binding is enabled: - - -``` -;;; -*- lexical-binding: t; -*- - -(defun some-other-function () -  (message "I see `c', its value is: %s" c)) - -(defvar c t) - -(let ((a "I'm lexically bound") -      (c "I'm special and therefore dynamically bound")) -  (some-other-function) -  (message "I see `a', its values is: %s" a)) -``` - -To see both messages in the example above, switch to the ***Messages*** buffer using **C-h e**. - -Local variables bound with **let** or function arguments follow the lookup rules defined by the **lexical-binding** variable, but global variables defined with **defvar**, **defconst**, or **defcustom** can be changed deep down in the call stack for the duration of the **let** body. - -This behavior allows for convenient ad-hoc customizations and is often used in Emacs, which isn't surprising given that Emacs Lisp started out with dynamic binding being the only option. Here is a common example showing how you can temporarily write to a read-only buffer: - - -``` -(let ((inhibit-read-only t)) -  (insert ...)) -``` - -Here is another often-seen example for performing case-sensitive searches: - - -``` -(let ((case-fold-search nil)) -  (some-function-which-uses-search ...)) -``` - -Dynamic binding allows you to change the behavior of functions in ways the authors of those functions may have never anticipated. It's a powerful tool and a great feature for a program that is designed and used like Emacs. - -There is one caveat to be aware of: You might accidentally use a local variable name that is declared as a special variable elsewhere. One trick to prevent such conflicts is to avoid dashes in local variables' names. In my current Emacs session, this leaves only a handful of potential conflicting candidates: - - -``` -(let ((vars ())) -  (mapatoms -   (lambda (cand) -     (when (and (boundp cand) -                (not (keywordp cand)) -                (special-variable-p cand) -                (not (string-match "-" -                                   (symbol-name cand)))) -       (push cand vars)))) -  vars) ;; => (t obarray noninteractive debugger nil) -``` - -### Buffer-local variables - -Each buffer can have a local binding for a variable. This means any variable lookup made while this buffer is current will reveal the buffer's local value of that variable instead of the default value. Local variables are an important feature in Emacs; for example, they are used by major modes to establish their buffer-local behavior and settings. - -You have already seen a buffer-local variable in this article: the special comment line for **lexical-binding** that binds the buffer locally to **t**. In Emacs, such buffer-local variables defined in special comment lines are also called _file-local variables_. - -Any global variable can be shadowed by a buffer-local variable. Take, for example, the **my-var** variable defined above, which you can set locally like this: - - -``` -(setq-local my-var t) -;; or (set (make-local-variable 'my-var) t) -``` - -**my-var** is local to the buffer, which is current when you evaluate the code above. If you call **describe-variable** on it, the documentation tells you both the local value and the global one. Programmatically, you can check the local value using **buffer-local-value** and the default value with **default-value**. To remove the local version, you could invoke  **M-x kill-local-variable**. - -Another important property to be aware of is that once a variable is buffer-local, any further use of **setq** (while this buffer is current) will continue to set the local value. To set the default value, you would need to use **setq-default**. - -Because local variables are meant for buffer customization, they're used most often in mode hooks. A typical example would be something like this: - - -``` -(add-hook 'go-mode-hook -          (defun go-setup+ () -            (setq-local compile-command -              (if (string-suffix-p "_test.go" buffer-file-name) -                  "go test -v" -                (format "go run %s" -                        (shell-quote-argument -                         (file-name-nondirectory buffer-file-name))))))) -``` - -This sets the compile command used by **M-x compile** for go-mode buffers. - -Another important aspect is that some variables are _automatically_ buffer-local. This means as soon as you **setq** such a variable, it sets a local binding for the current buffer. This feature shouldn't be used often (because this implicit behavior isn't nice), but if you want, you can create such automatically local variables like this: - - -``` -(defvar-local my-automatical-local-var t) -;; or (make-variable-buffer-local 'my-automatical-local-var) -``` - -The variable **indent-tabs-mode** is a built-in example of this. If you use **setq** in your init file to change the value of this variable, it won't affect the default value at all. Only the value for the buffer that is current while loading your init file will be changed. Therefore, you need to use **setq-default** to change the default value of **indent-tabs-mode**. - -### Closing words - -Emacs is a powerful editor, and it only gets more powerful the more you change it to suit your needs. Now you know how Elisp deals with variables and how you can use them in your own scripts and configurations. - -* * * - -_This previously appeared on [With-Emacs][7] under a CC BY-NC-SA 4.0 license and has been adapted (with a merge request) and republished with the author's permission._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/variables-emacs - -作者:[Clemens Radermacher][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/clemera -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) -[2]: https://www.gnu.org/software/emacs/ -[3]: http://sachachua.com/blog/p/27144 -[4]: https://www.gnu.org/software/emacs/download.html -[5]: https://www.gnu.org/software/emacs/manual/html_node/elisp/ -[6]: https://github.com/jwiegley/use-package#customizing-variables -[7]: https://with-emacs.com/posts/tutorials/almost-all-you-need-to-know-about-variables/ diff --git a/sources/tech/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md b/sources/tech/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md deleted file mode 100644 index fc3c4b7bab..0000000000 --- a/sources/tech/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md +++ /dev/null @@ -1,108 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Create Stunning Pixel Art With Free and Open Source Editor Pixelorama) -[#]: via: (https://itsfoss.com/pixelorama/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Create Stunning Pixel Art With Free and Open Source Editor Pixelorama -====== - -_**Brief: Pixelorama is a cross-platform, free and open source 2D sprite editor. It provides all the necessary tools to create pixel art in a neat user interface.**_ - -### Pixelorama: open source sprite editor - -[Pixelorama][1] is a tool created by young game developers at [Orama Interactive][2]. They have developed a few 2D games and a couple of them use pixel art. - -While Orama is primarily into game development, the developers are also creating utility tools that help them (and others) create those games. - -The free and open source sprite editor, Pixelorama is such a utility tool. It’s built on top of [Godot Engine][3] and is perfect for creating pixel art. - -![Pixelorama screenshot][4] - -You see the pixel art in the screenshot above? It’s been created using Pixelorama. This video shows a timelapse video of creating the above image. - -### Features of Pixelorama - -Here are the main features Pixelorama provides: - - * Multiple tools like penicl, erase, fill bucket color picker etc - * Multiple layer system that allows you to add, remove, move up and down, clone and merge as many layers as you like - * Support for spritesheets - * Import images and edit them inside Pixelorama - * Animation timeline with [Onion Skinning][5] - * Custom brushes - * Save and open your projects in Pixelorama’s custom file format, .pxo - * Horizontal & vertical mirrored drawing - * Tile Mode for pattern creation - * Split screen mode and mini canvas preview - * Zoom with mouse scroll wheel - * Unlimited undo and redo - * Scale, crop, flip, rotate, color invert and desaturate your images - * Keyboard shortcuts - * Available in several languages - * Supports Linux, Windows and macOS - - - -### Installing Pixelorama on Linux - -Pixelorama is available as a Snap application and if you are using Ubuntu, you can find it in the software center itself. - -![Pixelorama is available in Ubuntu Software Center][6] - -Alternatively, if you have [Snap support enabled on your Linux distribution][7], you can install it using this command: - -``` -sudo snap install pixelorama -``` - -If you don’t want to use Snap, no worries. You can download the latest release of Pixelorama from [their GitHub repository][8], [extract the zip file][9] and you’ll see an executable file. Give this file execute permission and double click on it to run the application. - -[Download Pixelorama][10] - -**Conclusion** - -![Pixelorama Welcome Screen][11] - -In the Pixeloaram features, it says that you can import images and edit them. I guess that’s only true for certain kind of files because when I tried to import PNG or JPEG files, the application crashed. - -However, I could easily doodle like a 3 year old and make random pixel art. I am not that into arts but I think this is a [useful tool for digital artists on Linux][12]. - -I liked the idea that despite being game developers, they are creating tools that could help other game developers and artists. That’s the spirit of open source. - -If you like the project and will be using it, consider supporting them by a donation. [It’s FOSS has made a humble donation][13] of $25 to thank their effort. - -[Donate to Pixelorama (personal Paypal account of the lead developer)][14] - -Do you like Pixelorama? Do you use some other open source sprite editor? Feel free to share your views in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/pixelorama/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.orama-interactive.com/pixelorama -[2]: https://www.orama-interactive.com/ -[3]: https://godotengine.org/ -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama-v6.jpg?ssl=1 -[5]: https://en.wikipedia.org/wiki/Onion_skinning -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama-ubuntu-software-center.jpg?ssl=1 -[7]: https://itsfoss.com/install-snap-linux/ -[8]: https://github.com/Orama-Interactive/Pixelorama -[9]: https://itsfoss.com/unzip-linux/ -[10]: https://github.com/Orama-Interactive/Pixelorama/releases -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama.jpg?ssl=1 -[12]: https://itsfoss.com/best-linux-graphic-design-software/ -[13]: https://itsfoss.com/donations-foss/ -[14]: https://www.paypal.me/erevos diff --git a/sources/tech/20200318 Share data between C and Python with this messaging library.md b/sources/tech/20200318 Share data between C and Python with this messaging library.md deleted file mode 100644 index cda6e54e33..0000000000 --- a/sources/tech/20200318 Share data between C and Python with this messaging library.md +++ /dev/null @@ -1,663 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Share data between C and Python with this messaging library) -[#]: via: (https://opensource.com/article/20/3/zeromq-c-python) -[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) - -Share data between C and Python with this messaging library -====== -ZeroMQ makes for a fast and resilient messaging library to gather data -and share between multiple languages. -![Chat via email][1] - -I've had moments as a software engineer when I'm asked to do a task that sends shivers down my spine. One such moment was when I had to write an interface between some new hardware infrastructure that requires C and a cloud infrastructure, which is primarily Python. - -One strategy could be to [write an extension in C][2], which Python supports by design. A quick glance at the documentation shows this would mean writing a good amount of C. That can be good in some cases, but it's not what I prefer to do. Another strategy is to put the two tasks in separate processes and exchange messages between the two with the [ZeroMQ messaging library][3]. - -When I experienced this type of scenario before discovering ZeroMQ, I went through the extension-writing path. It was not that bad, but it is very time-consuming and convoluted. Nowadays, to avoid that, I subdivide a system into independent processes that exchange information through messages sent over [communication sockets][4]. With this approach, several programming languages can coexist, and each process is simpler and thus easier to debug. - -ZeroMQ provides an even easier process: - - 1. Write a small shim in C that reads data from the hardware and sends whatever it finds as a message. - 2. Write a Python interface between the new and existing infrastructure. - - - -One of ZeroMQ's project's founders is [Pieter Hintjens][5], a remarkable person with [interesting views and writings][6]. - -### Prerequisites - -For this tutorial, you will need: - - * A C compiler (e.g., [GCC][7] or [Clang][8]) - * The [**libzmq** library][9] - * [Python 3][10] - * [ZeroMQ bindings][11] for python - - - -Install them on Fedora with: - - -``` -`$ dnf install clang zeromq zeromq-devel python3 python3-zmq` -``` - -For Debian or Ubuntu: - - -``` -`$ apt-get install clang libzmq5 libzmq3-dev python3 python3-zmq` -``` - -If you run into any issues, refer to each project's installation instructions (which are linked above). - -### Writing the hardware-interfacing library - -Since this is a hypothetical scenario, this tutorial will write a fictitious library with two functions: - - * **fancyhw_init()** to initiate the (hypothetical) hardware - * **fancyhw_read_val()** to return a value read from the hardware - - - -Save the library's full source code to a file named **libfancyhw.h**: - - -``` -#ifndef LIBFANCYHW_H -#define LIBFANCYHW_H - -#include <stdlib.h> -#include <stdint.h> - -// This is the fictitious hardware interfacing library - -void fancyhw_init(unsigned int init_param) -{ -    [srand][12](init_param); -} - -int16_t fancyhw_read_val(void) -{ -    return (int16_t)[rand][13](); -} - -#endif -``` - -This library can simulate the data you want to pass between languages, thanks to the random number generator. - -### Designing a C interface - -The following will go step-by-step through writing the C interface—from including the libraries to managing the data transfer. - -#### Libraries - -Begin by loading the necessary libraries (the purpose of each library is in a comment in the code): - - -``` -// For printf() -#include <stdio.h> -// For EXIT_* -#include <stdlib.h> -// For memcpy() -#include <string.h> -// For sleep() -#include <unistd.h> - -#include <zmq.h> - -#include "libfancyhw.h" -``` - -#### Significant parameters - -Define the **main** function and the significant parameters needed for the rest of the program: - - -``` -int main(void) -{ -    const unsigned int INIT_PARAM = 12345; -    const unsigned int REPETITIONS = 10; -    const unsigned int PACKET_SIZE = 16; -    const char *TOPIC = "fancyhw_data"; - -    ... -``` - -#### Initialization - -Both libraries need some initialization. The fictitious one needs just one parameter: - - -``` -`fancyhw_init(INIT_PARAM);` -``` - -The ZeroMQ library needs some real initialization. First, define a **context**—an object that manages all the sockets: - - -``` -void *context = zmq_ctx_new(); - -if (!context) -{ -    [printf][14]("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); - -    return EXIT_FAILURE; -} -``` - -Then define the socket used to deliver data. ZeroMQ supports several types of sockets, each with its application. Use a **publish** socket (also known as **PUB** socket), which can deliver copies of a message to multiple receivers. This approach enables you to attach several receivers that will all get the same messages. If there are no receivers, the messages will be discarded (i.e., they will not be queued). Do this with: - - -``` -`void *data_socket = zmq_socket(context, ZMQ_PUB);` -``` - -The socket must be bound to an address so that the clients know where to connect. In this case, use the [TCP transport layer][15] (there are [other options][16], but TCP is a good default choice): - - -``` -const int rb = zmq_bind(data_socket, "tcp://*:5555"); - -if (rb != 0) -{ -    [printf][14]("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); - -    return EXIT_FAILURE; -} -``` - -Next, calculate some useful values that you will need later. Note **TOPIC** in the code below; **PUB** sockets need a topic to be associated with the messages they send. Topics can be used by the receivers to filter messages: - - -``` -const size_t topic_size = [strlen][17](TOPIC); -const size_t envelope_size = topic_size + 1 + PACKET_SIZE * sizeof(int16_t); - -[printf][14]("Topic: %s; topic size: %zu; Envelope size: %zu\n", TOPIC, topic_size, envelope_size); -``` - -#### Sending messages - -Start a loop that sends **REPETITIONS** messages: - - -``` -for (unsigned int i = 0; i < REPETITIONS; i++) -{ -    ... -``` - -Before sending a message, fill a buffer of **PACKET_SIZE** values. The library provides signed integers of 16 bits. Since the dimension of an **int** in C is not defined, use an **int** with a specific width: - - -``` -int16_t buffer[PACKET_SIZE]; - -for (unsigned int j = 0; j < PACKET_SIZE; j++) -{ -    buffer[j] = fancyhw_read_val(); -} - -[printf][14]("Read %u data values\n", PACKET_SIZE); -``` - -The first step in message preparation and delivery is creating a ZeroMQ message and allocating the memory necessary for your message. This empty message is an envelope to store the data you will ship: - - -``` -zmq_msg_t envelope; - -const int rmi = zmq_msg_init_size(&envelope, envelope_size); -if (rmi != 0) -{ -    [printf][14]("ERROR: ZeroMQ error occurred during zmq_msg_init_size(): %s\n", zmq_strerror(errno)); - -    zmq_msg_close(&envelope); - -    break; -} -``` - -Now that the memory is allocated, store the data in the ZeroMQ message "envelope." The **zmq_msg_data()** function returns a pointer to the beginning of the buffer in the envelope. The first part is the topic, followed by a space, then the binary data. Add whitespace as a separator between the topic and the data. To move along the buffer, you have to play with casts and [pointer arithmetic][18]. (Thank you, C, for making things straightforward.) Do this with: - - -``` -[memcpy][19](zmq_msg_data(&envelope), TOPIC, topic_size); -[memcpy][19]((void*)((char*)zmq_msg_data(&envelope) + topic_size), " ", 1); -[memcpy][19]((void*)((char*)zmq_msg_data(&envelope) + 1 + topic_size), buffer, PACKET_SIZE * sizeof(int16_t)); -``` - -Send the message through the **data_socket**: - - -``` -const size_t rs = zmq_msg_send(&envelope, data_socket, 0); -if (rs != envelope_size) -{ -    [printf][14]("ERROR: ZeroMQ error occurred during zmq_msg_send(): %s\n", zmq_strerror(errno)); - -    zmq_msg_close(&envelope); - -    break; -} -``` - -Make sure to dispose of the envelope after you use it: - - -``` -zmq_msg_close(&envelope); - -[printf][14]("Message sent; i: %u, topic: %s\n", i, TOPIC); -``` - -#### Clean it up - -Because C does not provide [garbage collection][20], you have to tidy up. After you are done sending your messages, close the program with the clean-up needed to release the used memory: - - -``` -const int rc = zmq_close(data_socket); - -if (rc != 0) -{ -    [printf][14]("ERROR: ZeroMQ error occurred during zmq_close(): %s\n", zmq_strerror(errno)); - -    return EXIT_FAILURE; -} - -const int rd = zmq_ctx_destroy(context); - -if (rd != 0) -{ -    [printf][14]("Error occurred during zmq_ctx_destroy(): %s\n", zmq_strerror(errno)); - -    return EXIT_FAILURE; -} - -return EXIT_SUCCESS; -``` - -#### The entire C program - -Save the full interface library below to a local file called **hw_interface.c**: - - -``` -// For printf() -#include <stdio.h> -// For EXIT_* -#include <stdlib.h> -// For memcpy() -#include <string.h> -// For sleep() -#include <unistd.h> - -#include <zmq.h> - -#include "libfancyhw.h" - -int main(void) -{ -    const unsigned int INIT_PARAM = 12345; -    const unsigned int REPETITIONS = 10; -    const unsigned int PACKET_SIZE = 16; -    const char *TOPIC = "fancyhw_data"; - -    fancyhw_init(INIT_PARAM); - -    void *context = zmq_ctx_new(); - -    if (!context) -    { -        [printf][14]("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); - -        return EXIT_FAILURE; -    } - -    void *data_socket = zmq_socket(context, ZMQ_PUB); - -    const int rb = zmq_bind(data_socket, "tcp://*:5555"); - -    if (rb != 0) -    { -        [printf][14]("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); - -        return EXIT_FAILURE; -    } - -    const size_t topic_size = [strlen][17](TOPIC); -    const size_t envelope_size = topic_size + 1 + PACKET_SIZE * sizeof(int16_t); - -    [printf][14]("Topic: %s; topic size: %zu; Envelope size: %zu\n", TOPIC, topic_size, envelope_size); - -    for (unsigned int i = 0; i < REPETITIONS; i++) -    { -        int16_t buffer[PACKET_SIZE]; - -        for (unsigned int j = 0; j < PACKET_SIZE; j++) -        { -            buffer[j] = fancyhw_read_val(); -        } - -        [printf][14]("Read %u data values\n", PACKET_SIZE); - -        zmq_msg_t envelope; -    -        const int rmi = zmq_msg_init_size(&envelope, envelope_size); -        if (rmi != 0) -        { -            [printf][14]("ERROR: ZeroMQ error occurred during zmq_msg_init_size(): %s\n", zmq_strerror(errno)); -    -            zmq_msg_close(&envelope); -    -            break; -        } -        -        [memcpy][19](zmq_msg_data(&envelope), TOPIC, topic_size); - -        [memcpy][19]((void*)((char*)zmq_msg_data(&envelope) + topic_size), " ", 1); - -        [memcpy][19]((void*)((char*)zmq_msg_data(&envelope) + 1 + topic_size), buffer, PACKET_SIZE * sizeof(int16_t)); -    -        const size_t rs = zmq_msg_send(&envelope, data_socket, 0); -        if (rs != envelope_size) -        { -            [printf][14]("ERROR: ZeroMQ error occurred during zmq_msg_send(): %s\n", zmq_strerror(errno)); -    -            zmq_msg_close(&envelope); -    -            break; -        } -    -        zmq_msg_close(&envelope); - -        [printf][14]("Message sent; i: %u, topic: %s\n", i, TOPIC); - -        sleep(1); -    } - -    const int rc = zmq_close(data_socket); - -    if (rc != 0) -    { -        [printf][14]("ERROR: ZeroMQ error occurred during zmq_close(): %s\n", zmq_strerror(errno)); - -        return EXIT_FAILURE; -    } - -    const int rd = zmq_ctx_destroy(context); - -    if (rd != 0) -    { -        [printf][14]("Error occurred during zmq_ctx_destroy(): %s\n", zmq_strerror(errno)); - -        return EXIT_FAILURE; -    } - -    return EXIT_SUCCESS; -} -``` - -Compile using the command: - - -``` -`$ clang -std=c99 -I. hw_interface.c -lzmq -o hw_interface` -``` - -If there are no compilation errors, you can run the interface. What's great is that ZeroMQ **PUB** sockets can run without any applications sending or retrieving data. That reduces complexity because there is no obligation in terms of which process needs to start first. - -Run the interface: - - -``` -$ ./hw_interface -Topic: fancyhw_data; topic size: 12; Envelope size: 45 -Read 16 data values -Message sent; i: 0, topic: fancyhw_data -Read 16 data values -Message sent; i: 1, topic: fancyhw_data -Read 16 data values -... -... -``` - -The output shows the data being sent through ZeroMQ. Now you need an application to read the data. - -### Write a Python data processor - -You are now ready to pass the data from C to a Python application. - -#### Libraries - -You need two libraries to help transfer data. First, you need ZeroMQ bindings in Python: - - -``` -`$ python3 -m pip install zmq` -``` - -The other is the [**struct** library][21], which decodes binary data. It's commonly available with the Python standard library, so there's no need to **pip install** it. - -The first part of the Python program imports both of these libraries: - - -``` -import zmq -import struct -``` - -#### Significant parameters - -To use ZeroMQ, you must subscribe to the same topic used in the constant **TOPIC** above: - - -``` -topic = "fancyhw_data".encode('ascii') - -print("Reading messages with topic: {}".format(topic)) -``` - -#### Initialization - -Next, initialize the context and the socket. Use a **subscribe** socket (also known as a **SUB** socket), which is the natural partner of the **PUB** socket. The socket also needs to subscribe to the right topic: - - -``` -with zmq.Context() as context: -    socket = context.socket(zmq.SUB) - -    socket.connect("tcp://127.0.0.1:5555") -    socket.setsockopt(zmq.SUBSCRIBE, topic) - -    i = 0 - -    ... -``` - -#### Receiving messages - -Start an infinite loop that waits for new messages to be delivered to the SUB socket. The loop will be closed if you press **Ctrl+C** or if an error occurs: - - -``` -    try: -        while True: - -            ... # we will fill this in next - -    except KeyboardInterrupt: -        socket.close() -    except Exception as error: -        print("ERROR: {}".format(error)) -        socket.close() -``` - -The loop waits for new messages to arrive with the **recv()** method. Then it splits whatever is received at the first space to separate the topic from the content: - - -``` -`binary_topic, data_buffer = socket.recv().split(b' ', 1)` -``` - -#### Decoding messages - -Python does yet not know that the topic is a string, so decode it using the standard ASCII encoding: - - -``` -topic = binary_topic.decode(encoding = 'ascii') - -print("Message {:d}:".format(i)) -print("\ttopic: '{}'".format(topic)) -``` - -The next step is to read the binary data using the **struct** library, which can convert shapeless binary blobs to significant values. First, calculate the number of values stored in the packet. This example uses 16-bit signed integers that correspond to an "h" in the **struct** [format][22]: - - -``` -packet_size = len(data_buffer) // struct.calcsize("h") - -print("\tpacket size: {:d}".format(packet_size)) -``` - -By knowing how many values are in the packet, you can define the format by preparing a string with the number of values and their types (e.g., "**16h**"): - - -``` -`struct_format = "{:d}h".format(packet_size)` -``` - -Convert that binary blob to a series of numbers that you can immediately print: - - -``` -data = struct.unpack(struct_format, data_buffer) - -print("\tdata: {}".format(data)) -``` - -#### The full Python program - -Here is the complete data receiver in Python: - - -``` -#! /usr/bin/env python3 - -import zmq -import struct - -topic = "fancyhw_data".encode('ascii') - -print("Reading messages with topic: {}".format(topic)) - -with zmq.Context() as context: -    socket = context.socket(zmq.SUB) - -    socket.connect("tcp://127.0.0.1:5555") -    socket.setsockopt(zmq.SUBSCRIBE, topic) - -    i = 0 - -    try: -        while True: -            binary_topic, data_buffer = socket.recv().split(b' ', 1) - -            topic = binary_topic.decode(encoding = 'ascii') - -            print("Message {:d}:".format(i)) -            print("\ttopic: '{}'".format(topic)) - -            packet_size = len(data_buffer) // struct.calcsize("h") - -            print("\tpacket size: {:d}".format(packet_size)) - -            struct_format = "{:d}h".format(packet_size) - -            data = struct.unpack(struct_format, data_buffer) - -            print("\tdata: {}".format(data)) - -            i += 1 - -    except KeyboardInterrupt: -        socket.close() -    except Exception as error: -        print("ERROR: {}".format(error)) -        socket.close() -``` - -Save it to a file called **online_analysis.py**. Python does not need to be compiled, so you can run the program immediately. - -Here is the output: - - -``` -$ ./online_analysis.py -Reading messages with topic: b'fancyhw_data' -Message 0: -        topic: 'fancyhw_data' -        packet size: 16 -        data: (20946, -23616, 9865, 31416, -15911, -10845, -5332, 25662, 10955, -32501, -18717, -24490, -16511, -28861, 24205, 26568) -Message 1: -        topic: 'fancyhw_data' -        packet size: 16 -        data: (12505, 31355, 14083, -19654, -9141, 14532, -25591, 31203, 10428, -25564, -732, -7979, 9529, -27982, 29610, 30475) -... -... -``` - -### Conclusion - -This tutorial describes an alternative way of gathering data from C-based hardware interfaces and providing it to Python-based infrastructures. You can take this data and analyze it or pass it off in any number of directions. It employs a messaging library to deliver data between a "gatherer" and an "analyzer" instead of having a monolithic piece of software that does everything. - -This tutorial also increases what I call "software granularity." In other words, it subdivides the software into smaller units. One of the benefits of this strategy is the possibility of using different programming languages at the same time with minimal interfaces acting as shims between them. - -In practice, this design allows software engineers to work both more collaboratively and independently. Different teams may work on different steps of the analysis, choosing the tool they prefer. Another benefit is the parallelism that comes for free since all the processes can run in parallel. The [ZeroMQ messaging library][3] is a remarkable piece of software that makes all of this much easier. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/zeromq-c-python - -作者:[Cristiano L. Fontana][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cristianofontana -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) -[2]: https://docs.python.org/3/extending/extending.html -[3]: https://zeromq.org/ -[4]: https://en.wikipedia.org/wiki/Network_socket -[5]: https://en.wikipedia.org/wiki/Pieter_Hintjens -[6]: http://hintjens.com/ -[7]: https://gcc.gnu.org/ -[8]: https://clang.llvm.org/ -[9]: https://github.com/zeromq/libzmq#installation-of-binary-packages- -[10]: https://www.python.org/downloads/ -[11]: https://zeromq.org/languages/python/ -[12]: http://www.opengroup.org/onlinepubs/009695399/functions/srand.html -[13]: http://www.opengroup.org/onlinepubs/009695399/functions/rand.html -[14]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html -[15]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol -[16]: http://zguide.zeromq.org/page:all#Plugging-Sockets-into-the-Topology -[17]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html -[18]: https://en.wikipedia.org/wiki/Pointer_%28computer_programming%29%23C_and_C++ -[19]: http://www.opengroup.org/onlinepubs/009695399/functions/memcpy.html -[20]: https://en.wikipedia.org/wiki/Garbage_collection_(computer_science) -[21]: https://docs.python.org/3/library/struct.html -[22]: https://docs.python.org/3/library/struct.html#format-characters diff --git a/sources/tech/20200319 7 open hardware projects working to solve COVID-19.md b/sources/tech/20200319 7 open hardware projects working to solve COVID-19.md deleted file mode 100644 index 3d89271d1c..0000000000 --- a/sources/tech/20200319 7 open hardware projects working to solve COVID-19.md +++ /dev/null @@ -1,207 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 open hardware projects working to solve COVID-19) -[#]: via: (https://opensource.com/article/20/3/open-hardware-covid19) -[#]: author: (Harris Kenny https://opensource.com/users/harriskenny) - -7 open hardware projects working to solve COVID-19 -====== -Open hardware solutions can prevent the spread and suffering of the -novel coronavirus. -![open on blue background with heartbeat symbol][1] - -The open source [hardware][2] movement has long championed the importance of the right to repair, fully own the technology you buy, and be able to remix and reproduce gadgets, just like you can with music. And so, during this challenging time, open hardware is providing some answers to some of the problems created by the coronavirus pandemic. - -### An overview of what's happening - -For one, hardware developers around the world are working to resolve supply chain weaknesses using open source, the same philosophy that has driven a proliferation of new software technologies over the last 30 years. The hardware movement's past successes include the [RepRap Project][3], [Open Source Ecology][4], and [Open Source Beehives][5], proving this can be done. - -There has been increasing interest in creators using 3D printing and other technologies to create replacement parts for and manufacturing of safety equipment on demand. For example, the Polytechnic University lab in Hong Kong [3D printed face shields][6] for hospital workers. And Italian startup Isinnova partnered with the FabLab in Milan to [3D-print replacement valves][7] for reanimation devices in hard-hit Northern Italy. Companies are also releasing designs to adapt our physical interactions, like this [3D printed hands-free door opener][8] from Materialise. These examples of replacing parts and solving problems are an excellent start and appear to be saving lives. - -Another traditional hardware technique is picking up steam: sewing. The AFP reports that there is an acute need for face masks around the world and guidance from the World Health Organization about their importance. With single-use, disposable masks being prioritized for healthcare workers, in the Czech Republic people are [taking to sewing to make their own masks][9]. (Repeat-use masks do introduce sterility concerns.) The Facebook group "Czechia sews face masks" started to address this problem in their country, with tens of thousands of members using their at-home sewing machines. - -Open source hardware equipment and machinery projects are also gaining traction. First, there is testing equipment that is sophisticated and highly capable. Next, there is medical equipment that can be categorized as field-grade (at best) for scenarios with no other option. These projects are outlined in detail below. - -To learn more, I spoke with Jason Huggins, founder and CEO of Chicago-based [Tapster Robotics][10]. Tapster Robotics designs and manufactures desktop robots using 3D printing, computer numerical control (CNC) machining, and open electronics like [Arduino][11]. He has both the technical know-how and the industrial capacity to make an impact. And he wants to commit his company's resources to help in this fight. - -"Basically, we're in a World War II mobilization moment right now. Even though I'm not a doctor, we should still all follow the Hippocratic Oath. Whatever I do, I don't want to make the problem worse," Huggins explains. "As a counterpoint, there is WHO executive director Dr. Michael Ryan's comment: 'Speed trumps perfection,'" Huggins argues. - -> Wow. -> -> This man is the global authority on the spread of disease. If you are a leader (in any capacity) watch this. If you are not, watch it too. [pic.twitter.com/bFogaekehM][12] -> -> — Jim Richards Sh🎙wgram (@JIMrichards1010) [March 15, 2020][13] - -Huggins has extensive experience with delivering during times of need. His efforts were instrumental in helping [Healthcare.gov][14] scale after its challenging initial launch. He also created the software industry-standard testing frameworks Selenium and Appium. With this experience, his advice is well worth considering. - -I also spoke with Seattle-based attorney Mark Tyson of [Tyson Law][15], who works with startups and small businesses. He has direct experience working with nimble companies in rapidly evolving industries. In framing the overall question, Tyson begins: - -> Good Samaritan laws protect volunteers—i.e., “Good Samaritans”—from being held liable as a result of their decision to give aid during an emergency. While the specifics of these laws vary by state, they share a common public policy rationale: namely, encouraging bystanders to help others facing an emergency. Conceivably, this rationale could justify application of these types of laws in less traditional settings than, say, pulling the victim of a car accident out of harm’s way. - -Applying this specific situation, Tyson notes: - -> "Before taking action, creators would be wise to speak with an attorney to conduct a state-specific risk assessment. It would also be prudent to ask larger institutions, like hospitals or insurers, to accept potential liability exposure via contract—for instance, through the use of indemnification agreements, whereby the hospital or its insurer agrees to indemnify the creator for liability." - -Tyson understands the urgency and gravity of the situation. This option to use contracts is not meant to be a roadblock; instead, it may be a way to help adoption happen at scale to make a bigger difference faster. It is up to you or your organization to make this determination. - -With all that said, let's explore the projects that are in use or in development (and may be available for deployment soon). - -### 7 open hardware projects fighting COVID-19 - -#### Opentrons - -[Opentrons][16]' open source lab automation platform is comprised of a suite of open source hardware, verified labware, consumables, reagents, and workstations. Opentrons says its products can help dramatically [scale-up COVID-19 testing][17] with systems that can "automate up to 2,400 tests per day within days of an order being placed." It plans to ramp up to 1 million tested samples by July 1. - -![Opentrons roadmap graphic][18] - -From the Opentrons [website][17], Copyright - -The company is already working with federal and local government agencies to determine if its systems can be used for clinical diagnosis under an [emergency use authorization][19]. Opentrons is shared under an [Apache 2.0 license][20]. I first learned of it from biologist Kristin Ellis, who is affiliated with the project. - -#### Chai Open qPCR - -Chai's [Open qPCR][21] device uses [polymerase chain reaction][22] (PCR) to rapidly test swabs from surfaces (e.g., door handles and elevator buttons) to see if the novel coronavirus is present. This open source hardware shared under an [Apache 2.0 license][23] uses a [BeagleBone][24] low-power Linux computer. Data from the Chai Open qPCR can enable public health, civic, and business leaders to make more informed decisions about cleaning, mitigation, facility closures, contract tracing, and testing. - -#### OpenPCR - -[OpenPCR][25] is a PCR testing device kit from Josh Perfetto and Jessie Ho, the creators behind the Chai Open qPCR. This is more of a DIY open source device than their previous project, but it has the same use case: using environmental testing to identify the coronavirus in the field. As the project page states, "traditional real-time PCR machines capable of detecting these pathogens typically cost upwards of $30,000 US dollars and are not suitable for field usage." Because OpenPCR is a kit users build and is shared under a [GPLv3.0 license][26], the device aims to democratize access to molecular diagnostics. - -![OpenPCR][27] - -From the OpenPCR [website][25], Copyright - -And, like any good open source project, there is a derivative! [WildOpenPCR][28] by [GaudiLabs][29] in Switzerland is also shared under a [GPLv3.0 license][30]. - -#### PocketPCR - -Gaudi Labs' [PocketPCR][31] thermocycler is used to activate biological reactions by raising and lowering the temperature of a liquid in small test tubes. It can be powered with a simple USB power adapter, either tethered to a device or on its own, with preset parameters that don't require a computer or smartphone. - -![PocketPCR][32] - -From the PocketPCR [website][31], Copyright - -Like the other PCR options described in this article, this device may facilitate environmental testing for coronavirus, although its project page does not explicitly state so. PocketPCR is shared under a [GPLv3.0 license][33]. - -#### Open Lung Low Resource Ventilator - -The [Open Lung Low Resource Ventilator][34] is a quick-deployment ventilator that utilizes a [bag valve mask][35] (BVM), also known as an Ambu-bag, as a core component. Ambu-bags are mass-produced, certified, small, mechanically simple, and adaptable to both invasive tubing and masks. The OPEN LUNG ventilator will use micro-electronics to sense and control air pressure and flow, with the goal to enable semi-autonomous operation. - -![Open Lung ventilator][36] - -Open Lung [on GitLab][37] - -This early-stage project boasts a large team with hundreds of contributors, led by: Colin Keogh, David Pollard, Connall Laverty, and Gui Calavanti. It is shared under a [GPLv3.0 license][38]. - -#### Pandemic Ventilator - -The [Pandemic Ventilator][39] is a DIY ventilator prototype. Like the RepRap project, it uses commonly available hardware components in its design. The project was uploaded by user Panvent to Instructables more than 10 years ago, and there are six major steps to producing it. The project is shared under a [CC BY-NC-SA license][39]. This video shows the system in action: - -#### Folding at Home - -[Folding at Home][40] is a distributed computing project for simulating protein dynamics, including the process of protein folding and the movements of proteins implicated in a variety of diseases. It is a call-to-action for citizen scientists, researchers, and volunteers to use their computers at home to help run simulations, similar to the decommissioned [SETI@Home project][41]. If you're a technologist with capable computer hardware, Folding at Home is for you. - -![Markov state model][42] - -Vincent Voelz, CC BY-SA 3.0 - -Folding at Home uses Markov state models (shown above) to model the possible shapes and folding pathways a protein can take in order to look for new therapeutic opportunities. You can find out more about the project in Washington University biophysicist Greg Bowman's post on [how it works and how you can help][43]. - -The project involves a consortium of academic laboratories, contributors, and corporate sponsors from many countries, including Hong Kong, Croatia, Sweden, and the United States. Folding at Home is shared under a [mix of GPL and proprietary licenses][44] on [GitHub][45] and is multi-platform for Windows, macOS, and GNU/Linux (e.g., Debian, Ubuntu, Mint, RHEL, CentOS, Fedora). - -### Many other interesting projects - -These projects are just a fraction of the activity happening in the open hardware space to solve or treat COVID-19. In researching this article, I discovered other projects worth exploring, such as: - - * [Open source ventilators, oxygen concentrators, etc.][46] by Coronavirus Tech Handbook - * [Helpful engineering][47] by ProjectOpenAir - * [Open source ventilator hackathon][48] on Hackaday - * [Specifications for simple open source mechanical ventilator][49] by Johns Hopkins emergency medicine resident Julian Botta - * [Coronavirus-related phishing, malware, and randomware on the rise][50] by Shannon Morse - * [Converting a low-cost CPAP blower into a rudimentary ventilator][51] by jcl5m1 - * [Forum A.I.R.E. discussion on open respirators and fans][52] (Spanish/español) - * [Special Issue on Open-Source COVID19 Medical Hardware][53] by Elsevier HardwareX - - - -These projects are based all over the world, and this type of global cooperation is exactly what we need, as the virus ignores borders. The novel coronavirus pandemic affects countries at different times and in different ways, so we need a distributed approach. - -As my colleague Steven Abadie and I write in the [OSHdata 2020 Report][54], the open source hardware movement is a global movement. Participating individuals and organizations with certified projects are located in over 35 countries around the world and in every hemisphere. - -![Open source hardware map][55] - -OSHdata, CC BY-SA 4.0 International - -If you are interested in joining this conversation with open source hardware developers around the world, join the [Open Hardware Summit Discord][56] server with a dedicated channel for conversations about COVID-19. You can find roboticists, designers, artists, firmware and mechanical engineers, students, researchers, and others who are fighting this war together. We hope to see you there. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/open-hardware-covid19 - -作者:[Harris Kenny][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/harriskenny -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/health_heartbeat.png?itok=P-GXea-p (open on blue background with heartbeat symbol) -[2]: https://opensource.com/resources/what-open-hardware -[3]: https://reprap.org/wiki/RepRap -[4]: https://www.opensourceecology.org/ -[5]: https://www.osbeehives.com/ -[6]: https://www.scmp.com/news/hong-kong/health-environment/article/3052135/polytechnic-university-lab-3d-printing-face -[7]: https://www.3dprintingmedia.network/covid-19-3d-printed-valve-for-reanimation-device/ -[8]: https://www.3dprintingmedia.network/materialise-shows-3d-printed-door-opener-for-coronavirus-containment-efforts/ -[9]: https://news.yahoo.com/stitch-time-czechs-sew-combat-virus-mask-shortage-205213804.html -[10]: http://tapster.io/ -[11]: https://opensource.com/life/15/5/arduino-or-raspberry-pi -[12]: https://t.co/bFogaekehM -[13]: https://twitter.com/JIMrichards1010/status/1239140710558969857?ref_src=twsrc%5Etfw -[14]: http://Healthcare.gov -[15]: https://www.marktysonlaw.com/ -[16]: https://opentrons.com/ -[17]: https://blog.opentrons.com/testing-for-covid-19-with-opentrons/ -[18]: https://opensource.com/sites/default/files/uploads/opentrons.png (Opentrons roadmap graphic) -[19]: https://www.fda.gov/regulatory-information/search-fda-guidance-documents/policy-diagnostics-testing-laboratories-certified-perform-high-complexity-testing-under-clia-prior -[20]: https://github.com/Opentrons/opentrons/blob/edge/LICENSE -[21]: https://www.chaibio.com/openqpcr -[22]: https://en.wikipedia.org/wiki/Polymerase_chain_reaction -[23]: https://github.com/chaibio/chaipcr -[24]: https://beagleboard.org/bone -[25]: https://openpcr.org/ -[26]: https://github.com/jperfetto/OpenPCR/blob/master/license.txt -[27]: https://opensource.com/sites/default/files/uploads/openpcr.png (OpenPCR) -[28]: https://github.com/GenericLab/WildOpenPCR -[29]: http://www.gaudi.ch/GaudiLabs/?page_id=328 -[30]: https://github.com/GenericLab/WildOpenPCR/blob/master/license.txt -[31]: http://gaudi.ch/PocketPCR/ -[32]: https://opensource.com/sites/default/files/uploads/pocketpcr.png (PocketPCR) -[33]: https://github.com/GaudiLabs/PocketPCR/blob/master/LICENSE -[34]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor -[35]: https://en.wikipedia.org/wiki/Bag_valve_mask -[36]: https://opensource.com/sites/default/files/uploads/open-lung.png (Open Lung ventilator) -[37]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor/-/blob/master/images/CONCEPT_1_MECH.png -[38]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor/-/blob/master/LICENSE -[39]: https://www.instructables.com/id/The-Pandemic-Ventilator/ -[40]: https://foldingathome.org/ -[41]: https://setiathome.ssl.berkeley.edu/ -[42]: https://opensource.com/sites/default/files/uploads/foldingathome.png (Markov state model) -[43]: https://foldingathome.org/2020/03/15/coronavirus-what-were-doing-and-how-you-can-help-in-simple-terms/ -[44]: https://en.wikipedia.org/wiki/Folding@home -[45]: https://github.com/FoldingAtHome -[46]: https://coronavirustechhandbook.com/hardware -[47]: https://app.jogl.io/project/121#about -[48]: https://hackaday.com/2020/03/12/ultimate-medical-hackathon-how-fast-can-we-design-and-deploy-an-open-source-ventilator/ -[49]: https://docs.google.com/document/d/1FNPwrQjB1qW1330s5-S_-VB0vDHajMWKieJRjINCNeE/edit?fbclid=IwAR3ugu1SGMsacwKi6ycAKJFOMduInSO4WVM8rgmC4CgMJY6cKaGBNR14mpM -[50]: https://www.youtube.com/watch?v=dmQ1twpPpXA -[51]: https://github.com/jcl5m1/ventilator -[52]: https://foro.coronavirusmakers.org/ -[53]: https://www.journals.elsevier.com/hardwarex/call-for-papers/special-issue-on-open-source-covid19-medical-hardware -[54]: https://oshdata.com/2020-report -[55]: https://opensource.com/sites/default/files/uploads/oshdata-country.png (Open source hardware map) -[56]: https://discord.gg/duAtG5h diff --git a/sources/tech/20200320 Build a private social network with a Raspberry Pi.md b/sources/tech/20200320 Build a private social network with a Raspberry Pi.md deleted file mode 100644 index 7917add925..0000000000 --- a/sources/tech/20200320 Build a private social network with a Raspberry Pi.md +++ /dev/null @@ -1,373 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Build a private social network with a Raspberry Pi) -[#]: via: (https://opensource.com/article/20/3/raspberry-pi-open-source-social) -[#]: author: (Giuseppe Cassibba https://opensource.com/users/peppe8o) - -Build a private social network with a Raspberry Pi -====== -Step-by-step instructions on how to create your own social network with -low-cost hardware and simple setup. -![Team of people around the world][1] - -Social networks have revolutionized people's lives in the last several years. People use social channels every day to stay connected with friends and family. But a common question remains regarding privacy and data security. Even if social networks have created complex privacy policies to protect users, maintaining your data in your own server is always the best option if you don't want to make them available to the public. - -Again, a Raspberry Pi—Raspbian Lite version can be very versatile to help you put a number of useful home services (see also my [Raspberry Pi projects][2] article) in place. Some addictive features can be achieved by searching for open source software and testing it with this fantastic device. An interesting example to try is installing OpenSource Social Network in your Raspberry Pi. - -### What Is OpenSource Social Network? - -[OpenSource Social Network][3] (OSSN) is a rapid-development social networking software written in PHP, that essentially allows you to make a social networking website. OSSN can be used to build different types of social apps, such as: - - * Private Intranets - * Public/Open Networks - * Community - - - -OSSN supports features like: - - * Photos - * Profile - * Friends - * Smileys - * Search - * Chat - - - -OSSN runs on a LAMP server. It has very poor hardware requirements, but an amazing user interface, which is also mobile-friendly. - -### What we need - -This project is very simple and, because we're installing only remote web services, we only need a few cheap parts. I'm going to use a Raspberry Pi 3 model B+, but it should also work with Raspberry Pi 3 model A+ or newer boards. - -Hardware: - - * Raspberry Pi 3 model B+ with its power supply - * a micro SD card (better if it is a performing card, at least 16GB) - * a Desktop PC with an SFTP software (for example, the free [Filezilla][4]) to transfer installation packages into your RPI. - - - -### Step-by-step procedure - -We'll start by setting up a classic LAMP server. We'll then set up database users and install OpenSource Social Network. - -#### 1\. Install Raspbian Buster Lite OS - -For this step, you can simply follow my [Install Raspbian Buster Lite in your Raspberry Pi][5] article. - -Make sure that your system is up to date. Connect via ssh terminal and type following commands: - - -``` -sudo apt-get update -sudo apt-get upgrade -``` - -2\. Install LAMP server - -LAMP (Linux–Apache–Mysql–Php) servers usually come with the MySQL database. In our project, we'll use MariaDB instead, because it is lighter and works with Raspberry Pi.  - -#### 3\. Install Apache server: - - -``` -`sudo apt-get install apache2 -y` -``` - -You should now be able to check that Apache installation has gone correctly by browsing http://<<YouRpiIPAddress>>: - -![][6] - -#### 4\. Install PHP: - - -``` -`sudo apt-get install php -y` -``` - -5\. Install MariaDB server and PHP connector: - - -``` -`sudo apt-get install mariadb-server php-mysql -y` -``` - -6\. Install PhpMyAdmin: - -PhpMyAdmin is not mandatory in OpenSource Social Network, but I suggest that you install it because it simplifies database management. - - -``` -`sudo apt-get install phpmyadmin` -``` - -In the phpMyAdmin setup screen, take the following steps: - - * Select apache (mandatory) with space and press OK. - * Select Yes to configure the database for phpMyAdmin with dbconfig-common. - * Enter your favorite phpMyAdmin password and press OK. - * Enter your phpMyAdmin password again to confirm and press OK - - - -#### 7\. Grant phpMyAdmin user DB privileges to manage DBs: - -We'll connect to MariaDB with root user (default password is empty) to grant permissions. Remember to use semicolons at the end of each command row as shown below: - - -``` -sudo mysql -uroot -p -grant all privileges on *.* to 'phpmyadmin'@'localhost'; -flush privileges; -quit -``` - -8\. Finally, restart Apache service: - - -``` -`sudo systemctl restart apache2.service` -``` - -And check that phpMyAdmin is working by browsing http://<<YouRpiIPAddress>>/phpmyadmin/.  - -![][7] - -Default phpMyAdmin login credentials are: - - * user: phpmyadmin - * password: the one you set up in the phpMyAdmin installation step - - - -### Installing other open source social network-required packages and setting up PHP - -We need to prepare our system for OpenSource Social Network's first setup wizard. Required packages are: - - * PHP version any of 5.6, 7.0, 7.1 - * MYSQL 5 OR > - * APACHE - * MOD_REWRITE - * PHP Extensions cURL & Mcrypt should be enabled - * PHP GD Extension - * PHP ZIP Extension - * PHP settings allow_url_fopen enabled - * PHP JSON Support - * PHP XML Support - * PHP OpenSSL - - - -So we'll install them with following terminal commands: - - -``` -`sudo apt-get install php7.3-curl php7.3-gd php7.3-zip php7.3-json php7.3-xml` -``` - -#### 1\. Enable MOD_REWRITE: - - -``` -`sudo a2enmod rewrite` -``` - -2\. Edit default Apache config to use mod_rewrite: - - -``` -`sudo nano /etc/apache2/sites-available/000-default.conf` -``` - -3\. Add the section so that your **000-default.conf** file appears like the following (excluding comments): - - -``` -<VirtualHost *:80> -    ServerAdmin webmaster@localhost -    DocumentRoot /var/www/html -    ErrorLog ${APACHE_LOG_DIR}/error.log -    CustomLog ${APACHE_LOG_DIR}/access.log combined -    # SECTION TO ADD -------------------------------- -        <Directory /var/www/html> -            Options Indexes FollowSymLinks MultiViews -            AllowOverride All -            Require all granted -        </Directory> -    # END SECTION TO ADD -------------------------------- -</VirtualHost> -``` - -4\. Install Mcrypt: - - -``` -sudo apt install php-dev libmcrypt-dev php-pear -sudo pecl channel-update pecl.php.net -sudo pecl install mcrypt-1.0.2 -``` - -5\. Enable Mcrypt module by adding (or uncommenting) “extension=mcrypt.so" in "/etc/php/7.3/apache2/php.ini": - - -``` -`sudo nano /etc/php/7.3/apache2/php.ini` -``` - -**allow_url_fopen** should be already enabled in "/etc/php/7.3/apache2/php.ini". OpenSSL should be already installed in php7.3. - -#### 6\. Another setting that I suggest is editing the PHP max upload file size up to 16 MB: - - -``` -`sudo nano /etc/php/7.3/apache2/php.ini` -``` - -7\. Look for the row with the **upload_max_filesize** parameter and set it as the following: - - -``` -`upload_max_filesize = 16M` -``` - -8\. Save and exit. Restart Apache: - - -``` -`sudo systemctl restart apache2.service` -``` - -### Install OSSN - -#### 1\. Create DB and set up user: - -Go back to phpmyadmin web page (browse "http://<<YourRpiIPAddress>>/phpmyadmin/") and login: - -User: phpmyadmin - -Password: the one set up in phpmyadmin installation step - -Click on database tab: - -![][8] - -Create a database and take note of the database name, as you will be required to enter it later in the installation process. - -![][9] - -It's time to create a database user for OSSN. In this example, I'll use the following credentials: - -User: ossn_db_user - -Password: ossn_db_password - -So, terminal commands will be (root password is still empty, if not changed by you before): - - -``` -sudo mysql -uroot -p -CREATE USER 'ossn_db_user'@'localhost' IDENTIFIED BY 'ossn_db_password'; -GRANT ALL PRIVILEGES ON ossn_db.* TO 'ossn_db_user'@'localhost'; -flush privileges; -quit -``` - -2\. Install OSSN software: - -Download the OSSN installation zip file from the [OSSN download page][10] on your local PC. At the time of this writing, this file is named "ossn-v5.2-1577836800.zip." - -Using your favorite SFTP software, transfer the entire zip file via SFTP to a new folder in the path "/home/pi/download" on your Raspberry Pi. Common (default) SFP connection parameters are: - - * Host: your Raspberry Pi IP address - * User: pi - * Password: raspberry (if you didn't change the pi default password) - * Port: 22 - - - -Back to terminal: - - -``` -cd /home/pi/download/ #Enter directory where OSSN installation files have been transferred -unzip ossn-v5.2-1577836800.zip #Extracts all files from zip -cd /var/www/html/ #Enter Apache web directory -sudo rm index.html #Removes Apache default page - we'll use OSSN one -sudo cp -R /home/pi/download/ossn-v5.2-1577836800/* ./ #Copy installation files to web directory -sudo chown -R www-data:www-data ./ -``` - -Create a data folder:OSSN requires a folder to store data. OSSN suggests, for security reasons, to create this folder outside of the published document root. So, we'll create this opt-in folder and give grants: - - -``` -sudo mkdir /opt/ossn_data -sudo chown -R www-data:www-data /opt/ossn_data/ -``` - -Browse http://<<YourRpiIPAddress>> to start the installation wizard: - -![][11] - -All checks should be fine. Click the Next button at the end of the page. - -![][12] - -Read the license validation and click the Next button at the end of the page to accept. - -![][13] - -Enter the database user, password, and the DB name you chose. Remember also to enter the OSSN data folder. Press Install. - -![][14] - -Enter your admin account information and press the Create button. - -![][15] - -Everything should be fine now. Press Finish to access the administration dashboard. - -![][16] - -So, administration panel can be reached with URL "http://<<YourRpiIPAddress>>/administrator" while user link will be "http://<<YourRpiIPAddress>>". - -![][17] - -_This article was originally published at [peppe8o.com][18]. Reposted with permission._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/raspberry-pi-open-source-social - -作者:[Giuseppe Cassibba][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/peppe8o -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) -[2]: https://peppe8o.com/2019/04/best-raspberry-pi-projects-with-open-source-software/ -[3]: https://www.opensource-socialnetwork.org/ -[4]: https://filezilla-project.org/ -[5]: https://peppe8o.com/2019/07/install-raspbian-buster-lite-in-your-raspberry-pi/ -[6]: https://opensource.com/sites/default/files/uploads/ossn_1_0.jpg -[7]: https://opensource.com/sites/default/files/uploads/ossn_2.jpg -[8]: https://opensource.com/sites/default/files/uploads/ossn_3.jpg -[9]: https://opensource.com/sites/default/files/uploads/ossn_4.jpg -[10]: https://www.opensource-socialnetwork.org/download -[11]: https://opensource.com/sites/default/files/uploads/ossn_5.jpg -[12]: https://opensource.com/sites/default/files/uploads/ossn_6.jpg -[13]: https://opensource.com/sites/default/files/uploads/ossn_7.jpg -[14]: https://opensource.com/sites/default/files/uploads/ossn_8.jpg -[15]: https://opensource.com/sites/default/files/uploads/ossn_9.jpg -[16]: https://opensource.com/sites/default/files/uploads/ossn_10.jpg -[17]: https://opensource.com/sites/default/files/uploads/ossn_11.jpg -[18]: https://peppe8o.com/private-social-network-with-raspberry-pi-and-opensource-social-network/ diff --git a/sources/tech/20200320 Control the firewall at the command line.md b/sources/tech/20200320 Control the firewall at the command line.md deleted file mode 100644 index fb49292d28..0000000000 --- a/sources/tech/20200320 Control the firewall at the command line.md +++ /dev/null @@ -1,138 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (tinyeyeser ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Control the firewall at the command line) -[#]: via: (https://fedoramagazine.org/control-the-firewall-at-the-command-line/) -[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) - -Control the firewall at the command line -====== - -![][1] - -A network _firewall_ is more or less what it sounds like: a protective barrier that prevents unwanted network transmissions. They are most frequently used to prevent outsiders from contacting or using network services on a system. For instance, if you’re running a laptop at school or in a coffee shop, you probably don’t want strangers poking around on it. - -Every Fedora system has a firewall built in. It’s part of the network functions in the Linux kernel inside. This article shows you how to change its settings using _firewall-cmd_. - -### Network basics - -This article can’t teach you [everything][2] about computer networks. But a few basics suffice to get you started. - -Any computer on a network has an _IP address_. Think of this just like a mailing address that allows correct routing of data. Each computer also has a set of _ports_, numbered 0-65535. These are not physical ports; instead, you can think of them as a set of connection points at the address. - -In many cases, the port is a [standard number][3] or range depending on the application expected to answer. For instance, a web server typically reserves port 80 for non-secure HTTP communications, and/or 443 for secure HTTPS. The port numbers under 1024 are reserved for system and well-known purposes, ports 1024-49151 are registered, and ports 49152 and above are usually ephemeral (used only for a short time). - -Each of the two most common protocols for Internet data transfer, [TCP][4] and [UDP][5], have this set of ports. TCP is used when it’s important that all data be received and, if it arrives out of order, reassembled in the right order. UDP is used for more time-sensitive services that can withstand losing some data. - -An application running on the system, such as a web server, reserves one or more ports (as seen above, 80 and 443 for example). Then during network communication, a host establishes a connection between a source address and port, and the destination address and port. - -A network firewall can block or permit transmissions of network data based on rules like address, port, or other criteria. The _firewall-cmd_ utility lets you interact with the rule set to view or change how the firewall works. - -### Firewall zones - -To verify the firewall is running, use this command with [sudo][6]. (In fairness, you can run _firewall-cmd_ without the _sudo_ command in environments where [PolicyKit][7] is running.) - -``` -$ sudo firewall-cmd --state -running -``` - -The firewalld service supports any number of _zones_. Each zone can have its own settings and rules for protection. In addition, each network interface can be placed in any zone individually The default zone for an external facing interface (like the wifi or wired network card) on a Fedora Workstation is the _FedoraWorkstation_ zone. - -To see what zones are active, use the _–get-active-zones_ flag. On this system, there are two network interfaces, a wired Ethernet card _wlp2s0_ and a virtualization (libvirt) bridge interface _virbr0_: - -``` -$ sudo firewall-cmd --get-active-zones -FedoraWorkstation - interfaces: wlp2s0 -libvirt - interfaces: virbr0 -``` - -To see the default zone, or all the defined zones: - -``` -$ sudo firewall-cmd --get-default-zone -FedoraWorkstation -$ sudo firewall-cmd --get-zones -FedoraServer FedoraWorkstation block dmz drop external home internal libvirt public trusted work -``` - -To see the services the firewall is allowing other systems to access in the default zone, use the _–list-services_ flag. Here is an example from a customized system; you may see something different. - -``` -$ sudo firewall-cmd --list-services -dhcpv6-client mdns samba-client ssh -``` - -This system has four services exposed. Each of these has a well-known port number. The firewall recognizes them by name. For instance, the _ssh_ service is associated with port 22. - -To see other port settings for the firewall in the current zone, use the _–list-ports_ flag. By the way, you can always declare the zone you want to check: - -``` -$ sudo firewall-cmd --list-ports --zone=FedoraWorkstation -1025-65535/udp 1025-65535/tcp -``` - -This shows that ports 1025 and above (both UDP and TCP) are open by default. - -### Changing zones, ports, and services - -The above setting is a design decision.* It ensures novice users can use network facing applications they install. If you know what you’re doing and want a more protective default, you can move the interface to the _FedoraServer_ zone, which prohibits any ports not explicitly allowed. _(**Warning:** if you’re using the host via the network, you may break your connection — meaning you’ll have to go to that box physically to make further changes!)_ - -``` -$ sudo firewall-cmd --change-interface= --zone=FedoraServer -success -``` - -* _This article is not the place to discuss that decision, which went through many rounds of review and debate in the Fedora community. You are welcome to change settings as needed._ - -If you want to open a well-known port that belongs to a service, you can add that service to the default zone (or use _–zone_ to adjust a different zone). You can add more than one at once. This example opens up the well-known ports for your web server for both HTTP and HTTPS traffic, on ports 80 and 443: - -``` -$ sudo firewall-cmd --add-service=http --add-service=https -success -``` - -Not all services are defined, but many are. To see the whole list, use the _–get-services_ flag. - -If you want to add specific ports, you can do that by number and protocol as well. (You can also combine _–add-service_ and _–add-port_ flags, as many as necessary.) This example opens up the UDP service for a network boot service: - -``` -$ sudo firewall-cmd --add-port=67/udp -success -``` - -**Important:** If you want your changes to be effective after you reboot your system or restart the firewalld service, you **must** add the _–permanent_ flag to your commands. The examples here only change the firewall until one of those events next happens. - -These are just some of the many functions of the _firewall-cmd_ utility and the firewalld service. There is much more information on firewalld at the project’s [home page][8] that’s worth reading and trying out. - -* * * - -_Photo by [Jakob Braun][9] on [Unsplash][10]._ - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/control-the-firewall-at-the-command-line/ - -作者:[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/2020/03/firewall-cmd-816x345.jpg -[2]: https://en.wikipedia.org/wiki/Portal:Internet -[3]: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers -[4]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol -[5]: https://en.wikipedia.org/wiki/User_Datagram_Protocol -[6]: https://fedoramagazine.org/howto-use-sudo/ -[7]: https://en.wikipedia.org/wiki/Polkit -[8]: https://firewalld.org/ -[9]: https://unsplash.com/@jakobustrop?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText -[10]: https://unsplash.com/s/photos/brick-wall?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/tech/20200322 Meet DebianDog - Puppy sized Debian Linux.md b/sources/tech/20200322 Meet DebianDog - Puppy sized Debian Linux.md deleted file mode 100644 index ea2b2d1f7c..0000000000 --- a/sources/tech/20200322 Meet DebianDog - Puppy sized Debian Linux.md +++ /dev/null @@ -1,120 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Meet DebianDog – Puppy sized Debian Linux) -[#]: via: (https://itsfoss.com/debiandog/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Meet DebianDog – Puppy sized Debian Linux -====== - -Recently I stumbled upon an intriguing Linux project. This project aims to create small live CDs for Debian and Debian-based systems, similar to the [Puppy Linux project][1]. Let’s take a look at DebianDog. - -### What is DebianDog? - -As it says on the tin, [DebianDog][2] “is a small Debian Live CD shaped to look like Puppy and act like Puppy. Debian structure and Debian behaviour are untouched and Debian documentation is 100% valid for DebianDog. You have access to all Debian repositories using apt-get or synaptic.” - -![DebianDog Jessie][3] - -For those of you who are not familiar with [Puppy Linux][1], the project is “a collection of multiple Linux distributions, built on the same shared principles”. Those principles are to be fast, small (300 MB or less), and easy to use. There are versions of Puppy Linux built to support Ubuntu, Slackware, and Raspbian packages. - -The major difference between DebianDog and Puppy Linux is that Puppy Linux has its own package manager [the [Puppy Package Manager][4]]. As stated above, DebianDog using the Debian package manager and packages. Even the DebianDog website tries to make that clear: “It is not Puppy Linux and it has nothing to do with Puppy based on Debian.” - -### Why should anyone use DebianDog? - -The main reason to install DebianDog (or any of its derivatives) would be to restore an older system to operability. Every entry on DebianDog has a 32-bit option. They also have lighter desktop environments/window managers, such as [Openbox][5] or the [Trinity Desktop][6] environment. Most of those also have an alternative to systemd. They also come with lighter applications installed, such as [PCManFM][7]. - -### What versions of DebianDog are available? - -Though DebianDog was the first in the series, the project is called ‘Dog Linux’ and provides various ‘Dog variants’ on popular distributions based on Debian and Ubuntu. - -#### DebianDog Jessie - -The first (and original) version of DebianDog is DebianDog Jessie. There are two [32-bit versions][8] of it. One uses [Joe’s Window Manager (JWM)][9] as default and the other uses XFCE. Both systemd and sysvinit are available. There is also a [64-bit version][10]. DebianDog Jessie is based on Debian 8.0 (codename Jessie). Support for Debian 8.0 ends on June 30th, 2020, so install with caution. - -![TrinityDog][11] - -#### StretchDog - -[Stret][12][c][12][hDog][12] is based on Debian 9.0 (codename Stretch). It is available in 32 and 64-bit. Openbox is the default window manager, but we can also switch to JWM. Support for Debian 9.0 ends on June 30th, 2022. - -#### BusterDog - -[BusterDog][13] is interesting. It is based on [Debian 10][14] (codename Buster). It does not use systemd, instead, it uses [elogind][15] just like [AntiX][16]. Support for Debian 10.0 ends on June 2024. - -#### MintPup - -[MintPup][17] is based on [Linux Mint][18] 17.1. This LiveCD is 32-bit only. You can also access all of the “Ubuntu/Mint repositories using apt-get or synaptic”. Considering that Mint 17 has reached end of life, this version must be avoided. - -#### XenialDog - -There are both [32-bit][19] and [64-bit versions][20] of this spin based on the Ubuntu 16.04 LTS. Both versions come with Openbox as default with JWM as an option. Support for Ubuntu 16.04 LTS ends in April of 2021, so install with caution. - -#### TrinityDog - -There are two versions of the [TrintyDog][21] spin. One is based on Debian 8 and the other is based on Debian 9. Both are 32-bit and both use the [Trinity Desktop Environment][6], thus the name. - -![BionicDog][22] - -#### BionicDog - -As you should be able to guess by the name. [BionicDog][23] is based on [Ubuntu 18.04 LTS][24]. The main version of this spin has both 32 and 64-bit with Openbox as the default window manager. There is also a version that uses the [Cinnamon desktop][25] and is only 64-bit. - -### Final Thoughts - -I like any [Linux project that wants to make older systems usable][26]. However, most of the operating systems available through DebianDog are no longer supported or nearing the end of their life span. This makes it less than useful for the long run. - -**I wouldn’t really advise to use it on your main computer.** Try it in live USB or on a spare system. Also, [you can create][27] your own LiveCD spin if you want to take advantage of a newer base system. - -Somehow I keep on stumbling across obscure Linux distributions like [FatDog64][28], [4M Linux][29] and [Vipper Linux][30]. Even though I may not always recommend them to use, it’s still good to know about the existence of such projects. - -What are your thoughts on the DebianDog? What is your favorite Puppy-syle OS? Please let us know in the comments below. - -If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][31]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/debiandog/ - -作者:[John Paul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/john/ -[b]: https://github.com/lujun9972 -[1]: http://puppylinux.com/ -[2]: https://debiandog.github.io/doglinux/ -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/DebianDog-Jessie.jpg?fit=800%2C600&ssl=1 -[4]: http://wikka.puppylinux.com/PPM?redirect=no -[5]: http://openbox.org/wiki/Main_Page -[6]: https://www.trinitydesktop.org/ -[7]: https://wiki.lxde.org/en/PCManFM -[8]: https://debiandog.github.io/doglinux/zz01debiandogjessie.html -[9]: https://en.wikipedia.org/wiki/JWM -[10]: https://debiandog.github.io/doglinux/zz02debiandog64.html -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/TrinityDog.jpg?ssl=1 -[12]: https://debiandog.github.io/doglinux/zz02stretchdog.html -[13]: https://debiandog.github.io/doglinux/zz03busterdog.html -[14]: https://itsfoss.com/debian-10-buster/ -[15]: https://github.com/elogind/elogind -[16]: https://antixlinux.com/ -[17]: https://debiandog.github.io/doglinux/zz04mintpup.html -[18]: https://linuxmint.com/ -[19]: https://debiandog.github.io/doglinux/zz05xenialdog.html -[20]: https://debiandog.github.io/doglinux/zz05zxenialdog.html -[21]: https://debiandog.github.io/doglinux/zz06-trinitydog.html -[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/BionicDog.jpg?ssl=1 -[23]: https://debiandog.github.io/doglinux/zz06-zbionicdog.html -[24]: https://itsfoss.com/ubuntu-18-04-released/ -[25]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) -[26]: https://itsfoss.com/lightweight-linux-beginners/ -[27]: https://github.com/DebianDog/MakeLive -[28]: https://itsfoss.com/fatdog64-linux-review/ -[29]: https://itsfoss.com/4mlinux-review/ -[30]: https://itsfoss.com/viperr-linux-review/ -[31]: https://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20200323 Don-t love diff- Use Meld instead.md b/sources/tech/20200323 Don-t love diff- Use Meld instead.md deleted file mode 100644 index e5049454e2..0000000000 --- a/sources/tech/20200323 Don-t love diff- Use Meld instead.md +++ /dev/null @@ -1,131 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Don't love diff? Use Meld instead) -[#]: via: (https://opensource.com/article/20/3/meld) -[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -Don't love diff? Use Meld instead -====== -Meld is a visual diff tool that makes it easier to compare and merge -changes in files, directories, Git repos, and more. -![Person drinking a hat drink at the computer][1] - -Meld is one of my essential tools for working with code and data files. It's a graphical diff tool, so if you've ever used the **diff** command and struggled to make sense of the output, [Meld][2] is here to help. - -Here is a brilliant description from the project's website: - -> "Meld is a visual diff and merge tool targeted at developers. Meld helps you compare files, directories, and version controlled projects. It provides two- and three-way comparison of both files and directories, and has support for many popular version control systems. -> -> "Meld helps you review code changes and understand patches. It might even help you to figure out what is going on in that merge you keep avoiding." - -You can install Meld on Debian/Ubuntu systems (including Raspbian) with: - - -``` -`$ sudo apt install meld` -``` - -On Fedora or similar, it's: - - -``` -`$ sudo dnf install meld` -``` - -Meld is cross-platform—there's a [Windows install][3] using the [Chocolately][4] package manager. While it's not officially supported on macOS, there are [builds available for Mac][5], and you can install it on Homebrew with: - - -``` -`$ brew cask install meld` -``` - -See Meld's homepage for [additional options][2]. - -### Meld vs. the diff command - -If you have two similar files (perhaps one is a modified version of the other) and want to see the changes between them, you could run the **diff** command to see their differences in the terminal: - -![diff output][6] - -This example shows the differences between **conway1.py** and **conway2.py**. It's showing that I: - - * Removed the [shebang][7] and second line - * Removed **(object)** from the class declaration - * Added a docstring to the class - * Swapped the order of **alive** and **neighbours == 2** in a method - - - -Here's the same example using the **meld** command. You can run the same comparison from the command line with: - - -``` -`$ meld conway1.py conway2.py` -``` - -![Meld output][8] - -Much clearer! - -You can easily see changes and merge changes between files by clicking the arrows (they work both ways). You can even edit the files live (Meld doubles up as a simple text editor with live comparisons as you type)—just be sure to save before you close the window. - -You can even compare and edit three different files: - -![Comparing three files in Meld][9] - -### Meld's Git-awareness - -Hopefully, you're using a version control system like [Git][10]. If so, your comparison isn't between two different files but to find differences between the current working file and the one Git knows. Meld understands this, so if you run **meld conway.py**, where **conway.py** is known by Git, it'll show you any changes made since the last Git commit: - -![Comparing Git files in Meld][11] - -You can see changes made in the current version (on the right) and the repository version (on the left). You can see I deleted a method and added a parameter and a loop since the last commit. - -If you run **meld .**, you'll see all the changes in the current directory (or the whole repository, if you're in its root): - -![Meld . output][12] - -You can see a single file is modified, another file is unversioned (meaning it's new to Git, so I need to **git add** the file before comparing it), and lots of other unmodified files. Various display options are provided by icons along the top. - -You can also compare two directories, which is sometimes handy: - -![Comparing directories in Meld][13] - -### Conclusion - -Even regular users can find comparisons with diff difficult to decipher. I find the visualizations Meld provides make a big difference in troubleshooting what's changed between files. On top of that, Meld comes with some helpful awareness of version control and helps you compare across Git commits without thinking much about it. Give Meld a go, and make troubleshooting a little easier on the eyes. - -* * * - -_This was originally published on Ben Nuttall's [Tooling blog][14] and is reused with permission._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/meld - -作者:[Ben Nuttall][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bennuttall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) -[2]: https://meldmerge.org/ -[3]: https://chocolatey.org/packages/meld -[4]: https://opensource.com/article/20/3/chocolatey -[5]: https://yousseb.github.io/meld/ -[6]: https://opensource.com/sites/default/files/uploads/diff-output.png (diff output) -[7]: https://en.wikipedia.org/wiki/Shebang_(Unix) -[8]: https://opensource.com/sites/default/files/uploads/meld-output.png (Meld output) -[9]: https://opensource.com/sites/default/files/uploads/meld-3-files.png (Comparing three files in Meld) -[10]: https://opensource.com/resources/what-is-git -[11]: https://opensource.com/sites/default/files/uploads/meld-git.png (Comparing Git files in Meld) -[12]: https://opensource.com/sites/default/files/uploads/meld-directory-changes.png (Meld . output) -[13]: https://opensource.com/sites/default/files/uploads/meld-directory-compare.png (Comparing directories in Meld) -[14]: https://tooling.bennuttall.com/meld/ diff --git a/sources/tech/20200323 How to create a personal file server with SSH on Linux.md b/sources/tech/20200323 How to create a personal file server with SSH on Linux.md deleted file mode 100644 index f758123bb1..0000000000 --- a/sources/tech/20200323 How to create a personal file server with SSH on Linux.md +++ /dev/null @@ -1,137 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to create a personal file server with SSH on Linux) -[#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh) -[#]: author: (Jim Hall https://opensource.com/users/jim-hall) - -How to create a personal file server with SSH on Linux -====== -Connecting to a remote Linux system over SSH is just plain easy. Here's -how to do it. -![Hand putting a Linux file folder into a drawer][1] - -The Raspberry Pi makes for a useful and inexpensive home server for lots of things. I most often use the [Raspberry Pi as a print server][2] to share a laser printer with other devices in our home or as a personal file server to store copies of projects and other data. - -I use this file server in various ways. Let's say I'm working on a project, such as a new book, and I want to make a snapshot copy of my work and all my associated files. In that case, I simply copy my **BookProject** folder to a **BookBackup** folder on the file server. - -Or if I'm cleaning up my local files, and I discover some files that I don't really need but I'm not yet ready to delete, I'll copy them to a **KeepForLater** folder on the file server. That's a convenient way to remove clutter from my everyday Linux system and offload infrequently used files to my personal file server. - -Setting up a Raspberry Pi—or any Linux system—as a personal file server doesn't require configuring Network File System (NFS) or Common Internet File System (CIFS) or tinkering with other file-sharing systems such as WebDAV. You can easily set up a remote file server using SSH. And here's how. - -### Set up SSHD on the remote system - -Your Linux system probably has the SSH daemon (sshd) installed. It may even be running by default. If not, you can easily set up SSH through whatever control panel you prefer on your Linux distribution. I run [Fedora ARM][3] on my Raspberry Pi, and I can access the control panel remotely by pointing my Pi's web browser to port 9090. (On my home network, the Raspberry Pi's IP address is **10.0.0.11**, so I connect to **10.0.0.11:9090**.) If the SSH daemon isn't running by default, you can set it to start automatically in Services in the control panel. - -![sshd in the list of system services][4] - -You can find sshd in the list of system services. - -![slider to activate sshd][5] - -Click the slider to activate **sshd** if it isn't already. - -### Do you have an account? - -Make sure you have an account on the remote system. It might be the same as the username you use on your local system, or it could be something different. - -On the popular Raspbian distribution, the default account username is **pi**. But other Linux distributions may require you to set up a unique new user when you install it. If you don't know your username, you can use your distribution's control panel to create one. On my Raspberry Pi, I set up a **jhall** account that matches the username on my everyday Linux desktop machine. - -![Set up a new account on Fedora Server][6] - -If you use Fedora Server, click the **Create New Account** button to set up a new account. - -![Set password or SSH key][7] - -Don't forget to set a password or add a public SSH key. - -### Optional: Share your SSH public key - -If you exchange your public SSH key with the remote Linux system, you can log in without having to enter a password. This step is optional; you can use a password if you prefer. - -You can learn more about SSH keys in these Opensource.com articles: - - * [Tools for SSH key management][8] - * [Graphically manage SSH keys with Seahorse][9] - * [How to manage multiple SSH keys][10] - * [How to enable SSH access using a GPG key for authentication][11] - - - -### Make a file manager shortcut - -Since you've started the SSH daemon on the remote system and set up your account username and password, all that's left is to map a shortcut to the other Linux system from your file manager. I use GNOME as my desktop, but the steps are basically the same for any Linux desktop. - -#### Make the initial connection - -In the GNOME file manager, look for the **+Other Locations** button in the left-hand navigation. Click that to open a **Connect to Server** prompt. Enter the address of the remote Linux server here, starting with the SSH connection protocol. - -![Creating a shortcut in GNOME file manager][12] - -The GNOME file manager supports a variety of connection protocols. To make a connection over SSH, start your server address with **sftp://** or **ssh://**. - -If your username is the same on your local Linux system and your remote Linux system, you can just enter the server's address and the folder location. To make my connection to the **/home/jhall** directory on my Raspberry Pi, I use: - - -``` -`sftp://10.0.0.11/home/jhall` -``` - -![GNOME file manager Connect to Server][13] - -If your username is different, you can specify your remote system's username with an **@** sign before the remote system's address. To connect to a Raspbian system on the other end, you might use: - - -``` -`sftp://pi@10.0.0.11/home/pi` -``` - -![GNOME file manager Connect to Server][14] - -If you didn't share your public SSH key, you may need to enter a password. Otherwise, the GNOME file manager should automatically open the folder on the remote system and let you navigate. - -![GNOME file manager connection][15] - -#### Create a shortcut so you can easily connect to the server later - -This is easy in the GNOME file manager. Right-click on the remote system's name in the navigation list, and select **Add Bookmark**. This creates a shortcut to the remote location. - -![GNOME file manager - adding bookmark][16] - -If you want to give the bookmark a more memorable name, you can right-click on the shortcut and choose **Rename**. - -### That's it! - -Connecting to a remote Linux system over SSH is just plain easy. And you can use the same method to connect to systems other than home file servers. I also have a shortcut that allows me to instantly access files on my provider's web server and another that lets me open a folder on my project server. SSH makes it a secure connection; all of my traffic is encrypted. Once I've opened the remote system over SSH, I can use the GNOME file manager to manage my remote files as easily as I'd manage my local folders. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/personal-file-server-ssh - -作者:[Jim Hall][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jim-hall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) -[2]: https://opensource.com/article/18/3/print-server-raspberry-pi -[3]: https://arm.fedoraproject.org/ -[4]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd.png (sshd in the list of system services) -[5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd) -[6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server) -[7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key) -[8]: https://opensource.com/article/20/2/ssh-tools -[9]: https://opensource.com/article/19/4/ssh-keys-seahorse -[10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage -[11]: https://opensource.com/article/19/4/gpg-subkeys-ssh -[12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager) -[13]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp.png (GNOME file manager Connect to Server) -[14]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp-username.png (GNOME file manager Connect to Server) -[15]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall.png (GNOME file manager connection) -[16]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall-add-bookmark.png (GNOME file manager - adding bookmark) diff --git a/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md deleted file mode 100644 index 53e7ea3fa6..0000000000 --- a/sources/tech/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md +++ /dev/null @@ -1,106 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu) -[#]: via: (https://itsfoss.com/audacious-4-release/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu -====== - -[Audacious][1] is an open-source audio player available for multiple platforms that include Linux. Almost after 2 years of its last major release, Audacious 4.0 has arrived with some big changes. - -The latest release Audacious 4.0 comes with [Qt 5][2] UI by default. You can still go for the old GTK2 UI from the source – however, the new features will be added to the Qt UI only. - -Let’s take a look at what has changed and how to install the latest Audacious on your Linux system. - -### Audacious 4.0 Key Changes & Features - -![Audacious 4 Release][3] - -Of course, the major change would be the use of Qt 5 UI as the default. In addition to that, there are a lot of improvements and feature additions mentioned in their [official announcement post][4], here they are: - - * Clicking on playlist column headers sorts the playlist - * Dragging playlist column headers changes the column order - * Application-wide settings for volume and time step sizes - * New option to hide playlist tabs - * Sorting playlist by path now sorts folders after files - * Implemented additional MPRIS calls for compatibility with KDE 5.16+ - * New OpenMPT-based tracker module plugin - * New VU Meter visualization plugin - * Added option to use a SOCKS network proxy - * The Song Change plugin now works on Windows - * New “Next Album” and “Previous Album” commands - * The tag editor in Qt UI can now edit multiple files at once - * Implemented equalizer presets window for Qt UI - * Lyrics plugin gained the ability to save and load lyrics locally - * Blur Scope and Spectrum Analyzer visualizations ported to Qt - * MIDI plugin SoundFont selection ported to Qt - * JACK output plugin gained some new options - * Added option to endlessly loop PSF files - - - -If you didn’t know about it previously, you can easily get it installed and use the equalizer coupled with [LADSP][5] effects to tweak your music experience. - -![Audacious Winamp Classic Interface][6] - -### How to Install Audacious 4.0 on Ubuntu - -It is worth noting that the [unofficial PPA][7] is made available by [UbuntuHandbook][8]. You can simply follow the instructions below to install it on Ubuntu 16.04, 18.04, 19.10, and 20.04. - -1\. First, you have to add the PPA to your system by typing in the following command in the terminal: - -``` -sudo add-apt-repository ppa:ubuntuhandbook1/apps -``` - -3\. Next, you need to update/refresh the package information from the repositories/sources you have and proceed to install the app. Here’s how to do that: - -``` -sudo apt update -sudo apt install audacious audacious-plugins -``` - -That’s it. You don’t have to do anything else. In either case, if you want to [remove the PPA and the software][9], just type in the following commands in order: - -``` -sudo add-apt-repository --remove ppa:ubuntuhandbook1/apps -sudo apt remove --autoremove audacious audacious-plugins -``` - -You can also check out their GitHub page for more information on the source and potentially install it on other Linux distros as well, if that’s what you’re looking for. - -[Audacious Source Code][10] - -### Wrapping Up - -The new features and the Qt 5 UI switch should be a good thing to improve the user experience and the functionality of the audio player. If you’re a fan of the classic Winamp interface, it works just fine as well – but missing a few features as mentioned in their announcement post. - -You can try it out and let me know your thoughts in the comments below! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/audacious-4-release/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://audacious-media-player.org -[2]: https://doc.qt.io/qt-5/qt5-intro.html -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-4-release.jpg?ssl=1 -[4]: https://audacious-media-player.org/news/45-audacious-4-0-released -[5]: https://www.ladspa.org/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-winamp.jpg?ssl=1 -[7]: https://itsfoss.com/ppa-guide/ -[8]: http://ubuntuhandbook.org/index.php/2020/03/audacious-4-0-released-qt5-ui/ -[9]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ -[10]: https://github.com/audacious-media-player/audacious diff --git a/sources/tech/20200326 How to detect outdated Kubernetes APIs.md b/sources/tech/20200326 How to detect outdated Kubernetes APIs.md new file mode 100644 index 0000000000..a45a9b2add --- /dev/null +++ b/sources/tech/20200326 How to detect outdated Kubernetes APIs.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to detect outdated Kubernetes APIs) +[#]: via: (https://opensource.com/article/20/3/deprek8) +[#]: author: (Tyler Auerbeck https://opensource.com/users/tylerauerbeck) + +How to detect outdated Kubernetes APIs +====== +Deprek8 and Conftest alert you about deprecated APIs that threaten to +slip into your codebase. +![Ship captain sailing the Kubernetes seas][1] + +Recently, deprecated APIs have been wreaking havoc on everyone's [Kubernetes][2] manifests. Why is this happening?!? It's because the objects that we've come to know and love are moving on to their new homes. And it's not like this happened overnight. Deprecation warnings have been in place for quite a few releases now. We've all just been lazy and thought the day would never come. Well, _it's here_! + +So, maybe it caught up to us this time. But we'll be prepared next time, right?!? Yeah, that's what we said last time. But what if we could put something in place that makes sure that this doesn't happen? + +### What is Deprek8? + +[Deprek8][3] is a set of [Open Policy Agent][4] (OPA) policies that allow you to check your repository for deprecated API versions. These policies offer a way to provide warnings and errors when something is in the process of being or has already been deprecated. But **Deprek8** is just a set of policies that define what to watch for. How do you actually actively use these policies in order to monitor for deprecations? + +There are a number of ways and tools that can do this; one way is to use the OPA Deprek8 policy. + +### What is the OPA Deprek8 policy? + +OPA is "an open source, general-purpose policy engine that enables unified, context-aware policy enforcement." In other words, OPA provides a means of establishing and enforcing a set of policies based upon a policy file. The policies are defined in a file (or set of files) using the [Rego query language][5]. This use case won't necessarily rely on the OPA application, but more specifically, it uses this query language to do the heavy lifting. By using Rego, you can check whether various manifests match certain criteria and then either warn or error them out based on your definition. For example, in Kubernetes 1.16, the Deployment object can no longer be served from the **extensions/v1beta1 apiVersion**. So in your .rego file, you could have something like: + + +``` +_deny = msg { +  resources := ["Deployment"] +  input.apiVersion == "extensions/v1beta1" +  input.kind == resources[_] +  msg := sprintf("%s/%s: API extensions/v1beta1 for %s is no longer served by default, use apps/v1 instead.", [input.kind, input.metadata.name, input.kind]) +} +``` + +This would alert that you have a deprecated manifest and print a message like: + +> Deployment/myDeployment: API extensions/v1beta1 for Deployment is no longer served by default, use apps/v1 instead. + +That's great! This is exactly what you need in order to avoid having old manifests lying around. But these are just the policies; you need something that will check these policies and put them into action. + +### Conftest + +This is where [Conftest][6] comes in. Conftest is a utility that allows you to put Rego policies into action against any number of configuration files. According to the repo, Conftest currently supports: + + +``` + - YAML + - JSON + - INI + - TOML + - HOCON + - HCL + - CUE + - Dockerfile + - HCL2 (Experimental) + - EDN + - VCL + - XML +``` + +It has some fairly strict defaults (i.e., expecting policy files to be in certain locations), but they can be overridden with the appropriate flags if you have a layout that you prefer. If you want to know more about those specifics, please consult the [documentation][7] in the repository. + +For example, you can run any policy file on Conftest with a command like: + + +``` +`helm template --set podSecurityPolicy.enabled=true --set server.ingress.enabled=true . | conftest -p mypolicy.rego -` +``` + +This would generate the appropriate output from a Helm template and pipe it directly to the Conftest utility. Conftest inspects that output against any policies defined in the **mypolicy.rego** file and then gives any appropriate warnings or errors for objects that match against those policies. You can, of course, swap out any templating tooling of your choice, or you can feed specific files directly to the Conftest tool. + +So now you have the tools to set your policies and enforce them against your configuration files. But how do you tie these two things together? Better yet: How do you automate this process to continuously monitor the codebase to make sure you never fall behind the deprecation line again? + +### Using Git to run checks + +There are many methods and tools to run checks against code. By adding similar steps to your continuous integration (CI) tooling (e.g., Jenkins, Tekton, etc.), you can accomplish the same goal. In this very basic use case, I used [GitHub Actions][8], a new feature of GitHub repositories. + +GitHub Actions allows you to automate your entire workflow, so you don't have to sit in front of your keyboard and hack all of this together. With Actions, you can string together any number of steps into a workflow (or multiple workflows) by either rolling your own Actions if you're doing something custom or, in most cases, using something that already exists in the [Marketplace][9]. Luckily, others have provided Actions to do the things you need to do for this example, so you can lean on the community's expertise to pull your workflow together. + +As described in the steps above, the workflow looks something like: + + 1. Retrieve the Deprek8 policy you need and store it somewhere for later use. + 2. Run Conftest against the appropriate files/charts with the policy file you grabbed in step 1. + + + +What does this boil down to? Well, all you really need to do is to use curl to pull your policy file and then run it through Conftest after pointing to your code, using the [curl][10] and [Conftest][11] Actions. Since these Actions already exist, you don't need to write any custom code! And as I'm sure you can tell by the names, they allow you to run the associated commands without having to do any custom work to pre-process anything or pull down any binaries. + +Now that you have the Actions you need to use, how do you pull them together? This is where your workflow comes into play. While Actions are the pieces of code that get things done, they're useless without a way to string them together so that they can be triggered by some event. A GitHub Action workflow will look something like this: + + +``` +name: Some Awesome Workflow Name +on: An Event That Triggers Our Workflow +jobs: +  awesome-job-name: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +      - name: awesome-step-name +        uses: someorg/someaction@version +        with: +          args: some args that I might pass to someaction +``` + +Now you have a workflow that has multiple steps, can be triggered by a specific GitHub event, and can be passed a set of parameters (if that is applicable to that specific Action). This example is _extremely basic_. But luckily, the workflow you're trying to put together is equally simple. This shouldn't be taken as a comprehensive example of a GitHub Action, as there are many more complicated (and elegant) things you can do. If you're interested in learning more, take a look at the [GitHub Actions documentation][12]. + +Now that you have an idea of what a workflow looks like and know what Actions you're interested in using, take a run at plugging the two together. For this example, you want to make sure that whenever your code is updated, it's checked to make sure it's not using any deprecated APIs. + +First, rig up your workflow with some names and the events that you want to trigger off of. Give your workflow and job a useful name that will help you identify it (and what it does). + + +``` +name: API Deprecation Check +on: pull_request, push +jobs: + deprecation-check: +``` + +Next, you need to tell your workflow that you want to trigger these Actions based on any **pull_request** or **push** that happens to this repository because these are the two main events that get new code into a repository. You can do this by utilizing the **on** keyword. + + +``` +name: API Deprecation Check +on: pull_request, push +jobs: +  deprecation-check: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +``` + +Then, add where you want these Actions to run and how the Action can get the code. You can tell the Action where to run by using the **runs-on** keyword. You have a few options here: Windows, Mac, or Ubuntu. In most cases, using Ubuntu is fine, as you'll frequently rely on Actions that run inside their own container (versus running on the base OS that you define here). It's also very important to understand that an Action does not check out code by default. When you need to do something that interacts with your code, make sure to use the Action **actions/checkout**. When this is included, your code will be available within your Action, and you can pass that through to the next step in your workflow. + + +``` +name: API Deprecation Check +on: pull_request, push +name: API Deprecation Check +jobs: +  deprecation-check: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +      - name: curl +        uses: wei/curl@master +        with: +          args: > /github/home/deprek8.rego +``` + +Now that your code is checked out, you can start preparing to do something with it. As mentioned, before you can check code for deprecations, you first need the file that contains the policies that you want to check for, so just retrieve the file using the **curl** Action. This is a fairly straightforward Action, in that it accepts whatever parameters you would normally pass into the curl command. If you were doing something more complicated, this is where you could pass in things like specific HTTP Actions, headers, etc. However, in this case, you're just trying to retrieve a file, so the only thing you need to pass to your Action is the URL you want to retrieve (in this case, the one that contains your raw policy file) and then tell it where you want to write that file. In this case, you're going to have it write to **/github/home**. Why? It's because this filesystem persists between steps and will allow you to use the policy file within this next step. + + +``` +name: API Deprecation Check +on: pull_request, push +jobs: +  deprecation-check: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +      - name: curl +        uses: wei/curl@master +        with: +          args: > /github/home/deprek8.rego +      - name: Check helm chart for deprecation +        uses: instrumenta/conftest-action/helm@master +        with: +          chart: nginx-test +          policy: /github/home/deprek8.rego +``` + +Now that you have your policy file, it's just a matter of running it against the code via **conftest**. Similar to the **curl** Action, the **conftest** Action just expects a series of parameters to understand how it should run against the code. In the example above, it runs against a Helm chart, but it can run against a specific file (or set of files) by changing the **uses** value to **instrumenta/[conftest-action@master][13]**. Just point to the path where your chart sits in the repository and then provide the path to your policy file (specified in the previous step). Once you have all of this together, you have a complete workflow. But what does this look like (assuming there's some bad code in your Helm chart)? To find out, take a look at the [example repository][14]. + +In the Nginx Helm chart, you'll notice that one of the templates is a [statefulset][15]. You may also notice that the apiVersion the StatefulSet is using is **apps/v1beta1**. This API was deprecated in Kubernetes 1.16 and is now hosted in **apps/v1**. So when your GitHub Actions workflow runs, it should detect this issue and serve an error like: + + +``` +FAIL - StatefulSetf/web: API apps/v1beta1 is no longer served by default, use apps/v1 instead. +Error: plugin "conftest" exited with error +##[error]Docker run failed with exit code 1 +``` + +The Action indicates there is something wrong and then fails the rest of the Action. You can see the [full workflow][16] if you are interested. + +### Wrapping up + +This workflow will save some future heartache by alerting you to any deprecated APIs that slip into your codebase. To be clear, this is an _alerting_ mechanism. This won't prevent you from merging bad code into your codebase. But, as long as you pay attention, you should be completely aware prior to (or just after) merging problematic code. + +Where do you go from here? Well, there are a few things to keep in mind. Currently, Deprek8 is up to date as of Kubernetes 1.16. If you're interested in more recent versions, I'm sure Deprek8 would be happy to accept your [pull request][3]. + +The other shortcoming of this method is that the **conftest** and GitHub Actions are a bit limited in that they only allow you to point at specific files or a single chart at a time. What if you want to point at multiple directories of manifests or have multiple charts inside your repository? Currently, the only way to get around that is to either list out every single file you're interested in (in the case of having multiple charts) or have multiple steps inside your workflow. Other scenarios could become problematic, like other templating engines that require some custom logic to pair the parameters and template files together. But a simple workaround for that could be to have a step in your workflow that pulls down Conftest along with a tiny inline script to loop through some of this. I'm sure there are more elegant solutions (and if you come up with one, I'm sure these projects would be more than happy to take a look at your PR). + +Regardless, you now have a mechanism that should allow you to sleep a bit easier when checking in your code! And hopefully, this method will help you build even more robust workflows to protect your code. + +* * * + +_This was originally published in [Tyler Auerbeck's GitHub repository][17] and is reposted, with edits, with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/deprek8 + +作者:[Tyler Auerbeck][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/tylerauerbeck +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://github.com/naquada/deprek8 +[4]: https://github.com/open-policy-agent/opa +[5]: https://blog.openpolicyagent.org/opas-full-stack-policy-language-caeaadb1e077 +[6]: https://github.com/instrumenta/conftest +[7]: https://github.com/instrumenta/conftest/tree/master/docs +[8]: https://github.com/features/actions +[9]: https://github.com/marketplace?type=actions +[10]: https://github.com/marketplace/actions/github-action-for-curl +[11]: https://github.com/instrumenta/conftest-action +[12]: https://help.github.com/en/actions +[13]: mailto:conftest-action@master +[14]: https://github.com/tylerauerbeck/deprek8-example +[15]: https://raw.githubusercontent.com/tylerauerbeck/deprek8-example/master/nginx-test/templates/statefulset.yaml +[16]: https://github.com/tylerauerbeck/deprek8-example/runs/426774566?check_suite_focus=true +[17]: https://github.com/tylerauerbeck/writing/blob/master/opa/deprek8.md diff --git a/sources/tech/20200328 Open source fights against COVID-19, Google-s new security tool written in Python, and more open source news.md b/sources/tech/20200328 Open source fights against COVID-19, Google-s new security tool written in Python, and more open source news.md new file mode 100644 index 0000000000..dce9c83a0e --- /dev/null +++ b/sources/tech/20200328 Open source fights against COVID-19, Google-s new security tool written in Python, and more open source news.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source fights against COVID-19, Google's new security tool written in Python, and more open source news) +[#]: via: (https://opensource.com/article/20/3/news-march-28) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Open source fights against COVID-19, Google's new security tool written in Python, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![][1] + +In this edition of our open source news roundup, we take a look open source solutions for COVID-19, Google's new security tool, code cleanup software from Uber, and more! + +### Using open source in the fight against COVID-19 + +When COVID-19 started its march around the world, open source [stepped up][2] to try to help stop it. That includes using open data to [create tracking dashboards and apps][3], designing ventilators, and developing protective gear. + +Scientists at the University of Waterloo in Canada have teamed with artificial intelligence firm DarwinAI to create an open source tool "[to identify signs of Covid-19 in chest x-rays][4]." Called COVID-Net, it's neural network "that is particularly good at recognizing images." The dataset the researchers are using is [available on GitHub][5], which includes a link the software. + +Additionally, many [open source hardware projects][6] are underway to expedite the search for a cure.  + +### Google releases tool to fight USB keystroke injection attacks + +One of the sneakiest and potentially most malicious ways to hack a computer is a USB keystroke injection attack. Using a compromised USB device connected to a computer, a hacker can run commands without you even noticing. Google's making it easier for Linux users to fight back against these kinds of attacks by releasing [an open source detection tool][7]. + +Called USB Keystroke Injection Protection, the tool detects "if the keystrokes have been made without human involvement". It does that by measuring "the timing of keystrokes coming from connected USB devices." Sebastian Neuner of Google's Information Security Engineering Team said that while the USB Keystroke Injection Protection tool isn't the last word in defense against these kinds of attacks, but offers "another layer of protection and to defend a user sitting in front of their unlocked machine by them seeing the attack happening." + +You can find the Python source code for the tool [on GitHub][8]. + +### Uber makes code deletion tool open source + +As applications get bigger, they often contain code that's either no longer used or which is obsolete. That added code make software more difficult to maintain. To help solve the problem of quickly finding that redundant code, Uber recently [open sourced a tool called Pirhana][9]. + +Pirhana scans code for [feature flags][10], looking for ones that are no longer used. The software then deletes the unused flags from the code. At the moment, Pirhana works with software written in the Objective-C, Swift, and Java languages. Uber's developers hope the number of supported languages will increase "now that outside developers have an opportunity to contribute to the project." + +You can grab [Pirhana's source code][11] from its repository on GitHub + +#### In other news + + * [Singapore government to open source contact-tracing protocol][12] + * [European Commission to use open source messaging service Signal][13] + * [Spanish software to computerize healthcare in Cameroon and India][14] + * [ING Open-Sources Lion, Its White-Label Web Component Library][15] + * [Open Source Goes Mainstream – How Sharing Is Shaping The Future Of Music][16] + + + +Thanks, as always, to Opensource.com staff members and [Correspondents][17] for their help this week. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/news-march-28 + +作者:[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/weekly_news_roundup_tv.png?itok=tibLvjBd +[2]: https://jaxenter.com/covid-19-open-source-170237.html +[3]: https://opensource.com/article/20/3/open-source-software-covid19 +[4]: https://www.technologyreview.com/s/615399/coronavirus-neural-network-can-help-spot-covid-19-in-chest-x-ray-pneumonia/ +[5]: https://github.com/lindawangg/COVID-Net +[6]: https://opensource.com/article/20/3/open-hardware-covid19 +[7]: https://www.zdnet.com/article/google-linux-systems-can-use-this-new-tool-against-usb-keystroke-injection-attacks/ +[8]: https://github.com/google/ukip +[9]: https://siliconangle.com/2020/03/17/ubers-open-source-piranha-tool-hunts-redundant-application-code/ +[10]: https://en.wikipedia.org/wiki/Feature_toggle +[11]: https://github.com/uber/piranha +[12]: https://www.computerweekly.com/news/252480501/Singapore-government-to-open-source-contact-tracing-protocol +[13]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/signal-messaging-service +[14]: https://intallaght.ie/spanish-software-to-computerize-healthcare-in-cameroon-and-india/ +[15]: https://www.infoq.com/articles/ing-open-sources-lion-web-component/ +[16]: https://www.forbes.com/sites/andreazarczynski/2020/03/19/open-source-goes-mainstream--how-sharing-is-shaping-the-future-of-music/#9e1ca1290013 +[17]: https://opensource.com/correspondent-program diff --git a/sources/tech/20200329 Nextcloud- The Swiss Army Knife of Remote Working Tools.md b/sources/tech/20200329 Nextcloud- The Swiss Army Knife of Remote Working Tools.md new file mode 100644 index 0000000000..82d84f984b --- /dev/null +++ b/sources/tech/20200329 Nextcloud- The Swiss Army Knife of Remote Working Tools.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Nextcloud: The Swiss Army Knife of Remote Working Tools) +[#]: via: (https://itsfoss.com/nextcloud/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Nextcloud: The Swiss Army Knife of Remote Working Tools +====== + +Remote working culture has been booming for past few years in coding, graphics and other IT related fields. But the recent [Coronavirus pandemic][1] has made it mandatory for the companies to work from home if it’s possible for them. + +While there are tons of tools to help you and your organization in working from home, let me share one open source software that has the features of several such tools combined into one. + +### Nextcloud Hub: A Suite of Essential Tools for Remote Collaboration + +[Nextcloud][2] is an open source software that can be used to store files, photos and videos for personal usage like Dropbox. But it’s more than just a private [cloud service][3]. + +You can add more than one users in Nextcloud and turn it into a collaboration platform for editing files in real time, chat with users, manage calendars, assign and manage tasks and more. + +This video gives a good overview of its main features: + +[Subscribe to our YouTube channel for more Linux videos][4] + +### Main Features of Nextcloud + +Let me highlight the main features of Nextcloud: + +#### Sync files and share + +![Nextcloud Files][5] + +You can create workspaces based on user groups and share files in those folders. Users can create private files and folders and share them with selected users internally or externally (if they are allowed to). You can lock files in read only mode as well. + +It also has a very powerful search feature that lets you search files from their name or tags. You can comment on files to provide feedback. + +Text files can be edited in real time thanks to its builtin markdown editor. You can use OnlyOffice or Collabora to allow editing of docs, spreadsheet and presentations in real time. + +It also has version control for the files so that you can revert changes easily. + +#### Text Chat, Audio Chat, Video Chat and Web Meetings + +![Nextcloud Video Call][6] + +With NextCloud Talk, you can interact with other users by text messaging, audio calls, video calls and group calls for web meetings. You can also take meeting minutes during the video calls and share your screen for presentations. There is also a mobile app to stay connected all the time. + +You can also create Slack like channels (known as circles) to communicate between members concerned with a specific topic. + +#### Calendar, Contacts & Mail + +![Calendar Nextcloud][7] + +You can manage all of your organization’s contact, divide them into groups based on departments. + +With the calendar, you can see when someone is free or what meetings are taking place, like you do on Outlook. + +You can also use the Mail feature and import the emails from other providers to use them inside Nextcloud interface. + +#### Kanban project management with Deck + +![][8] + +Like Trello and Jira, you can create boards for various projects. You can create cards for each tasks, assign them to users and they can move it between the list based on the status of the task. It’s really up to you how you create boards to manage your projects in Kanban style. + +#### Plenty of add-ons to get more out of Nextcloud + +![Password Manager][9] + +Nextcloud also has several add-ons (called apps). Some are developed by Nextcloud teams while some are from third-party developers. You may use them to extend the capability of Nextcloud. + +For example, you can add a [Feedly style feed reader][10] and read news from various sources. Similarly, the [Paswords addon][11] lets you use Netxcloud as a password manager. You can even share common passwords with other Nextcloud users. + +You can explore [all the apps on its website][12]. You’ll also notice the ratings of apps that will help you decide if you should use an app or not. + +#### Many more features + +Let me summarize all the features here: + + * Open source software that lets you own your data on your own servers + * Seamlessly edit office documents together with others + * Communicate with other members of your organization and do audio and video calls and held web meetings + * Calendar lets you book meetings, brings busy view for meetings and resource booking and more + * Manage users locally or authenticate through LDAP / Active Directory, Kerberos and Shibboleth / SAML 2.0 and more + * Secure data with powerful file access control, multi-layer encryption, machine-learning based authentication protection and advanced ransomware recovery capabilities + * Access existing storage silos like FTP, Windows Network Drives, SharePoint, Object Storage and Samba shares seamlessly through Nextcloud. + * Automation: Automatically turn documents in PDFs, send messages to chat rooms and more! + * Built in ONLYOFFICE makes collaborative editing of Microsoft Office documents accessible to everyone + * Users can install desktop and mobile apps or simply use it in web browser + + + +### How to get Nextcloud + +![][13] + +NextCloud is free and open source software. You can download it and install it on your own server. + +You can use cloud server providers like [Linode][14] or [DigitalOcean][15] that allow you to deploy a brand new Linux server within minutes. And then you can use Docker to install NextCloud. At It’s FOSS, we use [Linode][14] for our NextCloud instance. + +If you don’t want to do that, you can [signup with one of the Nextcloud partners][16] that provide you with configured Nextcloud instance. Some providers also provide a few GB of free data to try it. + +Nextcloud also has an [enterprise plan][17] where Nextcloud team itself handles everything for the users and provide premium support. You can check their pricing [here][18]. + +If you decide to use Nextcloud, you should refer to its documentation or community forum to explore all its features. + +### Conclusion + +At It’s FOSS, our entire team works remote. We have no centralized office anywhere and all of us work from our home. Initially we relied on non-open source tools like Slack, Google Drive etc but lately we are migrating to their open source alternatives. + +Nextcloud is one of the first software we tried internally. It has features of Dropbox, Google Docs, [Slack][19], [Trello][20], Google Hangout all combined in one software. + +NextCloud works for most part but we found it struggling with the video calls. I think that has to do with the fact that we have it installed on a server with 1 GB of RAM that also runs some other web services like [Ghost CMS][21]. We plan to move it to a server with better specs. We’ll see if that should address these issues. + +Since the entire world is struggling with the Coronavirus pandemic, using a solution like Nextcloud could be helpful for you and your organization in working from home. + +How are you coping during the Coronavirus lockdown? Like [Linus Torvalds’ advice on remote working][22], do you also have some suggestion to share with the rest of us? Please feel free to use the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/nextcloud/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/2019%E2%80%9320_coronavirus_pandemic +[2]: https://nextcloud.com/ +[3]: https://itsfoss.com/cloud-services-linux/ +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud_files.png?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud_video_call.jpg?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/calendar_nextcloud.jpeg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud_kanban_project_management_app.jpeg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/passman.png?fit=800%2C389&ssl=1 +[10]: https://apps.nextcloud.com/apps/news +[11]: https://apps.nextcloud.com/apps/passwords +[12]: https://apps.nextcloud.com/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud-feature.jpg?ssl=1 +[14]: https://www.linode.com/?r=19db9d1ce8c1c91023c7afef87a28ce8c8c067bd +[15]: https://m.do.co/c/d58840562553 +[16]: https://nextcloud.com/signup/ +[17]: https://nextcloud.com/enterprise/ +[18]: https://nextcloud.com/pricing/ +[19]: https://slack.com/ +[20]: https://trello.com/ +[21]: https://itsfoss.com/ghost-3-release/ +[22]: https://itsfoss.com/torvalds-remote-work-advice/ diff --git a/sources/tech/20200330 Access control lists and external drives on Linux- What you need to know.md b/sources/tech/20200330 Access control lists and external drives on Linux- What you need to know.md new file mode 100644 index 0000000000..079e775ce1 --- /dev/null +++ b/sources/tech/20200330 Access control lists and external drives on Linux- What you need to know.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Access control lists and external drives on Linux: What you need to know) +[#]: via: (https://opensource.com/article/20/3/external-drives-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Access control lists and external drives on Linux: What you need to know +====== +Learn how to use external drives correctly on Linux. +![Penguin driving a car with a yellow background][1] + +While cloud storage offers many advantages, there's nothing quite like having your data on a physical hard drive. When you save data to a drive, you know exactly where your data is, and it's always available when you need it. When you save data to an external portable drive like a USB thumb drive, it's even better—not only do you know where your data is, but you can take your data with you everywhere you go. If you're new to [Linux][2], or you're trying to use a Linux file system on an external drive, you might find external drives confusing, being prone to permission errors or conflicts, or even losing metadata. + +There are two "right" answers to this: + +### ExFAT + +Formerly, ExFAT was a file system fraught with legal threats from Microsoft because they own the code. They've sued companies and organizations before to defend their ownership of FAT, so it was commonly feared that they could do the same over ExFAT. However, recently. Microsoft made the specifications for ExFAT open source. They didn't provide a driver, unfortunately, but there's an existing drive to make it function on Linux, and, now that developers have access to the full specs, improvements are inevitable. + +The advantage of ExFAT is that it's cross-platform (Windows, Mac, and many portable devices use it), and it's designed without the overhead of file permissions. You can attach a drive formatted as ExFAT to any computer, and all files are available to anyone. Whether that's good or bad depends on your use case, but for portable media, that's often exactly the intent. + +### Access control lists (ACL) + +If you prefer to use a Linux file system on your portable drive, then you can do that, but to make sharing files seamless, you should use access control lists (ACL). + +When you create a file or directory on a drive, there are defaults on your system determining what file permissions it gets. For most cases, those defaults make sense—when you create a file in your home directory, you probably don't want other users to have access to that file. However, when you're creating a file on an external drive, there's a high likelihood that it's because you need to share that file with someone else (even if that someone is you on another computer). + +You can override default permissions for file viewing with an ACL, and you can control default file creation mode by setting a sticky bit. An ACL is a layer of security policies in the extended attributes of directories and files. It allows you to specify exceptions to what the file system permissions indicate. Most notably, this allows you to transcend the single-owner and single-group model of traditional UNIX permissions. + +For instance, while the **seth** (ID 1000) account might own a directory created on my desktop, **seth** (ID 500) on my laptop does not, because the user IDs are different. + +The same could be true for a group. If a directory with group ID 1000 is assigned to a directory on one computer, then a group with an ID 500 or 10922 doesn't have access to it on another computer. But an ACL can add secondary owners and groups to directories and files. + +#### View the current ACL + +Any directory and file on any common Linux filesystem has ACL rules by default. They're stored in extended attributes, a kind of metadata that you don't normally see. + +You can view them in the terminal: + + +``` +$ getfacl ./example +# file: /run/media/drive/example +# owner: seth +# group: users +user::rwx +group::rwx +other::r-- +``` + +The commented lines are just for your reference; they tell you the path, and the owner and group, of the file or directory you're viewing information about. The next lines display the rules applied to the file or directory. In this example, the user permissions are set to **rwx**, the group to **r-x**, and other to **r-x**. These permissions are reflected by a normal filesystem list: + + +``` +$ ls -lA /run/media/drive +drwxrwxr-- 26 seth users 4096 Jan 16 21:04 example +$ id +uid=1000(seth) gid=100(users) groups=100(users)... +``` + +As long as user **seth** (UID 1000) or a member of **group** (GID 100) interacts with the **example** directory, full access is granted. Any other account, however, has only read (**r**) permission. + +#### Setting an ACL + +To modify an ACL, you use the **setfacl** command or use a file manager with ACL support. You can be very specific or very generic when setting your ACL. + +To just modify the filesystem permission settings, you can use either **chmod** or **setfacl**. This is a very generic ACL setting because you're not adding anything to the permissions already available to UNIX from the filesystem specification. + + +``` +$ setfacl --modify g::r example +$ getfacl ./example | grep "group::" +group::r-- +$ ls -l . | grep example +drwxr--r-- 26 seth users 4096 Jan 16 21:04 example +``` + +The same effect is available through **chmod**: + + +``` +$ chmod g+x example +$ getfacl ./example | grep "group::" +group::r-x +$ ls -l . | grep example +drwxr-xr-- 26 seth users 4096 Jan 16 21:04 example +``` + +#### Adding users and groups + +To really benefit from an ACL is to use it for permissions outside the scope of native UNIX permissions. If I'm logged into my desktop as **seth** with user ID 1000, and I know that a directory on my portable drive needs to be usable by **seth** with ID 500 on my laptop, then just declaring **seth** as owner isn't enough because the user IDs aren't the same. + +You can add a user or user ID to an access control list: + + +``` +$ setfacl --modify u:500:rwx example +$ getfacl example +# file: /run/media/drive/example +# owner: seth +# group: users +user::rwx +user:500:rwx +[...] +``` + +A new entry, specific to user ID 500, has been added to the list. Attaching the drive to another Linux or UNIX computer now allows the user with ID 500 to access the **example** folder. + +You can also add users by account name, or groups by either group name or group ID. The IDs are what really count with permissions, though, so if you're in a mixed environment (RHEL servers and Elementary clients, for example), you should verify the user IDs and group IDs lurking behind accounts that seem, on the surface, identical. + +#### Setting default ACL rules + +If you treat access control as a one-time setting, you'll quickly run into problems once your different user accounts start creating files and directories. Any new file or directory created by each user inherits the system's default permissions (and ACL). This means that once laptop user **seth** with ID 500 creates a file in a directory, it could be off-limits to desktop user **seth** with ID 1000 because the owner of the file is set to UID 500. + +A default ACL can be applied to directories so that files and subdirectories created within them inherit the parent ACL. You can set the default ACL of a directory with the **–default** option: + + +``` +$ setfacl --default --modify u:500:rwx example +$ setfacl --default --modify u:1000:rwx example +$ getfacl --omit-header example +user::rwx +user:500:rwx +group::rw- +mask::rwx +other::r-x +default:user::rwx +default:group::rw- +default:group:500:rwx +default:group:1000:rwx +default😷:rwx +default:other::r-x +``` + +When a user creates a new directory within the **example** directory, the inherited ACL is the same as its parent: + + +``` +$ cd example +$ mkdir penguins +$ getfacl --omit-header penguins +user::rwx +group::rw- +group:500:rwx +group:1000:rwx +mask::rwx +other::r-x +default:user::rwx +default:group::rw- +default:group:500:rwx +default:group:1000:rwx +default😷:rwx +default:other::r-x +``` + +This means that any directory or file created inherits the same ACL, so neither user 500 or 1000 are ever excluded from access. + +#### Pragmatic ACL for external drives + +When using a Linux filesystem for external drives, the easy method of ensuring it works with all the users who expect to use the portable drive is to set an ACL on a single top-level directory. + +For instance, assume you have formatted a USB drive called **mydrive** as an ext4 filesystem. You want your account on your laptop and your desktop, as well as your colleague Alice, to be able to access the files. + +First, create a directory at the top level of the drive: + + +``` +$ mkdir /mnt/mydrive/umbrella +``` + +Then apply an ACL to the top-level directory to grant all-important users access: + + +``` +$ setfacl --modify \ +  u:500:rwx,u:1000:rwx,u:alice:rwx \ +  /mnt/mydrive/umbrella +``` + +Finally, apply a default ACL so that all directories and files created within the top-level directory **umbrella** inherit the same default ACL (note that this command uses the short version of **–modify**): + + +``` +$ setfacl --default -m u:500:rwx,u:1000:rwx,u:alice:rwx \ +  /mnt/mydrive/umbrella +``` + +#### Applying defaults to an existing system + +If you need to apply ACL settings to many files that already exist, you can accomplish that with the **find** command. + +First, find all directories and apply ACL rules: + + +``` +$ find /mnt/mydrive/umbrella -type d | \ +  parallel --max-args=6 setfacl \ +  --default -m u:500:rwx,u:1000:rwx,u:alice:rwx +``` + +It's not wise to indiscriminately set all file permissions to executable, so next, find all files and set permissions to **re**. Files that require an executable bit can be set manually or by file extension: + + +``` +$ find /mnt/mydrive/umbrella -type f | \ +  parallel --max-args=6 setfacl \ +  --default -m u:500:rw,u:1000:rw,u:alice:rw +``` + +Adjust the logic of these commands to suit your individual need (don't run a command that removes the executable bit on **/usr**, for instance, or on a directory containing nothing but executable programs). + +### External drives + +Don't let confusion around external drives on Linux get the best of you, and don't limit yourself to traditional UNIX permissions. Put access control lists to work for you, and feel free to use native journaled Linux filesystems on your portable drives. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/external-drives-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://opensource.com/resources/linux diff --git a/sources/tech/20200330 Why I switched from Mac to Linux.md b/sources/tech/20200330 Why I switched from Mac to Linux.md new file mode 100644 index 0000000000..95561b6b45 --- /dev/null +++ b/sources/tech/20200330 Why I switched from Mac to Linux.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I switched from Mac to Linux) +[#]: via: (https://opensource.com/article/20/3/mac-linux) +[#]: author: (Lee Tusman https://opensource.com/users/leeto) + +Why I switched from Mac to Linux +====== +After 25 years, Lee made the switch to Linux and couldn't be happier. +Here's what he uses. +![Code going into a computer.][1] + +In 1994, my family bought a Macintosh Performa 475 as a home computer. I had used Macintosh SE computers in school and learned to type with [Mavis Beacon Teaches Typing][2], so I've been a Mac user for well over 25 years. Back in the mid-1990s, I was attracted to its ease of use. It didn't start with a DOS command prompt; it opened to a friendly desktop. It was playful. And even though there was a lot less software for Macintosh than PCs, I thought the Mac ecosystem was better, just on the strength of KidPix and Hypercard, which I still think of as the unsurpassed, most intuitive _creative stack_. + +Even so, I still had the feeling that Mac was an underdog compared to Windows. I remember thinking the company could disappear one day. Flash-forward decades later, and Apple is a behemoth, a trillion-dollar company. But as it evolved, it changed significantly. Some changes have been for the better, such as better stabilization, simpler hardware choices, increased security, and more accessibility options. Other changes annoyed me—not all at once, but slowly. Most significantly, I am annoyed by Apple's closed ecosystem—the difficulty of accessing photos without iPhoto; the necessity of using iTunes; and the enforced bundling of the Apple store ecosystem even when I don't want to use it. + +Over time, I found myself working largely in the terminal. I used iTerm2 and the [Homebrew][3] package manager. I couldn't get all my Linux software to work, but much of it did. I thought I had the best of both worlds: the macOS graphical operating system and user interface alongside the ability to jump into a quick terminal session. + +Later, I began using Raspberry Pi computers booting Raspbian. I also collected a number of very old laptops rescued from the trash at universities, so, by necessity, I decided to try out various Linux distros. While none of them became my main machine, I started to really enjoy using Linux. I began to consider what it would be like to try running a Linux distro as my daily driver, but I thought the Macbook's comfort and ease, especially the hardware's size and weight, would be hard to find in a non-Mac laptop. + +## Time to make the switch? + +About two years ago, I began using a Dell for work. It was a larger laptop with an integrated GPU, and dual-booted Linux and Windows. I used it for game development, 3D modeling, some machine learning, and basic programming in C# and Java. I considered making it my primary machine, but I loved the portability of my Macbook Air, and continued to use that as well. + +Last fall, I started to notice my Air was running hot, and the fan was coming on more often. My primary machine was starting to show its age. For years, I used the Mac's terminal to access Darwin's Unix-like operating system, and I was spending more and more time bouncing between the terminal and my web browser. Was it time to make the switch? + +I began exploring the possibilities for a Macbook-like Linux laptop. After doing some research, reading reviews and message boards, I went with the long-celebrated Dell XPS 13 Developer Edition 7390, opting for the 10th Generation i7. I chose it because I love the feel of the Macbook (and especially the slim Macbook Air), and reviews of the XPS 13 suggested it seemed it was similar, with really positive reviews of the trackpad and keyboard. + +Most importantly, it came loaded with Ubuntu. While it's easy enough to get a PC, wipe it, and install a new Linux distro, I was attracted to the cohesive operating system and hardware, but one that allowed a lot of the customization we know and love in Linux. So when there was a sale, I took the plunge and purchased it. + +## What it's like to run Linux daily + +I've been using the XPS 13 for three months and my dual-booted Linux work laptop for two years. At first, I thought I'd want to spend more time finding an alternate desktop environment or window manager that was more Mac-like, such as [Enlightenment][4]. I tried several, but I have to say, I like the simplicity of running [GNOME][5] out of the box. For one thing, it's minimal; there's not much GUI to get caught up in. In fact, it's intuitive and the [overview][6] takes only a couple minutes to read.  + +I can access my applications through the application dash bar or a grid button to get to the application view. To access my file system, I click on the **Files** icon in the dash. To open the GNOME terminal, I type **Ctrl+Alt+T** or just **Alt+Tab** to switch between an open application and an open terminal. It's also easy to define your own [custom hotkey shortcuts][7]. + +Beyond this, there's not much else to say. Unlike the Mac's desktop, there's not a lot to get lost in, which means there's less to distract me from my work or the applications I want to run. I didn't realize all the options or how much time I spent navigating windows on my Mac. In Linux, there are just files, applications, and the terminal. + +I installed the [i3 tiling window manager][8] to do a test run. I had a few issues configuring it because I type in [Dvorak][9], and i3 doesn't adapt to the alternate keyboard configuration. I think with more effort, I could figure out a new keyboard mapping in i3, but the main thing I was looking for was simple tiling. + +I looked up GNOME's tiling capabilities and was pleasantly surprised. You press the **Super** key (for me, it's the key with the Windows logo—which I should cover with a sticker!) and then a modifier key. For example, pressing **Super+Left** moves your current window to a tile on the left side of the screen. **Super+Right** moves to the right half. **Super+Up** maximizes the current window. **Super+Down** reverts to the previous size. You can move between app windows with **Alt+Tab**. This is all default behavior and can be customized in the Keyboard settings. + +Plugging in headphones or connecting to HDMI works the way you expect. Sometimes, I open the Sound settings to switch between the HDMI sound output or my external audio cable, just as I would on a Mac or PC. The trackpad is responsive, and I haven't noticed any difference from the Macbook's. When I plug in a three-button mouse, it works instantly, even with my Bluetooth mouse and keyboard. + +### Software + +I installed Atom, VLC, Keybase, Brave Browser, Krita, Blender, and Thunderbird in a matter of minutes. I installed other software with the Apt package manager in the terminal (as normal), which offers many more packages than the Homebrew package manager for macOS. + +### Music + +I have a variety of options for listening to music. I use Spotify and [PyRadio][10] to stream music. [Rhythmbox][11] is installed by default on Ubuntu; the simple music player launches instantly and without any bloat. Simply click on the menu, choose **Add Music**, and navigate to a directory of audio tracks (it searches recursively). You can also stream podcasts or online radio easily. + +### Text and PDFs + +I tend to write in Markdown in [Neovim][12] with some plugins, then convert my document using Pandoc to whatever final format is needed. For a nice Markdown editor with preview, I downloaded [Ghostwriter][13], a minimal-focus writing application. + +If someone sends me a Microsoft Word document, I can open it using the default LibreOffice Writer application. + +Occasionally, I have to sign a document. This is easy with macOS's Preview application and my signature in PNG format, and I needed a Linux equivalent. I found that the default PDF viewer app didn't have the annotation tools I needed. The LibreOffice Draw program was acceptable but not particularly easy to use, and it occasionally crashed. Based on some research, I installed [Xournal][14], which has the simple annotation tools I need to add dates, text, and my signature and is fairly comparable to Mac's Preview app. It works exactly as needed. + +### Importing images from my phone + +I have an iPhone. To get my images off the phone, there are a number of methods to sync and access your files. If you have a different phone, your process may be different. Here's my method: + + 1. Install gvfs-backends with **sudo apt install gvfs-backends**, which is part of the GNO \ No newline at end of file diff --git a/sources/tech/20200401 How does kanban relate-to DevOps.md b/sources/tech/20200401 How does kanban relate-to DevOps.md new file mode 100644 index 0000000000..3f37c35a4c --- /dev/null +++ b/sources/tech/20200401 How does kanban relate-to DevOps.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How does kanban relate to DevOps?) +[#]: via: (https://opensource.com/article/20/4/kanban-devops) +[#]: author: (Willy-Peter Schaub https://opensource.com/users/wpschaub) + +How does kanban relate to DevOps? +====== +Reduce waste, optimize the flow of value, and continuously deliver value +to delighted users. +![two women kanban brainstorming and brainmapping with post-it notes on a whiteboard ][1] + +Kanban is nothing new; in fact, it predates most readers of this article. Its age becomes apparent when we add the year Toyota introduced kanban in its main plant machine shop (1953) to the timeline image from our [analyzing the DNA of DevOps][2] article. + +![DevOps timeline][3] + +I have intuitively been using kanban, in one form or the other, for more than two decades to track personal plans, engineering projects, and digital transformations. Only in the past few weeks have I pondered the origins, power, and synergy of kanban with other frameworks and systems, while introducing teams to kanban and helping them embrace it as a powerful system in our common engineering system. + +### What is kanban? + +Kanban means "visual signal" and has its roots in the Toyota manufacturing industry. It was developed by [Taiichi Ohno][4] to improve manufacturing efficiency. When we jump a few decades into the future, kanban complements agile and lean, often used with frameworks such as scrum, Scaled Agile Framework, and Disciplined Agile to visualize and manage work. + +![Kanban complements agile and lean][5] + +You can explore the many interpretations of kanban on the internet, in books, and in vibrant discussions with other engineers who have embraced the system. In the context of our common collaboration and engineering system, kanban delivers four pivotal practices: + + * **Visualize work:** We visualize all work and look for triggers such as cards turning **red** when the work they represent is blocked or has been dormant for more than two days. + * **Limit work in progress:** We agree on and enforce (soft) work-in-progress limits to encourage reduced batch sizes and manage queue lengths. + * **Focus on flow:** We _pull_ not push work, which helps us to defer commitment until we meet our definition of done (_DoD_) and we have the capacity to commit to the next _activity_. + * **Continuous improvement:** It is important to measure work from when it enters our backlog, how long it takes to get through the process (lead time), and how efficient we are working (cycle/lead time). This enables us to continuously inspect and improve how we work and track progress. + + + +![Kanban practices and terminology][6] + +We use colorful, visual cards to represent activities that flow through one or more _activities_ in one of many _swim lanes_. Each kanban column represents an activity, and each swim lane represents a person, group, or another bucket to segment the cards. There are no rules for the color of the cards, but **red** typically signals a problem. But remember to combine color with a meaningful icon to visualize special states for users who are color-blind. + +> "_We should defer commitment until our Definition of Ready (DOR) is met so that we can ensure that our Definition of Done (DOD) is achieved sooner and with high quality. I like the two distinct terms (DOR and DOD) because the [project owner] should be accountable for the DOR while the team can take ownership of the DOD_." —[Mathew Mathai][7] + +I often use this analogy to explain the difference between _lead_ and _cycle_ time to new teams: Imagine you walk into a restaurant. You sit down, study the menu, and decide what you would like to drink and eat. When the waiter takes your order, the _lead_ cycle time starts ticking. When the bar starts pouring your favorite potion and the kitchen starts preparing your meal, the _cycle_ time starts ticking. As the order arrives at your table, both the lead and cycle time are stopped if (and only if) you are satisfied. + +Therefore, the _lead_ time measures how long you, the customer, had to wait until you received your order. The _cycle_ time measures the process time of an activity to prepare your order. From a customer perspective, the _lead_ time is important. + +It is important to _make your policies explicit_, such as when you start measuring lead and cycle times. Some customers start their "impatience" clock when they enter the restaurant, while others start the clock when they place their order. In both cases, they need to understand how you measure your flow to avoid misunderstandings, unfeasible expectations, and disappointment. + +This image is extracted from one of our information transfer posters, and it summarizes key learnings when we started adopting the kanban system. + +![Key kanban learnings][8] + +### What about DevOps? + +In _[Using PowerShell to automate Linux, macOS, and Windows processes][9]_, we briefly introduced value-stream mapping. It enables us to measure individual and total lead times, cycle times, efficiency, and quality and unearth different activities, groups, and silos that cancel out each other. + +![value-stream mapping][10] + +You will notice a similarity between the kanban board and the value-stream mapping images. Both _visualize_ and _focus_ on the flow of activities represented by individual cards pulled across a visual board. + +![Continuous delivery pipeline][11] + +Continuous flow and efficiency are core to a healthy DevOps mindset. It transforms into a continuous delivery pipeline, as shown above, which unites different teams, such as business, development, security, and quality assurance, to implement ideas from ideation to production. Continuously measuring and streamlining the delivery pipeline not only helps improve the flow of value, but also the quality of value. + +It should be evident that (similar to kanban) the focus here is on flow. Flipping back and forth between activities is frowned upon in kanban and impractical with continuous delivery pipelines. It reminds me of a recent whiteboard discussion where we discussed the challenge of visualizing and managing the flow of work that requires two teams. + +![Dividing a job between two teams][12] + +As shown here, we slice a job that requires team X to perform activities, then team Y, and again team X, into three stories. The three stories are visualized by three cards on two kanban boards, flowing from A to B to C, with clear ownership by team X and Y, which we can measure independently as lead and cycle time. + +We are drifting into another exciting topic of flow optimization … let's get back to the original question. + +### What is the relationship between kanban and DevOps? + +[Donovan Brown][13] defines DevOps as "_the union of people, process, and products to enable continuous delivery of value to our end users._" + +When we unpack this definition, we realize that the core of the DevOps [mindset][14] is to continuously deliver value and delight our customers. + + * _"Feedback from stakeholders is essential."_ + * _"Improve beyond the limits of today's processes."_ + * _"No new silos to break down silos."_ + * _"Knowing your customers means cross-organization collaboration."_ + * _"Inspire adoption through enthusiasm."_ + + + +The kanban system helps us visualize and improve the efficiency of value delivery, resulting in delighted customers. I argue that if you are comfortable with kanban, you will enjoy the full benefits of DevOps through _visualization_, _flow improvement_, _feedback_, and _continuous innovation_. + +We have collaboration at its finest—_synergy_**,** or is that _symbiosis_? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/kanban-devops + +作者:[Willy-Peter Schaub][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/wpschaub +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/whiteboard-brainstorming-brainmapping-design-thinking-postits-kanban.png?itok=Is2Tg1Jk (Brainstorming with post-it notes on a whiteboard) +[2]: https://opensource.com/article/18/11/analyzing-devops +[3]: https://opensource.com/sites/default/files/uploads/devops-timeline.png (DevOps timeline) +[4]: https://en.wikipedia.org/wiki/Taiichi_Ohno +[5]: https://opensource.com/sites/default/files/uploads/kanban-agile-lean-devops.png (Kanban complements agile and lean) +[6]: https://opensource.com/sites/default/files/uploads/kanban-practices-terms.png (Kanban practices and terminology) +[7]: https://opensource.com/users/anicheinc +[8]: https://opensource.com/sites/default/files/uploads/kanban-key-learnings.png (Key kanban learnings) +[9]: https://opensource.com/article/20/2/devops-automation +[10]: https://opensource.com/sites/default/files/uploads/value-stream-mapping.png (value-stream mapping) +[11]: https://opensource.com/sites/default/files/uploads/cd-pipeline.png (Continuous delivery pipeline) +[12]: https://opensource.com/sites/default/files/uploads/splitting-jobs.png (Dividing a job between two teams) +[13]: https://www.donovanbrown.com/post/what-is-devops +[14]: https://opensource.com/article/19/5/values-devops-mindset diff --git a/sources/tech/20200403 Building a sensing prosthetic with the Raspberry Pi.md b/sources/tech/20200403 Building a sensing prosthetic with the Raspberry Pi.md new file mode 100644 index 0000000000..0eef549525 --- /dev/null +++ b/sources/tech/20200403 Building a sensing prosthetic with the Raspberry Pi.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a sensing prosthetic with the Raspberry Pi) +[#]: via: (https://opensource.com/article/20/4/raspberry-pi-sensebreast) +[#]: author: (Kathy Reid https://opensource.com/users/kathyreid) + +Building a sensing prosthetic with the Raspberry Pi +====== +SenseBreast is an early prototype of a sensing mastectomy prosthetic +based on open hardware. +![Open source doctor.][1] + +_Content advisory: this article contains frank discussions of breast cancer._ + +What's the first question you ask your surgeon when you're discussing reconstruction options after breast cancer? + +"How many USB ports can you give me?" is probably not the one that comes to mind for many people! + +Although the remark was said jokingly, it sparked a thread that would ultimately become [SenseBreast][2]—an early prototype of a sensing mastectomy prosthetic, based on open hardware. + +### How did SenseBreast come about? + +All technology has a history—an origin story of experimentation, missteps, successes, setbacks, and breakthroughs. SenseBreast is no different. SenseBreast was developed as a term project for the Masters of Applied Cybernetics—a highly selective course at the Australian National University's [3A Institute][3]. The mission of the 3Ai is to bring artificial intelligence and cyber-physical systems safely, responsibly, and sustainably to scale. The purpose of the assignment was to explore the nexus between the electronic, virtual world, and the physical, tactile world. + +### What is SenseBreast? + +SenseBreast combines two distinct elements: a cyber component—electronics, sensors, and storage for gathering data, and a physical component—a breast form designed to be worn inside a mastectomy bra. SenseBreast is a rudimentary cyber-physical system. In cyber-physical systems, physical and software components are deeply intertwined and interact in different ways depending on context. + +The SenseBreast draws on a rich heritage of open source hardware and software. Based on the Raspberry Pi 3B+, it uses the Debian-flavored Raspbian operating system, Python to interact with the onboard sensors, and d3.js to visualize the data that the sensors generate. + +Early versions of the SenseBreast used the SenseHAT, but in the true spirit of open source collaboration, I partnered with Australian open source luminary Jon Oxer to develop a custom SenseBreast board. This contains an inertial motion unit (IMU) and temperature, humidity, and pressure sensors, just like the SenseHAT, but in addition, it contains the BME680 volatile gas sensor and a breakout for a heart rate monitor. + +![SenseBreast open hardware board developed by Jon Oxer and Kathy Reid][4] + +SenseBreast is wearable tech, so the physical form of the cyber-physical system is also important. Factors like comfort, texture, and fit in clothing are important in the design of wearables because technology isn't better unless it's better for people! The early attempts at building a housing for SenseBreast were spectacular failures; in fact, the very first iteration was put together using acrylic render and linen cloth, and held together with paper clips—in true hacker style! It wasn't comfortable to wear at all, but it served as a proof point for further exploration. + +![First attempt at creating a breast form using acrylic render covered in linen cloth][5] + +Later iterations used a different approach. This involved taking a cast of a breast, using quick-dry silicone supported by a plaster cast. The resulting mold was then used with slow-setting silicone to create a true-to-life shape. A recess was carved into the form to house the electronic components, and an additional silicone layer was added to protect the wearer's skin from contact with electronics. + +### What did we learn from SenseBreast? + +The key learning from SenseBreast is that data is partial. It only tells part of a story. It can be misleading and untrustworthy, which makes the decisions based on that data unreliable too. For example, the sensor data gathered by SenseBreast was affected by how hard the CPU was working. The graph below plots a sequence of 5 minutes of data from SenseBreast, just after the device has booted. You can see that the temperature decreases over time; this is because the CPU has to work harder as the Raspberry Pi boots, and then cools down after the boot operations are completed. + +![Data visualisation of the readings in SenseBreast using the d3.js library][6] + +These sorts of learnings have implications on a broader scale. + +What if the SenseBreast were not an open source device, but a commercial wearable that stored data about me? What if part of the business model of that company was to sell the data that was harvested? What if my health insurer had access to that data? Or prospective employers? Now, more than ever, it's important that we have private, open solutions for sensing data about ourselves. + +### What's next for the SenseBreast project? + +The SenseBreast is a very early prototype, but it has the potential to develop through many different arcs. It could be used to assess range of movement post-surgery, to research how different garments and fabrics adjust to temperature and humidity, and to identify correlations between ambient air pressure and conditions such as lymphoedema. The path SenseBreast takes will be dependent on the passion, needs, and dedication of the incredible global open source community. + +You can learn more about SenseBreast at [https://sensebreast.org][2] and see my presentation at [linux.conf.au][7] 2020 [here][8]. + +The code for SenseBreast is available on [GitHub][9]. + +Health IT has been surprisingly unwilling to deeply support open source software. Despite the huge... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/raspberry-pi-sensebreast + +作者:[Kathy Reid][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kathyreid +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourcedoctor.png?itok=fk79NwpC (Open source doctor.) +[2]: https://sensebreast.org/ +[3]: https://3ainstitute.cecs.anu.edu.au/ +[4]: https://opensource.com/sites/default/files/uploads/49427571178_bb5df37c3a_c.jpg (SenseBreast open hardware board developed by Jon Oxer and Kathy Reid) +[5]: https://opensource.com/sites/default/files/uploads/49641040471_6d0cc91619_c.jpg (First attempt at creating a breast form using acrylic render covered in linen cloth) +[6]: https://opensource.com/sites/default/files/uploads/49640513813_5a7d63803a_c.jpg (Data visualisation of the readings in SenseBreast using the d3.js library) +[7]: http://linux.conf.au +[8]: https://www.youtube.com/watch?v=G3QfZ11DCpc. +[9]: https://github.com/KathyReid/sensebreast diff --git a/sources/tech/20200407 Love or hate chat- 4 best practices for remote teams.md b/sources/tech/20200407 Love or hate chat- 4 best practices for remote teams.md new file mode 100644 index 0000000000..855c622e49 --- /dev/null +++ b/sources/tech/20200407 Love or hate chat- 4 best practices for remote teams.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Love or hate chat? 4 best practices for remote teams) +[#]: via: (https://opensource.com/article/20/4/chat-tools-best-practices) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +Love or hate chat? 4 best practices for remote teams +====== +Plus, learn about a few open source alternatives for chat. +![Chat via email][1] + +Chat is a part of most people's daily lives, especially if you work in tech, and especially if you work with teammates located in different parts of the world. It can be a great way to achieve these goals: + + * **to connect**; to share with teammates on a personal level + * **to get work done**; to communicate with teammates about work in progress + * **to share**; to give notes and feedback from experiences, meetings, and interactions outside of the group that may be relevant to your work or interests + + + +I encourage you to explore [open source alternatives to chat][2] like [Mattermost][3], [Rocket.Chat][4], and [Riot][5]. + +### To chat or not to chat, that is the question + +First, it's important to make time to have a discussion with each member of your team focused on answering whether they are comfortable with using a chat platform to keep in touch throughout the workday. Some people enjoy chat and see it as a vital part of their workday, getting things done and communicating with teammates who they rely on to get that work done and move forward with projects. Others struggle with chat as a way of getting work done and prefer to use it when they feel like having more casual conversations with teammates on topics less focused on work and more on social interaction and personal sharing. Some people wish chat would burn in a fire. + +Gather these opinions and talk through these feelings with each person. You can do this as a group or one-on-one if that feels more appropriate. + +Why? Because communication is important and always will be, and your team will find a way to chat no matter what you do. We're human, and need various levels and types of interaction with each other throughout our days and lives. And when it comes to our work colleagues, it's helpful to put some structure in place to guide your team. + +### Best practices for team chat + +If you have decided to use chat in some form, the next step is to place structure around when and how to use it and **not** use it. These best practices work well for teams who are working remotely and at home, as well as in the office. + +**1\. Create rooms and threads to focus your conversations.** + +My team has a room for each of our sub-teams who work on a particular project together. We also have an at-large room for all of us to banter and share. + +Additionally, we use threads to focus on one topic at a time which is helpful when you have several to dozens of teammates in one room together. It helps conversations to continue and not stop prematurely because they were lost in the mix of other conversations. + +**2\. Decide when your team will be signed in and available to talk.** + +Is it throughout the workday (whatever hours those are for you), during a set timeframe, or as desired? + +My team has set the expectation that they will be signed in and available to chat at some point during the workday **about work-related topics**, and that at that time they will check for and respond to messages that were sent to them while they were away. So, we are using it as an asynchronous way to communicate about work. + +For us, asynchronous chat helps us plan and schedule each day how we see fit with the goal of being productive and serving our project in the best we can _that day_. + +If a teammate does **not** plan on signing in and responding to messages one day, that is OK, and we set the expectation that they will send a message to let the team know. For my team, almost no communication is wrong (see guideline #4), but it should be communicated. We also review our schedules for the following week in a team meeting the week before so we know when someone will be away from their desk, not working, or blocking out a chunk of time for a project. + +**3\. Decide when your teammates are responsible for responding (and when they are not).** + +Use @ mentions if you want someone to see and respond to your question or comment in chat. Don't expect them to be watching every thread and conversation.  + +And I would recommend that you take it a step further and define when teammates should be responsible for responding and when they should not. This type of decision is meant to free you and your teammates, not hold you down. The more you understand the expectations, the freer you are to operate within the same understood universe. When you are unsure of the rules, you may act and make decisions in fear or trepidation instead, like staying signed in to chat all day when you really just need to block it out to get something done. + +Our team has decided that it's nice if you can respond in chat when you are mentioned, but if you don't that is OK. Perhaps you were AFK during that time and lost track of the notification. For us, if you definitely want a response to something from someone, send them an email.  + +**4\. Communicate clearly and with kindness.** + +The way we interpret messages when we are chatting via text is different than when we are chatting verbally, in-person or over video. + +My team uses a lot of humor, emojis, and clear, concise messages to chat with each other. + +We also hold weekly in-person or video conference meetings so that we can get to know each other better. The more you trust someone, the easier it is to give them the benefit of the doubt when you're confused by a message and the better you are at understanding what they are saying and what their intention is behind the text coming through to you. + +### Signing off + +What best practices does your team use? Do you love or hate chat, and why?  + +For all kinds of teams today, chat is a special part of how we stay connected, working, and sharing with each other. Finding ways to do that in a healthy and committed way is part of everyone's responsibility. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/chat-tools-best-practices + +作者:[Jen Wike Huger][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://opensource.com/alternatives/slack +[3]: https://mattermost.com/ +[4]: https://rocket.chat/ +[5]: https://riot.im/app/ diff --git a/sources/tech/20200409 GNOME Announces Community Engagement Challenge Offering up to -65,000 in Rewards.md b/sources/tech/20200409 GNOME Announces Community Engagement Challenge Offering up to -65,000 in Rewards.md new file mode 100644 index 0000000000..63de71fec7 --- /dev/null +++ b/sources/tech/20200409 GNOME Announces Community Engagement Challenge Offering up to -65,000 in Rewards.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME Announces Community Engagement Challenge Offering up to $65,000 in Rewards) +[#]: via: (https://itsfoss.com/gnome-community-engagement-challenge/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME Announces Community Engagement Challenge Offering up to $65,000 in Rewards +====== + +It’s always good to see several competitions or challenges trying to promote Free and Open-Source Software (FOSS) more than ever. + +In a recent effort by GNOME with the help of [Endless][1], they announced the inaugural GNOME Community Engagement Challenge. + +This Community Challenge is a part of their original announcement of [coding education challenge for which GNOME was granted $500,000 funding by Endless][2] last year. + +The three-phase challenge aims to attract new developers to engage with FOSS and potentially create new/unique solutions that would gain more traction from the next-gen coders. + +The challenge will involve up to $65,000 in cash prizes. Sounds exciting, right? Let’s take a look at some of the details involved in the challenge. + +![][3] + +### Why The GNOME Community Engagement Challenge? + +In their official [press release][4], they mentioned their primary motive for the challenge: + +> “Through the Challenge we hope to reach a diverse audience, to encourage beginning coders to get involved with the FOSS community to help ensure that free software is available long into the future,” said Neil McGovern, GNOME Foundation Executive Director. “What better way to do that than to reach out to the community itself to come up with creative ways to inspire the next generation?” + +As Neil mentioned above, it’s definitely a good idea to reach out to more people (community) to look for creative ways to promote and work on FOSS projects that will leave a significant impact on the open-source community. + +And, rewarding for the ideas in the form of a challenge will easily get the attention needed. + +### Here’s How The Community Challenge Works + +To quote the official announcement: + +> The Challenge will ask entrants to devise creative ways to promote open-source software to coders typically in high school and college. How a submission will achieve this goal has deliberately been left open-ended to encourage unique, novel approaches. + +So, there’s no particular constraint for the type of ideas or projects you can propose and submit. But, it would be wise to read the usual [terms and conditions][5] to know about the submission rules, eligibility, requirements, prize details, and more. + +Here are the key information about the three phases of the challenge as per the announcement: + + * The **first phase** of the Challenge asks entrants to submit a written proposal for their concept no later than **July 1, 2020**. Twenty entries will be chosen to move to the next round and receive **$1000 each**. + * The **second phase** of the Challenge will require proof of concept, with four entries receiving **$5000** and moving onto the final round. + * The final round will call for a deliverable end product, with the winner receiving **$15,000** and the second place finisher receiving **$10,000**. + + + +They plan to announce the winner of the challenge in the spring of 2021. + +You can take a look at their [challenge FAQ][6] and the [official webpage][7] for more details before starting to submit your entry on **April 9th**. The last date of submission is **July 1, 2020**. + +Head to their website to get started and explore more about the challenge. + +[GNOME Community Engagement Challenge][7] + +### Wrapping Up + +I think this is a perfect opportunity for developers to get started with FOSS projects that will end up rewarding them with a good amount of money and help the community at the same time. + +What do you think about the community engagement challenge by GNOME? Feel free to let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-community-engagement-challenge/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.endlessnetwork.com/ +[2]: https://itsfoss.com/endless-gnome-coding-education-challenge/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-community-challenge.png?ssl=1 +[4]: https://www.gnome.org/news/2020/04/gnome-foundation-and-endless-launch-inaugural-community-engagement-challenge/ +[5]: https://www.gnome.org/challenge/terms/ +[6]: https://www.gnome.org/challenge/faq/ +[7]: https://www.gnome.org/challenge/ diff --git a/sources/tech/20200409 How to set up a remote school environment for kids with Linux.md b/sources/tech/20200409 How to set up a remote school environment for kids with Linux.md new file mode 100644 index 0000000000..327af54c79 --- /dev/null +++ b/sources/tech/20200409 How to set up a remote school environment for kids with Linux.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up a remote school environment for kids with Linux) +[#]: via: (https://opensource.com/article/20/4/school-home-linux) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +How to set up a remote school environment for kids with Linux +====== +Repurpose an old computer to support the new home-schooler in your life. +![Image by Alan Formy-Duvall][1] + +COVID-19 has suddenly thrown all of us into a new and challenging situation. Many of us are now working full-time from home, and for a lot of us (especially people who aren't used to working remotely), this is taking some getting used to. + +Another group that is similarly challenged is our kids. They can't go to school or participate in their regular after-school activities. My daughter's elementary school closed its classrooms and is teaching through an online, web-based learning portal instead. And one of her favorite extracurricular activities—a coding school where she has been learning Scratch and just recently "graduated" to WoofJS–has also gone to an online-only format. + +We are fortunate that so many of our children's activities can be done online now, as this is the only way they will be able to learn, share, and socialize for at least the next several months. + +### Setting up a temporary homeschool environment + +When our daughter's school went to an online-only format, we realized she needed a place and some tools to do her work. So we cleaned off her desk and cleared the toys from the floor around it to make an "office" for her. We also realized she would need a computer. While I could have shopped online and ordered a new computer (and spent at least several hundred dollars—if not more than $1,000—in the process), I chose an alternative and put an old, unused laptop back to work. + +If you have an unused computer sitting around and are willing to do a bit of tech work, you, too, can set something up to get your kids online. Here's how I did it. + +### The hardware + +While my daughter already has her own small IT department (as I like to say), it consists of some gaming systems, a tablet, and a Chromebook. Even her Chromebook has just an 11.6" screen and a small keyboard, so none of her devices are really quite adequate for full-time school duty. + +So we found ourselves in a pinch. She really needed a desktop-capable computer system with a decent-sized screen, a full keyboard, a good-quality microphone, a set of speakers, and a headphone jack. And having an external video connector helps if you decide one screen isn't enough. + +I didn't have a spare desktop, but I did have a laptop: a Lenovo G550 with a Pentium Dual-Core T4500 2.3GHz processor and 4GB RAM. I replaced its aging 5400RPM spindle hard drive with a 240GB solid-state drive. The laptop has a 15.6" screen, which is much easier to view than the small screens on her other devices, and a comfortable, full-size keyboard. Its CPU scores a bit better in PassMark's benchmarks (913 vs. 674) than the 1.6GHz Intel Celeron N3060 Dual-Core in the Chromebook. + +However, it is 10 years old, certainly on the edge of usability by today's standards. But, thanks to the efficiency of the Linux operating system, it gets the job done. I installed the latest version (v31) of [Fedora Workstation][2], but many other distributions will work just fine. If you really want to eke out every drop of performance, you could use one of the [lightweight Linux distributions][3]. The only area that required a little extra effort with Fedora was the wireless; I had to install the driver for the Broadcom WiFi hardware. But really, this was only a few extra steps and a restart, and it was good to go. + +Linux supports all of the other hardware in the laptop. My daughter prefers a full-sized mouse over the touchpad, so I attached one. She likes the keyboard on this laptop, but if she wants an external keyboard, there are enough USB ports to hook one up. + +It has a traditional 3.5mm audio jack, so she can use headphones. I recommend giving children decibel-limited headphones to protect their hearing. + +Even though this laptop has a 15.6" widescreen display, I think having a second monitor gives the best experience. I have a spare that I might hook up to the external VGA connector. + +### The software + +My daughter's school set up an online learning portal. The benefit is that students just need a supported web browser to log on and get to work, and I thank the school for its efforts and choice of a vendor-agnostic solution. Most Linux distributions include the Mozilla Firefox web browser installed by default, and Linux provides a full operating system, so I can install any applications she might need. Fedora is also updated regularly (unlike the old Windows Vista that came with the laptop and is no longer supported). + +![][4] + +Scratch running on Fedora + +Her extracurricular coding school is using the Zoom client. I'm happy to report that it was an easy [install with RPM][5] and works great on Fedora 31. + +### Success! + +My daughter has no trouble using her new laptop. She likes the [GNOME desktop][6], particularly the fact that it "Looks like Dad's!" This is turning out to be a great experiment in practical (and under-pressure) use of a Linux desktop. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/school-home-linux + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/homeschool.jpg?itok=vYEd9NON (Image by Alan Formy-Duvall) +[2]: https://getfedora.org/en/workstation/ +[3]: https://opensource.com/article/19/6/linux-distros-to-try +[4]: https://opensource.com/sites/default/files/scratch.jpg +[5]: https://zoom.us/download?os=linux +[6]: https://www.gnome.org/ diff --git a/sources/tech/20200409 Print double-sided documents at home with this simple Bash script.md b/sources/tech/20200409 Print double-sided documents at home with this simple Bash script.md new file mode 100644 index 0000000000..daacfa8365 --- /dev/null +++ b/sources/tech/20200409 Print double-sided documents at home with this simple Bash script.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Print double-sided documents at home with this simple Bash script) +[#]: via: (https://opensource.com/article/20/4/print-duplex-bash-script) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Print double-sided documents at home with this simple Bash script +====== +Use this script and save yourself the hassle and wasted paper of trying +to manually load and print double-sided documents. +![bash logo on green background][1] + +We have a laser printer at home. This Hewlett Packard LaserJet Pro CP1525nw Color Printer is an older model, but it has been a great workhorse that prints reliably and in color. I [put it on our home network][2] a few years ago using our [Raspberry Pi][3] as a print server. + +The LaserJet has been a great addition to my home office. Since [I launched my company][4] last year, I have relied on this little laser printer to print handouts and other materials for client meetings, workshops, and training sessions. + +My only gripe with this printer is that it prints single-sided only. If you want to print double-sided, you need to set up a custom print job to do it yourself. That's inconvenient and requires manual steps. In LibreOffice, I need to specifically set up the print job to print the odd-numbered pages first, then reload the paper before printing the even-numbered pages on the other side—but in reverse order. + +![LibreOffice print dialog][5] + +If I need to print a PDF that someone has sent me, the process is the same. For a four-page document, I first need to print pages 1 and 3, then reload the paper and print pages 2 and 4 in reverse order. In the GNOME print dialog, you need to select "Page Setup" to print odd pages or even pages. + +![Gnome print dialog][6] + +![Gnome page setup][7] + +Regardless of how I print, the overall process is to print the odd-numbered pages, reload the stack of printed pages into the paper tray, then print the even-numbered pages in reverse order. If I'm printing a four-page document, printing the even-numbered pages in reverse order means page 4 prints on the back of page 3 and page 2 prints on the back of page 1. Imagine my frustration in those few instances when I forgot to select the option to print in reverse order when printing the even-numbered pages and ruined a long print job. + +Similarly, it's easy to forget how to deal with documents that have an odd number of pages. In a five-page document, you first print pages 1, 3, and 5. But when you reload the printed pages into the printer, you don't want page 5. Instead, you only want to load pages 1 and 3. Otherwise, page 4 will print on the back of page 5, page 2 will print on the back of page 3, and nothing gets printed on the back of page 1. + +To make things easier and more reliable, I wrote a simple Bash script that automates printing duplex. This is basically a wrapper to print odd-numbered pages, remind me to reload the pages (and remove the last page if needed), then print the even-numbered pages. + +Whenever I need to print a document as duplex, I first convert the document to PDF. This is very easy to do. In LibreOffice, there's a toolbar icon to export directly as PDF. You can also navigate under **File— Export As—Export as PDF** to do the same. Or in any other application, there's usually a **Save to PDF** feature. When in doubt, GNOME supports printing to a PDF file instead of a printer. + +![Libre Office toolbar][8] + +![Export as PDF][9] + +### How it works + +Once I've saved to PDF, I let my Bash script do the rest. This really just automates the **lpr** commands to make printing easier. It prints odd pages first, prompts me to reload the paper, then prints the even pages. If the document has an odd number of pages, it also reminds me to remove the last page when I reload the printed pages. It's pretty simple. + +The only "programming" part of the script is determining the page count, and figuring out if that's an even or odd number. Both of those are easy to do. + +To determine the page count, I use the **pdfinfo** command. This generates useful info about a PDF document. Here's some sample output: + + +``` +$ pdfinfo All\ training\ -\ catalog.pdf +Creator:        Writer +Producer:       LibreOffice 6.3 +CreationDate:   Fri Oct 18 16:06:07 2019 CDT +Tagged:         no +UserProperties: no +Suspects:       no +Form:           none +JavaScript:     no +Pages:          11 +Encrypted:      no +Page size:      612 x 792 pts (letter) +Page rot:       0 +File size:      65623 bytes +Optimized:      no +PDF version:    1.5 +``` + +That output is very easy to parse. To get the page count, I use an AWK one-line script to look for **Pages:** and print the second field. + + +``` +`pages=$( pdfinfo "$1" | awk '/^Pages:/ {print $2}' )` +``` + +To figure out if this is an odd or even number, I use the modulo (**%**) arithmetic operator to divide by two and tell me the remainder. The modulo of two will always be zero for an even number, and one for an odd number. I use this simple test to determine if the document has an odd number of pages, so I'll need to remove the last page before printing the rest of the document: + + +``` +`if [ $(( $pages % 2 )) -ne 0 ] ; then` +``` + +With that, writing the **print-duplex.sh** Bash script is a simple matter of calling **lpr** with the correct options to send output to my printer (**lpr -P "HP_LaserJet_CP1525nw"**), to print odd-numbered pages (**-o page-set=odd**) or even-numbered pages (**-o page-set=even**), and to print in reverse order (**-o outputorder=reverse**). + +### Bash script + + +``` +#!/bin/sh +# print-duplex.sh +# simple wrapper to print duplex + +cat<<EOF +$1 ($pages pages) +\------------------------------------------------------------------------------- +Printing odd pages first +Please wait for job to finish printing... +\------------------------------------------------------------------------------- +EOF + +lpr -P "HP_LaserJet_CP1525nw" -o page-set=odd "$1" +sleep $pages + +cat<<EOF +=============================================================================== +Put paper back into the printer in EXACT OUTPUT ORDER (face down in tray) +then press ENTER +=============================================================================== +EOF + +pages=$( pdfinfo "$1" | awk '/^Pages:/ {print $2}' ) + +if [ $(( $pages % 2 )) -ne 0 ] ; then +  echo '!! Remove the last page - this document has an odd number of pages' +fi + +echo -n '>' +read x + +cat<<EOF +\------------------------------------------------------------------------------- +Printing even pages +Please wait for job to finish printing... +\------------------------------------------------------------------------------- +EOF + +lpr -P "HP_LaserJet_CP1525nw" -o page-set=even -o outputorder=reverse "$1" +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/print-duplex-bash-script + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/18/3/print-server-raspberry-pi +[3]: https://opensource.com/resources/raspberry-pi +[4]: https://opensource.com/article/19/9/business-creators-open-source-tools +[5]: https://opensource.com/sites/default/files/uploads/print_dialog_-_libreoffice_0.png (LibreOffice print dialog) +[6]: https://opensource.com/sites/default/files/uploads/print_dialog_-_gnome_0.png (Gnome print dialog) +[7]: https://opensource.com/sites/default/files/uploads/print_dialog_-_gnome_-_page_setup.png (Gnome page setup) +[8]: https://opensource.com/sites/default/files/uploads/toolbar_-_export_as_pdf_-_libreoffice.png (Libre Office toolbar) +[9]: https://opensource.com/sites/default/files/uploads/file_-_export_as_pdf_-_libreoffice.png (Export as PDF) diff --git a/sources/tech/20200409 Use Emacs Org mode to easily create LaTeX documents.md b/sources/tech/20200409 Use Emacs Org mode to easily create LaTeX documents.md new file mode 100644 index 0000000000..461c52a8a5 --- /dev/null +++ b/sources/tech/20200409 Use Emacs Org mode to easily create LaTeX documents.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Emacs Org mode to easily create LaTeX documents) +[#]: via: (https://opensource.com/article/20/4/emacs-org-mode) +[#]: author: (Peter Prevos https://opensource.com/users/danderzei) + +Use Emacs Org mode to easily create LaTeX documents +====== +You can use LaTeX for scientific and technical documents without all of +the confusing commands and syntax you would normally need. +![Filing cabinet for organization][1] + +LaTeX is a powerful system, especially for writing scientific and technical documents. But writing documents in LaTeX can be confusing because you need to know a lot of commands, and your text is littered with backslashes, curly braces, and other syntax distractions. But being productive as a writer requires that you focus on the text's content instead of how it looks. Fortunately, the [GNU Emacs][2] Org mode extension makes it easy to write plain-text documents and seamlessly export them to LaTeX and PDF. + +[Org mode][3] is a built-in Emacs extension that helps you keep notes, maintain to-do lists, manage projects, and author documents with a fast and effective plain-text system. Emacs also comes with [AUCTeX][4], an extensible package for writing TeX files in Emacs. AUCTeX has a preview module that shows the results of what you type, but I find it distracting because it draws my attention away from the document's content to its design. Writing text in Org mode is my preferred option because the source remains a plain-text file with minimal typesetting elements. The text is independent of its result because Org mode can export it to multiple formats, including LaTeX and PDF. + +Emacs is known for being difficult to use with a steep learning curve. But Emacs is only difficult when you want to fine-tune the default settings. By following a minimalist approach to using the vanilla GNU Emacs, this article will get you quickly and easily on your way to writing beautiful documents without any complex configuration. + +### First steps + +Before you begin, [install Emacs][5] and a fully functioning version of [LaTeX][6] on your computer. + +Next, you need to learn some conventions. In Emacs lingo, the abbreviation **C-c** means to enter **Ctrl+C** on your keyboard. The abbreviation **M-x** means **Alt+X**. The M stands for the mod key, which no longer exists in modern systems. The **S** prefix indicates the **Shift** key. + +The **find-file** function, which you start with the **C-x C-f** keystroke combination, creates a new document or opens an existing document. Entering this function opens a dialog in the mini-buffer at the bottom of the screen, which is where Emacs communicates with the user. Type the name of the file you want to create or open into the mini-buffer. Emacs is sensitive to file extensions, so make sure that the name of your document ends in **.org**. + +In Emacs speak, opening or creating a file is called ["visiting" a file][7]. Visiting a file means reading its contents into an Emacs buffer so that it is available for editing. Emacs generates a new buffer for each file you visit. + +### Writing prose with Org mode + +Once you're visiting a file, you can start typing your text the same way you would in any text editor or word processor. Some conventions: Begin the file with **#+TITLE:** to denote the title of the document and **#+AUTHOR** for your name. These options are used when exporting the file. Org mode recognizes a range of [export settings][8] to configure the output. For example, to suppress the table of contents, enter **#+OPTIONS: toc:nil**. + +Org mode has its own Markdown-like conventions to format your document. [Headlines][9] start with one or more asterisks. Org mode can [collapse a headline][10] to render parts of it invisible with the **TAB** or **S-TAB** keys. You can make words ***bold***, **/italic/**, **_underlined_**, or **=verbatim=**. The Org manual describes the many options for [rich text][11]. + +One minor issue with plain-vanilla Emacs that you will quickly notice is it does not wrap lines at the end of the visible screen. Emacs has several line-wrapping functions, and [Visual Line mode][12] is the most useful for writing long-form text. To activate this mode, use **M-x** and enter **visual-line-mode** in the mini-buffer at the bottom of the screen. The **M-x** keyboard shortcut enables executing functions for which there is no direct keyboard shortcut. + +Adding [images][13] is as easy as adding a link to the image file within double square brackets: + + +``` +`[[file:path_to_image.png]]` +``` + +Org has a great system for [formatting tables][14] in plain ASCII. Any line with **|** is considered part of a table. The vertical line is also the column separator. A line starting with **|-** is rendered as a horizontal rule, and rows before the first horizontal rule are header lines. A table might look like this in the source file: + + +``` +| Name  |   id | Age | +|-------+------+-----| +| Peter | 1234 |  50 | +| Sue   | 4321 |  54 | +``` + +Both images and tables are preceded with **#+CAPTION:** to add a [caption][15]. Advanced options are also available to control float placement and size of figures. + +Emacs has extensive [editing functions][16] to make you more efficient when typing text. Spell checking, thesaurus, auto-completion, and an undo tree are just some of the tools that help you write efficiently. + +### Adding LaTeX snippets to Org + +In addition to the text itself, Org mode-text can include simple LaTeX commands, such as **\newpage**, within the text. Equations in standard LaTeX syntax are placed between dollar signs **$e^{i\pi} + 1 = 0$**. The **org-latex-preview** function (**C-c C-x C-l**) shows a [preview][17] of any LaTeX equations within the text buffer. Last, you can also add complete LaTeX snippets to insert complex content. The code has to be placed in an export block: + + +``` +#+BEGIN_EXPORT latex +\setlength{\unitlength}{1cm} +\thicklines +\begin{picture}(10,6) +\put(2,2.2){\line(1,0){6}} +\put(2,2.2){\circle{2}} +\put(6,2.2){\oval(4,2)[r]} +\end{picture} +#+END_EXPORT +``` + +### Exporting to LaTeX + +Org mode includes a powerful export module to convert your files to many formats using the powerful [Pandoc][18] software. Start the export module with the **org-export-dispatch** function, which you can run with the **C-c C-e** keyboard shortcut. The dispatch will split your screen and provide a range of options. + +First, Pandoc converts the Org mode file to a LaTeX file. Then you can choose to open the LaTeX file in a new buffer or save it as a file. Org mode can also directly render a PDF file, which you can view within Emacs or save to disk. + +![Emacs with Org mode source and PDF preview][19] + +### Advanced use + +This article provides a first taste of writing prose in Org mode and LaTeX. Org mode has numerous configuration options to fine-tune your document or to change default settings. + +By default, Org mode uses the article style to export documents, but you can change this with export settings. These settings can also be used to add commands to the document header, for example: + + +``` +#+LATEX_CLASS: report +#+LATEX_CLASS_OPTIONS: [a4paper] +#+LATEX_HEADER: \usepackage{times} +``` + +If you write scientific documents, the [org-ref][20] package by John Kitchin provides Org-mode modules for citations, cross-references, and bibliographies in Org mode and useful BibTeX tools to go with it. + +The Org mode manual's [LaTex export][21] section provides a detailed discussion of the functionality available. + +### Conclusion + +Org mode is a perfect editor for writing LaTeX. The main advantage is that you lose the clutter of LaTeX syntax and can focus on the text. This comes at no cost because you can still add LaTeX code as much as you need, and you get access to the powerful editing functions in Emacs. + +Using Org to write books and articles allows you to focus on the text as you combine two of the oldest and most powerful pieces of open source software. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/emacs-org-mode + +作者:[Peter Prevos][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/danderzei +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) +[2]: https://opensource.com/article/20/3/getting-started-emacs +[3]: https://orgmode.org +[4]: https://www.gnu.org/software/auctex/ +[5]: https://www.gnu.org/software/emacs/ +[6]: https://www.latex-project.org/get/ +[7]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Visiting.html +[8]: https://orgmode.org/manual/Export-Settings.html +[9]: https://orgmode.org/manual/Headlines.html#Headlines +[10]: https://orgmode.org/manual/Global-and-local-cycling.html#Global-and-local-cycling +[11]: https://orgmode.org/manual/Markup-for-Rich-Contents.html#Markup-for-Rich-Contents +[12]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Visual-Line-Mode.html +[13]: https://orgmode.org/manual/Images.html +[14]: https://orgmode.org/manual/Built_002din-Table-Editor.html#Built_002din-Table-Editor +[15]: https://orgmode.org/manual/Captions.html#Captions +[16]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Basic.html#Basic +[17]: https://orgmode.org/manual/Previewing-LaTeX-fragments.html +[18]: https://pandoc.org/ +[19]: https://opensource.com/sites/default/files/uploads/org-mode-latex-screenshot.png (Emacs with Org mode source and PDF preview.) +[20]: https://github.com/jkitchin/org-ref +[21]: https://orgmode.org/manual/LaTeX-Export.html#LaTeX-Export diff --git a/sources/tech/20200410 Get started with Bash programming.md b/sources/tech/20200410 Get started with Bash programming.md new file mode 100644 index 0000000000..875adb9876 --- /dev/null +++ b/sources/tech/20200410 Get started with Bash programming.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Bash programming) +[#]: via: (https://opensource.com/article/20/4/bash-programming-guide) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Get started with Bash programming +====== +Learn how to write custom programs in Bash to automate your repetitive +tasks. Download our new eBook to get started. +![Command line prompt][1] + +One of the original hopes for Unix was that it would empower everyday computer users to fine-tune their computers to match their unique working style. The expectations around computer customization have diminished over the decades, and many users consider their collection of apps and websites to be their "custom environment." One reason for that is that the components of many operating systems are not open, so their source code isn't available to normal users. + +But for Linux users, custom programs are within reach because the entire system is based around commands available through the terminal. The terminal isn't just an interface for quick commands or in-depth troubleshooting; it's a scripting environment that can reduce your workload by taking care of mundane tasks for you. + +### How to learn programming + +If you've never done any programming before, it might help to think of it in terms of two different challenges: one is to understand how code is written, and the other is to understand what code to write. You can learn _syntax_—but you won't get far without knowing what words are available to you in the _language_. In practice, you start learning both concepts all at once because you can't learn syntax without words to arrange, so initially, you write simple tasks using basic commands and basic programming structures. Once you feel comfortable with the basics, you can explore more of the language so you can make your programs do more and more significant things. + +In [Bash][2], most of the _words_ you use are Linux commands. The _syntax_ is Bash. If you already use Bash on a frequent basis, then the transition to Bash programming is relatively easy. But if you don't use Bash, you'll be pleased to learn that it's a simple language built for clarity and simplicity. + +### Interactive design + +Sometimes, the hardest thing to figure out when learning to program is what a computer can do for you. Obviously, if a computer on its own could do everything you do with it, then you wouldn't have to ever touch a computer again. But the reality is that humans are important. The key to finding something your computer can help you with is to take notice of tasks you repeatedly do throughout the week. Computers handle repetition particularly well. + +But for you to be able to tell your computer to do something, you must know how to do it. This is an area Bash excels in: interactive programming. As you perform an action in the terminal, you are also learning how to script it. + +For instance, I was once tasked with converting a large number of PDF books to versions that would be low-ink and printer-friendly. One way to do this is to open the PDF in a PDF editor, select each one of the hundreds of images—page backgrounds and textures counted as images—delete them, and then save it to a new PDF. Just one book would take half a day this way. + +My first thought was to learn how to script a PDF editor, but after days of research, I could not find a PDF editing application that could be scripted (outside of very ugly mouse-automation hacks). So I turned my attention to finding out to accomplish the task from within a terminal. This resulted in several new discoveries, including GhostScript, the open source version of PostScript (the printer language PDF is based on). By using GhostScript for the task for a few days, I confirmed that it was the solution to my problem. + +Formulating a basic script to run the command was merely a matter of copying the command and options I used to remove images from a PDF and pasting them into a text file. Running the file as a script would, presumably, produce the same results. + +### Passing arguments to a Bash script + +The difference between running a command in a terminal and running a command in a shell script is that the former is interactive. In a terminal, you can adjust things as you go. For instance, if I just processed **example_1.pdf** and am ready to process the next document, to adapt my command, I only need to change the filename. + +A shell script isn't interactive, though. In fact, the only reason a shell _script_ exists is so that you don't have to attend to it. This is why commands (and the shell scripts that run them) accept arguments. + +In a shell script, there are a few predefined variables that reflect how a script starts. The initial variable is **$0**, and it represents the command issued to start the script. The next variable is **$1**, which represents the first "argument" passed to the shell script. For example, in the command **echo hello**, the command **echo** is **$0,** and the word **hello** is **$1**. In the command **echo hello world**, the command **echo** is **$0**, **hello** is **$1**, and **world** is **$2**. + +In an interactive shell: + + +``` +$ echo hello world +hello world +``` + +In a non-interactive shell script, you _could_ do the same thing in a very literal way. Type this text into a text file and save it as **hello.sh**: + + +``` +`echo hello world` +``` + +Now run the script: + + +``` +$ bash hello.sh +hello world +``` + +That works, but it doesn't take advantage of the fact that a script can take input. Change **hello.sh** to this: + + +``` +`echo $1` +``` + +Run the script with two arguments grouped together as one with quotation marks: + + +``` +$ bash hello.sh "hello bash" +hello bash +``` + +For my PDF reduction project, I had a real need for this kind of non-interactivity, because each PDF took several minutes to condense. But by creating a script that accepted input from me, I could feed the script several PDF files all at once. The script processed each one sequentially, which could take half an hour or more, but it was a half-hour I could use for other tasks. + +### Flow control + +It's perfectly acceptable to create Bash scripts that are, essentially, transcripts of the exact process you took to achieve the task you need to be repeated. However, scripts can be made more powerful by controlling how information flows through them. Common methods of managing a script's response to data are: + + * if/then + * for loops + * while loops + * case statements + + + +Computers aren't intelligent, but they are good at comparing and parsing data. Scripts can feel a lot more intelligent if you build some data analysis into them. For example, the basic **hello.sh** script runs whether or not there's anything to echo: + + +``` +$ bash hello.sh foo +foo +$ bash hello.sh + +$ +``` + +It would be more user-friendly if it provided a help message when it receives no input. That's an if/then statement, and if you're using Bash in a basic way, you probably wouldn't know that such a statement existed in Bash. But part of programming is learning the language, and with a little research you'd learn about if/then statements: + + +``` +if [ "$1" = "" ]; then +        echo "syntax: $0 WORD" +        echo "If you provide more than one word, enclose them in quotes." +else +        echo "$1" +fi +``` + +Running this new version of **hello.sh** results in: + + +``` +$ bash hello.sh +syntax: hello.sh WORD +If you provide more than one word, enclose them in quotes. +$ bash hello.sh "hello world" +hello world +``` + +### Working your way through a script + +Whether you're looking for something to remove images from PDF files, or something to manage your cluttered Downloads folder, or something to create and provision Kubernetes images, learning to script Bash is a matter of using Bash and then learning ways to take those scripts from just a list of commands to something that responds to input. It's usually a process of discovery: you're bound to find new Linux commands that perform tasks you never imagined could be performed with text commands, and you'll find new functions of Bash to make your scripts adaptable to all the different ways you want them to run. + +One way to learn these tricks is to read other people's scripts. Get a feel for how people are automating rote commands on their systems. See what looks familiar to you, and look for more information about the things that are unfamiliar. + +Another way is to download our [introduction to programming with Bash][3] eBook. It introduces you to programming concepts specific to Bash, and with the constructs you learn, you can start to build your own commands. And of course, it's free to download and licensed under a [Creative Commons][4] license, so grab your copy today. + +### [Download our introduction to programming with Bash eBook!][3] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/bash-programming-guide + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) +[2]: https://opensource.com/resources/what-bash +[3]: https://opensource.com/downloads/bash-programming-guide +[4]: https://opensource.com/article/20/1/what-creative-commons diff --git a/sources/tech/20200410 How Kubernetes saved my desktop application.md b/sources/tech/20200410 How Kubernetes saved my desktop application.md new file mode 100644 index 0000000000..ecbd6ee273 --- /dev/null +++ b/sources/tech/20200410 How Kubernetes saved my desktop application.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Kubernetes saved my desktop application) +[#]: via: (https://opensource.com/article/20/4/kubernetes-desktop-application) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +How Kubernetes saved my desktop application +====== +Keep this fix in mind if you have a broken Java desktop application but +aren't a crypto expert. +![Puzzle pieces coming together to form a computer screen][1] + +Recently, fellow Opensource.com scribe James Farrell wrote a wonderful article entitled _[How Ansible brought peace to my home][2]_. In addition to the great article, I really liked the title, one of those unexpected phrases that I’m sure brought a smile to many faces. + +I recently had a weird but positive experience of my own that begs a similar sort of unexpected label. I’ve been grappling with a difficult problem that arose when upgrading some server and networking infrastructure that broke a Java application I’ve been supporting since the early 2000s. Strangely enough, I found the solution in what appears to be a very informative and excellent article on Kubernetes, of all things. + +Without further ado, here is my problem: + +![][3] + +I’m guessing that most readers will look at that message and think things like, "I hope there’s more info in the log file," or "I’m really glad I’ve never received a message like that." + +Unfortunately, there isn’t a lot of info in the log file, just the same message, in fact. In an effort to debug this, I did three things: + + 1. I searched online for the message. Interestingly, or perhaps ominously, there were only 200 or so hits on this string, [one of which suggested][4] [turn][4][ing][4] [on more debugging output][4], which involved adding the setting + + +``` +**-Djavax.net.debug=ssl:handshake:verbose**[/code] to the **java** command running the application. + + 2. I tried that suggestion, which resulted in a lot of output (good), most of which only vaguely made sense to me as I’m no kind of expert in the underlying bits of stuff like SSL. But one thing I did notice is that there was no information regarding a response from the server in the midst of all of that output; + + 3. So I searched some more. + + + + +Another interesting part of this problem is that the code ran fine when executed by the Java command bundled in the OpenJDK, but failed with this error when using a customized runtime [created from the same OpenJDK in this way][5]. So the relatively modest number of apparently similar problems turned up from search #1 above were actually not all that relevant since they all seemed to be dealing mostly with bad SSL certificates on the server in conjunction with the PostgreSQL JDBC’s ability to check the server’s credentials. + +I should also mention that it took me quite some time to realize that the problem was introduced by using the custom Java runtime, as I managed to check many other possibilities along the way (and indeed, I did fix a few minor bugs while I was at it). My efforts included things like getting the latest OpenJDK, checking and re-checking all the URLs in case one had a typo, and so forth. + +As often happens, after putting the problem aside for a few hours, an idea occurred to me—perhaps I was missing some module in the customized Java runtime. While I didn’t receive any errors directly suggesting that problem, the observable fact that the standard OpenJDK environment worked while the custom one failed seemed to hint at that possibility. I took a quick look in the **jmods/** folder in the OpenJDK installation, but there are some 70 modules there and nothing jumped out at me. + +But again, what seemed odd was, with debugging turned on (see #1 above), there was no indication of what the server would accept, just what the client mostly couldn’t offer, many lines like this: +``` +`Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA` +``` +So I was at least thinking by this time that maybe what was missing was the module that offered those kinds of cipher suites. So I started searching with strings like "jdbc crypto," and in the midst of that, the most unlikely article showed up: [Optimizing Kubernetes Services—Part 2: Spring Web][6], written by [Juan Medina][7]. Midway down the article, I spotted the following: + +![][8] + +Huh! Imagine that, his script is creating a custom Java runtime, just like mine. But he says he needs to add in manually the module **jdk.crypto.ec** in order t \ No newline at end of file diff --git a/sources/tech/20200412 Use this helpful Bash script when stargazing.md b/sources/tech/20200412 Use this helpful Bash script when stargazing.md new file mode 100644 index 0000000000..f9e39e5632 --- /dev/null +++ b/sources/tech/20200412 Use this helpful Bash script when stargazing.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this helpful Bash script when stargazing) +[#]: via: (https://opensource.com/article/20/4/linux-astronomy) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +Use this helpful Bash script when stargazing +====== +Keep your eyes on the stars by putting your Linux machine in night +vision mode with xcalib. +![Computer laptop in space][1] + +We often talk about [Linux][2] being used on servers and by developers, but it is used in many other fields too, including astronomy. There are a lot of astronomy tools available for Linux, such as sky maps, star charts, and interfaces to telescope drive systems for controlling your telescope. But one challenge for astronomers is using a computer while keeping their eyes working in the dark. + +When working out in the field at night, astronomers need to preserve their night vision. It can take up to 30 minutes for the human eye to fully dilate and adjust to low light levels, and doing things like checking a phone or laptop at the regular color and brightness levels can cause the eyes to lose their adjustment. This reduces the ability to see in the dark. An example anyone can understand: if you're reading something on your phone in bed at night and get up to go to the bathroom, you know how difficult it can be to see any obstacles that might be in your way. + +### A solution + +I'd like to present a nifty little script to help the astronomer in your family keep "their eyes" in the dark. It relies on a utility called [xcalib][3], a "tiny monitor calibration loader for X.org." It can be installed easily using your Linux package manager. + +On Fedora, for example: + + +``` +$ sudo dnf info xcalib +$ sudo dnf install xcalib +``` + +Or Ubuntu: + + +``` +`$ sudo apt-get install xcalib` +``` + +The xcalib application works only with X11, so it is not functional on Wayland systems. But Wayland has this functionality built-in, so you can get the same results through GNOME Settings. If you're using X11, xcalib is an easy way to change the color temperature of your display. + +### The script + +I discovered [Redscreen][4], a night vision filter script written by Jeff Jahr in 2014. The original script is written for the C shell, but Bash is the common default these days. In fact, the C shell is not installed by default on my current Fedora Linux workstation. So, I decided to write an updated version of the Redscreen script aimed at the newest Bash syntax, but I made one major change: utilizing a case statement. + + +``` +#!/usr/bin/bash +# redscreen.sh Fri Feb 28 11:36 EST 2020 Alan Formy-Duval +# Turn screen red - Useful to Astronomers +# Inspired by redscreen.csh created by Jeff Jahr 2014 +# () + +# This program is free software: you can redistribute it +# and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any +# later version. + +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE.  See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public +# License along with this program.   +# If not, see <[http://www.gnu.org/licenses/\>][5]. + +case $1 in +            on) +            # adjust color, gamma, brightness, contrast +            xcalib -green .1 0 1 -blue .1 0 1 -red 0.5 1 40 -alter +            exit 1 +        ;; +        off) +                xcalib -clear +            exit 1 +            ;; +        inv) +            # Invert screen +                xcalib -i -a +                    exit 1 +        ;; +        dim) +            # Make the screen darker +                xcalib -clear +            xcalib -co 30 -alter +            exit 1       +        ;; +        *) +                echo "$0 [on | dim | inv | off]" +                    exit 1 +        ;; +esac +``` + +![Skychart for Linux Version 4.2.1 on Fedora workstation][6] + +A lot of astronomy programs include a "night-mode" function, but not all do. Also, this script provides a way to affect the entire screen, not just a specific application. This allows you to use your Linux system out in the field at night for other things than just stargazing—such as checking email or reading Opensource.com—without ruining your night vision. + +Whether you are an astronomer or just an amateur stargazer, you can spend all night admiring the heavens using Linux and open source! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/linux-astronomy + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://opensource.com/resources/linux +[3]: http://xcalib.sourceforge.net/ +[4]: http://www.jeffrika.com/~malakai/redscreen/index.html +[5]: http://www.gnu.org/licenses/\> +[6]: https://opensource.com/sites/default/files/uploads/starchart_in_red.png (A star chart displayed in red screen mode) diff --git a/sources/tech/20200414 How young people can help fight COVID-19 with code.md b/sources/tech/20200414 How young people can help fight COVID-19 with code.md new file mode 100644 index 0000000000..73705b5a62 --- /dev/null +++ b/sources/tech/20200414 How young people can help fight COVID-19 with code.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How young people can help fight COVID-19 with code) +[#]: via: (https://opensource.com/article/20/4/covid19-hackathon) +[#]: author: (Melissa Sasi https://opensource.com/users/mesassi) + +How young people can help fight COVID-19 with code +====== +Youth developers are invited to submit ideas by April 15 to counter the +educational, informational, social, and health challenges uncovered by +the COVID-19 pandemic. +![woman on laptop sitting at the window][1] + +More than 91% of students around the world are impacted by school closures due to COVID-19, and most governments have temporarily closed academic institutions. That's nearly [1.6 billion young people in 188 countries][2]. Also, most of the learning platforms available online today aren't practical, engaging, or interactive, and lack true virtual collaboration. + +This big and wicked challenge got me thinking about how these circumstances are impacting my children, their friends, and my passions of empowering youth, fostering tech entrepreneurship, and inspiring under-represented communities to find their purpose through building digital skills. These all came together in [CodeTheCurve][3], "a global, virtual hackathon for students, educators, teachers, and the research community to build tech skills, entrepreneurial spirit, and professional competencies to build digital creativity and cooperation to mobilize the world." + +We hope you'll want to participate, but you need to act fast: the deadline to submit proposals is April 15. + +### My story + +The passions mentioned above stem from a deeply personal journey: My children and I are victims of parental kidnapping, and access to the internet and digital literacy are my pathways to being a mother from afar. My children, Zahra (age 13), Zahran (15), and Youmna (18), are safe and healthy, and we are frequently connected. They're living the same life youth all over the world are living these days, trying to social distance and remain in good health while figuring out this school thing (or lack thereof)—only one of my children has access to formal virtual learning during to COVID-19 school closures. The other two, without school-driven online learning options, tend to stay up all night playing Fortnight and making TikTok videos. + +I have always been passionate about digital inclusion and empowering the world through computer science, and the effects of COVID-19 have increased my desire to make a difference. About four years ago, I created a non-profit organization, [MentorNations][4], to inspire youth and the world via technology. My non-profit has taught tens of thousands of young people in 12 countries to code. In my work at IBM as a developer advocate, I focus on empowering early-stage entrepreneurs, developers, and students with access to tech skills, professional development, and entrepreneurial thinking. My major focus areas include inspiring students to discover their career potential in enterprise computing while recognizing that we are all ANDs and not ORs. + +Teaching the next generation about the power of collaboration, teamwork, problem-solving, and critical thinking that happen through open source code and principles empowers them to be creators and innovators who focus on solving relevant and real-world problems. + +Looking through the lens of my children, my non-profit work, my roles within a variety of United Nations Task Forces, and my position as IEEE Chair over the Digital Skills Working Group, I wondered, _**what can I do to make a difference with open source technology?**_ So I reached out to my network, and the world responded in a much bigger way than I had ever imagined. + +### CodeTheCurve + +In response, we launched UNESCO's [CodeTheCurve][3] hackathon in collaboration with 14 partners, including UN EQUALS, SAP, iHackOnline, Angel Hack, Internet Society, and YPO. Participants are invited to bring their open source ideas to combat the current and future environment and challenges relating to COVID-19. This initiative is centered around youth empowerment, gender inclusion, and making the world a better place for our communities, including for people we may not directly encounter daily. + +CodeTheCurve is for anyone above the age of 16. To ensure gender, age, and experience diversity, teams must include a developer or data scientist (early-stage chops are fine); at least one person under the age of 25; and at least one male and one female. The 40 teams selected to participate in CodeTheCurve will have access to more than 80 business and technical mentors (experts!) from around the world to help turn their ideas into reality. + +My vision for this hackathon is to train young talent; enable them with free, online resources and access to real people with real answers; and encourage the creation of real-world problem solving in real-time. The results of the hackathon, I hope, will be open source utilities and information that can be used, in some way, to combat COVID-19. + +#### Week-long learning, bootcamp, and hacking experience + +CodeTheCurve is a three-day virtual hackathon experience guided by expert business and technical mentors. Before the hackathon proper, participants begin with two days of self-paced, online learning from content curated by CodeTheCurve collaborators, followed by a two-day, instructor-led learning journey where the 40 selected teams will collaborate in virtual breakout rooms with activity kits, hands-on computing resources in machine learning, and expert-guided plenary sessions. + +#### CodeTheCurve hackathon themes + +CodeTheCurve includes three themes: + + * Education + * Information and data management + * Current and post-COVID-19 health and social issues + + + +#### Professional development, entrepreneurship, and hands-on open source skills + +The 40 teams will be empowered with expert-guided, engaging activities, including the following skill-building opportunities: + + * **Hand-on tech skills** + * Using Jupyter Notebooks for data science + * Data protection, privacy, security, and encryption + * Machine learning and artificial intelligence + * Architectural diagrams and frameworks + * Technical roadmaps + * **Professional development** + * Design thinking + * Personal branding + * Communication skills + * How not to feel like an imposter + * Conflict resolution + * Working in global, virtual teams + * Media literacy + * Ethics in machine learning and artificial intelligence + * **Entrepreneurship** + * Problem statements + * Mission and vision statements + * Value propositions + * Audience and target markets + * Business model canvassing + * Pitch decks + * Pitch practice + + + +### April 15: CodeTheCurve deadline + +Did I mention that the initial application deadline is April 15? Here's the full timeline: + + * Video submission deadline: **April 15** + * 40 selected teams announced: **April 20** + * Learning resources for pre-collaboration: **April 20-21** + * Instructor-led learning: **April 22-23** + * Hacking: **April 24-26** + * CodeTheCurve winners announced: **April 30** + + + +#### Prizes. Prizes. Prizes. + +Prizes include free access to [IBM LinuxONE Community Cloud][5] for one year, free training courses from SAP, four pitch opportunities at IBM and SAP events, free access to enterprise-grade IBM Z and its machine learning suite for six months, and one-on-one technical and business mentorship for a full year with industry experts. + +### How to apply + +Interested in applying? Know someone who should apply? Simply [submit a video][6] of your **amazing** open source idea, the problem you're trying to solve, and who you expect to reach. + +If you'd like to learn more, here are some other articles about CodeTheCurve: + + * [UN News CodeTheCurve article][7] + * [UNESCO CodeTheCurve blog][8] + * [Forbes CodeTheCurve article][9] + * [IBM CodeTheCurve blog][10] + + + +I cannot wait to see all the amazing open source ideas the world brings our way! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/covid19-hackathon + +作者:[Melissa Sasi][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mesassi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://en.unesco.org/covid19/educationresponse +[3]: https://www.codethecurve.org/ +[4]: https://mentornations.org/ +[5]: https://developer.ibm.com/linuxone/ +[6]: http://ibm.biz/codethecurve-apply +[7]: https://news.un.org/en/story/2020/04/1061142 +[8]: http://ibm.biz/unesco-pr +[9]: https://www.forbes.com/sites/danielnewman/2020/04/10/digital-transformation-for-good-shines-as-we-fight-covid-19/#78d51a4c4946 +[10]: http://ibm.biz/codethecurve diff --git a/sources/tech/20200414 Try this Kubernetes HTTP router and reverse proxy.md b/sources/tech/20200414 Try this Kubernetes HTTP router and reverse proxy.md new file mode 100644 index 0000000000..fc78ee9bce --- /dev/null +++ b/sources/tech/20200414 Try this Kubernetes HTTP router and reverse proxy.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Try this Kubernetes HTTP router and reverse proxy) +[#]: via: (https://opensource.com/article/20/4/http-kubernetes-skipper) +[#]: author: (Sandor Szücs https://opensource.com/users/sszuecs) + +Try this Kubernetes HTTP router and reverse proxy +====== +Skipper is designed to handle large numbers of HTTP route definitions, +beyond what you would want to manage in Nginx or Apache. +![Traffic circle with arrows pointing which way to go][1] + +Skipper is an open source HTTP router and reverse proxy for service composition. As its [GitHub page][2] states, it's designed to handle large amounts of dynamically configured HTTP route definitions (>600,000 routes) with detailed lookup conditions and flexible augmentation of the request flow with filters. It can be used out of the box or extended with custom lookup, filter logic, and configuration sources. + +### Proxies + +When some people think of a proxy, they imagine a webpage that serves as a gateway to an intranet or a suspicious-looking webpage designed to unblock social media sites on a school or work network. A forward proxy is one that operators of desktop infrastructure use to save internet bandwidth, enforce parental controls, or limit social media access. Another kind of proxy is one in which an individual user navigates to a page, provides credentials, and is then forwarded to a protected intranet resource. The inverse of that kind of proxy is the reverse proxy, which accepts all traffic and forwards it to a specific resource, like a server or container. That's the kind of work Skipper does for infrastructure. + +When I read [Matt Klein's post][3] on modern network load balancing and proxying, I realized that we, as [Skipper][4] maintainers, should explain more features and details about why and how you can leverage HTTP proxies. In this article, I will treat the terminology "HTTP (reverse) proxy" and "HTTP router" as the same. + +### HTTP routing + +According to [Wikipedia][5]: "Routing is the process of selecting a path for traffic in a network." This definition refers to routing at [OSI layer 3][6], most commonly based on [IP][7] with routing protocols like [BGP][8] or [OSPF][9]. Since this article isn't about one of those, I will try to explain what HTTP routers are about. But first, I want to introduce Skipper, an [OSI layer 7][10] HTTP router library written in [Go][11] and a core component of retailer [Zalando][12]'s e-commerce shop and the [Kubernetes][13] Ingress infrastructure. + +At Zalando, we use Skipper as a [Kubernetes Ingress][14] controller to support our users with visibility, reliability, security, and additional features to offload common applications. + +Any organization running HTTP services, often in a microservice architecture, needs to route HTTP requests to the right applications. HTTP routers route based on information provided by the HTTP request. For example, the following shows an HTTP/1.1 request. + + +``` +GET /details HTTP/1.1 +Host: [www.zalando.de][15] +User-Agent: curl/7.49.0 +Accept: */* +Authorization: Bearer <token> +... +``` + +We can route based on the method **GET**, the path **/details**, the **Host** header [**www.zalando.de**][16], or any arbitrary part of the request. + +One common problem an application owner faces is splitting an API into multiple applications, so you need to split the responsibility of a component into subcomponents. Another common task is to support refactoring; maybe you have rewritten one part of your app, and you want to deploy it separately now. + +For example, imagine you you have a store that has a list of products and their details, and you need to split it into _shop_ and _product_ backend applications. At **/**, your shop shows the list of products, and at **/details**, it shows product details, such as color, size, sustainability, and price. + +![Figure 1: shop][17] + +You need to split the responsibility of the product detail into its own application, such that **/** stays in the _shop_ application and **/details** is refactored to the _product_ application. + +![Figure 2: product and shop][18] + +To make sure an HTTP proxy finds the right backend for an incoming request, it uses a routing table to check the destination to make sure it's correct. + +### Routing tables + +In Skipper, the routing table is created by pulling information generated by [dataclients][19] from different sources. One source can be a [routes file][20], similar to what you may see in more popular HTTP servers, like Apache or Nginx. + +Depending on the size of your organization—or better, the number of backend applications—the routing table can grow quite large. Skipper implements the routing table as a tree that can scale beyond 600,000 routes (far more than you'd want to manage in an Nginx or Apache config). + +Following along with the example application above, Table 1 shows the routing table from [Figure 2][21]. The store **/** should be routed to **shop,** and the **/detail** routed to the **product** application. + +path | app +---|--- +/ | shop +/detail | product + +Table 1: Routing table + +The available dataclients in Skipper fetch routes from different sources and what a route consists of. + +### Dataclient + +The routing configuration in Skipper's routes file [dataclient][22] is similar to what you might know from HTTP proxies in Nginx or Apache. In Skipper, a routes file specifies all routes in [eskip][23] syntax, as shown in Figure 3. + + +``` +r1: P1() && P2() && .. && PN() +    -> f1() +    -> f2() +    ... +    -> fN() +    -> <backend>; +r2: ... +... +``` + +Figure 3: Routes file in eskip + +In the above: + + * **r1, r2, ...** are unique routeIDs. + * **P1, P2,..,PN** are predicates that define the matching. + * **f1, f2,..,fN** are filters that are applied after the route was selected. Filters can change the request and response. + * Finally, the Skipper backend is defined. This can be a single URL, a list of load-balanced URLs, and others for special cases such as [direct response][24]. + + + +The [routes string][25] is another dataclient that is handy for tests. For example, if you need a pseudo backend for your demo that replies a green background with HTML, you could use: + + +``` +$ skipper -routes-string='* +-> inlineContent( +      "<html><body style=\"background-color: green;\"></body></html>" +   )' +``` + +Skipper's most popular dataclient, by far, is the Kubernetes dataclient, which is used to fetch information from a [Kubernetes API server][26] and create a routing table from [Skipper Ingress][27] resources and the [RouteGroup][28] custom resource definition (CRD). + +To summarize the above, dataclients fetch information from different providers to build Skipper's routing table. Table 1 shows a routing table for the shop/description example, and Skipper uses predicates to select the route to process the request. + +### Predicates + +In Skipper, an incoming request is matched to [predicates][29] of all the routes to find the best matching route for an incoming request. Predicates are functions that match based on the incoming request. In the example from Figure 2 and Table 1, Skipper would have a routing table similar to Figure 4: + + +``` +shop: Path("/") +    -> ""; +product: Path("/detail") +    -> ""; +``` + +Figure 4: Skipper routing table + +This means HTTP requests with a path **/** would be matched by the **Path("/")** predicate, such that Skipper will execute the shop route. Requests with a path **/detail** would be matched by **Path("/detail")** and routed to the product application. + +In general, routing behavior can be changed by predicates. There are a lot of predicates you can choose from. For example, **Method("POST")** will be true only if a POST request would be passed. A route with more predicates is considered more specific. Also, a route with more predicates has more weight in the route selection than one that has less. + +Special cases are **Path()** and **PathSubtree()**, which is matched first in a tree and reduces the number of routes, which are scanned as a list. For example, the tree structure shown in Figure 5 helps to scale the number of routes to more than 600,000 in one of Zalando's production setups. + +![Skipper tree example][30] + +### Filters + +After a route is selected, the request [filters][31] are applied. Filters work on request or response; they can change the incoming request to the backend, and they can change the response to the client. + +For example, **setRequestHeader("Foo", "bar")** sets the HTTP header **"Foo"** to the value **"bar"**, such that the backend sees this header in the request. + +The response filter **responseCookie("keks", "val", 3600)** sets a Cookie named **"keks"** in the response to the caller, which might be a browser in this case. The cookie would have the value **"val"** and is valid for one hour. + +One filter that works on request and response is **enableAccessLog(40, 5)**. This would do access logs for all responses from the backend with status codes 40x or 5xx. + +As you can see from the examples, filters can change the request or the response or just do some work based on it. Another filter example is **auth filters** or **ratelimits**. These would stop requests from passing to the backend if the request should not be allowed to pass. For example, to serve static content from a directory called **/var/www**, you can use the filter **static("/var/www")**. + +### Learn more + +This article provided a basic overview of Skipper and its capabilities. For more information, consult [Skipper's documentation][32], and please share your questions or feedback in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/http-kubernetes-skipper + +作者:[Sandor Szücs][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sszuecs +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-patent_reform_520x292_10136657_1012_dc.png?itok=Cd2PmDWf (Traffic circle with arrows pointing which way to go) +[2]: https://github.com/zalando/skipper +[3]: https://blog.envoyproxy.io/introduction-to-modern-network-load-balancing-and-proxying-a57f6ff80236 +[4]: https://opensource.zalando.com/skipper +[5]: https://en.wikipedia.org/wiki/Routing +[6]: https://en.wikipedia.org/wiki/OSI_model#Layer_3:_Network_Layer +[7]: https://en.wikipedia.org/wiki/Internet_Protocol +[8]: https://en.wikipedia.org/wiki/Border_Gateway_Protocol +[9]: https://en.wikipedia.org/wiki/Open_Shortest_Path_First +[10]: https://en.wikipedia.org/wiki/OSI_model#Layer_7:_Application_Layer +[11]: https://golang.org/ +[12]: https://en.zalando.de/ +[13]: https://kubernetes.io +[14]: https://kubernetes.io/docs/concepts/services-networking/ingress/ +[15]: http://www.zalando.de +[16]: https://en.zalando.de/?_rfl=de +[17]: https://opensource.com/sites/default/files/uploads/skipper_1_shop.png (Figure 1: shop) +[18]: https://opensource.com/sites/default/files/uploads/skipper_2_product-shop.png (Figure 2: product and shop) +[19]: https://opensource.zalando.com/skipper/reference/backends/ +[20]: https://opensource.zalando.com/skipper/data-clients/eskip-file/ +[21]: tmp.ftM58r5YpM#fig2 +[22]: https://opensource.zalando.com/skipper/tutorials/development/#dataclients +[23]: https://godoc.org/github.com/zalando/skipper/eskip +[24]: https://opensource.zalando.com/skipper/reference/backends/#shunt-backend +[25]: https://opensource.zalando.com/skipper/data-clients/route-string/ +[26]: https://kubernetes.io/docs/concepts/overview/components/#kube-apiserver +[27]: https://opensource.zalando.com/skipper/kubernetes/ingress-usage/ +[28]: https://opensource.zalando.com/skipper/kubernetes/routegroups/ +[29]: https://opensource.zalando.com/skipper/reference/predicates/ +[30]: https://opensource.com/sites/default/files/uploads/skipper_5_tree.png (Skipper tree example) +[31]: https://opensource.zalando.com/skipper/reference/filters/ +[32]: https://opensource.zalando.com/skipper/ diff --git a/sources/tech/20200415 6 open source teaching tools for virtual classrooms.md b/sources/tech/20200415 6 open source teaching tools for virtual classrooms.md new file mode 100644 index 0000000000..807ebfae3d --- /dev/null +++ b/sources/tech/20200415 6 open source teaching tools for virtual classrooms.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 open source teaching tools for virtual classrooms) +[#]: via: (https://opensource.com/article/20/4/open-source-remote-teaching-tools) +[#]: author: (Mathias Hoffmann https://opensource.com/users/mhopensource) + +6 open source teaching tools for virtual classrooms +====== +Create podcasts, online lectures, tutorials, and other teaching +resources for learning at home with open source tools. +![Person reading a book and digital copy][1] + +As schools and universities are shutting down around the globe due to COVID-19, many of us in academia are wondering how we can get up to speed and establish a stable workflow to get our podcasts, online lectures, and tutorials out there for our students. + +Open source software (OSS) has a key role to play in this situation for many reasons, including: + + * **Speed:** OSS can roll out quickly and in large numbers (e.g., to an army of teaching assistants for multiple tutorial sessions in big lectures) without licensing issues and in a decentralized manner. + * **Cost:** OSS does not cost anything upfront, which is important for financially stretched schools and universities that need solutions to complex challenges on very short notice. + + + +With everything going online, we need new ways to engage with students. Here is a list of tools that I have found useful to share my own lectures.  + +### Create podcasts, videos, or live streams with OBS + +[Open Broadcast Studio (OBS)][2] is a professional, open source audio and video recording tool that allows you to record, stream instantly, and do much more. OBS is available for all major platforms (Windows, macOS, and Linux), so interoperability with your colleagues and their various devices is ensured. + +Even if you're already using online conferencing software as a recording system, OBS can be a great backup solution. Since it records locally, you're protected against any network lags or disconnections. You also have complete control over your data, so many educational institutions may find it to be a more secure solution than some other options. + +Compatibility is also an advantage: OBS stores recordings in a standard intermediate format (MKV), which can be transferred to MP4 or other formats. Also, support for Nvidia graphics cards under OBS is great, as the company is one of the main sponsors of the OBS project. This allows you to make full use of your hardware and speed up the recording process. + +### Video and sound editing + +After you record your podcast or video, you may find that it needs editing. There are many reasons you may need to edit your audio or video. For example, many university online platforms restrict the size of files you can upload, so you may have to cut long videos. Or, the sound may be too quiet, or maybe it was too noisy when you recorded it, so you need to make adjustments to the audio. + +Two of the open source apps to explore are [OpenShot][3] and [Shotcut][4]. Of the two, Shotcut is a more advanced program, which implies a slightly steeper learning curve. Both are cross-platform and have full support for hardware encoding with NVidia and other graphics cards, which will substantially lower processing time compared to CPU-only processing. + +You can also extract a soundtrack in either program (although I have found it to be much faster with Shotcut) and export it to an audio-editing program. I find [Audacity][5], another open source, cross-platform (Mac, Linux, Windows) tool, to work extremely well. + +My typical workflow looks something like this: + + * Import the recording into Shotcut + * Extract the audio, save it to an audio file + * Import it into Audacity, normalize and amplify the audio, maybe do some noise reduction + * Save the audio to a new file + * Import the new audio file into Shotcut, align it with the audio-free video, and cut appropriately + * Export into an MP4 video (this last step usually takes some time, so have a coffee…) + + + +### Electronic blackboards + +If you want to annotate your slides or develop ideas on an electronic blackboard, you need note-taking software and a device with a touchscreen or a graphics tablet. A great open source tool (developed with Swiss taxpayer funding) for blackboarding is [OpenBoard][6]. It is cross-platform; although it is officially only available for Linux on Ubuntu 16.04, you can install a [Flatpak][7] and it will work on any Linux flavor. It is really a nice tool; its only shortcoming is that annotating slides is not very good. + +My main open source annotation and electric blackboard tool is [Xournal++][8], which is available in some Linux distros repos (e.g., Linux Mint) and otherwise via [Flathub][9]. Like all the tools mentioned earlier, it is also available on Mac and Windows. If you know of any open source, cross-platform note-taking tools, please share them in the comments. + +### Built-in solutions have their limits + +You might wonder why you should bother with alternative recording software in the first place. After all, most modern operating systems have built-in screen recorders that will also capture audio. However, these built-in solutions have their limits. One key limitation is that you cannot usually capture more than one video source at a time (e.g., a webcam with your talking head and a set of slides plus a whiteboard from a graphics tablet). + +The ability to use multiple video sources is very useful, though, since it can be dull for students to just listen to your voice and see your slides for extended periods. Face-to-face interactions—even if done virtually—help keep listeners' attention and make it easier for them to cope with imperfect recording quality and background noise. In addition, many of the built-in tools do not allow you to capture selected areas of the screen, and in general, you cannot change the resolution or the number of frames per second, which can be important for keeping your podcast's memory and bandwidth usage in check. + +### Conclusion + +When planning your online teaching, you will want to use a blend of audio, video, slides, and electronic blackboards to create an immersive experience even while students are learning remotely. Open source software offers advanced, effective tools for creating such online educational experiences. + +* * * + +_This article is based on "[Open source software for online teaching in the times of corona][10]" on Mathias Hoffman's blog and is reused with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-remote-teaching-tools + +作者:[Mathias Hoffmann][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mhopensource +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://obsproject.com/ +[3]: http://www.openshot.org/ +[4]: http://www.shotcut.org/ +[5]: https://www.audacityteam.org/ +[6]: http://www.openboard.ch/ +[7]: http://www.flathub.org +[8]: https://github.com/xournalpp/xournalpp +[9]: https://flathub.org/apps/details/com.github.xournalpp.xournalpp +[10]: http://mathiashoffmann.net/2020/03/22/open-source-software-for-online-teaching-in-the-times-of-corona diff --git a/sources/tech/20200415 How to automate your cryptocurrency trades with Python.md b/sources/tech/20200415 How to automate your cryptocurrency trades with Python.md new file mode 100644 index 0000000000..c216d22663 --- /dev/null +++ b/sources/tech/20200415 How to automate your cryptocurrency trades with Python.md @@ -0,0 +1,424 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to automate your cryptocurrency trades with Python) +[#]: via: (https://opensource.com/article/20/4/python-crypto-trading-bot) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +How to automate your cryptocurrency trades with Python +====== +In this tutorial, learn how to set up and use Pythonic, a graphical +programming tool that makes it easy for users to create Python +applications using ready-made function modules. +![scientific calculator][1] + +Unlike traditional stock exchanges like the New York Stock Exchange that have fixed trading hours, cryptocurrencies are traded 24/7, which makes it impossible for anyone to monitor the market on their own. + +Often in the past, I had to deal with the following questions related to my crypto trading: + + * What happened overnight? + * Why are there no log entries? + * Why was this order placed? + * Why was no order placed? + + + +The usual solution is to use a crypto trading bot that places orders for you when you are doing other things, like sleeping, being with your family, or enjoying your spare time. There are a lot of commercial solutions available, but I wanted an open source option, so I created the crypto-trading bot [Pythonic][2]. As [I wrote][3] in an introductory article last year, "Pythonic is a graphical programming tool that makes it easy for users to create Python applications using ready-made function modules." It originated as a cryptocurrency bot and has an extensive logging engine and well-tested, reusable parts such as schedulers and timers. + +### Getting started + +This hands-on tutorial teaches you how to get started with Pythonic for automated trading. It uses the example of trading [Tron][4] against [Bitcoin][5] on the [Binance][6] exchange platform. I choose these coins because of their volatility against each other, rather than any personal preference. + +The bot will make decisions based on [exponential moving averages][7] (EMAs). + +![TRX/BTC 1-hour candle chart][8] + +TRX/BTC 1-hour candle chart + +The EMA indicator is, in general, a weighted moving average that gives more weight to recent price data. Although a moving average may be a simple indicator, I've had good experiences using it. + +The purple line in the chart above shows an EMA-25 indicator (meaning the last 25 values were taken into account). + +The bot monitors the pitch between the current EMA-25 value (t0) and the previous EMA-25 value (t-1). If the pitch exceeds a certain value, it signals rising prices, and the bot will place a buy order. If the pitch falls below a certain value, the bot will place a sell order. + +The pitch will be the main indicator for making decisions about trading. For this tutorial, it will be called the _trade factor_. + +### Toolchain + +The following tools are used in this tutorial: + + * Binance expert trading view (visualizing data has been done by many others, so there's no need to reinvent the wheel by doing it yourself) + * Jupyter Notebook for  data-science tasks + * Pythonic, which is the  overall framework + * PythonicDaemon as the  pure runtime (console- and Linux-only) + + + +### Data mining + +For a crypto trading bot to make good decisions, it's essential to get open-high-low-close ([OHLC][9]) data for your asset in a reliable way. You can use Pythonic's built-in elements and extend them with your own logic. + +The general workflow is: + + 1. Synchronize with Binance time + 2. Download OHLC data + 3. Load existing OHLC data from the file into memory + 4. Compare both datasets and extend the existing dataset with the newer rows + + + +This workflow may be a bit overkill, but it makes this solution very robust against downtime and disconnections. + +To begin, you need the **Binance OHLC Query** element and a **Basic Operation** element to execute your own code. + +![Data-mining workflow][10] + +Data-mining workflow + +The OHLC query is set up to query the asset pair **TRXBTC** (Tron/Bitcoin) in one-hour intervals. + +![Configuration of the OHLC query element][11] + +Configuring the OHLC query element + +The output of this element is a [Pandas DataFrame][12]. You can access the DataFrame with the **input** variable in the **Basic Operation** element. Here, the **Basic Operation** element is set up to use Vim as the default code editor. + +![Basic Operation element set up to use Vim][13] + +Basic Operation element set up to use Vim + +Here is what the code looks like: + + +``` +import pickle, pathlib, os +import pandas as pd + +outout = None + +if isinstance(input, pd.DataFrame): +    file_name = 'TRXBTC_1h.bin' +    home_path = str(pathlib.Path.home()) +    data_path = os.path.join(home_path, file_name) + +    try: +        df = pickle.load(open(data_path, 'rb')) +        n_row_cnt = df.shape[0] +        df = pd.concat([df,input], ignore_index=True).drop_duplicates(['close_time']) +        df.reset_index(drop=True, inplace=True) +        n_new_rows = df.shape[0] - n_row_cnt +        log_txt = '{}: {} new rows written'.format(file_name, n_new_rows) +    except: +        log_txt = 'File error - writing new one: {}'.format(e) +        df = input + +    pickle.dump(df, open(data_path, "wb" )) +    output = df +``` + +First, check whether the input is the DataFrame type. Then look inside the user's home directory (**~/**) for a file named **TRXBTC_1h.bin**. If it is present, then open it, concatenate new rows (the code in the **try** section), and drop overlapping duplicates. If the file doesn't exist, trigger an _exception_ and execute the code in the **except** section, creating a new file. + +As long as the checkbox **log output** is enabled, you can follow the logging with the command-line tool **tail**: + + +``` +`$ tail -f ~/Pythonic_2020/Feb/log_2020_02_19.txt` +``` + +For development purposes, skip the synchronization with Binance time and regular scheduling for now. This will be implemented below. + +### Data preparation + +The next step is to handle the evaluation logic in a separate grid; therefore, you have to pass over the DataFrame from Grid 1 to the first element of Grid 2 with the help of the **Return element**. + +In Grid 2, extend the DataFrame by a column that contains the EMA values by passing the DataFrame through a **Basic Technical Analysis** element. + +![Technical analysis workflow in Grid 2][14] + +Technical analysis workflow in Grid 2 + +Configure the technical analysis element to calculate the EMAs over a period of 25 values. + +![Configuration of the technical analysis element][15] + +Configuring the technical analysis element + +When you run the whole setup and activate the debug output of the **Technical Analysis** element, you will realize that the values of the EMA-25 column all seem to be the same. + +![Missing decimal places in output][16] + +Decimal places are missing in the output + +This is because the EMA-25 values in the debug output include just six decimal places, even though the output retains the full precision of an 8-byte float value. + +For further processing, add a **Basic Operation** element: + +![Workflow in Grid 2][17] + +Workflow in Grid 2 + +With the **Basic Operation** element, dump the DataFrame with the additional EMA-25 column so that it can be loaded into a Jupyter Notebook; + +![Dump extended DataFrame to file][18] + +Dump extended DataFrame to file + +### Evaluation logic + +Developing the evaluation logic inside Juypter Notebook enables you to access the code in a more direct way. To load the DataFrame, you need the following lines: + +![Representation with all decimal places][19] + +Representation with all decimal places + +You can access the latest EMA-25 values by using [**iloc**][20] and the column name. This keeps all of the decimal places. + +You already know how to get the latest value. The last line of the example above shows only the value. To copy the value to a separate variable, you have to access it with the **.at** method, as shown below. + +You can also directly calculate the trade factor, which you will need in the next step. + +![Buy/sell decision][21] + +Buy/sell decision + +### Determine the trading factor + +As you can see in the code above, I chose 0.009 as the trade factor. But how do I know if 0.009 is a good trading factor for decisions? Actually, this factor is really bad, so instead, you can brute-force the best-performing trade factor. + +Assume that you will buy or sell based on the closing price. + +![Validation function][22] + +Validation function + +In this example, **buy_factor** and **sell_factor** are predefined. So extend the logic to brute-force the best performing values. + +![Nested for loops for determining the buy and sell factor][23] + +Nested _for_ loops for determining the buy and sell factor + +This has 81 loops to process (9x9), which takes a couple of minutes on my machine (a Core i7 267QM). + +![System utilization while brute forcing][24] + +System utilization while brute-forcing + +After each loop, it appends a tuple of **buy_factor**, **sell_factor**, and the resulting **profit** to the **trading_factors** list. Sort the list by profit in descending order. + +![Sort profit with related trading factors in descending order][25] + +Sort profit with related trading factors in descending order + +When you print the list, you can see that 0.002 is the most promising factor. + +![Sorted list of trading factors and profit][26] + +Sorted list of trading factors and profit + +When I wrote this in March 2020, the prices were not volatile enough to present more promising results. I got much better results in February, but even then, the best-performing trading factors were also around 0.002. + +### Split the execution path + +Start a new grid now to maintain clarity. Pass the DataFrame with the EMA-25 column from Grid 2 to element 0A of Grid 3 by using a **Return** element. + +In Grid 3, add a **Basic Operation** element to execute the evaluation logic. Here is the code of that element: + +![Implemented evaluation logic][27] + +Implemented evaluation logic + +The element outputs a **1** if you should buy or a **-1** if you should sell. An output of **0** means there's nothing to do right now. Use a **Branch** element to control the execution path. + +![Branch element: Grid 3 Position 2A][28] + +Branch element: Grid 3, Position 2A + +Due to the fact that both **0** and **-1** are processed the same way, you need an additional Branch element on the right-most execution path to decide whether or not you should sell. + +![Branch element: Grid 3 Position 3B][29] + +Branch element: Grid 3, Position 3B + +Grid 3 should now look like this: + +![Workflow on Grid 3][30] + +Workflow on Grid 3 + +### Execute orders + +Since you cannot buy twice, you must keep a persistent variable between the cycles that indicates whether you have already bought. + +You can do this with a **Stack element**. The Stack element is, as the name suggests, a representation of a file-based stack that can be filled with any Python data type. + +You need to define that the stack contains only one Boolean element, which determines if you bought (**True**) or not (**False**). As a consequence, you have to preset the stack with one **False**. You can set this up, for example, in Grid 4 by simply passing a **False** to the stack. + +![Forward a False-variable to the subsequent Stack element][31] + +Forward a **False** variable to the subsequent Stack element + +The Stack instances after the branch tree can be configured as follows: + +![Configuration of the Stack element][32] + +Configuring the Stack element + +In the Stack element configuration, set **Do this with input** to **Nothing**. Otherwise, the Boolean value will be overwritten by a 1 or 0. + +This configuration ensures that only one value is ever saved in the stack (**True** or **False**), and only one value can ever be read (for clarity). + +Right after the Stack element, you need an additional **Branch** element to evaluate the stack value before you place the **Binance Order** elements. + +![Evaluate the variable from the stack][33] + +Evaluating the variable from the stack + +Append the Binance Order element to the **True** path of the Branch element. The workflow on Grid 3 should now look like this: + +![Workflow on Grid 3][34] + +Workflow on Grid 3 + +The Binance Order element is configured as follows: + +![Configuration of the Binance Order element][35] + +Configuring the Binance Order element + +You can generate the API and Secret keys on the Binance website under your account settings. + +![Creating an API key in Binance][36] + +Creating an API key in the Binance account settings + +In this tutorial, every trade is executed as a market trade and has a volume of 10,000 TRX (~US$ 150 on March 2020). (For the purposes of this tutorial, I am demonstrating the overall process by using a Market Order. Because of that, I recommend using at least a Limit order.) + +The subsequent element is not triggered if the order was not executed properly (e.g., a connection issue, insufficient funds, or incorrect currency pair). Therefore, you can assume that if the subsequent element is triggered, the order was placed. + +Here is an example of output from a successful sell order for XMRBTC: + +![Output of a successfully placed sell order][37] + +Successful sell order output + +This behavior makes subsequent steps more comfortable: You can always assume that as long the output is proper, the order was placed. Therefore, you can append a **Basic Operation** element that simply writes the output to **True** and writes this value on the stack to indicate whether the order was placed or not. + +If something went wrong, you can find the details in the logging message (if logging is enabled). + +![Logging output of Binance Order element][38] + +Logging output from Binance Order element + +### Schedule and sync + +For regular scheduling and synchronization, prepend the entire workflow in Grid 1 with the **Binance Scheduler** element. + +![Binance Scheduler at Grid 1, Position 1A][39] + +Binance Scheduler at Grid 1, Position 1A + +The Binance Scheduler element executes only once, so split the execution path on the end of Grid 1 and force it to re-synchronize itself by passing the output back to the Binance Scheduler element. + +![Grid 1: Split execution path][40] + +Grid 1: Split execution path + +Element 5A points to Element 1A of Grid 2, and Element 5B points to Element 1A of Grid 1 (Binance Scheduler). + +### Deploy + +You can run the whole setup 24/7 on your local machine, or you could host it entirely on an inexpensive cloud system. For example, you can use a Linux/FreeBSD cloud system for about US$5 per month, but they usually don't provide a window system. If you want to take advantage of these low-cost clouds, you can use PythonicDaemon, which runs completely inside the terminal. + +![PythonicDaemon console interface][41] + +PythonicDaemon console + +PythonicDaemon is part of the basic installation. To use it, save your complete workflow, transfer it to the remote running system (e.g., by Secure Copy [SCP]), and start PythonicDaemon with the workflow file as an argument: + + +``` +`$ PythonicDaemon trading_bot_one` +``` + +To automatically start PythonicDaemon at system startup, you can add an entry to the crontab: + + +``` +`# crontab -e` +``` + +![Crontab on Ubuntu Server][42] + +Crontab on Ubuntu Server + +### Next steps + +As I wrote at the beginning, this tutorial is just a starting point into automated trading. Programming trading bots is approximately 10% programming and 90% testing. When it comes to letting your bot trade with your money, you will definitely think thrice about the code you program. So I advise you to keep your code as simple and easy to understand as you can. + +If you want to continue developing your trading bot on your own, the next things to set up are: + + * Automatic profit calculation (hopefully only positive!) + * Calculation of the prices you want to buy for + * Comparison with your order book (i.e., was the order filled completely?) + + + +You can download the whole example on [GitHub][2]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-crypto-trading-bot + +作者:[Stephan Avenwedde][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://github.com/hANSIc99/Pythonic +[3]: https://opensource.com/article/19/5/graphically-programming-pythonic +[4]: https://tron.network/ +[5]: https://bitcoin.org/en/ +[6]: https://www.binance.com/ +[7]: https://www.investopedia.com/terms/e/ema.asp +[8]: https://opensource.com/sites/default/files/uploads/1_ema-25.png (TRX/BTC 1-hour candle chart) +[9]: https://en.wikipedia.org/wiki/Open-high-low-close_chart +[10]: https://opensource.com/sites/default/files/uploads/2_data-mining-workflow.png (Data-mining workflow) +[11]: https://opensource.com/sites/default/files/uploads/3_ohlc-query.png (Configuration of the OHLC query element) +[12]: https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#dataframe +[13]: https://opensource.com/sites/default/files/uploads/4_edit-basic-operation.png (Basic Operation element set up to use Vim) +[14]: https://opensource.com/sites/default/files/uploads/6_grid2-workflow.png (Technical analysis workflow in Grid 2) +[15]: https://opensource.com/sites/default/files/uploads/7_technical-analysis-config.png (Configuration of the technical analysis element) +[16]: https://opensource.com/sites/default/files/uploads/8_missing-decimals.png (Missing decimal places in output) +[17]: https://opensource.com/sites/default/files/uploads/9_basic-operation-element.png (Workflow in Grid 2) +[18]: https://opensource.com/sites/default/files/uploads/10_dump-extended-dataframe.png (Dump extended DataFrame to file) +[19]: https://opensource.com/sites/default/files/uploads/11_load-dataframe-decimals.png (Representation with all decimal places) +[20]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iloc.html +[21]: https://opensource.com/sites/default/files/uploads/12_trade-factor-decision.png (Buy/sell decision) +[22]: https://opensource.com/sites/default/files/uploads/13_validation-function.png (Validation function) +[23]: https://opensource.com/sites/default/files/uploads/14_brute-force-tf.png (Nested for loops for determining the buy and sell factor) +[24]: https://opensource.com/sites/default/files/uploads/15_system-utilization.png (System utilization while brute forcing) +[25]: https://opensource.com/sites/default/files/uploads/16_sort-profit.png (Sort profit with related trading factors in descending order) +[26]: https://opensource.com/sites/default/files/uploads/17_sorted-trading-factors.png (Sorted list of trading factors and profit) +[27]: https://opensource.com/sites/default/files/uploads/18_implemented-evaluation-logic.png (Implemented evaluation logic) +[28]: https://opensource.com/sites/default/files/uploads/19_output.png (Branch element: Grid 3 Position 2A) +[29]: https://opensource.com/sites/default/files/uploads/20_editbranch.png (Branch element: Grid 3 Position 3B) +[30]: https://opensource.com/sites/default/files/uploads/21_grid3-workflow.png (Workflow on Grid 3) +[31]: https://opensource.com/sites/default/files/uploads/22_pass-false-to-stack.png (Forward a False-variable to the subsequent Stack element) +[32]: https://opensource.com/sites/default/files/uploads/23_stack-config.png (Configuration of the Stack element) +[33]: https://opensource.com/sites/default/files/uploads/24_evaluate-stack-value.png (Evaluate the variable from the stack) +[34]: https://opensource.com/sites/default/files/uploads/25_grid3-workflow.png (Workflow on Grid 3) +[35]: https://opensource.com/sites/default/files/uploads/26_binance-order.png (Configuration of the Binance Order element) +[36]: https://opensource.com/sites/default/files/uploads/27_api-key-binance.png (Creating an API key in Binance) +[37]: https://opensource.com/sites/default/files/uploads/28_sell-order.png (Output of a successfully placed sell order) +[38]: https://opensource.com/sites/default/files/uploads/29_binance-order-output.png (Logging output of Binance Order element) +[39]: https://opensource.com/sites/default/files/uploads/30_binance-scheduler.png (Binance Scheduler at Grid 1, Position 1A) +[40]: https://opensource.com/sites/default/files/uploads/31_split-execution-path.png (Grid 1: Split execution path) +[41]: https://opensource.com/sites/default/files/uploads/32_pythonic-daemon.png (PythonicDaemon console interface) +[42]: https://opensource.com/sites/default/files/uploads/33_crontab.png (Crontab on Ubuntu Server) diff --git a/sources/tech/20200415 Tweaking history on Linux.md b/sources/tech/20200415 Tweaking history on Linux.md new file mode 100644 index 0000000000..b17a666a8a --- /dev/null +++ b/sources/tech/20200415 Tweaking history on Linux.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tweaking history on Linux) +[#]: via: (https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Tweaking history on Linux +====== +The bash shell's history command in Linux makes it easy to review and reuse commands, but there's a lot you do to control how much it remembers and how much forgets. +[Claudio Testa][1] [(CC0)][2] + +The bash **history** command on Linux systems helps with remembering commands you’ve previously run and repeating those commands without having to retype them. + +You could decide, however, that you’d be just as happy to forget that you referenced a dozen man pages, listed your files every 10 minutes or viewed previously run commands by typing “history”. In this post, we’re going to look at how you can get the history command to remember just what you want it to remember and forget commands that are likely to be of little "historic value". + +### Viewing your command history + +To view previously run commands, you simply type “history”. You’ll probably see a long list of commands. The number of commands remembered depends on an environment variable called **$HISTSIZE** that is set up in your **~/.bashrc** file, but there’s nothing stopping you from changing this setting if you want to save more or fewer commands. + +To view history, use the **history** command: + +``` +$ history +209 uname -v +210 date +211 man chage +... +``` + +To see the maximum number of commands that will be displayed: + +``` +$ echo $HISTSIZE +500 +``` + +You can change **$HISTSIZE** and make the change permanent by running commands like these: + +``` +$ export HISTSIZE=1000 +$ echo “HISTSIZE=1000” >> ~/.bashrc +``` + +There’s also a difference between how much history is preserved for you and how much is displayed when you type “history”. The **$HISTSIZE** variable controls how much history is displayed while the **$HISTFILESIZE** variable controls how many commands are retained in your **.bash_history** file. + +[][3] + +``` +$ echo $HISTSIZE +1000 +$ echo $HISTFILESIZE +2000 +``` + +You can verify the second variable by counting the lines in your history file: + +``` +$ wc -l .bash_history +2000 .bash_history +``` + +One thing to keep in mind is that commands that you enter during a login session aren’t added to your **.bash_history** file until you log off, even though they show up in the **history** command output right away. + +### Using history + +There are three ways to reissue commands that you find in your history. The simplest way, especially if the command you want to reuse was run recently, is often to type a ! followed by enough of the first letters in the command's name to uniquely identify it. + +``` +$ !u +uname -v +#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 +``` + +Another easy way to repeat a command is to simply press your up-arrow key until the command is displayed and then press enter. + +Alternately, if you run the history command and see the command you want to rerun listed, you can type an ! followed by the sequence number shown to the left of the command. + +``` +$ !209 +uname -v +#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 +``` + +### Hiding history + +If you want to stop recording commands for some period of time, you can use this command: + +``` +$ set +o history +``` + +Commands will not show up when you type "history" nor will they be added to your **.bash_history** file when you exit the session by logging off or exiting the terminal. + +To reverse this setting, use **set -o history**. To make it permanent, you can add it to your **.bashrc** file, though failing to make use of command history altogether is generally not a good idea. + +``` +$ echo 'set +o history' >> ~/.bashrc +``` + +To temporarily clear history, so that only commands that you enter afterwards show up when you type "history", use the **history -c** (clear) command: + +``` +$ history | tail -3 +209 uname -v +210 date +211 man chage +$ history -c +$ history +1 history +``` + +NOTE: The commands entered after typing "history -c" will not be added to your .bash_history file. + +### Controlling history + +The command history settings on many systems will default to including one called **$HISTCONTROL** that ensures that, even if you run the same command seven times in a row, it will only be remembered once. It also ensures that commands that you type after first entering one or more blanks will be omitted from your command history. + +``` +$ grep HISTCONTROL .bashrc +HISTCONTROL=ignoreboth +``` + +The "ignoreboth" means "ignore both duplicate commands and command starting with blanks". For example, if you type these commands: + +``` +$ echo try this +$ date +$ date +$ date +$ pwd +$ history +``` + +your history command should report something like this: + +``` +$ history +$ echo try this +$ date +$ history +``` + +Notice that the sequential date commands were reduced to one and the indented command was omitted. + +### Overlooking history + +To ignore certain commands so that they never show up when you type "history" and are never added to your **.bash_history** file, use the **$HISTIGNORE** setting. For example: + +``` +$ export HISTIGNORE=”history:cd:exit:ls:pwd:man” +``` + +This setting will cause all **history**, **cd**, **exit**, **ls**, **pwd** and **man** commands to be omitted from your **history** output and your **.bash_history** file. + +If you want to make this setting permanent, you have to add it to your **.bashrc** file. + +``` +$ echo 'HISTIGNORE="history:cd:exit:ls:pwd:man"' >> .bashrc +``` + +This setting just means that when you look back through previously run commands, the list won’t be cluttered by commands that you're unlikely to be looking for when you are looking through your command history. + +### Remembering, ignoring and forgetting the past + +Command history is useful because it helps you remember what commands you’ve recently used and reminds you about changes you’ve recently made. It also makes it easier to rerun commands, especially those with a string of arguments that you don't necessarily want to recreate. Tailoring your history settings can make your use of command history a little easier and more efficient. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/iqeG5xA96M4 +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200415 Writing Java with Quarkus in VS Code.md b/sources/tech/20200415 Writing Java with Quarkus in VS Code.md new file mode 100644 index 0000000000..2d61db71de --- /dev/null +++ b/sources/tech/20200415 Writing Java with Quarkus in VS Code.md @@ -0,0 +1,239 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Writing Java with Quarkus in VS Code) +[#]: via: (https://opensource.com/article/20/4/java-quarkus-vs-code) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +Writing Java with Quarkus in VS Code +====== +In this tutorial, I'll walk you through how to rebuild, package, and +deploy cloud-native applications automatically with Quarkus. +![Person drinking a hat drink at the computer][1] + +In the previous articles in this series about cloud-native [Java][2] applications, I shared [_6 requirements of cloud-native software_][3] and [_4 things cloud-native Java must provide_][4]. But now you might want to implement these advanced Java applications in your local machine without climbing a steep learning curve. In this article, I will walk through using the open source technologies [Quarkus][5] and [Visual Studio Code][6] (VS Code) to accelerate the development of both traditional cloud-native Java stacks and also serverless, reactive applications with easier and more familiar methods. + +Quarkus is a Kubernetes-native Java stack tailored for GraalVM and OpenJDK HotSpot. It's crafted from best-of-breed Java libraries and standards with live coding, unified configuration, superfast startup, small memory footprint, and unified imperative and reactive development. VS Code is an open source integrated development environment (IDE) for editing code. + +### Generate a Quarkus project + +Begin by navigating to Quarkus' [Start coding][7] page to generate a Quarkus project that includes a RESTful endpoint. Leave all variables (i.e., Group, Artifact, Build Tool, Extensions) on the default settings, then click **Generate your application** at the top-right of the page. Note that the RESTEasy JAX-RS extension is preselected as default. + +![Quarkus Generate application button][8] + +The ZIP file will automatically download on your local machine. Extract the file with the following command: + + +``` +$ unzip code-with-quarkus.zip +Archive: code-with-quarkus.zip +    creating: code-with-quarkus/ +   inflating: code-with-quarkus/pom.xml +   ... +``` + +### Install VS Code + +Download and install VS Code in your preferred way, whether that's [from the website][9] or through your package manager (dnf, apt, brew, etc). Once that's done, open the unzipped Quarkus project using VS Code's command-line tool: + + +``` +$ cd code-with-quarkus/ +$ code . +``` + +You will see the [Apache Maven][10] project structure with: + + * **ExampleResource** exposed on **/hello** + * Associated JUnit test + * Accessible landing page via + * Dockerfiles for both [native compilation][11] and JVM HotSpot + * A unified application configuration file + + + +Add Quarkus tools to your IDE through the VS Code's extension feature. + +![Add Quarkus tools to VS Code IDE][12] + +### Start coding + +Run the application using Quarkus development mode. To run the application, you need: + + * JDK 1.8+ installed with JAVA_HOME configured appropriately + * Apache Maven 3.6.3+ + + + +Move to the **code-with-quarkus** directory then type **mvn compile quarkus:dev** in VS Code's terminal. + +![Run application][13] + +You will see that the Java application is running well with: + + * About one second to startup + * Live coding activated + * EnabledCDI and RESTEASY features + + + +When you access the endpoint via a web browser, you will see the return code, **hello**. + +!["Hello" return][14] + +Now, you're ready to change the code! Move back to VS Code, then open the **ExampleResource.java** file in **src/main/java/org/acme**. Replace the return code with "**Welcome, Cloud-Native Java with Quarkus!"** Don't forget to **Save** the file. + +![Editing the return][15] + +Go back to the web browser and reload the page. + +![New return][16] + +_It's like magic!_ Behind the scenes, Quarkus rebuilt, packaged, and deployed the application for you automatically, and it only took half a second. This is one of the essential cloud-native Java runtime features for increasing development productivity. + +![Quarkus output][17] + +Continue running your cloud-native Java application in Quarkus. + +### Integrate data transactions via Quakrus Tool + +To add an in-memory database (H2) transaction capability, press **F1** then click on **Quarkus: Add extensions to the current project**. + +![Adding extensions in Quarkus][18] + +Enter **h2** in the search bar, then double-click on **JDBC Driver - H2 Data** in the result. + +![JDBC Driver - H2 Data extension][19] + +Select the following three extensions, which will simplify your persistence code and return JSON format data: + + * Hibernate ORM with Panache Data + * JDBC Driver - H2 + * RESTEasy JSON-B Web + + + +Press **Enter** to add those dependencies. + +![Add Quarkus extensions][20] + +You should see the following in a new VS Code terminal: + +![VS Code adding extensions][21] + +You should also find the following pulled dependencies in **POM.xml**: + +![dependencies in POM.xml][22] + +### Create an Inventory entity + +With your project in place, you can get to work defining the business logic. + +The first step is to define the model (entity) of an Inventory object. Since Quarkus uses Hibernate ORM Panache, create an **Inventory.java** file in the **src.main.java.org.acme** directory, and paste the following code into it: + + +``` +package org.acme; + +import javax.persistence.Cacheable; +import javax.persistence.Entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntity; + +@[Entity][23] +@Cacheable +public class Inventory extends PanacheEntity { +    +    public [String][24] itemId; +    public [String][24] location; +    public int quantity; +    public [String][24] link + +    public Inventory() { + +    } +    +} +``` + +#### Define the RESTful endpoint of Inventory + +Next, mirror the abstraction of service so that you can inject the Inventory service into various places (like a RESTful resource endpoint) in the future. Create an **InventoryResource.java** file in the **src.main.java.org.acme** directory and add this code to it: + + +``` +package org.acme; + +import java.util.List; +import javax.enterprise.context.ApplicationScoped; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path("/services/inventory") +@ApplicationScoped +@Produces("application/json") +@Consumes("application/json") +public class InventoryResource { + +    @GET +    +    public List<Inventory> getAll() { +        return Inventory.listAll(); +    } +} +``` + +Don't forget to save these files. Go back to your web browser and access a new endpoint, . You will see: + +![Inventory endpoint][25] + +### Wrapping up + +If you have an issue or get an error when you implement this, you can find and reuse the [code in my GitHub repository][26]. + +If you want to learn more, Quarkus has some [practical and useful guides][27] that show how to develop advanced cloud-native Java applications using Quarkus extensions with event-driven programming, serverless development, and Kubernetes deployment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/java-quarkus-vs-code + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://opensource.com/resources/java +[3]: https://opensource.com/article/20/1/cloud-native-software +[4]: https://opensource.com/article/20/1/cloud-native-java +[5]: https://quarkus.io/ +[6]: https://code.visualstudio.com/ +[7]: https://code.quarkus.io/ +[8]: https://opensource.com/sites/default/files/uploads/quarkus_generateapplication.png (Quarkus Generate application button) +[9]: https://code.visualstudio.com/download +[10]: https://maven.apache.org/ +[11]: https://quarkus.io/guides/building-native-image +[12]: https://opensource.com/sites/default/files/uploads/add-quarkus-to-ide.png (Add Quarkus tools to VS Code IDE) +[13]: https://opensource.com/sites/default/files/uploads/run-application.png (Run application) +[14]: https://opensource.com/sites/default/files/uploads/endpoint-hello.png ("Hello" return) +[15]: https://opensource.com/sites/default/files/uploads/edit-return-code.png (Editing the return) +[16]: https://opensource.com/sites/default/files/uploads/new-return-code.png (New return) +[17]: https://opensource.com/sites/default/files/uploads/quarkus-magic.png (Quarkus output) +[18]: https://opensource.com/sites/default/files/uploads/quarkus-add-extensions.png (Adding extensions in Quarkus) +[19]: https://opensource.com/sites/default/files/uploads/jbdc-driver-h2-data.png (JDBC Driver - H2 Data extension) +[20]: https://opensource.com/sites/default/files/uploads/add-extensions.png (Add Quarkus extensions) +[21]: https://opensource.com/sites/default/files/uploads/vscode-adding-extensions.png (VS Code adding extensions) +[22]: https://opensource.com/sites/default/files/uploads/dependencies-pomxml.png (dependencies in POM.xml) +[23]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+entity +[24]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[25]: https://opensource.com/sites/default/files/uploads/inventory-endpoint.png (Inventory endpoint) +[26]: https://github.com/danieloh30/code-with-quarkus +[27]: https://quarkus.io/guides/ diff --git a/sources/tech/20200417 How to set up and run WordPress for your classroom.md b/sources/tech/20200417 How to set up and run WordPress for your classroom.md new file mode 100644 index 0000000000..bb8b87d560 --- /dev/null +++ b/sources/tech/20200417 How to set up and run WordPress for your classroom.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up and run WordPress for your classroom) +[#]: via: (https://opensource.com/article/20/4/wordpress-virtual-machine) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +How to set up and run WordPress for your classroom +====== +Follow these simple steps to customize WordPress for use in the +classroom using free open source software. +![Painting art on a computer screen][1] + +There are many good reasons to set up WordPress for your classroom. As more schools switch to online classes, WordPress can become the go-to content management system. Teachers using WordPress can provide a number of different educational choices to differentiate instruction for their students. Blogging is an accessible way to create content that energizes student learning. Teachers can write short stories, poems, and provide picture galleries that function as story starters. Students can comment and those comments can be moderated by their teacher. + +There are free options like [WordPress.com][2] and [Edublogs][3]. However, these free versions are limited, and you may want to explore all your options. You can install [Virtualbox][4] on any Windows, macOS, or Linux computer. You can use your own computer or an extra you happen to have access to in a virtual environment. + +On Linux, you can install Virtualbox from your package manager. For instance, on Debian, Elementary OS, or Ubuntu: + + +``` +`$ sudo apt install virtualbox` +``` + +On Fedora: + + +``` +`$ sudo dnf install virtualbox` +``` + +### Download a Wordpress image + +Wordpress is easy to install, but server configuration and management can be difficult for the uninitiated. That's why there's [Turnkey Linux][5], a project dedicated to creating virtual machine images and containers of popular server software, preconfigured and ready to run. With Turnkey Linux, you just download a disk image containing the operating system and the software you want to run, and then import that image into Virtualbox. + +To get started with Wordpress, download the **VM** virtual machine image from [turnkeylinux.org/wordpress][6] (in the **Builds** section). Make sure you download the image labeled **VM**, because that's the only format meant for Virtualbox. + +### Import the image into Virtualbox + +After installing Virtualbox, launch the application and import the virtual machine image into Virtualbox. + +![][7] + +Networking on the imported image is set to NAT by default. You will want to change the network settings to "bridged." + +![Virtualbox menu][8] + +After restarting the virtual machine, you are prompted to add passwords for MySQL, Adminer, and the WordPress **admin** user. + +Then you see the network configuration console for the installation. Launch a web browser and navigate to the **web** address provided (in this example, it's 192.168.86.149). + +![Console][9] + +In a web browser, you see a login screen for your Wordpress installation. Click on the **Login** link. + +![Wordpress welcome][10] + +Enter **admin** as the username, followed by the password you created earlier. Click the **Login** link. On this first login as **admin**, you can choose a new password. Be sure to remember it! + +![Login screen][11] + +After logging in, you're presented with the WordPress Dashboard. The software will likely notify you, in the upper left corner of the window, that a new version of Wordpress exists. Update to the latest versions as prompted so your site is secure. + +It's important to note that your Wordpress blog isn't visible by anyone on the Internet yet. It only exists in your local network: only people in your building who are connected to the same router or wifi access point as you can see your Wordpress site right now. The worldwide Internet can't get to it because you're behind a firewall (embedded in your router, and possible also in your computer). + +![Wordpress dashboard][12] + +Following the upgrade, the application restarts, and you're ready to begin configuring WordPress to your liking. + +![Wordpress configuration][13] + +On the far left, there is a button to **Customize Your Site**. + +There, you can choose the name of your site. You can accept the default theme, which is "Twenty Nineteen," or choose another. My favorite is "Twenty Ten," but browse through the themes available to find your personal favorite. WordPress comes with five free themes installed. You can download other free themes from the [WordPress][14][.org][15] site or choose to purchase a premium theme. + +When you click the **Customize Your Site** button, you're presented with new menu options. Select **Site Identity** and change the name of your site. You might use the name of your school or classroom. There's also room to choose a byline (the credit given to the author of a blog post). You can choose the colors for your site and where you will place menus and widgets. WordPress widgets and content and features to the sidebars for your site. Homepage settings are important, as they allow you to choose between a static page that might have a description of your school or classroom or having your blog entries displayed prominently. You can add additional CSS. + +![Turnkey theme][16] + +You can edit your front page, add additional pages like "About," or add a blog post. You can also manage widgets, manage menus, turn comments on or off, or add a link to learn more about WordPress. + +Customizing your site allows you to configure a number of options quickly and easily. + +WordPress has dozens of widgets that you can place in different areas of your page. Widgets are independent sections of content that can be placed into specific areas provided by your theme. These areas are called sidebars. + +### Adding content + +After you have WordPress configured to your liking, you probably want to get busy creating content. The best way to do that is to head back to the WordPress Dashboard. + +On the left side, near the top of the page, you see **Posts**. Select that link and a dropdown appears. Choose **Add New** to create your very first blog post. + +![Add post dropdown][17] + +Fill in your title in the top block and then move down to the body. It's like using a word processor. WordPress has all the tools you need to write. You can set the font size from _small_ to _huge_. You can start a paragraph with dropped capitals. The text and background color can be changed. Your posts can include quote blocks and embedded content. A wide variety of embedded content is supported so you can make your posts a dynamic multimedia experience. + +![Wordpress classroom blog][18] + +### Going online + +So far, your Wordpress blog only exists on your local network. Anyone using the same router as you (your housemates or classroom) can see your Wordpress site by navigating to 192.168.86.149, but once you're away from that router, the site becomes inaccessible. + +If you want to go online with your custom Wordpress site, you have to allow traffic through your router, and then direct that traffic to the computer running Virtualbox. If you've installed Virtualbox on a laptop, then your website would disappear any time you closed your laptop, which is why servers that never get shutdown exist. But if this is just a fun lesson on how to run a Wordpress site, then having a website that's only available during class hours is fine. + +If you have access to your router, then you can log into it and make the adjustments yourself. If you don't own or control your router, then you must talk to your systems administrator for access. + +A _router_ is the box you got from your internet service provider. You might also call it your _modem_. + +Every device is different, so there's no way for me to definitively tell you what you need to click on to adjust your settings. Generally, you access your home router through a web browser. Your router's address is often printed on the bottom of the router and begins with either 192.168 or 10. + +Navigate to the router address and log in with the credentials you were provided when you got your internet service. It's often as simple as `admin` with a numeric password (sometimes this password is printed on the router, too). If you don't know the login, call your internet provider and ask for details. + +Different routers use different terms for the same thing; keywords to look for are **Port forwarding**, **Virtual server**, and **Firewall**. Whatever your router calls it, you want to accept traffic coming to port 80 of your router and forward that traffic to the same port of your virtual machines's IP address (in this example, that is 192.168.86.149, but it could be different for you). + +![Example router setting screen][19] + +Now you're allowing traffic through the web port of your router's firewall. To view your Wordpress site over the Internet, get your worldwide IP address. You can get your global IP by going to the site [icanhazip.com][20]. Then go to a different computer, open a browser, and navigate to that IP address. As long as Virtualbox is running, you'll see your Wordpress site on the Internet. You can do this from anywhere in the world, because your site is on the Internet now. + +Most websites use a domain name so you don't have to remember global IP addresses. You can purchase a domain name from services like [webhosting.coop][21] or [gandi.net][22], or a temporary one from [freenom.com][23]. Mapping that to your Wordpress site, however, is out of scope for this article. + +### Wordpress for everyone + +[WordPress][24] is open source and is licensed under the [GNU Public License][25]. You are welcome to contribute to WordPress as either a [developer][26] or enthusiast. WordPress is committed to being inclusive and accessible as possible. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/wordpress-virtual-machine + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen) +[2]: https://wordpress.com/ +[3]: https://edublogs.org/ +[4]: https://www.virtualbox.org/ +[5]: https://www.turnkeylinux.org +[6]: https://www.turnkeylinux.org/wordpress +[7]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_1.png +[8]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_2.png (Virtualbox menu) +[9]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_3.png (Console) +[10]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_4.png (Wordpress welcome) +[11]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_5.png (Login screen) +[12]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_6.png (Wordpress dashboard) +[13]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_7.png (Wordpress configuration) +[14]: http://Wordpress.org +[15]: http://WordPress.org +[16]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_8.png (Turnkey theme) +[17]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_12.png (Add post dropdown) +[18]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_13.png (Wordpress classroom blog) +[19]: https://opensource.com/sites/default/files/router-web.jpg (Example router setting screen) +[20]: http://icanhazip.com/ +[21]: https://webhosting.coop/domain-names +[22]: https://www.gandi.net +[23]: http://freenom.com/ +[24]: https://wordpress.org/ +[25]: https://github.com/WordPress/WordPress/blob/master/license.txt +[26]: https://wordpress.org/five-for-the-future/ diff --git a/sources/tech/20200417 Is reporting 100- of code coverage reasonable.md b/sources/tech/20200417 Is reporting 100- of code coverage reasonable.md new file mode 100644 index 0000000000..6d57fb30f8 --- /dev/null +++ b/sources/tech/20200417 Is reporting 100- of code coverage reasonable.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is reporting 100% of code coverage reasonable?) +[#]: via: (https://opensource.com/article/20/4/testing-code-coverage) +[#]: author: (Eric Herman https://opensource.com/users/ericherman) + +Is reporting 100% of code coverage reasonable? +====== +The time required to reach reporting 100% of code coverage is +considerably less than what I would have estimated before this +exploration. +![Code going into a computer.][1] + +The [Foundation for Public Code][2] works to enable open and collaborative public-purpose software for public organizations (like local governments) internationally. We do this by supporting software at the codebase level through codebase stewardship. We also publish the [Standard for Public Code][3] (draft version 0.1.4 at the time of this writing), which helps open source codebase communities build solutions that can be reused successfully by other organizations. It includes guidance for policymakers, managers, developers, designers, and vendors. + +Among other things, the standard addresses [code coverage][4], or how much of the code is executed when an automated test suite runs. It's one way to measure the likelihood that the code contains undetected software bugs. In the standard's ["Use continuous integration" requirements][5], it says, "source code test and documentation coverage **should** be monitored." Additionally, the [guidance to check][6] this requirement states, "code coverage tools check whether coverage is at 100% of the code." + +Over my software development career, which spans more than two decades, I have worked on codebases large and small and some with very high percentages of code coverage. Yet none of the non-trivial codebases I have contributed to have reported 100% test coverage. This made me question whether the "_check whether coverage is at 100%_" guidance would be followed. + +When I think about the nature of the test coverage gaps in the codebases I have worked on, they typically have been around system states that are very difficult (and in some cases, impossible) to create. For instance, in earlier versions of Java, I recall we were required to write catch blocks for exceptions that could never be thrown. + +Previously, I reasoned that 100% test coverage is something to aspire to, but it is probably not worth the cost on most codebases and may not be realistic in a few. + +Coverage tools have been getting smarter and more tunable over time. Languages have been getting lighter, and libraries have been getting easier to mock and test. So how unreasonable is 100% coverage of functionality today? + +### Resource exhaustion + +The high-quality but low test-coverage codebases I contribute to happen to be written in C or C++. A quick glance at these codebases shows that there is a class of common low-coverage situations that I'll lump together under the umbrella of resource exhaustion: out of memory, out of disk space, etc. + +Here is a simple example of code that does not check for resource exhaustion; in this case, memory allocation failure: + + +``` +char *buf = malloc(80); +sprintf(buf, "hello, world"); +``` + +This example code needs to allocate a small buffer, so it calls **malloc(80)**, and **malloc** usually returns a pointer to 80 bytes of memory … but that can fail. In the (unlikely) case that **malloc** returns **NULL**, the code above will proceed to call **sprintf** with a **NULL** pointer which causes a crash. It is typical in C code to do something more like this: + + +``` +char *buf = malloc(80); +if (buf == NULL) { +    fprintf(stderr, "malloc returned NULL for 80 bytes?\n"); +    return NULL; +} +sprintf(buf, "hello, world"); +``` + +This code guards against **malloc** returning **NULL**, which is better. However, creating tests for correct behavior in the face of this kind of resource exhaustion can be really hard. It's not impossible, of course, and there are multiple approaches. Many approaches result in fragile tests, which require a lot of maintenance over time, and these tests can be very time-consuming to build in the first place. + +### Exploration + +Pondering this, I decided to run a little experiment to see if I could learn something about the costs and consequences of this strict, 100% criterion. + +Since I do some embedded-systems development, I have a few C libraries that I've developed and reused over the years in my embedded projects. I decided to look at some of these libraries and see just how hard it would be to bring them up to 100% code coverage. In the process, I paid attention to the impact on code clarity, code structure, and performance. + +#### A library with preexisting dependency injection + +Step one is measuring by adding code coverage to a codebase. Since this is C, **gcc** provides quite a lot by default with the **\--coverage** option, and **lcov** (with **genhtml**) does a good job of making reports; thus, this step was easy. I expected the starting coverage to be pretty good—it was, but it had a few untested branches, as well as the predicted gaps around error conditions and error reporting. + +I made error reporting pluggable, so it was easier to capture and make assertions around error messages in previously untested branches. + +Since this code already allowed for pluggable implementations of **malloc** and **free**, it was straightforward to write little malloc and free wrappers that I could inject memory allocation failures into. Within an hour or two, that was covered. + +In the process, I realized that there was one condition where, from the perspective of the calling client code, it was impossible to distinguish between the situation where an error occurs and one where **NULL** is a valid return value. For you C programmers, it was essentially similar to the following: + + +``` +/* stashes a copy of the value + * returns the previously stashed value */ +char *foo_stash(foo_s *context, +                char *stash_me, +                size_t stash_me_len) +{ +    char *copy = malloc(stash_me_len); +    if (copy == NULL) { +        return NULL; +    } +    memcpy(copy, stash_me, stash_me_len); +    char *previous = context->stash; +    context->stash = copy; +    /* previous may be NULL */ +    return previous; +} +``` + +I adjusted the API to allow the error information to be explicitly available. If you are a C developer, you know there are various ways this can be accomplished. I chose an approach similar to this: + + +``` +/* stashes a copy of the value + * returns the previously stashed value + * on error, the 'err' pointer is set to 1 */ +char *foo_stash2(foo_s *context, +                char *stash_me, +                size_t stash_me_len, +                int *err) +{ +    char *copy = malloc(stash_me_len); +    if (copy == NULL) { +        *err = 1; +        return NULL; +    } +    memcpy(copy, stash_me, stash_me_len); +    char *previous = context->stash; +    context->stash = copy; +    /* previous may be NULL */ +    return previous; +} +``` + +Without testing for resource exhaustion, it may have taken a long time for me to notice this (now obvious) shortcoming of the API. + +To get **lcov** to report 100% test coverage, I had to tell the compiler to [not inline any code][7], something I learned it does even at optimization level zero. + +When embedded in actual firmware, the compiler optimized away the unused indirection; therefore, the added indirection in the source code imposed no real-world performance penalty in the compiled firmware. + +Of course, this was the easy library. + +#### A more typical library + +Once I established a method of injecting memory allocation failures in tests, I decided to move onto another library, but one for which malloc and free were not already pluggable. I had questions. How invasive will this be to the codebase? Will it clutter the code, making it less clear? How time-consuming will it be? + +While I don't always record coverage metrics, I am a big believer in testing: more than 20 years ago, I learned that my code improves if I write the tests and client code [before][8] the implementation code, and I have worked that way ever since. (In [_Test-Driven Development: By Example_][9], you can find my name in the acknowledgments.) Yet, when I added code coverage reporting to the second library, I was surprised to see that (at some point in the past) I had added a pair of functions to the library without adding tests for them. The other untested areas were, unsurprisingly, code to handle memory-allocation failure. + +Writing tests for the pair of untested functions was, of course, quick and easy. The coverage tools also revealed that I had a function with an untested code branch that, given only a quick glance, contained a bug. The fix was trivial, yet I was surprised to find a bug, given the different projects where I use this library. Nonetheless, there it was, a humbling reminder that, all too often, bugs lurk in untested code. + +Next up was the more challenging stuff: testing for resource exhaustion. I started by introducing some global variables for the malloc/free function pointers, as well as a variable to hold a memory-tracking object. Once that was working, I moved those variables from global scope into a context argument that was already present. Refactoring the code to allow for the necessary indirection took only a couple of hours (less time than I expected), and the complexity added was negligible. + +### Reflections + +My conclusion from the first library was that it was well worth the time. The code is now more flexible, the API is now more complete for the caller, and writing the failure injection harness was pretty easy. + +From the second library, I was reminded that even less-pluggable code could be made testable without adding undue levels of complexity. The code improved, I fixed a bug, and I can be more confident in the code. Also, the additional modularity of being able to plug in an alternative memory allocator is a feature that may prove more valuable in the future. + +Exclusion comments are a feature of **lcov** to cause coverage reporting to ignore a block of code. Interestingly, I didn't feel the need to use exclusion comments in either library. + +I am more certain than ever that even very good code is improved by investing in test coverage. + +Both of these codebases are small, had some modularity already, began from a point of good testing, are single-threaded, and contain no graphical UI code. If I were to try to tackle this on one of the larger, more monolithic codebases I contribute to, it would be harder and require a larger time investment. There would likely be some sections of code where I might still conclude that the best thing to do would be to "cheat" by tuning the tooling to not report on some section of code. + +That said, I estimate that the time required to reach reporting 100% of code coverage is considerably less than what I would have estimated before this exploration. + +If you happen to be a C coder and want to see a running example of this, including **gcov** / **lcov** usage, I extracted the out-of-memory injecting code and put it in an [example repository][10]. + +Have you pushed a codebase to 100% coverage by tests, or tried to? What was your experience? Please share it in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/testing-code-coverage + +作者:[Eric Herman][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ericherman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.) +[2]: https://publiccode.net/ +[3]: https://standard.publiccode.net +[4]: https://en.wikipedia.org/wiki/Code_coverage +[5]: https://standard.publiccode.net/criteria/continuous-integration.html#requirements +[6]: https://standard.publiccode.net/criteria/continuous-integration.html#how-to-test +[7]: https://twitter.com/Eric_Herman/status/1224983465784938496 +[8]: https://opensource.com/article/20/2/automate-unit-tests +[9]: https://www.oreilly.com/library/view/test-driven-development/0321146530/ +[10]: https://github.com/ericherman/context-alloc diff --git a/sources/tech/20200419 A stress-free guide to keeping WordPress sites updated.md b/sources/tech/20200419 A stress-free guide to keeping WordPress sites updated.md new file mode 100644 index 0000000000..98ee9b1b1e --- /dev/null +++ b/sources/tech/20200419 A stress-free guide to keeping WordPress sites updated.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A stress-free guide to keeping WordPress sites updated) +[#]: via: (https://opensource.com/article/20/4/updating-wordpress) +[#]: author: (Sara Kelly https://opensource.com/users/sarapk) + +A stress-free guide to keeping WordPress sites updated +====== +This practical guide to a necessary task will show you how to maximize +site performance and avoid bugs and other issues with regular updates. +![Working from home at a laptop][1] + +We all know how important it is to keep WordPress sites updated. New updates provide the latest bug and security fixes against any nasties lurking on the web. But, more critically, an outdated site can also lead to poor performance, such as slow loading speed or an outdated look and feel. + +Unfortunately, keeping your WordPress site up-to-date is not as easy as clicking a button. There are several components to consider, from theme to plugins to PHP. Even worse, updating too quickly can wreak another kind of havoc. Have you ever experienced the dreaded, "There has been a critical error on your website" warning after an innocent little update? I know I have, many times! + +Here is a practical guide on what to look out for, as well as when and what to update, to ensure your WordPress site works well. + +### Updating WordPress + +Let's start with the basics. Check your WordPress version is up-to-date by visiting Dashboard > Updates. + +![WordPress update screen][2] + +### Choosing a WordPress theme + +Before we deep dive into updating themes, I'd like to take a few steps back. Choose an up-to-date theme from the get-go and do your homework before installing it! There is nothing worse than pouring your heart and soul into customizing a new theme, only to discover it is buggy. + +Questions to ask when choosing a theme include: + + * When was it first created? + * What is the current version available? + * Does the theme provider still maintain an active demo site and helpdesk? + * What do recent reviews say about the theme? + + + +If the theme provider is no longer maintaining the theme, save yourself the trouble and move on. Also, don't assume that just because you paid for a theme, that is necessarily maintained. I recently fell into this trap when I purchased [Pinable][3]. I loved the Pinterest look and feel. However, soon after installation, I noticed the lack of customization within the theme settings, major compatibility issues arose with my plugins, and the customer service was nonexistent. I should have known better. The theme was created in 2013 and selling for a bargain. + +If you already have a theme, then pay attention to how frequently updates become available. If there are never any updates, the theme provider may have closed up shop. It is only a matter of time before the impact of an outdated theme will cause problems. + +A quick aside while we are on the topic—up-to-date themes also give access to the two new alignment options in the WordPress block editor, which enable wide-width and full-width images. These help your blog posts look more professional. While there are a number of [tutorials][4] on the web that show you how to manually update your functions, PHP file, and CSS to enable the new alignment blocks, the code does not always work on older themes (especially masonry themes). + +![Wordpress theme][5] + +### Updating themes + +To check the current version of your theme, go to Appearance > Themes and click on the active theme to see the current version. If an upgrade is available, there will be an alert banner. Click on "update now" to initiate the update. You can also check for updates by going to Dashboard > Updates. + +![Themify screenshot][6] + +If you purchased a theme from a marketplace such as [Envato][7] or [Themify][8], check the theme documentation to learn what is required to initiate updates, as it will not show up automatically in the dashboard. In most cases, you will be required to download and install a specific plugin or manually upload new versions when they become available. In the latter case, you will need to delete or rename the old theme file via your cPanel before you can install the new one. A guide to installing themes via cPanel is available [here][9]. + +If you plan to customize your theme extensively and are worried about the impact of this when upgrading, consider creating a child theme first. A child theme lets you make changes without touching the original theme's code. You can then update your site without losing any customizations you've made. Read more about child themes [here][10]. + +As I said before, the source of most issues tends to be the theme. Learn what is required to keep your theme up to date, and do so regularly. If your theme provider is no longer creating updates, then find a new theme. + +### Easy does it for plugins + +If you manage multiple plugins, then you will be used to the frequent dashboard reminders to update! Before we get onto that, though, let's touch on some basics. + +As a general rule, you don't want to have too many plugins. They slow down the speed of your site by creating more code that the browser has to load. Always delete any inactive plugins. I prefer to manage plugins on the Plugins tab. Here you can see all active and inactive plugins, the current version, and whether an update is available. To update the plugin, simply click "update." + +![Plugin update page][11] + +Nonetheless, I implore you to wait a week or two before installing new updates. Updating my plugins too quickly has caused me no end of grievances. To begin with, updates are prone to human error. Don't be the guinea pig that tests out the latest version. Sometimes, the newest version of a plugin is not compatible with an older version of WordPress or your theme. Check these are up-to-date first. + +### Website down after updating plugins? + +If your site has stopped working or performance has dropped noticeably after updating your plugins, then all is not lost. Forget about those newfangled plugins that promise to test speed and identify buggy plugins (the last thing you want is more plugins)! Disable all your plugins, then activate one at a time while you test the speed and performance of your site on a website such as [Pingdom][12]. This is a great exercise to perform periodically, even if your website has not crashed. Once you identify the plugin causing the problem, delete it. + +In the event you cannot access WordPress because there is a critical error, then you will need to access your files via cPanel and delete all the plugin folders from there ([full instructions here][13]). Don't worry; doing this will not impact your website's content. You can then proceed to reinstall and activate the plugins one-by-one via WordPress. + +Cache plugins tend to be the biggest culprit in my experience. Issues with cache plugins can be minimized by clearing the cache frequently. Do not install multiple cache plugins that perform the same function, as they will only serve to slow down your site. The only way to truly get around cache plugin issues is to either not use them, use a plugin recommended by your hosting provider, or become an expert on cache. [This blog][14] on common cache issues in WordPress is a good place to start. + +### Back up before updating PHP + +If you are concerned about your website speed and have spent enough time browsing Google for answers, then you likely have seen the advice, "You gotta update your PHP!" Please tread carefully with manual PHP updates, though! If you have a good hosting provider, you should never need to do this. Rather, select the option for automatic PHP version management with your host. Newer versions of PHP may not be stable or compatible with the version of WordPress you are running. Let your hosting provider be the one to determine when updates are ready. + +However, if you are adamant that an old version of PHP is causing your website to be slow, take care to follow these steps before initiating an update. First, back up your site. Investing in a premium version of [Jetpack][15] is worth its weight in gold. Jetpack can perform real-time as well as daily backups, depending on your plan. Not to mention, their customer service and troubleshooting support are excellent. Secondly, inform your hosting provider that you plan to update the PHP and seek their advice first. If your host is unable to advise or wants to charge you for the privilege, you should probably think about changing hosts. + +You can update PHP either via cPanel or via your hosting platform under Devs > PHP Manager. After that, you are on your own, as that is where my expertise on PHP ends. + +If you have any other tips or pitfalls regarding updating WordPress, drop them in the comments box below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/updating-wordpress + +作者:[Sara Kelly][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sarapk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/wfh_work_home_laptop_work.png?itok=VFwToeMy (Working from home at a laptop) +[2]: https://opensource.com/sites/default/files/uploads/wp_update_1.png (Wordpress update screen) +[3]: https://www.theme-junkie.com/themes/pinable/ +[4]: https://www.billerickson.net/full-and-wide-alignment-in-gutenberg/ +[5]: https://opensource.com/sites/default/files/uploads/wp_theme_2.png (Wordpress theme) +[6]: https://opensource.com/sites/default/files/uploads/themify_3.png (Themify screenshot) +[7]: https://elements.envato.com/ +[8]: https://themify.me/ +[9]: https://hostadvice.com/how-to/how-to-install-a-wordpress-theme-using-cpanel/ +[10]: https://developer.wordpress.org/themes/advanced-topics/child-themes/ +[11]: https://opensource.com/sites/default/files/uploads/plugins_4.png (Plugin update page) +[12]: https://tools.pingdom.com/ +[13]: https://www.wpbeginner.com/plugins/how-to-deactivate-all-plugins-when-not-able-to-access-wp-admin/ +[14]: https://mhthemes.com/support/knb/solving-common-cache-issues-on-wordpress-websites/ +[15]: https://jetpack.com/upgrade/backup/?utm_source=google&utm_campaign=google_jetpack_search_brand_desktop_sg_en&utm_medium=paid_search&utm_term=%2Bwordpress%20%2Bjetpack%20%2Bbackup&creative=379260213317&campaignid=2061290863&utm_content=77066462603&matchtype=b&device=c&network=g&gclid=Cj0KCQjwu6fzBRC6ARIsAJUwa2RuPx5Dzr72eBEtZegsf11MmOBgLiwLX2HcEUXVaULIgv1MdZqGmeAaArmFEALw_wcB&gclsrc=aw.ds diff --git a/sources/tech/20200419 Getting Started With Pacman Commands in Arch-based Linux Distributions.md b/sources/tech/20200419 Getting Started With Pacman Commands in Arch-based Linux Distributions.md new file mode 100644 index 0000000000..f2fd06793f --- /dev/null +++ b/sources/tech/20200419 Getting Started With Pacman Commands in Arch-based Linux Distributions.md @@ -0,0 +1,250 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting Started With Pacman Commands in Arch-based Linux Distributions) +[#]: via: (https://itsfoss.com/pacman-command/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Getting Started With Pacman Commands in Arch-based Linux Distributions +====== + +_**Brief: This beginner’s guide shows you what you can do with pacmancommands in Linux, how to use them to find new packages, install and upgrade new packages, and clean your system.**_ + +The [pacman][1] package manager is one of the main difference between [Arch Linux][2] and other major distributions like Red Hat and Ubuntu/Debian. It combines a simple binary package format with an easy-to-use [build system][3]. The aim of pacman is to easily manage packages, either from the [official repositories][4] or the user’s own builds. + +If you ever used Ubuntu or Debian-based distributions, you might have used the apt-get or apt commands. Pacman is the equivalent in Arch Linux. If you [just installed Arch Linux][5], one of the first few [things to do after installing Arch Linux][6] is to learn to use pacman commands. + +In this beginner’s guide, I’ll explain some of the essential usage of the pacmand command that you should know for managing your Arch-based system. + +### Essential pacman commands Arch Linux users should know + +![][7] + +Like other package managers, pacman can synchronize package lists with the software repositories to allow the user to download and install packages with a simple command by solving all required dependencies. + +#### Install packages with pacman + +You can install a single package or multiple packages using pacman command in this fashion: + +``` +pacman -S _package_name1_ _package_name2_ ... +``` + +![Installing a package][8] + +The -S stands for synchronization. It means that pacman first synchronizes + +The pacman database categorises the installed packages in two groups according to the reason why they were installed: + + * **explicitly-installed**: the packages that were installed by a generic pacman -S or -U command + * **dependencies**: the packages that were implicitly installed because [required][9] by another package that was explicitly installed. + + + +#### Remove an installed package + +To remove a single package, leaving all of its dependencies installed: + +``` +pacman -R package_name_ +``` + +![Removing a package][10] + +To remove a package and its dependencies which are not required by any other installed package: + +``` +pacman -Rs _package_name_ +``` + +To remove dependencies that are no longer needed. For example, the package which needed the dependencies was removed. + +``` +pacman -Qdtq | pacman -Rs - +``` + +#### Upgrading packages + +Pacman provides an easy way to [update Arch Linux][11]. You can update all installed packages with just one command. This could take a while depending on how up-to-date the system is. + +The following command synchronizes the repository databases _and_ updates the system’s packages, excluding “local” packages that are not in the configured repositories: + +``` +pacman -Syu +``` + + * S stands for sync + * y is for refresh (local + * u is for system update + + + +Basically it is saying that sync to central repository (master package database), refresh the local copy of the master package database and then perform the system update (by updating all packages that have a newer version available). + +![System update][12] + +Attention! + +If you are an Arch Linux user before upgrading, it is advised to visit the [Arch Linux home page][2] to check the latest news for out-of-the-ordinary updates. If manual intervention is needed an appropriate news post will be made. Alternatively you can subscribe to the [RSS feed][13] or the [arch-announce mailing list][14]. + +Be also mindful to look over the appropriate [forum][15] before upgrading fundamental software (such as the kernel, xorg, systemd, or glibc), for any reported problems. + +**Partial upgrades are unsupported** at a rolling release distribution such as Arch and Manjaro. That means when new library versions are pushed to the repositories, all the packages in the repositories need to be rebuilt against the libraries. For example, if two packages depend on the same library, upgrading only one package, might break the other package which depends on an older version of the library. + +#### Use pacman to search for packages + +Pacman queries the local package database with the -Q flag, the sync database with the -S flag and the files database with the -F flag. + +Pacman can search for packages in the database, both in packages’ names and descriptions: + +``` +pacman -Ss _string1_ _string2_ ... +``` + +![Searching for a package][16] + +To search for already installed packages: + +``` +pacman -Qs _string1_ _string2_ ... +``` + +To search for package file names in remote packages: + +``` +pacman -F _string1_ _string2_ ... +``` + +To view the dependency tree of a package: + +``` +pactree _package_naenter code hereme_ +``` + +#### Cleaning the package cache + +Pacman stores its downloaded packages in /var/cache/pacman/pkg/ and does not remove the old or uninstalled versions automatically. This has some advantages: + + 1. It allows to [downgrade][17] a package without the need to retrieve the previous version through other sources. + 2. A package that has been uninstalled can easily be reinstalled directly from the cache folder. + + + +However, it is necessary to clean up the cache periodically to prevent the folder to grow in size. + +The [paccache(8)][18] script, provided within the [pacman-contrib][19] package, deletes all cached versions of installed and uninstalled packages, except for the most recent 3, by default: + +``` +paccache -r +``` + +![Clear cache][20] + +To remove all the cached packages that are not currently installed, and the unused sync database, execute: + +``` +pacman -Sc +``` + +To remove all files from the cache, use the clean switch twice, this is the most aggressive approach and will leave nothing in the cache folder: + +``` +pacman -Scc +``` + +#### Installing local or third-party packages + +Install a ‘local’ package that is not from a remote repository: + +``` +pacman -U _/path/to/package/package_name-version.pkg.tar.xz_ +``` + +Install a ‘remote’ package, not contained in an official repository: + +``` +pacman -U http://www.example.com/repo/example.pkg.tar.xz +``` + +### Bonus: Troubleshooting common errors with pacman + +Here are some common errors you may encounter while managing packages with pacman. + +#### Failed to commit transaction (conflicting files) + +If you see the following error: + +``` +error: could not prepare transaction +error: failed to commit transaction (conflicting files) +package: /path/to/file exists in filesystem +Errors occurred, no packages were upgraded. +``` + +This is happening because pacman has detected a file conflict and will not overwrite files for you. + +A safe way to solve this is to first check if another package owns the file (pacman -Qo _/path/to/file_). If the file is owned by another package, file a bug report. If the file is not owned by another package, rename the file which ‘exists in filesystem’ and re-issue the update command. If all goes well, the file may then be removed. + +Instead of manually renaming and later removing all the files that belong to the package in question, you may explicitly run _**pacman -S –overwrite glob package**_ to force pacman to overwrite files that match _glob_. + +#### Failed to commit transaction (invalid or corrupted package) + +Look for .part files (partially downloaded packages) in /var/cache/pacman/pkg/ and remove them. It is often caused by usage of a custom XferCommand in pacman.conf. + +#### Failed to init transaction (unable to lock database) + +When pacman is about to alter the package database, for example installing a package, it creates a lock file at /var/lib/pacman/db.lck. This prevents another instance of pacman from trying to alter the package database at the same time. + +If pacman is interrupted while changing the database, this stale lock file can remain. If you are certain that no instances of pacman are running then delete the lock file. + +Check if a process is holding the lock file: + +``` +lsof /var/lib/pacman/db.lck +``` + +If the above command doesn’t return anything, you can remove the lock file: + +``` +rm /var/lib/pacman/db.lck +``` + +If you find the PID of the process holding the lock file with lsof command output, kill it first and then remove the lock file. + +I hope you like my humble effort in explaining the basic pacman commands. Please leave your comments below and don’t forget to subscribe on our social media. Stay safe! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pacman-command/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.archlinux.org/pacman/ +[2]: https://www.archlinux.org/ +[3]: https://wiki.archlinux.org/index.php/Arch_Build_System +[4]: https://wiki.archlinux.org/index.php/Official_repositories +[5]: https://itsfoss.com/install-arch-linux/ +[6]: https://itsfoss.com/things-to-do-after-installing-arch-linux/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/essential-pacman-commands.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-S.png?ssl=1 +[9]: https://wiki.archlinux.org/index.php/Dependency +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-R.png?ssl=1 +[11]: https://itsfoss.com/update-arch-linux/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-Syu.png?ssl=1 +[13]: https://www.archlinux.org/feeds/news/ +[14]: https://mailman.archlinux.org/mailman/listinfo/arch-announce/ +[15]: https://bbs.archlinux.org/ +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-Ss.png?ssl=1 +[17]: https://wiki.archlinux.org/index.php/Downgrade +[18]: https://jlk.fjfi.cvut.cz/arch/manpages/man/paccache.8 +[19]: https://www.archlinux.org/packages/?name=pacman-contrib +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-paccache-r.png?ssl=1 diff --git a/sources/tech/20200420 New open source GIS projects for Kubernetes applications.md b/sources/tech/20200420 New open source GIS projects for Kubernetes applications.md new file mode 100644 index 0000000000..a8fdec6e71 --- /dev/null +++ b/sources/tech/20200420 New open source GIS projects for Kubernetes applications.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New open source GIS projects for Kubernetes applications) +[#]: via: (https://opensource.com/article/20/4/gis-kubernetes) +[#]: author: (Adam Timm https://opensource.com/users/timmam) + +New open source GIS projects for Kubernetes applications +====== +pg_tileserv and pg_featureserv make it easier for developers to add +location services to Kubernetes applications. +![A map with a route highlighted][1] + +Spatial data from geographic information systems (GIS) is all around us. From smartphones that make our lives better and more convenient to precision agriculture that is increasing the amount of food farmers can produce while reducing the cost, whether or not we realize it, almost every part of our lives is touched by spatial data. + +This increase of spatial data is simultaneously bringing an increase of open spatial datasets that people can consume and use to build all sorts of new applications. However, these types of datasets have not always been easy to work with. Also, due to the size of some of the geographic data, they can be difficult to bring to modern application deployment frameworks such as Kubernetes. + +To help with these issues, [Crunchy Data][2] recently announced two new open source projects, [pg_tileserv][3] and [pg_featureserv][4], to make it easier to develop cloud-native spatial applications. These projects, part of open source [Crunchy Spatial][5], help developers leverage the robust [PostGIS][6] geospatial database extension to [PostgreSQL][7] without having to write complex SQL statements. + +So what are pg_tileserv and pg_featuresev, how do they make it easier for developers to add location services to their Kubernetes applications, and what does this mean for the future of spatial applications? + +### Traditional GIS vs. modern spatial microservices + +Traditionally, when an organization or individual works with spatial data, they start with a product that grew up as a GIS. There are many high-quality open source GIS products ([QGIS][8], [GeoServer][9], [GeoNode][10], etc.), but they may not align with modern, cloud-native approaches to software design. + +The popularity of Kubernetes creates challenges for these legacy applications around automation and deployment, as they require a lot of manual configuration, for example, when data sources are added and modified. In many setups, these spatial applications must exist outside Kubernetes and cannot leverage many of the conveniences it provides. + +In contrast, modern spatial services should be driven by the spatial data that they are processing and serving out. They should align with modern software development practices and scale efficiently and integrate easily with developer workflows. + +Applications that are spatially aware also need to ensure they can handle the unique characteristics of spatial data (e.g., geometries, projections, etc.). To do all of this in independent microservices can be challenging unless you have a highly capable database to do the majority of the work for you. This is where pg_tileserv and pg_featureserv help, as both projects leverage the power of PostGIS, an open source geospatial extension to PostgreSQL, to provide advanced spatial capabilities from a simple REST framework + +### Generate map vector tiles with pg_tileserv + +![pg_tileserv][11] + +pg_tileserv is a lightweight vector tile server written in Go that enables you to generate [vector tiles][12] directly from PostGIS. It does this by implementing the **ST_AsMVT()** function in a best-practice method that translates an HTTP request to the database. It includes common defaults that allow you to pass a database connection URL to the server and be up and running in no time. There's no heavyweight software to install and configure, and it's designed for cloud-native GIS applications. + +For specific examples on how to use it, check out our blog posts on [tile serving][13] and [spatial tile serving with PostgreSQL functions][14]. + +### Annotate your maps with pg_featureserv + +![pg_featureserv][15] + +pg_featureserv is a lightweight service written in Go that enables you to serve features directly out of PostGIS. It implements the [OGC API][16] for features and provides a standard REST endpoint for your spatial data and functions contained in PostGIS. Just like pg_tileserv, there's no heavyweight software to install; just pass a database connection URL to your PostGIS database, and you're off to the races. For a specific example of how to use it, check out our post on [querying spatial features][17]. + +### Focus on spatial data, not GIS + +With our deep background in developing PostGIS and building PostGIS-backed applications, we wanted to help developers unlock all the value of spatial data in a way that is easy to deploy, scale, and maintain. As the source code of pg_tileserv and pg_featureserv show, we are just leveraging functions already in PostGIS. This allows developers to quickly add spatial data to their applications and data scientists to focus on the data. + +![GIS architecture][18] + +The benefits of this approach are: + + * Faster performance because PostgreSQL and PostGIS are doing the work for you + * Less configuration to maintain because the database structure is the configuration + * By design, it runs in the cloud at enterprise scale from the start + * Shorter times to update customer-facing applications—when you update your data in the database, your application is updated instantly + * Ability to focus more on maintaining your data and delivering value to your users and less on wrangling software + + + +Also, since these services respond to the configuration of your database, they also expose functions contained in the database. Rather than developing their data functions to incorporate them into software later, data scientists can create functions in the database that are immediately made available via a REST API. The software begins to fade into the background so an organization can focus on the data. + +Suffice it to say, we're pretty excited about these new geospatial services, and we definitely want your feedback on them. Feel free to check out [pg_tileserve][3] and [pg_featureserv][4], try deploying them alongside your PostGIS databases with the [PostgreSQL Operator][19], and share your feedback in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/gis-kubernetes + +作者:[Adam Timm][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/timmam +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/map_route_location_gps_path.png?itok=RwtS4DsU (A map with a route highlighted) +[2]: https://www.crunchydata.com/ +[3]: https://github.com/CrunchyData/pg_tileserv +[4]: https://github.com/CrunchyData/pg_featureserv +[5]: https://www.crunchydata.com/products/crunchy-spatial/ +[6]: https://postgis.net/ +[7]: https://www.postgresql.org +[8]: https://www.qgis.org/en/site/ +[9]: http://geoserver.org/ +[10]: http://geonode.org/ +[11]: https://opensource.com/sites/default/files/pg_tileserv.jpg (pg_tileserv) +[12]: https://info.crunchydata.com/blog/dynamic-vector-tiles-from-postgis +[13]: https://info.crunchydata.com/blog/crunchy-spatial-tile-serving +[14]: https://info.crunchydata.com/blog/crunchy-spatial-tile-serving-with-postgresql-functions +[15]: https://opensource.com/sites/default/files/pg_featureserv.jpg (pg_featureserv) +[16]: http://www.ogcapi.org/ +[17]: https://info.crunchydata.com/blog/crunchy-spatial-querying-spatial-features-with-pg_featureserv +[18]: https://opensource.com/sites/default/files/uploads/architecture_0.png (GIS architecture) +[19]: https://github.com/CrunchyData/postgres-operator diff --git a/sources/tech/20200421 How I use Hugo for my classroom-s open source CMS.md b/sources/tech/20200421 How I use Hugo for my classroom-s open source CMS.md new file mode 100644 index 0000000000..bef4b09a9a --- /dev/null +++ b/sources/tech/20200421 How I use Hugo for my classroom-s open source CMS.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I use Hugo for my classroom's open source CMS) +[#]: via: (https://opensource.com/article/20/4/hugo-classroom) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +How I use Hugo for my classroom's open source CMS +====== +This open source software streamlines text editing while leaving room +for customization. +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +People love Markdown text with good reason—it is easy to write, easy to read, easy to edit, and it can be converted to a wide range of other text mark up formats. While Markdown text is very good for content creation and manipulation, it imposes limitations on the options for content display. + +If we could combine the virtues of Markdown with the power and flexibility of Cascading Style Sheets, HTML5, and JavaScript, that would be something special. One of the programs trying to do this is [Hugo][2]. Hugo was created in 2013 by Steve Francia; it is cross-platform and open source under an Apache 2.0 license with an active developer community and a growing user base. + +The basic concept is that pieces of content, such as web pages or blog posts, written in Markdown and associated with metadata, are converted into HTML and combined with templates and themes to produce a complete web site. The power and flexibility come through these themes and templates or changing the default behaviors of Hugo. This power comes with a degree of unavoidable complexity, but there are lots of [pre-built templates][3] available if you lack the time or inclination to make your own. + +Installing Hugo on my Linux machine was quick and easy. Starting a new project is as simple as typing **hugo new site quickstart** at the command line which creates a new project with this folder structure: + + * **archetypes**: Content template files that contain preconfigured front matter metadata (date, title, draft). You can create new archetypes with custom front matter fields. + * **assets**: Stores all the files, which are processed by Hugo Pipes (e.g., CSS/Sass files). This directory is not created by default. + * **config.toml**: The default site config file. + * **content**: Where all the content Markdown files live. + * **data**: Used to store configuration files that can be used by Hugo when generating your website. + * **layouts**: Stores templates as .html files. + * **static**: Stores all the static content—images, CSS, JavaScript, etc. + * **themes**: For the Hugo theme of your choice. + + + +The Markdown files in the content folder can be created manually or by Hugo and edited with any text editor or your Markdown creation tool of choice. If created manually, you will need to add any metadata that is needed. I prefer to use [Ghostwriter][4] for writing Markdown. Images are usually kept in a sub-folder in the static folder. Site development can proceed quickly, as Hugo includes a web server for testing and pre-viewing. + +To check your work, type **hugo server** at the command line to start the server. By default, Hugo will not publish: + + * Content with a future **publishdate** value. + * Content with **draft: true** status. + * Content with a past **expirydate** value. + + + +Adding **hugo server -D** will include draft articles, and Hugo can be configured to mark all new articles as draft. After starting the web server, you can see your work in a web browser at localhost:1313. Once the server is started by default, it will automatically reload the browser window when it detects a change to one of your files. + +There are tasks Markdown cannot do that need some HTML code. Hugo recognizes this but believes in keeping Markdown code as clean, simple, and uncluttered as possible. Hugo does this with shortcodes such as **{{< youtube id= "w7Ft2ymGmfc" autoplay= "true">}}**, which will embed the YouTube video with id. w7Ft2ymGmfc. There are quite a few pre-built shortcodes for common tasks, but it is also possible to create your own for particular jobs. + +I work in education quite a lot and wanted to include some interactive puzzles and questions on my Hugo-generated website. To get the output looking like this: + +![JClic shortcode][5] + +I created the activities with an open source Java program called [JClic][6], exported them as HTML5, put that into static/activities/excel, and displayed it in an iframe. + +The HTML code, which would spoil the nice clean Markdown content, looks like this: + + +``` +    <[iframe][7] +       src="/activity/excel/index.html" +       title="Activity" +       height="400" +       frameborder="0" +       marginwidth="0" +       marginheight="0" +       scrolling="no" +       style="border: 1px solid #CCC; border-width: 1px; margin-bottom: 20px; width: 100%;" +       allowfullscreen="true"> +    </[iframe][7]> +``` + +The code is saved in layouts/shortcodes as **activity.html** + +This makes the shortcode placed inside my Markdown file **{{<activity>}}**, which is much neater. + +When your project is ready, you can build it with the **hugo** command; this will create a public folder and generate the website in it. Hugo has a number of built-in deployment options for different hosting providers—basically, you deploy your site by copying the public folder to your production web server. There is a lot more to Hugo that I haven't even gotten to yet, including configuration options, importing content from other static site generators and Wordpress, display data from JSON files, syntax highlighting of source code, and the fact that it is very fast (an advantage when working with large sites). + +In many software tools, ease-of-use comes at the expense of flexibility, or vice-versa; Hugo makes a largely successful attempt at including both. For basic use with Markdown content and a pre-built theme, Hugo is easy to use and produces rapid results. Alternatively, if you have the need to alter the configuration settings or dive in and create your own themes, shortcodes, templates, or metadata schemes, that choice is open to you. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/hugo-classroom + +作者:[Peter Cheer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/petercheer +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://gohugo.io/ +[3]: https://themes.gohugo.io/ +[4]: http://github.com/wereturtle/ghostwriter +[5]: https://opensource.com/sites/default/files/uploads/jclic_shortcode.png (JClic shortcode) +[6]: https://clic.xtec.cat/legacy/en/index.html +[7]: http://december.com/html/4/element/iframe.html diff --git a/sources/tech/20200421 How I use Python to map the global spread of COVID-19.md b/sources/tech/20200421 How I use Python to map the global spread of COVID-19.md new file mode 100644 index 0000000000..2f5f8dbef0 --- /dev/null +++ b/sources/tech/20200421 How I use Python to map the global spread of COVID-19.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I use Python to map the global spread of COVID-19) +[#]: via: (https://opensource.com/article/20/4/python-map-covid-19) +[#]: author: (AnuragGupta https://opensource.com/users/999anuraggupta) + +How I use Python to map the global spread of COVID-19 +====== +Create a color coded geographic map of the potential spread of the virus +using these open source scripts. +![Globe up in the clouds][1] + +The spread of disease is a real concern for a world in which global travel is commonplace. A few organizations track significant epidemics (and any pandemic), and fortunately, they publish their work as open data. The raw data can be difficult for humans to process, though, and that's why data science is so vital. For instance, it could be useful to visualize the worldwide spread of COVID-19 with Python and Pandas. + +It can be hard to know where to start when you're faced with large amounts of raw data. The more you do it, however, the more patterns begin to emerge. Here's a common scenario, applied to COVID-19 data: + + 1. Download COVID-19 country spread daily data into a Pandas DataFrame object from GitHub. For this, you need the Python Pandas library. + 2. Process and clean the downloaded data and make it suitable for visualizing. The downloaded data (as you will see for yourself) is in quite good condition. The one problem with this data is that it uses the names of countries, but it's better to use three-digit ISO 3 codes. To generate the three-digit ISO 3 codes, use a small Python library called pycountry. Having generated these codes, you can add an extra column to our DataFrame and populate it with these codes. + 3. Finally, for the visualization, use the **express** module of a library called Plotly. This article uses what are called choropleth maps (available in Plotly) to visualize the worldwide spread of the disease. + + + +### Step 1: Corona data + +We will download the latest corona data from: + + + +We will load the data directly into a Pandas DataFrame. Pandas provides a function, **read_csv()**, which can take a URL and return a DataFrame object as shown below: + + +``` +import pycountry +import plotly.express as px +import pandas as pd +URL_DATASET = r'' +df1 = pd.read_csv(URL_DATASET) +print(df1.head(3))  # Get first 3 entries in the dataframe +print(df1.tail(3))  # Get last 3 entries in the dataframe +``` + +The screenshot of output (on Jupyter) is: + +![Jupyter screenshot][2] + +From output, you can see that the DataFrame (df1) has the following columns: + + 1. Date + 2. Country + 3. Confirmed + 4. Recovered + 5. Dead + + + +Further, you can see that the **Date** column has entries starting from January 22 to March 31. This database is updated daily, so you will get the current values. + +### Step 2: Cleaning and modifying the data frame + +We need to add another column to this DataFrame, which has the three-letter ISO alpha-3 codes. To do this, I followed these steps: + + 1. Create a list of all countries in the database. This was required because in the **df**, in the column **Country**, each country was figuring for each date. So in effect, the **Country** column had multiple entries for each country. To do this, I used the **unique().tolist()** functions. + 2. Then I took a dictionary **d_country_code** (initially empty) and populated it with keys consisting of country names and values consisting of their three-letter ISO codes. + 3. To generate the three-letter ISO code for a country, I used the function **pycountry.countries.search_fuzzy(country)**. You need to understand that the return value of this function is a "list of **Country** objects." I passed the return value of this function to a name country_data. Further, in this list of objects, the first object i.e., at index 0, is the best fit. Further, this **\** object has an attribute **alpha_3**. So, I can "access" the 3 letter ISO code by using **country_data[0].alpha_3**. However, it is possible that some country names in the DataFrame may not have a corresponding ISO code (For example, disputed territories). So, for such countries, I gave an ISO code of "i.e. a blank string. Further, you need to wrap this code in a try-except block. The statement: **print(_‘could not add ISO 3 code for ->'_, country)** will give a printout of those countries for which the ISO 3 codes could not be found. In fact, you will find such countries as shown with white color in the final output. + 4. Having got the three-letter ISO code for each country (or an empty string for some), I added the country name (as key) and its corresponding ISO code (as value) to the dictionary **d_country_code**. For adding these, I used the **update()** method of the Python dictionary object. + 5. Having created a dictionary of country names and their codes, I added them to the DataFrame using a simple for loop. + + + +### Step 3: Visualizing the spread using Plotly + +A choropleth map is a map composed of colored polygons. It is used to represent spatial variations of a quantity. We will use the express module of Plotly conventionally called **px**. Here we show you how to create a choropleth map using the function: **px.choropleth**. + +The signature of this function is: + + +``` +`plotly.express.choropleth(data_frame=None, lat=None, lon=None, locations=None, locationmode=None, geojson=None, featureidkey=None, color=None, hover_name=None, hover_data=None, custom_data=None, animation_frame=None, animation_group=None, category_orders={}, labels={}, color_discrete_sequence=None, color_discrete_map={}, color_continuous_scale=None, range_color=None, color_continuous_midpoint=None, projection=None, scope=None, center=None, title=None, template=None, width=None, height=None)` +``` + +The noteworthy points are that the **choropleth()** function needs the following things: + + 1. A geometry in the form of a **geojson** object. This is where things are a bit confusing and not clearly mentioned in its documentation. You may or may not provide a **geojson** object. If you provide a **geojson** object, then that object will be used to plot the earth features, but if you don't provide a **geojson** object, then the function will, by default, use one of the built-in geometries. (In our example here, we will use a built-in geometry, so we won't provide any value for the **geojson** argument) + 2. A pandas DataFrame object for the attribute **data_frame**. Here we provide our DataFrame ie **df1** we created earlier. + 3. We will use the data of **Confirmed** column to decide the color of each country polygon. + 4. Further, we will use the **Date** column to create the **animation_frame**. Thus as we slide across the dates, the colors of the countries will change as per the values in the **Confirmed** column. + + + +The complete code is given below: + + +``` +import pycountry +import plotly.express as px +import pandas as pd +# ----------- Step 1 ------------ +URL_DATASET = r'' +df1 = pd.read_csv(URL_DATASET) +# print(df1.head) # Uncomment to see what the dataframe is like +# ----------- Step 2 ------------ +list_countries = df1['Country'].unique().tolist() +# print(list_countries) # Uncomment to see list of countries +d_country_code = {}  # To hold the country names and their ISO +for country in list_countries: +    try: +        country_data = pycountry.countries.search_fuzzy(country) +        # country_data is a list of objects of class pycountry.db.Country +        # The first item  ie at index 0 of list is best fit +        # object of class Country have an alpha_3 attribute +        country_code = country_data[0].alpha_3 +        d_country_code.update({country: country_code}) +    except: +        print('could not add ISO 3 code for ->', country) +        # If could not find country, make ISO code ' ' +        d_country_code.update({country: ' '}) + +# print(d_country_code) # Uncomment to check dictionary   + +# create a new column iso_alpha in the df +# and fill it with appropriate iso 3 code +for k, v in d_country_code.items(): +    df1.loc[(df1.Country == k), 'iso_alpha'] = v + +# print(df1.head)  # Uncomment to confirm that ISO codes added +# ----------- Step 3 ------------ +fig = px.choropleth(data_frame = df1, +                    locations= "iso_alpha", +                    color= "Confirmed",  # value in column 'Confirmed' determines color +                    hover_name= "Country", +                    color_continuous_scale= 'RdYlGn',  #  color scale red, yellow green +                    animation_frame= "Date") + +fig.show() +``` + +The output is something like the following: + +![Map][3] + +You can download and run the [complete code][4]. + +To wrap up, here are some excellent resources on choropleth in Plotly: + + * + * [https://plotly.com/python/reference/#choropleth][5] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-map-covid-19 + +作者:[AnuragGupta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/999anuraggupta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://opensource.com/sites/default/files/uploads/jupyter_screenshot.png (Jupyter screenshot) +[3]: https://opensource.com/sites/default/files/uploads/map_2.png (Map) +[4]: https://github.com/ag999git/jupyter_notebooks/blob/master/corona_spread_visualization +[5]: tmp.azs72dmHFd#choropleth diff --git a/sources/tech/20200421 How to take advantage of Linux-s extensive vocabulary.md b/sources/tech/20200421 How to take advantage of Linux-s extensive vocabulary.md new file mode 100644 index 0000000000..249d9d84f5 --- /dev/null +++ b/sources/tech/20200421 How to take advantage of Linux-s extensive vocabulary.md @@ -0,0 +1,273 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to take advantage of Linux's extensive vocabulary) +[#]: via: (https://www.networkworld.com/article/3539011/how-to-takke-advantage-of-linuxs-extensive-vocabulary.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to take advantage of Linux's extensive vocabulary +====== +Linux systems don't only know a lot of words, it has commands that can help you use them by finding words that are on the tip of your tongue or fixing your typos. +Sandra Henry-Stocker + +While you might not think of Linux as a writing tutor, it does have some commendable language skills – at least when it comes to English. While the average American probably has a vocabulary between 20,000 and 50,000 words, Linux can claim over 100,000 words (spellings, not definitions). And you can easily put this vocabulary to work for you in a number of ways. Let’s look at how Linux can help with your word challenges. + +### Help with finding words + +First, let’s focus on finding words.If you use the **wc** command to count the number of words in the **/usr/share/dict/words** file on your system, you should see something like this: + +``` +$ wc -l /usr/share/dict/words +102402 /usr/share/dict/words +``` + +As you can see, the **words** file on this system contains 102,402 words. So, when you’re trying to nail down just the right word and are having trouble, you stand a good chance of finding it on your system by remembering (or guessing at) some part of it. But you'll need a little help narrowing down those 102,402 words to a group worth your time to review. In this command, we’re looking for words that start with the letters “revi”. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +``` +$ grep ^reviv /usr/share/dict/words +revival +revival's +revivalist +revivalist's +revivalists +revivals +revive +revived +revives +revivification +revivification's +revivified +revivifies +revivify +revivifying +reviving +``` + +That’s sixteen words that start with the string “revi”. The **^** character represents the beginning of the word and, as you might have suspected, each word in the file is on a line by itself. + +A good number of the words in the **/usr/share/dict/words** file are names. If you want to  find words regardless of whether they're capitalized, add the **-i** (ignore case) option to your **grep** command. + +``` +$ grep -i ^wool /usr/share/dict/words +Woolf +Woolf's +Woolite +Woolite's +Woolongong +Woolongong's +Woolworth +Woolworth's +wool +... +``` + +You can also look for words that end in or contain a certain string of letters. In this next command, we look for words that contain the string “nativ” at any location. + +``` +$ grep 'nativ' /usr/share/dict/words +alternative +alternative's +alternatively +alternatives +imaginative +imaginatively +native +native's +natives +nativities +nativity +nativity's +nominative +nominative's +nominatives +unimaginative +``` + +In this next command, we look for words that end in “emblance”, the **$** character representing the end of the line. Only two words in the **words** file fit the bill. + +[][2] + +``` +$ grep 'emblance$' /usr/share/dict/words +resemblance +semblance +``` + +If we, for some reason, want to find words with exactly 21 letters, we could use this command: + +``` +$ grep '^.....................$' /usr/share/dict/words +counterintelligence's +electroencephalograms +electroencephalograph +``` + +On the other hand, making sure we've typed the correct number of dots can be tedious. This next command is little easier to manage: + +``` +$ grep -E '^[[:alpha:]]{21}$' /usr/share/dict/words +electroencephalograms +electroencephalograph +``` + +This command does the same thing: + +``` +$ grep -E '^\w{21}$' /usr/share/dict/words +electroencephalograms +electroencephalograph +``` + +The one important difference between these commands is that the one with the dots matches any string of 21 characters. The two specifying "alpha" or "\w" only match letters, so they find only two matching words. + +Now let’s look for words that contain 20 letters (or more) in a row. + +``` +$ grep -E '(\w{20})' /usr/share/dict/words +Andrianampoinimerina +Andrianampoinimerina's +counterrevolutionaries +counterrevolutionary +counterrevolutionary's +electroencephalogram +electroencephalogram's +electroencephalograms +electroencephalograph +electroencephalograph's +electroencephalographs +uncharacteristically +``` + +That command returns words with apostrophes because they contain 20 letters in a row before they get to that point. + +Next, we’ll check out words with 21 or more characters. The 1 and 20 in combination with the **v** (invert) option in this command cause **grep** to skip over words with anywhere from 1 to 20 characters. + +``` +$ grep -vwE '\w{1,20}' /usr/share/dict/words +counterrevolutionaries +electroencephalograms +electroencephalograph +electroencephalographs +``` + +In this next command, we look for words that start with “ex” and have four additional letters. + +``` +$ grep '^ex.\{4\}$' /usr/share/dict/words +exacts +exalts +exam's +exceed +excels +except +excess +excise +excite +excuse +… +``` + +In case you're curious, the **words** file on this system contains 43 such words: + +``` +$ grep '^ex.\{4\}$' /usr/share/dict/words | wc -l +43 +``` + +To get help with spelling, you should try **aspell**. It can help you with individual words or run a spell check scan through an entire text file. In this first example, we ask **aspell** to help with a single word. It finds the word we’re after along with a couple other possibilities. + +### Checking a word + +``` +$ aspell -a +@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.7) +prolifferate <== entered word +& prolifferate 3 0: proliferate, proliferated, proliferates <== replacement options +``` + +If **aspell** doesn’t provide a list of words, that means that the spelling you offered was correct. Here's an example: + +``` +$ aspell -a +@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.7) +proliferate <== entered text +* <== no suggestions +``` + +Typing **^C** (control-c) exits **aspell**. + +### Checking a file + +When checking a file with **aspell**, you get suggestions for each misspelled word. When **aspell** spots typos, it highlights the misspelled words one at a time and gives you a chance to choose from a list of properly spelled words that are similar enough to the misspelled words to be good candidates for replacing them. + +To start checking a file, type **aspell -c** followed by the file name. + +``` +$ aspell -c thesis +``` + +You'll see something like this: + +``` +This thesis focusses on … + +1) focuses 6) Fosse's +2) focused 7) flosses +3) cusses 8) courses +4) fusses 9) focus +5) focus's 0) fuses +i) Ignore I) Ignore all +r) Replace R) Replace all +a) Add l) Add Lower +b) Abort x) Exit +``` + +Make your selection by pressing the key listed next to the word you want (1, 2, etc.) and **aspell** will replace the misspelled word in the file and move on to the next one if there are others. Notice that you also have options to replace the word by typing another one. Press "x" when you're done. + +### Help with crossword puzzles + +If you’re working on a crossword puzzle and need to find a five-letter word that starts with a “d” and has a “u” as its fourth letter, you can use a command like this: + +``` +$ grep -i '^d..u.$' /usr/share/dict/words +datum +debug +debut +demur +donut +``` + +### Help with word scrambles + +If you’re working on a puzzle that requires you to de-scramble the letters in a string until you've found a proper word, you can offer the list of letters to grep like this example in which **grep** turns the letters "yxusonlia" into the word “anxiously”. + +``` +$ grep -P '^(?:([yxusonlia])(?!.*?\1)){9}$' /usr/share/dict/words +anxiously +``` + +Linux’s word skills are impressive and sometimes even fun. Whether you're hoping to find words you can't quite call to mind or get a little help cheating on word puzzles, Linux offers some clever options. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3539011/how-to-takke-advantage-of-linuxs-extensive-vocabulary.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200423 4 open source chat applications you should use right now.md b/sources/tech/20200423 4 open source chat applications you should use right now.md new file mode 100644 index 0000000000..25aa100c53 --- /dev/null +++ b/sources/tech/20200423 4 open source chat applications you should use right now.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 open source chat applications you should use right now) +[#]: via: (https://opensource.com/article/20/4/open-source-chat) +[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur) + +4 open source chat applications you should use right now +====== +Collaborating remotely is an essential capability now, making open +source real-time chat an essential piece of your toolbox. +![Chat bubbles][1] + +The first thing we usually do after waking up in the morning is to check our cellphone to see if there are important messages from our colleagues and friends. Whether or not it's a good idea, this behavior has become part of our daily lifestyle. + +> _"Man is a rational animal. He can think up a reason for anything he wants to believe."_ +> _– Anatole France_ + +No matter the soundness of the reason, we all have a suite of communication tools—email, phone calls, web-conferencing tools, or social networking—we use on a daily basis. Even before COVID-19, working from home already made these communication tools an essential part of our world. And as the pandemic has made working from home the new normal, we're facing unprecedented changes to how we communicate, which makes these tools not merely essential but now required. + +### Why chat? + +When working remotely as a part of a globally distributed team, we must have a collaborative environment. Chat applications play a vital role in helping us stay connected. In contrast to email, chat applications provide fast, real-time communications with colleagues around the globe. + +There are a lot of factors involved in choosing a chat application. To help you pick the right one for you, in this article, I'll explore four open source chat applications and one open source video-communication tool (for when you need to be "face-to-face" with your colleagues), then outline some of the features you should look for in an effective communication application. + +### 4 open source chat apps + +#### Rocket.Chat + +![Rocket.Chat][2] + +[Rocket.Chat][3] is a comprehensive communication platform that classifies channels as public (open to anyone who joins) or private (invitation-only) rooms. You can also send direct messages to people who are logged in; share documents, links, photos, videos, and GIFs; make video calls; and send audio messages without leaving the platform. + +Rocket.Chat is free and open source, but what makes it unique is its self-hosted chat system. You can download it onto your server, whether it's an on-premises server or a virtual private server on a public cloud. + +Rocket.Chat is completely free, and its [source code][4] is available on GitHub. Many open source projects use Rocket.Chat as their official communication platform. It is constantly evolving with new features and improvements. + +The things I like the most about Rocket.Chat are its ability to be customized according to user requirements and that it uses machine learning to do automatic, real-time message translation between users. You can also download Rocket.Chat for your mobile device and use it on the go. + +#### IRC + +![IRC on WeeChat 0.3.5][5] + +[Internet Relay Chat (IRC)][6] is a real-time, text-based form of communication. Although it's one of the oldest forms of electronic communication, it remains popular among many well-known software projects. + +IRC channels are discrete chat rooms. It allows you to have conversations with multiple people in an open channel or chat with someone privately one-on-one. If a channel name starts with a #, you can assume it to be official, whereas chat rooms that begin with ## are unofficial and usually casual. + +[Getting started with IRC][7] is easy. Your IRC handle or nickname is what allows people to find you, so it must be unique. But your choice of IRC client is completely your decision. If you want a more feature-rich application than a standard IRC client, you can connect to IRC with [Riot.im][8]. + +Given its age, why should you still be on IRC? For one reason, it remains the home for many of the free and open source projects we depend on. If you want to participate in open source software and communities, IRC is the option to get started. + +#### Zulip + +![Zulip][9] + +[Zulip][10] is a popular group-chat application that follows the topic-based threading model. In Zulip, you subscribe to streams, just like in IRC channels or Rocket.Chat. But each Zulip stream opens a topic that is unique, which helps you track conversations later, thus making it more organized. + +Like other platforms, it supports emojis, inline images, video, and tweet previews. It also supports LaTeX for sharing math formulas or equations and Markdown and syntax highlighting for sharing code. + +Zulip is cross-platform and offers APIs for building your own integrations. Something I especially like about Zulip is its integration feature with GitHub: if I'm working on an issue, I can use Zulip's marker to link back to the pull request ID. + +Zulip is open source (you can access its [source code][11] on GitHub) and free to use, but it has paid offerings for on-premises support, [LDAP][12] integration, and more storage. + +#### Let's Chat + +![Let's Chat][13] + +[Let's Chat][14] is a self-hosted chat solution for small teams. It runs on Node.js and MongoDB and can be deployed to local servers or hosted services with a few clicks. It's free and open source, with the [source code][15] available on GitHub. + +What differentiates Let's Chat from other open source chat tools is its enterprise features: it supports LDAP and [Kerberos][16] authentication. It also has all the features a new user would want: you can search message history in the archives and tag people with mentions like @username. + +What I like about Let's Chat is that it has private and password-protected rooms, image embeds, GIPHY support, and code pasting. It is constantly evolving and adding more features to its bucket. + +### Bonus: Open source video chat with Jitsi + +![Jitsi][17] + +Sometimes text chat isn't enough, and you need to talk to someone face-to-face. In times like these, when in-person meetings aren't an option, video chat is the best alternative. [Jitsi][18] is a complete, open source, multi-platform, and WebRTC-compliant videoconferencing tool. + +Jitsi began with Jitsi Desktop and has evolved into multiple [projects][19], including Jitsi Meet, Jitsi Videobridge, jibri, and libjitsi, with [source code][20] published for each on GitHub. + +Jitsi is secure and scalable and supports advanced video-routing concepts such as simulcast and bandwidth estimation, as well as typical capabilities like audio, recording, screen-sharing, and dial-in features. You can set a password to secure your video-chat room and protect it against intruders, and it also supports live-streaming over YouTube. You can also build your own Jitsi server and host it on-premises or on a virtual private server, such as a Digital Ocean Droplet. + +What I like most about Jitsi is that it is free and frictionless; anyone can start a meeting in no time by visiting [meet.jit.si][21], and users are good to go with no need for registration or installation. (However, registration gives you calendar integrations.) This low-barrier-to-entry alternative to popular videoconferencing services is helping Jitsi's popularity spread rapidly. + +### Tips for choosing a chat application + +The variety of open source chat applications can make it hard to pick one. The following are some general guidelines for choosing a chat app. + + * Tools that have an interactive interface and simple navigation are ideal. + * It's better to look for a tool that has great features and allows people to use it in various ways. + * Integrations with tools you use can play an important role in your decision. Some tools have great and seamless integrations with GitHub, GitLab, and certain applications, which is a useful feature. + * It's convenient to use tools that have a pathway to hosting on cloud-based services. + * The security of the chat service should be taken into account. The ability to host services on a private server is necessary for many organizations and individuals. + * It's best to select communication tools that have rich privacy settings and allow for both private and public chat rooms. + + + +Since people are more dependent than ever on online services, it is smart to have a backup communication platform available. For example, if a project is using Rocket.Chat, it should also have the option to hop into IRC, if necessary. Since these services are continuously updating, you may find yourself connected to multiple channels, and this is where integration becomes so valuable. + +Of the different open source chat services available, which ones do you like and use? How do these tools help you work remotely? Please share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-chat + +作者:[Sudeshna Sur][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sudeshna-sur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) +[2]: https://opensource.com/sites/default/files/uploads/rocketchat.png (Rocket.Chat) +[3]: https://rocket.chat/ +[4]: https://github.com/RocketChat/Rocket.Chat +[5]: https://opensource.com/sites/default/files/uploads/irc.png (IRC on WeeChat 0.3.5) +[6]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[7]: https://opensource.com/article/16/6/getting-started-irc +[8]: https://opensource.com/article/17/5/introducing-riot-IRC +[9]: https://opensource.com/sites/default/files/uploads/zulip.png (Zulip) +[10]: https://zulipchat.com/ +[11]: https://github.com/zulip/zulip +[12]: https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol +[13]: https://opensource.com/sites/default/files/uploads/lets-chat.png (Let's Chat) +[14]: https://sdelements.github.io/lets-chat/ +[15]: https://github.com/sdelements/lets-chat +[16]: https://en.wikipedia.org/wiki/Kerberos_(protocol) +[17]: https://opensource.com/sites/default/files/uploads/jitsi_0_0.jpg (Jitsi) +[18]: https://jitsi.org/ +[19]: https://jitsi.org/projects/ +[20]: https://github.com/jitsi +[21]: http://meet.jit.si diff --git a/sources/tech/20200426 6 tips for securing your WordPress website.md b/sources/tech/20200426 6 tips for securing your WordPress website.md new file mode 100644 index 0000000000..757ff42d30 --- /dev/null +++ b/sources/tech/20200426 6 tips for securing your WordPress website.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 tips for securing your WordPress website) +[#]: via: (https://opensource.com/article/20/4/wordpress-security) +[#]: author: (Lucy Carney https://opensource.com/users/lucy-carney) + +6 tips for securing your WordPress website +====== +Even beginners can—and should—take these steps to protect their +WordPress sites against cyberattacks. +![A lock on the side of a building][1] + +Already powering over 30% of the internet, WordPress is the fastest-growing content management system (CMS) in the world—and it's not hard to see why. With tons of customization available through coding and plugins, top-notch SEO, and a supreme reputation for blogging, WordPress has certainly earned its popularity. + +However, with popularity comes other, less appealing attention. WordPress is a common target for intruders, malware, and cyberattacks—in fact, WordPress accounted for around [90% of hacked CMS platforms][2] in 2019. + +Whether you're a first-time WordPress user or an experienced developer, there are important steps you can take to protect your WordPress website. The following six key tips will get you started. + +### 1\. Choose reliable hosting + +Hosting is the unseen foundation of all websites—without it, you can't publish your site online. But hosting does much more than simply host your site. It's also responsible for site speed, performance, and security. + +The first thing to do is to check if a host includes SSL security in its plans. + +SSL is an essential security feature for all websites, whether you're running a small blog or a large online store. You'll need a more [advanced SSL certificate][3] if you're accepting payments, but for most sites, the basic free SSL should be fine. + +Other security features to look out for include: + + * Frequent, automatic offsite backups + * Malware and antivirus scanning and removal + * Distributed denial of service (DDoS) protection + * Real-time network monitoring + * Advanced firewall protection + + + +In addition to these digital security features, it's worth thinking about your hosting provider's _physical_ security measures as well. These include limiting access to data centers with security guards, CCTV, and two-factor or biometric authentication. + +### 2\. Use security plugins + +One of the best—and easiest—ways of protecting your website's security is to install a security plugin, such as [Sucuri][4], which is an open source, GPLv2 licensed project. Security plugins are vitally important because they automate security, which means you can focus on running your site rather than committing all your time to fighting off online threats. + +These plugins detect and block malicious attacks and alert you about any issues that require your attention. In short, they constantly work in the background to protect your site, meaning you don't have to stay awake 24/7 to fight off hackers, bugs, and other digital nasties. + +A good security plugin will provide all the essential security features you need for free, but some advanced features require a paid subscription. For example, you'll need to pay if you want to unlock [Sucuri's website firewall][5]. Enabling a web application firewall (WAF) blocks common threats and adds an extra layer of security to your site, so it's a good idea to look for this feature when choosing a security plugin. + +### 3\. Choose trustworthy plugins and themes + +The joy of WordPress is that it is open source, so anyone and everyone can pitch in with themes and plugins that they've developed. This can also pose problems when it comes to picking a high-quality theme or plugin. + +It serves to be cautious when picking a free theme or plugin, as some are poorly designed—or worse, may hide malicious code. + +To avoid this, always source free themes and plugins from reputable sources, such as the WordPress library. Always read reviews and research the developer to see if they've built any other programs. + +Outdated or poorly designed themes and plugins can leave "backdoors" open for attackers or bugs to get into your site, which is why it pays to be careful in your choices. However, you should also be wary of nulled or cracked themes. These are premium themes that have been compromised by hackers and are for sale illegally. You might buy a nulled theme believing that it's all above-board—only to have your site damaged by hidden malicious code. + +To avoid nulled themes, don't get drawn in by discounted prices, and always stick to reputable stores, such as the official [WordPress directory][6]. If you're looking elsewhere, stick to large and trusted stores, such as [Themify][7], a theme and plugin store that has been running since 2010. Themify ensures all its WordPress themes pass the [Google Mobile-Friendly][8] test and are open source under the [GNU General Public License][9]. + +### 4\. Run regular updates + +It's a fundamental WordPress rule: _always keep your site up to date._ However, it's a rule not everyone sticks to—in fact, only [43% of WordPress sites][10] are running the latest version. + +The problem is that when your site becomes outdated, it becomes susceptible to glitches, bugs, intrusions, and crashes because it falls behind on security and performance fixes. Outdated sites can't fix bugs the same way as updated sites can, and attackers can tell which sites are outdated. This means they can search for the most vulnerable sites and attack accordingly. + +This is why you should always run your site on the latest version of WordPress. And in order to keep your security at its strongest, you must update your plugins and themes as well as your core WordPress software. + +If you choose a managed WordPress hosting plan, you might find that your provider will check and run updates for you—be clear whether your host offers software _and_ plugin updates. If not, you can install an open source plugin manager, such as the GPLv2-licensed [Easy Updates Manager plugin][11], as an alternative. + +### 5\. Strengthen your logins + +Aside from creating a secure WordPress website through carefully choosing your theme and installing security plugins, you also need to safeguard against unauthorized access through logins. + +#### Password protection + +The first and simplest way to strengthen your login security is to change your password—especially if you're using an [easily guessed phrase][12] such as "123456" or "qwerty." + +Instead, try to use a long passphrase rather than a password, as they are harder to crack. The best way is to use a series of unrelated words strung together that you find easy to remember. + +Here are some other tips: + + * Never reuse passwords + * Don't include obvious words such as family members' names or your favorite football team + * Never share your login details with anyone + * Include capitals and numbers to add complexity to your passphrase + * Don't write down or store your login details anywhere + * Use a [password manager][13] + + + +#### Change your login URL + +It's a good idea to change your default login web address from the standard format: yourdomain.com/wp-admin. This is because hackers know this is the default URL, so you risk brute-force attacks by not changing it. + +To avoid this, change the URL to something different. Use an open source plugin such as the GPLv2-licensed [WPS Hide Login][14] for safe, quick, and easy customization. + +#### Apply two-factor authentication + +For extra protection against unauthorized logins and brute-force attacks, you should add two-factor authentication. This means that even if someone _does_ get access to your login details, they'll need a code that's sent directly to your phone to gain access to your WordPress site's admin. + +Adding two-factor authentication is pretty easy. Simply install yet another plugin—this time, search the WordPress Plugin Directory for "two-factor authentication," and select the plugin you want. One option is [Two Factor][15], a popular GPLv2 licensed project that has over 10,000 active installations. + +#### Limit login attempts + +WordPress tries to be helpful by letting you guess your login details as many times as you like. However, this is also helpful to hackers trying to gain unauthorized access to your WordPress site to release malicious code. + +To combat brute-force attacks, install a plugin that limits login attempts and set how many guesses you want to allow. + +### 6\. Disable file editing + +This isn't such a beginner-friendly step, so don't attempt it unless you're a confident coder—and always back up your site first! + +That said, disabling file editing _is_ an important measure if you're really serious about protecting your WordPress website. If you don't hide your files, it means anyone can edit your theme and plugin code straight from the admin area—which is dangerous if an intruder gets in. + +To deny unauthorized access, go to your **wp-config.php** file and enter: + + +``` +<Files wp-config.php> +order allow,deny +deny from all +</Files> +``` + +Or, to remove the theme and plugin editing options from your WordPress admin area completely, edit your **wp-config.php** file by adding: + + +``` +`define( 'DISALLOW_FILE_EDIT', true );` +``` + +Once you've saved and reloaded the file, the plugin and theme editors will disappear from your menus within the WordPress admin area, stopping anyone from editing your theme or plugin code—including you**.** Should you need to restore access to your theme and plugin code, just delete the code you added to your **wp-config.php** file when you disabled editing. + +Whether you block unauthorized access or totally disable file editing, it's important to take action to protect your site's code. Otherwise, it's easy for unwelcome visitors to edit your files and add new code. This means an attacker could use the editor to gather data from your WordPress site or even use your site to launch attacks on others. + +For an easier way of hiding your files, you can use a security plugin that will do it for you, such as Sucuri. + +### WordPress security recap + +WordPress is an excellent open source platform that should be enjoyed by beginners and developers alike without the fear of becoming a victim of an attack. Sadly, these threats aren't going anywhere anytime soon, so it's vital to stay on top of your site's security. + +Using the measures outlined above, you can create a stronger, more secure level of protection for your WordPress site and ensure a much more enjoyable experience for yourself. + +Staying secure is an ongoing commitment rather than a one-time checklist, so be sure to revisit these steps regularly and stay alert when building and using your CMS. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/wordpress-security + +作者:[Lucy Carney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lucy-carney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://cyberforces.com/en/wordpress-most-hacked-cms +[3]: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority +[4]: https://wordpress.org/plugins/sucuri-scanner/ +[5]: https://sucuri.net/website-firewall/ +[6]: https://wordpress.org/themes/ +[7]: https://themify.me/ +[8]: https://developers.google.com/search/mobile-sites/ +[9]: http://www.gnu.org/licenses/gpl.html +[10]: https://wordpress.org/about/stats/ +[11]: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/ +[12]: https://www.forbes.com/sites/kateoflahertyuk/2019/04/21/these-are-the-worlds-most-hacked-passwords-is-yours-on-the-list/#4f157c2f289c +[13]: https://opensource.com/article/16/12/password-managers +[14]: https://wordpress.org/plugins/wps-hide-login/ +[15]: https://en-gb.wordpress.org/plugins/two-factor/ diff --git a/sources/tech/20200427 New zine- How Containers Work.md b/sources/tech/20200427 New zine- How Containers Work.md new file mode 100644 index 0000000000..fa2198ebbc --- /dev/null +++ b/sources/tech/20200427 New zine- How Containers Work.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New zine: How Containers Work!) +[#]: via: (https://jvns.ca/blog/2020/04/27/new-zine-how-containers-work/) +[#]: author: (Julia Evans https://jvns.ca/) + +New zine: How Containers Work! +====== + +On Friday I published a new zine: “How Containers Work!”. I also launched a fun redesign of [wizardzines.com][1]. + +You can get it for $12 at . If you buy it, you’ll get a PDF that you can either print out or read on your computer. Or you can get a pack of [all 8 zines][2] so far. + +Here’s the cover and table of contents: + +[![][3]][4] + +### why containers? + +I’ve spent a lot of time [figuring][5] [out][6] [how to][7] [run][8] [things][9] [in][10] [containers][11] over the last 3-4 years. And at the beginning I was really confused! I knew a bunch of things about Linux, and containers didn’t seem to fit in with anything I thought I knew (“is it a process? what’s a network namespace? what’s happening?“). The whole thing seemed really weird. + +It turns out that containers ARE actually pretty weird. They’re not just one thing, they’re what you get when you glue together 6 different features that were mostly designed to work together but have a bunch of confusing edge cases. + +As usual, the thing that helped me the most in my container adventures is a good understanding of the **fundamentals** – what exactly is actually happening on my server when I run a container? + +So that’s what this zine is about – cgroups, namespaces, pivot_root, seccomp-bpf, and all the other Linux kernel features that make containers work. + +Once I understood those ideas, it got a **lot** easier to debug when my containers were doing surprising things in production. I learned a couple of interesting and strange things about containers while writing this zine too – I’ll probably write a blog post about one of them later this week. + +### containers aren’t magic + +This picture (page 6 of the zine) shows you how to run a fish container image with only 15 lines of bash. This is heavily inspired by [bocker][12], which “implements” Docker in about 100 lines of bash. + + + +The main things I see missing from that script compared to what Docker actually does when running a container (other than using an actual container image and not just a tarball) are: + + * it doesn’t drop any capabilities – the container is still running as root and has full root privileges (just in a different mount + PID namespace) + * it doesn’t block any system calls with seccomp-bpf + + + +### container command line tools + +The zine also goes over a bunch of command line tools & files that you can use to inspect running containers or play with Linux container features. Here’s a list: + + * `mount -t overlay` (create and view overlay filesystems) + * `unshare` (create namespaces) + * `nsenter` (use an existing namespace) + * `getpcaps` (get a process’s capabilities) + * `capsh` (drop or add capabilities, etc) + * `cgcreate` (create a cgroup) + * `cgexec` (run a command in an existing cgroup) + * `chroot` (change root directory. not actually what containers use but interesting to play with anyway) + * `/sys/fs/cgroups` (for information about cgroups, like `memory.usage_in_bytes`) + * `/proc/PID/ns` (all a process’s namespaces) + * `lsns` (another way to view namespaces) + + + +I also made a short youtube video a while back called [ways to spy on a Docker container][13] that demos some of these command line tools. + +### container runtime agnostic + +I tried to keep this zine pretty container-runtime-agnostic – I mention Docker a couple of times because it’s so widely used, but it’s about the Linux kernel features that make containers work in general, not Docker or LXC or systemd-nspawn or Kubernetes or whatever. If you understand the fundamentals you can figure all those things out! + +### we redesigned wizardzines.com! + +On Friday I also launched a redesign of [wizardzines.com][1]! [Melody Starling][14] (who is amazing) did the design. I think now it’s better organized but the tiny touch that I’m most delighted by is that now the zines jump with joy when you hover over them. + +One cool thing about working with a designer is – they don’t just make things _look_ better, they help _organize_ the information better so the website makes more sense and it’s easier to find things! This is probably obvious to anyone who knows anything about design but I haven’t worked with designers very much (or maybe ever?) so it was really cool to see. + +One tiny example of this: Melody had the idea of adding a tiny FAQ on the landing page for each zine, where I can put the answers to all the questions people always ask! Here’s what the little FAQ box looks like: + +[![][15]][4] + +I probably want to edit those questions & answers over time but it’s SO NICE to have somewhere to put them. + +### what’s next: maybe debugging! or working more on flashcards! + +The two projects I’m thinking about the most right now are + + 1. a zine about debugging, which I started last summer and haven’t gotten around to finishing yet + 2. a [flashcards project][16] that I’ve been adding to slowly over the last couple of months. I think could become a nice way to explain basic ideas. + + + +Here’s a link to where to [get the zine][4] again :) + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/04/27/new-zine-how-containers-work/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://wizardzines.com +[2]: https://wizardzines.com/zines/all-the-zines/ +[3]: https://jvns.ca/images/containers-cover.jpg +[4]: https://wizardzines.com/zines/containers +[5]: https://stripe.com/en-ca/blog/operating-kubernetes +[6]: https://jvns.ca/blog/2016/09/15/whats-up-with-containers-docker-and-rkt/ +[7]: https://jvns.ca/blog/2016/10/10/what-even-is-a-container/ +[8]: https://jvns.ca/blog/2016/12/22/container-networking/ +[9]: https://jvns.ca/blog/2016/10/26/running-container-without-docker/ +[10]: https://jvns.ca/blog/2017/02/17/mystery-swap/ +[11]: https://jvns.ca/blog/2016/10/02/a-list-of-container-software/ +[12]: https://github.com/p8952/bocker +[13]: https://www.youtube.com/watch?v=YCVSdnYzH34&t=1s +[14]: https://melody.dev +[15]: https://jvns.ca/images/wizardzines-faq.png +[16]: https://flashcards.wizardzines.com diff --git a/sources/tech/20200428 Learn Bash with this book of puzzles.md b/sources/tech/20200428 Learn Bash with this book of puzzles.md new file mode 100644 index 0000000000..08a07b93c5 --- /dev/null +++ b/sources/tech/20200428 Learn Bash with this book of puzzles.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn Bash with this book of puzzles) +[#]: via: (https://opensource.com/article/20/4/bash-it-out-book) +[#]: author: (Carlos Aguayo https://opensource.com/users/hwmaster1) + +Learn Bash with this book of puzzles +====== +'Bash it out' covers basic, medium, and advanced Bash scripting using 16 +puzzles. +![Puzzle pieces coming together to form a computer screen][1] + +Computers are both my hobby and my profession. I have about 10 of them scattered around my apartment, all running Linux (including my Macs). Since I enjoy upgrading my computers and my computer skills, when I came across [_Bash it out_][2] by Sylvain Leroux, I jumped on the chance to buy it. I use the command line a lot on Debian Linux, and it seemed like a great opportunity to expand my Bash knowledge. I smiled when the author explained in the preface that he uses Debian Linux, which is one of my two favorite distributions. + +Bash lets you automate tasks, so it's a labor-saving, interesting, and useful tool. Before reading the book, I already had a fair amount of experience with Bash on Unix and Linux. I'm not an expert, in part because the scripting language is so extensive and powerful. I first became intrigued with Bash when I saw it on the welcome screen of [EndeavourOS][3], an Arch-based Linux distribution. + +The following screenshots show some options from EndeavourOS. Beleieve it or not, these panels just point to Bash scripts, each of which accomplish some relatively complex tasks. And because it's all open source, I can modify any of these scripts if I want. + +![EndeavourOS after install][4] + +![EndeavourOS install apps][5] + +### Always something to learn + +My impressions of this book are very favorable. It's not long, but it is well-thought-out. The author has very extensive knowledge of Bash and an uncanny ability to explain how to use it. The book covers basic, medium, and advanced Bash scripting using 16 puzzles, which he calls "challenges." This taught me to see Bash scripting as a programming puzzle to solve, which makes it more interesting to play with. + +An exciting aspect of Bash is that it's deeply integrated with the Linux system. While part of its power lies in its syntax, it's also powerful because it has access to so much. You can script repetitive tasks, or tasks that are easy but you're just tired of performing manually. Nothing is too great or too small, and _Bash it out_ helps you understand both what you can do, and how to achieve it. + +This review would not be complete if I didn't mention David Both's free resource [_A sysadmin's guide to Bash scripting_][6] on Opensource.com. This 17-page PDF guide is different from _Bash it out_, but together they make a winning combination for anyone who wants to learn about it. + +I am not a computer programmer, but _Bash it out_ has increased my desire to get into more advanced levels of Bash scripting—I might inadvertently end up as a computer programmer without planning to. + +One reason I love Linux is because of how powerful and versatile the operating system is. However much I know about Linux, there is always something new to learn that makes me appreciate Linux even more. + +In a competitive and ever-changing job market, it behooves all of us to continuously update our skills. This book helped me learn Bash in a very hands-on way. It almost felt as if the author was in the same room with me, patiently guiding me in my learning. + +The author, Leroux, has an uncanny ability to engage readers. This is a rare gift that I think is even more valuable than his technical expertise. In fact, I am writing this book review to thank the author for anticipating my own learning needs; although we have never met, I have benefited in real ways from his gifts. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/bash-it-out-book + +作者:[Carlos Aguayo][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hwmaster1 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://www.amazon.com/Bash-Out-Strengthen-challenges-difficulties/dp/1521773262/ +[3]: https://endeavouros.com/ +[4]: https://opensource.com/sites/default/files/uploads/endeavouros-welcome.png (EndeavourOS after install) +[5]: https://opensource.com/sites/default/files/uploads/endeavouros-install-apps.png (EndeavourOS install apps) +[6]: https://opensource.com/downloads/bash-scripting-ebook diff --git a/sources/tech/20200429 Open source live streaming with Open Broadcaster Software.md b/sources/tech/20200429 Open source live streaming with Open Broadcaster Software.md new file mode 100644 index 0000000000..748786de77 --- /dev/null +++ b/sources/tech/20200429 Open source live streaming with Open Broadcaster Software.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source live streaming with Open Broadcaster Software) +[#]: via: (https://opensource.com/article/20/4/open-source-live-stream) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Open source live streaming with Open Broadcaster Software +====== +If you have something to say, a skill to teach, or just something fun to +share, broadcast it to the world with OBS. +![An old-fashioned video camera][1] + +If you have a talent you want to share with the world, whether it's making your favorite sourdough bread or speedrunning through a level of your favorite video game, live streaming is the modern show-and-tell. It's a powerful way to tell the world about your hobby through a medium once reserved for exclusive and expensive TV studios. Not only is the medium available to anyone with a relatively good internet connection, but the most popular software to make it happen is open source. + +[OBS][2] (Open Broadcaster Software) is a cross-platform application that serves as a control center for your live stream. A _stream_, strictly speaking, means _progressive and coherent data_. The data in a stream can be audio, video, graphics, text, or anything else you can represent as digital data. OBS is programmed to accept data as input, combine streams together (technically referred to as _mixing_) into one product, and then broadcast it. + +![OBS flowchart][3] + +A _broadcast_ is data that can be received by some target. If you're live streaming, your primary target is a streaming service that can host your stream, so other people can find it in a web browser or media player. A live stream is a live event, so people have to "tune in" to your stream when it's happening, or else they miss it. However, you can also target your own hard drive so you can record a presentation and then post it on the internet later for people to watch at their leisure. + +### Installing OBS + +To install OBS on Windows or macOS, download an installer package from [OBS's website][2]. + +To install OBS on Linux, either install it with your package manager (such as **dnf**, **zypper**, or **apt**) or [install it as a Flatpak][4]. + +### Join a streaming service + +In order to live stream, you must have a stream broker. That is, you need a central location on the internet for your stream to be delivered, so your viewers can get to what you're broadcasting. There are a few popular streaming services online, like YouTube and Twitch. You can also [set up your own video streaming server][5] using open source software. + +Regardless of which option you choose, before you begin streaming, you must have a destination for your stream. If you do use a streaming service, you must obtain a _streaming key_. A streaming key is a hash value (it usually looks something like **2ae2fad4e33c3a89c21**) that is private and unique to you. You use this key to authenticate yourself through your streaming software. Without it, the streaming service can't know you are who you say you are and won't let you broadcast over your user account. + +* * * + +* * * + +* * * + +**![Streaming key][6]** + + * In Twitch, your **Primary Stream Key** is available in the **Channel** panel of your **Creator Dashboard**. + * On YouTube, you must enable live streaming by verifying your account. Once you've done that, your **Stream Key** is in the **Other Features** menu option of your **Channel Dashboard**. + * If you're using your own server, there's no maze-like GUI to navigate. You just [create your own streaming key][7]. + + + +### Enter your streaming key + +Once you have a streaming key, launch OBS and go to the **File** > **Settings** menu. + +In the **Settings** window, click on the **Stream** category in the left column. Set the **Service** to your stream service (Custom, Twitch, YouTube, etc.), and enter your stream key. Click the **OK** button in the bottom right to save your changes. + +### Create sources + +In OBS, _sources_ represent any input signal you want to stream. By default, sources are listed at the bottom of the OBS window. + +![OBS sources][8] + +This might be a webcam, a microphone, an audio stream (such as the sound of a video game you're playing), a screen capture of your computer (a "screencast"), a slideshow you want to present, an image, and so on. Before you start streaming, you should define all the sources you plan on using for your stream. This means you have to do a little pre-production and consider what you anticipate for your show. Any camera you have set up must be defined as a source in OBS. Any extra media you plan on cutting to during your show must be defined as a source. Any sound effects or background music must be defined as a source. + +Not all sources "happen" at once. By adding media to your **Sources** panel in OBS, you're just assembling the raw components for your stream. Once you make devices and data available to OBS, you can create your **Scenes**. + +#### Setting up audio + +Computers have seemingly dozens of ways to route audio. Here's the workflow to follow when setting up sound for your stream: + + 1. Check your cables: verify that your microphone is plugged in. + 2. Go to your computer's sound control panel and set the input to whatever microphone you want OBS to treat as the main microphone. This might be a gaming headset or a boom mic or a desktop podcasting mic or a Bluetooth device or a fancy audio interface with XLR ports. Whatever it is, make sure your computer "hears" your main sound input. + 3. In OBS, create a source for your main microphone and name it something obvious (e.g., boom mic, master sound, or mic). + 4. Do a test. Make sure OBS "hears" your microphone by referring to the audio-level monitors at the bottom of the OBS window. If it's not responding to the input you believe you've set as input, check your cables, check your computer sound control panel, and check OBS. + + + +I've seen more people panic over audio sources than any other issue when streaming, and we've _all_ made the same dumb mistakes (several times each, probably!) when attempting to set a microphone for a live stream or videoconference call. Breathe deep, check your cables, check your inputs and outputs, and [get comfortable with audio][9]. It'll pay off in the end. + +### Create scenes + +A **Scene** in OBS is a screen layout and consists of one or more sources. + +![Scenes in OBS][10] + +For instance, you might create a scene called **Master shot** that shows you sitting at your desk in front of your computer or at the kitchen counter ready to mix ingredients together. The source could be a webcam mounted on a tripod a meter or two in front of you. Because you want to cut to a detail shot, you might create a second scene called **Close-up**, which uses the computer screen and audio as one input source and your microphone as another source, so you can narrate as you demonstrate what you're doing. If you're doing a baking show, you might want to mount a second webcam above the counter, so you can cut to an overhead shot of ingredients being mixed. Here, your source is a different webcam but probably the same microphone (to avoid making changes in the audio). + +A _scene_, in other words, is a lot like a _shot_ in traditional production vernacular, but it can be the combination of many shots. The fun thing about OBS is that you can mix and match a lot of different sources together, so when you're adding a **Scene**, you can resize and position different sources to achieve picture-in-picture, or split-screen, or any other effect you might want. It's common in video game "let's play" streams to have the video game in full-screen, with the player inset in the lower right or left. Or, if you're recording a panel or a multi-player game like D&D you might have several cameras covering several players in a _Brady Bunch_ grid. + +The possibilities are endless. During streaming, you can cut from one scene to another as needed. This is intended to be a dynamic system, so you can change scenes depending on what the viewer needs to see at any given moment. + +Generally, you want to have some preset scenes before you start to stream. Even if you have a friend willing to do video mixing as you stream, you always want a safe scene to fall back to, so take time beforehand to set up at least a master shot that shows you doing whatever it is you're doing. If all else fails, at least you'll have your main shot you can safely and reliably cut to. + +### Transitions + +When switching from one scene to another, OBS uses a transition. Once you have more than one scene, you can configure what kind of transition it uses in the **Transitions** panel. Simple transitions are usually best. By default, OBS uses a subtle crossfade, but you can experiment with others as you see fit. + +### Go live + +To start streaming, do your vocal exercises, find your motivation, and press the **Start Streaming** button. + +![Start streaming in OBS][11] + +As long as you've set up your streaming service correctly, you're on the air (or on the wires, anyway). + +If you're the talent (the person in front of the camera), it might be easiest to have someone control OBS during streaming. But if that's not possible, you can control it yourself as long as you've practiced a little in advance. If you're screencasting, it helps to have a two-monitor setup so you can control OBS without it being on screen. + +### Streaming for success + +Many of us take streaming for granted now that the internet exists and can broadcast media created by _anyone_. It's a hugely powerful means of communication, and we're all responsible for making the most of it. + +If you have something positive to say, a skill to teach, words of encouragement, or just something fun that you want to share, and you feel like you want to broadcast to the world, then take the time to learn OBS. You might not get a million viewers, but independent media is a vital part of [free culture][12]. The world can always use empowering and positive open source voices, and yours may be one of the most important of all. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-live-stream + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_film.png?itok=aElrLLrw (An old-fashioned video camera) +[2]: http://obsproject.com +[3]: https://opensource.com/sites/default/files/obs-flowchart.jpg (OBS flowchart) +[4]: https://flatpak.org/setup +[5]: https://opensource.com/article/19/1/basic-live-video-streaming-server +[6]: https://opensource.com/sites/default/files/twitch-key.jpg (Streaming key) +[7]: https://opensource.com/article/19/1/basic-live-video-streaming-server#obs +[8]: https://opensource.com/sites/default/files/uploads/obs-sources.jpg (OBS sources) +[9]: https://opensource.com/article/17/1/linux-plays-sound +[10]: https://opensource.com/sites/default/files/uploads/obs-scenes.jpg (Scenes in OBS) +[11]: https://opensource.com/sites/default/files/uploads/obs-stream-start.jpg (Start streaming in OBS) +[12]: https://opensource.com/article/18/1/creative-commons-real-world diff --git a/sources/tech/20200430 Edit music recordings with Audacity on Linux.md b/sources/tech/20200430 Edit music recordings with Audacity on Linux.md new file mode 100644 index 0000000000..be6f68f062 --- /dev/null +++ b/sources/tech/20200430 Edit music recordings with Audacity on Linux.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Edit music recordings with Audacity on Linux) +[#]: via: (https://opensource.com/article/20/4/audacity) +[#]: author: (David Both https://opensource.com/users/dboth) + +Edit music recordings with Audacity on Linux +====== +How COVID-19 caused me to learn Audacity on the fly and learn to love +it. +![Bird singing and music notes][1] + +In this strange and difficult time of a global pandemic, we are all called upon to do things differently, to change our routines, and to learn new things. + +I have worked from home for many years, so that is nothing new to me. Even though I am allegedly retired, I write articles for Opensource.com and [Enable Sysadmin][2] and books. I also manage my own home network, which is larger than you might think, and my church's network and Linux hosts, and I help a few friends with Linux. All of this keeps me busy doing what I like to do, and all of it is usually well within my comfort zone. + +But COVID-19 has changed all of that. And, like many other types of organizations, my church had to move quickly to a new service-delivery paradigm. And that is what churches do—deliver a specific kind of service. As the church sysadmin and with some knowledge of audio recording and editing (back in the '70s, I mixed the sound and was the only roadie for a couple of regional folk-rock groups in Toledo, Ohio), I decided to learn the open source audio recording and editing software [Audacity][3] to help meet this challenge. + +This is not a comprehensive how-to article about using Audacity. It is about my experiences getting started with this powerful audio-editing tool, but there should be enough information here to help you get started. + +I have learned just what I need to know in order to accomplish my task: combining several separate audio clips into a single MP3 audio file. If you already know Audacity and do things differently or know things that I don't, that is expected. And if you have any suggestions to help me accomplish my task more easily, please share them in the comments. + +### The old way + +I try not to use the term "normal" now because it is hard to know exactly what that is—if such a state even exists. But our old method of producing recordings for our shut-ins, members who are traveling, and anyone else was to record the sermon portion of our regular, in-person church services and post them on our website. + +To do this, I installed a TASCAM SS-R100 solid-state recorder that stores the sermons as MP3 files on a thumb drive. We uploaded the recordings to a special directory of our website so people could download them. The recordings are uploaded using a Bash [program][4] I wrote for the task. _Automate everything!_ I trained a couple of others to perform these tasks using sudo in case I was not available. + +This all worked very well. Until it didn't. + +### The new way + +As soon as the first restrictions on large gatherings occurred, we made some changes. We could still have small gatherings, so four of us met Sunday mornings and recorded an abbreviated service using our in-house recorder and doing the upload the usual way. This worked, but as the crisis deepened and it became more of a risk to meet with even a few people, we had to make more changes. + +Like a huge number of other organizations, we realized we each needed to perform our parts of creating services in separate locations from our own homes. + +Now, depending upon the structure of the service, I receive several recordings that I need to combine to create the full church service. Our music director records each anthem and interlude using her iPhone and sends me the recordings in the M4A (MPEG-4 audio) format. They each range in length from seconds to five minutes and are up to 3MB in size. Likewise, our rector sends me two to six recordings, also in M4A format, that contains his portion of the service. Sometimes, other musicians in our church send solos or duets recorded with their significant others; these can be in MP3 or M4A formats. + +Then, I pull all of this together into a single recording that can be uploaded to our server for people to download. I use Audacity for this because it was available in my repo, and it was easy to get started. + +### Getting started with Audacity + +I had never used [Audacity][5] before this, so, like many others these days, I needed to learn something new just in time to accomplish what I needed to do. I struggled a bit at first, but it turned out to be fun and very enlightening. + +Audacity was easy to install on my Fedora 31 workstation because, as in many distros, it is available from the Fedora repository. + +The first time I opened Audacity with the program launcher icon, the application's window was empty with no projects nor tracks present. Audacity projects have an AUP extension, so if you have an existing project, you could click on the file in your favorite file manager and launch Audacity that way. + +### Convert M4A to MP3 + +As installed by Fedora, Audacity does not recognize M4A files. Regardless of how you proceed, you need to install the [LAME][6] MP3 encoder and [FFmpeg][7] import/export library, both of which are available from the Fedora repository and, most likely, any other distro's repository. + +There are websites that explain how to configure Audacity to use these tools to import and convert audio files from M4A to other types (such as MP3), but I decided to write a script to do it from the command line. For one reason, using a script is faster than doing a lot of extra clicking in a GUI interface, and for another, the file names need some work, so I already needed a script to rename the files. Many people use non-alphanumeric characters to name files, but I don't like dealing with special keyboard characters from the command line. It's easier to manage files with simple alphanumeric names, so my script removes all non-alphanumeric characters from the file names and then converts the files to MP3 format. + +You may choose a different approach, but I like the scripted solution. It is fast, and I only need to run the script once, no matter how many files need to be renamed and converted to MP3. + +### Create a new project + +You can create a new project whether or not any audio tracks are loaded. I recommend creating the project first, before importing any audio files (aka "clips"). From the Menu bar, select **File > Save Project > Save Project As**. This opens a warning dialog window that says, _"'Save project' is for an Audacity project, not an audio file."_ Click the **OK** button to continue to a standard file-save dialog. + +I found that I needed to do this twice. The first time, the warning dialog did not display any buttons, so I had to close the dialog using the window menu or the x icon in the Title bar. + +Name the project whatever you like, and Audacity automatically adds the AUP extension. You now have an empty project. + +### Add audio files to your project + +The first step is to add your audio files to the project. Using the Menu bar, open **File > Import > Audio** and then use the file dialog to select one or more files to import. For my first test project, I loaded all the files at once without sorting the tracks nor aligning the clips in the desired sequence along the timeline. This time, I started by loading the audio files one at a time in the sequence I wanted them from top to bottom. As each file is imported, it is placed into a new track below any existing tracks. The following image shows the files loaded all at one time in the sequence they appear in the working directory. + +![Tracks loaded in Audacity][8] + +There is a timeline across the top of the window's track area. There is also a scroll bar at the bottom of the window, so you can scroll along the timeline when the tracks extend beyond the width of the Audacity window. There is also a vertical scroll bar if there are more tracks than fit into the window. + +Notice the names in the upper-left corner of the waveform section of each track—they are the file names of each track without the extension. These are not there by default, but I find them helpful. To display these names, use the Menu bar to select **Edit > Preferences** and place a check in the **Show Audio Track Name As Overlay** box. + +### Order your audio clips + +Once you have some files loaded into the Audacity workspace, you can start manipulating them. To order your audio clips, select one and use the **Time-Shift** tool (↔︎) to slide them horizontally along the tracks; continue doing this until all the clips line up end to end in the order you want them. Note that the clip you are moving is book-ended by a pair of vertical alignment lines. When they line up perfectly, the end lines of the two aligned tracks change color to alert you. + +You can hover the mouse pointer over the tool icons in the Audacity toolbars to see a pop-up that displays the name of that tool. This helps beginners understand what each tool does. + +![Audacity toolbox][9] + +Here, the **Selection** tool** **is selected in the Audacity toolbar. The **Time-Shift** tool is second from the left on the bottom row. + +The following image shows what happens when you slide the audio clips into place on the project timeline without sorting the tracks into a particular sequence. This may not be optimal for how you like to work. It is not for me. + +![Audio clips in Audacity][10] + +To remove segments of (or complete) audio clips, select them with the **Selection** tool—you can also select multiple adjacent tracks. Then you can press the **Delete** button on your keyboard to delete the selected segment(s). + +In the image above, you can see a vertical black line in track 1 and a vertical green line crossing all the tracks. These are the audio cursors that show the playback positions of a track or the entire project. Choose the **Selection** tool and click the desired position within a track, then click the **Play** button on the transport controls (in the upper-left of the Audacity window) to begin playback. Playback will continue past the end of the selected track and all the way to the end of the project. If tracks overlap on the timeline, they will play simultaneously. + +To begin playback immediately, click the desired starting point on the timeline. To play part of a track, hold down the Left mouse button to select a short segment of the track, and then click the **Play** button. The other transport buttons—Pause, Stop, and so—on are identified with universal icons and work as you would expect. + +You can also click the **Silence Audio Selection** button—the fifth button from the left on the **Edit** toolbar (shown below)—to completely silence a selected segment while leaving it in place for timing purposes. This is how I silenced a number of background clicks and noises. + +![Audacity edit tools][11] + +It took me a while to figure out how to sort the tracks vertically, and it turns out there are a few different ways to accomplish the task. + +You can use the track menu to reorder arrangement. Each track has its own Control Panel on the left side (shown below). The track drop-down Menu bar at the top of the Control Panel opens a menu that provides several track-sequencing options to move a track up, down, to the top, or to the bottom. + +![Moving tracks in Audacity][12] + +The items to move a track up or down move the track one position at a time, so you have to select it as many times as necessary to get the track in the desired position. + +To drag and drop tracks, you must click on the space occupied by the track details. In this screenshot, that's "Mono, 48000Hz 32 bit float". It can be tricky, because if you click too high, you adjust the panning (the left and right stereo position) and if you click too low, you may collapse or select the track. Target the "Mono" or "Stereo" label (whatever your track happens to be) label, and then click and drag the track up or down to reposition it in your workspace. + +### Apply amplification and noise reduction effects + +Some tracks need the overall volume to be adjusted. I used the **Selection** tool to double-click and select the entire track (but you could also select a portion of a track). On the Menu bar, select **Effect > Amplify** to display a small dialog window. You can use the slider or enter a value to specify the amount of amplification. Negative numbers decrease the volume. If you try to increase the volume, you need to place a check in the **Allow Clipping** box. Then click OK. + +I found that amplification is a bit tricky; it is easy to use too much or too little. Start by using small numbers to see the results. You can always use **Ctrl+Z** to undo your changes if you go too far in either direction. + +Another effect I find useful is noise reduction. One of the tracks was recorded with a noticeable 60Hz hum, which is usually due to poor grounding of the microphone or recorder. Fortunately, there were only several seconds of hum and no other sound at the beginning of the recording. + +Applying the noise reduction effect was a little confusing at first. First, I selected a few samples of the humming sound to tell Audacity what sound needed to be reduced, and then I navigated to **Effect > Noise Reduction**. This opens the **Noise Reduction** dialog. I clicked on the **Get Noise Profile** button in the Step 1 section of the dialog, which uses the selected sample as the basis for a set of filter presets. After it gathers the selected sample, though, the dialog disappeared (this is by design). I re-opened the dialog, used the slider to select the noise reduction level in decibels (I set it to 15dB and left the other sliders alone), and then clicked **OK**. + +This worked well—you can hear the residual hum only if you know it is there. I need to experiment with this some more, but since the result was acceptable, so I did not play with the settings any further. + +The reason the dialog box closes after getting a noise profile is actually for the sake of expediency. If you're processing many tracks or segments of audio, each with a different noise profile, you can open the **Noise Reduction** effect, get the current noise profile, and then select the audio you want to clean. You can then run the Noise Reduction filter using **Ctrl+R**, the keyboard shortcut for running the most recent filter. Instead of getting a new noise profile, however, Audacity uses the one you've just stored, and performs the filter instead. This way, you can get a sample with a few clicks but clean lots of audio with just one keyboard shortcut. + +### And so much more + +I have only worked with a few of the basics and have not even begun to scratch the surface of Audacity. I can already see that it has so many more features and tools that will enable me to create even more professional-sounding projects. + +For example, in addition to working with existing audio files, Audacity can make recordings from line inputs, the desktop sound stream, and microphone inputs. It can do special effects like fade in and out and cross-fades. And I have not even tried to figure out what many of the other effects and tools are capable of. + +I have a feeling I will need to learn more in the near future. Hopefully, this story of my very limited experience with Audacity will prompt you to check it out. For much more information, you can find the [Audacity manual][13] online. + +Using Audacity, you can quickly clean up audio file so that any background noise becomes tolerable. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/audacity + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/music-birds-recording-520.png?itok=UoM7brl0 (Bird singing and music notes) +[2]: https://www.redhat.com/sysadmin/ +[3]: https://www.audacityteam.org/ +[4]: https://opensource.com/article/17/12/using-sudo-delegate +[5]: https://opensource.com/education/16/9/audacity-classroom +[6]: https://manual.audacityteam.org/man/installing_and_updating_audacity_on_linux.html#linlame +[7]: https://manual.audacityteam.org/man/installing_and_updating_audacity_on_linux.html#linff +[8]: https://opensource.com/sites/default/files/uploads/audacity1_tracksloaded.png (Tracks loaded in Audacity) +[9]: https://opensource.com/sites/default/files/uploads/audacity2_tools.png (Audacity toolbox) +[10]: https://opensource.com/sites/default/files/uploads/audacity3_audioclips.png (Audio clips in Audacity) +[11]: https://opensource.com/sites/default/files/uploads/audacity4_edittoolbar.png (Audacity edit tools) +[12]: https://opensource.com/sites/default/files/uploads/audacity5_trackmovement.png (Moving tracks in Audacity) +[13]: https://manual.audacityteam.org/# diff --git a/sources/tech/20200430 Linux and Kubernetes- Serving The Common Goals of Enterprises.md b/sources/tech/20200430 Linux and Kubernetes- Serving The Common Goals of Enterprises.md new file mode 100644 index 0000000000..c3c0c36b66 --- /dev/null +++ b/sources/tech/20200430 Linux and Kubernetes- Serving The Common Goals of Enterprises.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux and Kubernetes: Serving The Common Goals of Enterprises) +[#]: via: (https://www.linux.com/articles/linux-and-kubernetes-serving-the-common-goals-of-enterprises/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Linux and Kubernetes: Serving The Common Goals of Enterprises +====== + +[![][1]][2] + +For [Stefanie Chiras,][3] VP & GM, Red Hat Enterprise Linux (RHEL) Business Unit at [Red Hat][4], aspects such as security and resiliency have always been important for Red Hat. More so, in the current situation when everyone has gone fully remote and it’s much harder to get people in front of the hardware for carrying out updates, patching, etc. + +“As we look at our current situation, never has it been more important to have an operating system that is resilient and secure, and we’re focused on that,” she said. + +The recently released version of [Red Hat Enterprise Linux (RHEL) 8.2][5] inadvertently address these challenge as it makes it easier for technology leaders to embrace the latest, production-ready innovations swiftly which offering security and resilience that their IT teams need. + +RHEL’s embrace of a predictable 6-month minor release cycle also helped customers plan upgrades more efficiently. + +“There is value for customers in having predictability of minor releases on a six-month cycle. Without knowing when they were coming was causing disruptions for them. The launch of 8.2 is now the second time we have delivered on our commitment of having minor releases every six months,” said Stefanie Chiras. + +In addition to offering security updates, the new version adds insights capabilities and forays into newer areas of innovation. + +The upgrade has expanded the earlier capability called ‘Adviser’ dramatically. Additional functionalities such as drift monitoring and CVE coverage allow for a much deeper granularity into how the infrastructure is running. + +“It really amplifies the skills that are already present in ops and sysadmin teams, and this provides a Red Hat consultation, if you will, directly into the data center,” claimed Charis. + +As containers are increasingly being leveraged for digital transformation, RHEL 8.2 offers an updated application stream of Red Hat’s container tools. It also has new, containerized versions of Buildah and Skopeo. + +[Skopeo][6] is an open-source image copying tool, while Buildah is a tool for building Docker- and Kubernetes-compatible images easily and quickly. + +RHEL has also ensured in-place upgrades in the new version. Customers can now directly in-place upgrade from version 7 to version 8.2. + +Chiras believes Linux has emerged as the go-to-platform for innovations such as Machine Learning, Deep Learning, and Artificial Intelligence. + +“Linux has now become the springboard of innovation,” she argued. “AI, machine learning, and deep learning are driving a real change in not just the software but also the hardware. In the context of these emerging technologies, it’s all about making them consumable into an enterprise.” + +“We’re very focused on our ecosystem, making sure that we’re working in the right upstream communities with the right ISVs, with the right hardware partners to make all of that magic come together,” Chiras said. + +Towards this end, Red Hat has been partnering with multiple architectures for a long time — be it an x86 architecture, ARM, Power, or mainframe with IBM Z. Its partnership with Nvidia pulls in capabilities such as FPGAs, and GPU. + +**Synergizing Kubernetes and Linux ** + +Kubernetes is fast finding favor in enterprises.  So how do Linux and Kubernetes serve the common goals of enterprises? + +“Kubernetes is a new way to deploy Linux. We’re very focused on providing operational consistency by leveraging our technology in RHEL and then bringing in that incredible capability of Kubernetes within our OpenShift product line,” Chiras said. + +The deployment of Linux within a Kubernetes environment is much more complicated than in a traditional deployment. RHEL, therefore, made some key changes. The company created Red Hat Enterprise Linux CoreOS — an optimized version of RHEL for the OpenShift experience. + +“It’s deployed as an immutable. It’s tailored, narrow, and gets updated as part of your OpenShift update to provide consistent user experience and comprehensive security. + +The launch of the Red Hat Universal Base Image (UBI) offers users greater security, reliability, and performance of official Red Hat container images where OCI-compliant Linux containers run. + +“Kubernetes is a new way to deploy Linux. It really is a tight collaboration but what we’re really focused on is the customer experience. We want them to get easy updates with consistency and reliability, resilience and security. We’re pulling all of that together. With such advancements going on, it’s a fascinating space to watch,” added Chiras. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/linux-and-kubernetes-serving-the-common-goals-of-enterprises/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280-1068x634.jpg (computer-2930704_1280) +[2]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280.jpg +[3]: https://www.linkedin.com/in/stefanie-chiras-9022144/ +[4]: https://www.redhat.com/en +[5]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.2_release_notes/index +[6]: https://github.com/containers/skopeo diff --git a/sources/tech/20200501 Transparent, open source alternative to Google Analytics.md b/sources/tech/20200501 Transparent, open source alternative to Google Analytics.md new file mode 100644 index 0000000000..d4ce222a39 --- /dev/null +++ b/sources/tech/20200501 Transparent, open source alternative to Google Analytics.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Transparent, open source alternative to Google Analytics) +[#]: via: (https://opensource.com/article/20/5/plausible-analytics) +[#]: author: (Marko Saric https://opensource.com/users/markosaric) + +Transparent, open source alternative to Google Analytics +====== +Plausible Analytics is a leaner, more transparent option, with the +essential data you need but without all the privacy baggage. +![Digital creative of a browser on the internet][1] + +Google Analytics is the most popular website analytics tool. Millions of developers and creators turn to it to collect and analyze their website statistics. + +More than 53% of all sites on the web track their visitors using Google Analytics. [84%][2] of sites that do use a known analytics script use Google Analytics. + +Google Analytics has, for years, been one of the first tools I installed on a newly launched site. It is a powerful and useful analytics tool. Installing Google Analytics was a habit I didn't think much about until the introduction of the [GDPR][3] (General Data Protection Regulation) and other privacy regulations. + +Using Google Analytics these days comes with several pitfalls, including the need for a privacy policy, the need for cookie banners, and the need for a GDPR consent prompt. All these may negatively impact the site loading time and visitor experience. + +This has made me try to [de-Google-ify websites][4] that I work on, and it's made me start working on independent solutions that are open source and more privacy-friendly. This is where Plausible Analytics enters the story. + +[Plausible Analytics][5] is an open source and lightweight alternative to Google Analytics. It doesn't use cookies and it doesn't collect any personal data, so you don't need to show any cookie banners or get GDPR or CCPA consent. Let's take a closer look. + +### Main differences between Google Analytics and Plausible + +Plausible Analytics is not designed to be a clone of Google Analytics. It is meant as a simple-to-use replacement and a privacy-friendly alternative. Here are the main differences between the two web analytics tools: + +#### Open source vs. closed source + +Google Analytics may be powerful and useful, but it is closed source. It is a proprietary tool run by one of the largest companies in the world, a company that is a key player in the ad-tech industry. There's simply no way of knowing what's going on behind the scenes. You have to put your trust in Google. + +Plausible is a fully open source tool. You can read our code [on GitHub][6]. We're "open" in other ways, too, such as our [public roadmap][7], which is based around the feedback and features submitted by the members of our community. + +#### Privacy of your website visitors + +Google Analytics places [several cookies][8] on the devices of your visitors, and it tracks and collects a lot of data. This means that there are several requirements if you want to use Google Analytics and be compliant with the different regulations: + + * You need to have a privacy policy about analytics + * You need to show a cookie banner + * You need to obtain a GDPR/CCPA consent + + + +Plausible is made to be fully compliant with the privacy regulations. No cookies are used, and no personal data is collected. This means that you don't need to display the cookie banner, you don't need a privacy policy, and you don't need to ask for the GDPR/CCPA consent when using Plausible. + +#### Page weight and loading time + +The recommended way of installing Google Analytics is to use the Google Tag Manager. Google Tag Manager script weights 28 KB, and it downloads another JavaScript file called the Google Analytics tag, which adds an additional 17.7 KB to your page size. That's 45.7 KB of page weight combined. + +Plausible script weights only 1.4 KB. That's 33 times smaller than the Google Analytics Global Site Tag. Every KB matters when you want to keep your site fast to load. + +#### Accuracy of visitor stats + +Google Analytics is being blocked by an increasing number of web users. It's blocked by those who use open source browsers such as [Firefox][9] and [Brave][10]. It's also blocked by those who use open source browser add-ons such as the [uBlock Origin][11]. It's not uncommon to see 40% or more of the audience on a tech site blocking Google Analytics. + +Plausible is a new player on this market and it's privacy-friendly by default, so it doesn't see the same level of blockage. + +#### Simple vs. complex web analytics + +[Google Analytics is overkill][12] for many website owners. It's a complex tool that takes time to understand and requires training. Google Analytics presents hundreds of different reports and metrics for you to get insights from. Many users end up creating custom dashboards while ignoring all the rest. + +Plausible cuts through all the noise that Google Analytics creates. It presents everything you need to know on one single page—all the most valuable metrics at a glance. You can get an overview of the most actionable insights about your website in one minute. + +### A guided tour of Plausible Analytics + +Plausible Analytics is not a full-blown replacement and a feature-by-feature reproduction of Google Analytics. It's not designed for all the different use-cases of Google Analytics. + +It's built with simplicity and speed in mind. There is no navigational menu. There are no additional sub-menus. There is no need to create custom reports. You get one simple and useful web analytics dashboard out of the box. + +Rather than tracking every metric imaginable, many of them that you will never find a use for, Plausible focuses on the essential website stats only. It is easy to use and understand with no training or prior experience: + +![Plausible analytics in action][13] + + * Choose the time range that you want to analyze. The visitor numbers are automatically presented on an hourly, daily, or monthly graph. The default time frame is set at the last 30 days. + * See the number of unique visitors, total page views, and the bounce rate. These metrics include a percentage comparison to the previous time period, so you understand if the trends are going up or down. + * See all the referral sources of traffic and all the most visited pages on your site. Bounce rates of the individual referrals and pages are included too. + * See the list of countries your traffic is coming from. You can also see the device, browser, and operating system your visitors are using. + * Track events and goals to identify the number of converted visitors, the conversion rate, and the referral sites that send the best quality traffic. + + + +Take a look at the [live demo][14] where you can follow the traffic to the Plausible website. + +### Give Plausible Analytics a chance + +With Plausible Analytics, you get all the important web analytics at a glance so you can focus on creating a better site without needing to annoy your visitors with all the different banners and prompts. + +You can try Plausible Analytics on your site alongside Google Analytics. [Register today][15] to try it out, and see what you like and what you don't. Share your feedback with the community. This helps us learn and improve. We'd love to hear from you. + +Take a look at five great open source alternatives to Google Docs. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/plausible-analytics + +作者:[Marko Saric][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/markosaric +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://w3techs.com/technologies/details/ta-googleanalytics +[3]: https://gdpr-info.eu/ +[4]: https://markosaric.com/degoogleify/ +[5]: https://plausible.io/ +[6]: https://github.com/plausible-insights/plausible +[7]: https://feedback.plausible.io/roadmap +[8]: https://developers.google.com/analytics/devguides/collection/analyticsjs/cookie-usage +[9]: https://www.mozilla.org/en-US/firefox/new/ +[10]: https://brave.com/ +[11]: https://github.com/gorhill/uBlock +[12]: https://plausible.io/vs-google-analytics +[13]: https://opensource.com/sites/default/files/plausible-analytics.png (Plausible analytics in action) +[14]: https://plausible.io/plausible.io +[15]: https://plausible.io/register diff --git a/sources/tech/20200503 13 tips for getting your talk accepted at a tech conference.md b/sources/tech/20200503 13 tips for getting your talk accepted at a tech conference.md new file mode 100644 index 0000000000..b260116fb6 --- /dev/null +++ b/sources/tech/20200503 13 tips for getting your talk accepted at a tech conference.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (13 tips for getting your talk accepted at a tech conference) +[#]: via: (https://opensource.com/article/20/5/tips-conference-proposals) +[#]: author: (Todd Lewis https://opensource.com/users/toddlewis) + +13 tips for getting your talk accepted at a tech conference +====== +Before you respond to an event's call for papers, make sure your talk's +proposal aligns with these best practices. +![All Things Open check-in at registration booth][1] + +As tech conference organizers ramp up for the fall season, you may be seeing calls for papers (CFP) landing in your email box or social media feeds. We at [All Things Open][2] (ATO) have seen a lot of presentation proposals over the years, and we've learned a few things about what makes them successful. + +As we prepare for the eighth annual ATO in October 2020, we thought we'd offer a few best practices for writing successful CFP responses. If you're considering submitting a talk to ATO or another tech event, we hope these tips will help improve the chances that your proposal will be accepted. + +### 1\. Know the event you're submitting a talk to + +This seems like the proverbial _no-brainer_, but some people don't take the time to research an event before they submit a talk. Peruse the conference's website and review the talks, speakers, topics, etc. featured in the last couple of years. You can also find a lot of information simply by googling. The time you invest here will help you avoid a submission that is completely out of context for the event. + +### 2\. Understand what the event is looking for + +Look for information about what the event is looking for and what types of topics or talks it expects will be a good fit. We try to provide as much information as possible about the [ATO conference][3], [why someone would want to speak][4], and [what we're looking for][5] (both general and special interest topics). We also try to make the submission process as easy as possible (no doubt, there is room for improvement), in part because we believe this improves the quality of submissions and makes our review process go more smoothly. + +### 3\. Reach out to the organizer and ask questions + +If you're considering submitting a talk, don't hesitate to reach out and ask the event organizers any questions you have and for guidance specific to the event. If there is no or little response, that should be a red flag. If you have any questions about All Things Open, please reach out directly at [info@allthingsopen.org][6]. + +### 4\. Be clear about what attendees will learn from your talk + +This is one of the most common mistakes we see. Only about 25% of the proposals we receive clearly explain the proposed talk's takeaways. One reason you should include this is that nearly every event attendee makes their schedule based on what they will learn if they go to a session. But for organizers and proposal reviewers, having this information clearly stated upfront is pure gold. It simplifies and speeds up the assessment process, which gets you one step closer to being accepted as a speaker. A paragraph titled "Attendee Takeaways" with bullet points is the holy grail for everyone involved. + +### 5\. Keep recommended word counts in mind + +This is another mistake we see a lot. Many talks are submitted with either a single sentence description in the abstract or an extraordinary long volume of text. Neither is a good idea. The only exception we can think of is when a topic is very popular or topical, and that alone is enough to win the day even if the abstract is extremely short (but this is rare). Most abstracts should be between 75 and 250 words, and perhaps more for an extended workshop with prerequisites (e.g., preexisting knowledge or required downloads). Even then, try to keep your proposal as sharp, concise, and on-point as possible. + +Disregard this advice at your own risk; otherwise, there's a high likelihood that your proposal will be met with one of these reactions from reviewers: "They didn't take the time to write any more than this?" or "Sheesh, there's no way I have the time to read all that. I'm going to give it the lowest score and move on." + +### 6\. Choose a good title + +This is a debate we see all the time: Should a talk's title describe what the talk is about, or should it be written to stand out and get attention (e.g., evoking emotion, anchoring to a popular pop culture topic, or asking a compelling question)? There isn't a single correct answer to this question, but we definitely know when a title "works" and when it doesn't. We've seen some very creative titles work well and generate interest, and we've seen very straightforward titles work well, also. + +Here is our rule of thumb: If the talk covers a topic that has been around a while and is not particularly _hot_ right now, try getting creative and spicing it up a bit. If the topic is newer, a more straightforward title describing the talk in plain terms should be good. + +Titles on an event schedule may be the only thing attendees use to decide what talks to attend. So, run your potential talk titles by colleagues and friends, and seek their opinions. Ask: "If you were attending an event and saw this title on the schedule, would it pique your interest?" + +### 7\. Know the basic criteria that reviewers and organizers use to make decisions + +While this isn't a comprehensive list of review criteria, most reviewers and organizers consider one or more of the following when evaluating talk proposals. Therefore, at minimum, consider this list when you're creating a talk and the components that go with it. + + 1. **Timeliness of and estimated interest in the topic:** Is the topic applicable to the session's target audience? Will it deliver value? Is it timely? + 2. **Educational value:** Based on the abstract and speaker, is it clear that attendees will learn something from the talk? As mentioned in item 4 above, including an "Attendee Takeaways" section is really helpful to establish educational value. + 3. **Technical value:** Is the technology you intend to showcase applicable, unique, or being used in a new and creative way? Is there a live demo or a hands-on component? While some topics don't lend themselves to a demo, most people are visual learners and are better off if a presentation includes one (if it's relevant). For this reason, we place a lot of value on demos and hands-on content. + 4. **Diversity:** Yes, there are exceptions, but the majority of events, reviewers, and organizers agree that having a diverse speaker lineup is optimal and results in a better overall event in multiple ways. A topic delivered from a different perspective can often lead to creative breakthroughs for attendees, which is a huge value-add. See item 10 below for more on this. + 5. **Talk difficulty level:** We identify All Things Open talks as introductory, intermediate, or advanced. Having a good mix of talk levels ensures everyone in attendance can access applicable content. See item 9 below for more on this, but in general, it's smart to indicate your talk's level, whether or not the CFP requests it. + + + +### 8\. Stay current on the event's industry or sector + +Submitting a proposal on a relevant topic increases the probability your talk will be accepted. But how do you know what topics are of interest, especially if the CFP doesn't spell it out in simple terms? The best way to know what's timely and interesting is to deeply understand the sector the event focuses on. + +Yes, this requires time and effort, and it implies you enjoy the sector enough to stay current on it, but it will pay off. This knowledge will result in a higher _sector IQ_, which will be reflected in your topic, title, and abstract. It will be recognized by reviewers and immediately set you apart from others. At All Things Open, we spend the majority of our time reading about and staying current on the "open" space so that we can feature relevant, substantive, and informed content. Submitting a talk that is relevant, substantive, and informed greatly enhances the chance it will be accepted. + +### 9\. Describe whether the talk is introductory, intermediate, or advanced + +Some CFPs don't ask for this information, but you should offer it anyway. It will make the reviewers and organizer very happy for multiple reasons, including these: + + 1. Unless the event targets attendees with a certain skill or experience level (and most do not), organizers must include content that is appealing to a wide audience, including people of all skill, experience, and expertise levels. Even if an event focuses on a specific type of attendee (perhaps people with higher levels of experience or skills), most want to offer something a little different. Listing the talk level makes this much easier for organizers. + 2. News flash: Reviewers and organizers don't know everything and are not experts in every possible topic area. As a result, reviewers will sometimes look for a few keywords or other criteria, and adding the talk level can "seal the deal" and get your talk confirmed. + + + +### 10\. Tell organizers if you're a member of a historically underrepresented group + +A growing number of events are getting better at recognizing the value of diversity and ensuring their speaker lineup reflects it. If you're part of a group that hasn't typically been included in tech events and leadership, look to see if there is a place to indicate that on the submission form. If not, mention it in a conspicuous place somewhere in the abstract. This does not guarantee approval in any way—your proposal must still be well-written and relevant—but it does give reviewers and organizers pertinent information they may value and take into consideration. + +### 11\. Don't be ashamed of your credentials or speaking experience if it is light + +We talk to a lot of people who would like to deliver a presentation and have a lot to offer, but they never submit a talk because they don't feel they're qualified to speak. _Not true._ Some of the best talks we've seen are from first-time speakers or those very early in their speaking careers. Go ahead and submit the talk, and be honest when discussing your background. Most reviewers and organizers will focus on the substance of the submission over your experience and recognize that new ways of approaching and using technology often come from newbies rather than industry veterans. + +One caveat here: It still pays to know yourself. By this, we mean if you absolutely hate public speaking, have no desire to do it, and are only considering submitting a talk due to, for example, pressure from an employer, the talk is not likely to go well. It's better, to be honest, on the frontend than force something you have no desire to do. + +### 12\. Consider panel sessions carefully + +If you've got an idea for a panel session, please consider it carefully. In more than 10 years of hosting events we've seen some really good panel sessions, but we've seen far more that didn't go so well. Perhaps too many people were on the panel and not everyone had a chance to speak, perhaps a single panel member dominated the entire conversation, or perhaps the moderator didn't keep the dialogue and engagement flowing smoothly. Regardless of the issue, panels have the potential to go very wrong. + +That said, panels can still work and deliver a lot of value to attendees. If you do submit a panel session be sure to keep in mind the amount of time allotted for the session and confirm the number of panel members accordingly. Remember, less is always more when it comes to the panel format. Also, be sure the moderator understands the subject matter being discussed and doesn't mind enforcing format parameters and speaking time limits. Finally, let organizers know panel members and the moderator will engage in a pre-conference walk-through/preparation call before the event to ensure a smooth process in front of a live audience. Remember, organizers are well aware panels can be terrific but can also go in the opposite direction and very easily lead to a lot of negative feedback. + +### 13\. This is not an opportunity to sell  + +This is a sensitive topic, but one that absolutely must be mentioned. Over the years we've seen literally hundreds of talks "disqualified" by reviewers because they viewed the talk as a sales pitch. Few things evoke such a visceral response. Yes, there are events, tracks, and session slots where a sales pitch is appropriate (and maybe even required by the company paying your costs). However, make it a priority to know when and where this is appropriate and acceptable. And always, and we mean always, err on the side of making substance the focus of the talk rather than a sales angle.  + +It might sound like a cliche, but when a talk is delivered effectively with a focus on substance, people will **want** to buy what you're selling. And if you're not selling anything, they'll want to follow you on social media and generally engage with you—because you delivered value to them. Meaning: You gave them something they can apply themselves (education) or because your delivery style was entertaining and engaging. With rare exceptions, always focus any abstract on substance, and the rest will take care of itself.  + +### Go for it! + +We greatly admire and respect anyone who submits a talk for consideration—it takes a lot of time, thought, and courage. Therefore, we go to great lengths to thank everyone who goes through the process; we give free event passes to everyone who applies (regardless of approval or rejection), and we make every effort to host Q&A sessions to provide as much guidance as possible on the front end. Again, the more time and consideration speakers put into the submission process, the easier the lives of reviewers and organizers. We need to make all of this as easy as possible. + +While this is not a comprehensive list of best practices, it includes some of the things we think people can benefit from knowing before submitting a talk. There are a lot of people out there with more knowledge and experience, so please share your best tips for submitting conference proposals in the comments, so we can all learn from you. + +* * * + +_[All Things Open][2] is a universe of platforms and events focusing on open source, open tech, and the open web. It hosts the [All Things Open conference][3], the largest open source/tech/web event on the US East Coast. The conference regularly hosts thousands of attendees and many of the world's most influential companies from a wide variety of industries and sectors. In 2019, nearly 5,000 people attended from 41 US states and 24 countries. Please direct inquiries about ATO to the team at [info@allthingsopen.org][6]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/tips-conference-proposals + +作者:[Todd Lewis][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/toddlewis +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ato2016_checkin_conference.jpg?itok=DJtoSS6t (All Things Open check-in at registration booth) +[2]: https://www.allthingsopen.org/ +[3]: https://2020.allthingsopen.org/ +[4]: https://2020.allthingsopen.org/call-for-speakers +[5]: https://www.allthingsopen.org/what-were-looking-for/ +[6]: mailto:info@allthingsopen.org diff --git a/sources/tech/20200504 Create interactive learning games for kids with open source.md b/sources/tech/20200504 Create interactive learning games for kids with open source.md new file mode 100644 index 0000000000..f6ade34857 --- /dev/null +++ b/sources/tech/20200504 Create interactive learning games for kids with open source.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create interactive learning games for kids with open source) +[#]: via: (https://opensource.com/article/20/5/jclic-games-kids) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +Create interactive learning games for kids with open source +====== +Help your students learn by creating fun puzzles and games in JClic, an +easy Java-based app. +![Family learning and reading together at night in a room][1] + +Schools are closed in many countries around the world to slow the spread of COVID-19. This has suddenly thrown many parents and teachers into homeschooling. Fortunately, there are plenty of educational resources on the internet to use or adapt, although their licenses vary. You can try searching for Creative Commons Open Educational Resources, but if you want to create your own materials, there are many options for that to. + +If you want to create digital educational activities with puzzles or tests, two easy-to-use, open source, cross-platform applications that fit the bill are eXeLearning and JClic. My earlier article on [eXeLearning][2] is a good introduction to that program, so here I'll look at [JClic][3]. It is an open source software project for creating various types of interactive activities such as associations, text-based activities, crosswords, and other puzzles with text, graphics, and multimedia elements. + +Although it's been around since the 1990s, JClic never developed a large user base in the English-speaking world. It was created in Catalonia by the [Catalan Educational Telematic Network][4] (XTEC). + +### About JClic + +JClic is a Java-based application that's available in many Linux repositories and can be downloaded from [GitHub][5]. It runs on Linux, macOS, and Windows, but because it is a Java program, you must have a Java runtime environment [installed][6]. + +The program's interface has not really changed much over the years, even while features have been added or dropped, such as introducing HTML5 export functionality to replace Java Applet technology for web-based deployment. It hasn't needed to change much, though, because it's very effective at what it does. + +### Creating a JClic project + +Many teachers from many countries have used JClic to create interactive materials for a wide variety of ability levels, subjects, languages, and curricula. Some of these materials have been collected in an [downloadable activities library][7]. Although few activities are in English, you can get a sense of the possibilities JClic offers. + +As JClic has a visual, point-and-click program interface, it is easy enough to learn that a new user can quickly concentrate on content creation. [Documentation][8] is available on GitHub. + +The screenshots below are from one of the JClic projects I created to teach basic Excel skills to learners in Papua New Guinea. + +A JClic project is created in its authoring tool and consists of the following four elements: + +#### 1\. Metadata about the project + +![JClic metadata][9] + +#### 2\. A library of the graphical and other resources it uses + +![JClic media][10] + +#### 3\. A series of one or more activities + +![JClic activities][11] + +JClic can produce seven different activity types: + + * Associations where the user discovers the relationships between two information sets + * Memory games where the user discovers pairs of identical elements or relations (which are hidden) between them + * Exploration activities involving the identification and information, based on a single Information set + * Puzzles where the user reconstructs information that is initially presented in a disordered form; the activity can include graphics, text, sound, or a combination of them + * Written-response activities that are solved by writing text, either a single word or a sentence + * Text activities that are based on words, phrases, letters, and paragraphs of text that need to be completed, understood, corrected, or ordered; these activities can contain images and windows with active content + * Word searches and crosswords + + + +Because of variants in the activities, there are 16 possible activity types. + +#### 4\. A timeline to sequence the activities + +![JClic timeline][12] + +### Using JClic content + +Projects can run in JClic's player (part of the Java application you used to create the project), or they can be exported to HTML5 so they can run in a web browser. + +The one thing I don't like about JClic is that its default HTML5 export function assumes you'll be online when running a project. If you want a project to work offline as needed, you must download a compiled and minified HTML5 player from [Github][13], and place it in the same folder as your JClic project. + +Next, open the **index.html** file in a text editor and replace this line: + + +``` +`` +``` + +With: + + +``` +`` +``` + +Now the HTML5 version of your project runs in a web browser, whether the user is online or not. + +JClic also provides a reports function that can store test scores in an ODBC-compliant database. I have not explored this feature, as my tests and puzzles are mostly used for self-assessment and to prompt reflection by the learner, rather than as part of a formal scheme, so the scores are not very important. If you would like to learn about it, there is [documentation][14] on running JClic Reports Server with Tomcat and MySQL (or [mariaDB][15]). + +### Conclusion + +JClic offers a wide range of activity types that provide plenty of room to be creative in designing content to fit your subject area and type of learner. JClic is a valuable addition for anyone who needs a quick and easy way to develop educational resources. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/jclic-games-kids + +作者:[Peter Cheer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/petercheer +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/family_learning_kids_night_reading.png?itok=6K7sJVb1 (Family learning and reading together at night in a room) +[2]: https://opensource.com/article/18/5/exelearning +[3]: https://clic.xtec.cat/legacy/en/jclic/index.html +[4]: https://clic.xtec.cat/legacy/en/index.html +[5]: https://github.com/projectestac/jclic +[6]: https://adoptopenjdk.net/installation.html +[7]: https://clic.xtec.cat/repo/ +[8]: https://github.com/projectestac/jclic/wiki/JClic_Guide +[9]: https://opensource.com/sites/default/files/uploads/metadata.png (JClic metadata) +[10]: https://opensource.com/sites/default/files/uploads/media.png (JClic media) +[11]: https://opensource.com/sites/default/files/uploads/activities.png (JClic activities) +[12]: https://opensource.com/sites/default/files/uploads/sequence.png (JClic timeline) +[13]: http://projectestac.github.io/jclic.js/ +[14]: https://github.com/projectestac/jclic/wiki/Jclic-Reports-Server-with-Tomcat-and-MySQL-on-Ubuntu +[15]: https://mariadb.org/ diff --git a/sources/tech/20200504 Define and optimize data partitions in Apache Cassandra.md b/sources/tech/20200504 Define and optimize data partitions in Apache Cassandra.md new file mode 100644 index 0000000000..d28f0daee0 --- /dev/null +++ b/sources/tech/20200504 Define and optimize data partitions in Apache Cassandra.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Define and optimize data partitions in Apache Cassandra) +[#]: via: (https://opensource.com/article/20/5/apache-cassandra) +[#]: author: (Anil Inamdar https://opensource.com/users/anil-inamdar) + +Define and optimize data partitions in Apache Cassandra +====== +Apache Cassandra is built for speed and scalability; here's how to get +the most out of those benefits. +![Person standing in front of a giant computer screen with numbers, data][1] + +Apache Cassandra is a database. But it's not just any database; it's a replicating database designed and tuned for scalability, high availability, low-latency, and performance. Cassandra can help your data survive regional outages, hardware failure, and what many admins would consider excessive amounts of data. + +Having a thorough command of data partitions enables you to achieve superior Cassandra cluster design, performance, and scalability. In this article, I'll examine how to define partitions and how Cassandra uses them, as well as the most critical best practices and known issues you ought to be aware of. + +To set the scene: partitions are chunks of data that serve as the atomic unit for key database-related functions like data distribution, replication, and indexing. Distributed data systems commonly distribute incoming data into these partitions, performing the partitioning with simple mathematical functions such as identity or hashing, and using a "partition key" to group data by partition. For example, consider a case where server logs arrive as incoming data. Using the "identity" partitioning function and the timestamps of each log (rounded to the hour value) for the partition key, we can partition this data such that each partition holds one hour of the logs. + +### Data partitions in Cassandra + +Cassandra operates as a distributed system and adheres to the data partitioning principles described above. With Cassandra, data partitioning relies on an algorithm configured at the cluster level, and a partition key configured at the table level. + +![Cassandra data partition][2] + +Cassandra Query Language (CQL) uses the familiar SQL table, row, and column terminologies. In the example diagram above, the table configuration includes the partition key within its primary key, with the format: Primary Key = Partition Key + [Clustering Columns]. + +A primary key in Cassandra represents both a unique data partition and a data arrangement inside a partition. Data arrangement information is provided by optional clustering columns. Each unique partition key represents a set of table rows managed in a server, as well as all servers that manage its replicas. + +### Defining primary keys in CQL + +The following four examples demonstrate how a primary key can be represented in CQL syntax. The sets of rows produced by these definitions are generally considered a partition. + +#### Definition 1 (partition key: log_hour, clustering columns: none) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP PRIMARYKEY, +   log_level text, +   message text, +   server text +   ) +``` + +Here, all rows that share a **log_hour** go into the same partition. + +#### Definition 2 (partition key: log_hour, clustering columns: log_level) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP, +   log_level text, +   message text, +   server text, +   PRIMARY KEY (log_hour, log_level) +   ) +``` + +This definition uses the same partition key as Definition 1, but here all rows in each partition are arranged in ascending order by **log_level**. + +#### Definition 3 (partition key: log_hour, server, clustering columns: none) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP, +   log_level text, +   message text, +   server text, +   PRIMARY KEY ((log_hour, server)) +   ) +``` + +In this definition, all rows share a **log_hour** for each distinct **server** as a single partition. + +#### Definition 4 (partition key: log_hour, server, clustering columns: log_level) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP, +   log_level text, +   message text, +   server text, +   PRIMARY KEY ((log_hour, server),log_level) +   )WITH CLUSTERING ORDER BY (column3 DESC); +``` + +This definition uses the same partition as Definition 3 but arranges the rows within a partition in descending order by **log_level**. + +### How Cassandra uses the partition key + +Cassandra relies on the partition key to determine which node to store data on and where to locate data when it's needed. Cassandra performs these read and write operations by looking at a partition key in a table, and using tokens (a long value out of range -2^63 to +2^63-1) for data distribution and indexing. These tokens are mapped to partition keys by using a partitioner, which applies a partitioning function that converts any partition key to a token. Through this token mechanism, every node of a Cassandra cluster owns a set of data partitions. The partition key then enables data indexing on each node. + +![Cassandra cluster with 3 nodes and token-based ownership][3] + +A Cassandra cluster with three nodes and token-based ownership. This is a simplistic representation: the actual implementation uses [Vnodes][4]. + +### Data partition impacts on Cassandra clusters + +Careful partition key design is crucial to achieving the ideal partition size for the use case. Getting it right allows for even data distribution and strong I/O performance. Partition size has several impacts on Cassandra clusters you need to be aware of: + + * Read performance—In order to find partitions in SSTables files on disk, Cassandra uses data structures that include caches, indexes, and index summaries. Partitions that are too large reduce the efficiency of maintaining these data structures – and will negatively impact performance as a result. Cassandra releases have made strides in this area: in particular, version 3.6 and above of the Cassandra engine introduce storage improvements that deliver better performance for large partitions and resilience against memory issues and crashes. + * Memory usage— Large partitions place greater pressure on the JVM heap, increasing its size while also making the garbage collection mechanism less efficient. + * Cassandra repairs—Large partitions make it more difficult for Cassandra to perform its repair maintenance operations, which keep data consistent by comparing data across replicas. + * Tombstone eviction—Not as mean as it sounds, Cassandra uses unique markers known as "tombstones" to mark data for deletion. Large partitions can make that deletion process more difficult if there isn't an appropriate data deletion pattern and compaction strategy in place. + + + +While these impacts may make it tempting to simply design partition keys that yield especially small partitions, the data access pattern is also highly influential on ideal partition size (for more information, read this in-depth guide to [Cassandra data modeling][5]). The data access pattern can be defined as how a table is queried, including all of the table's **select** queries. Ideally, CQL select queries should have just one partition key in the **where** clause—that is to say, Cassandra is most efficient when queries can get needed data from a single partition, instead of many smaller ones. + +### Best practices for partition key design + +Following best practices for partition key design helps you get to an ideal partition size. As a rule of thumb, the maximum partition size in Cassandra should stay under 100MB. Ideally, it should be under 10MB. While Cassandra versions 3.6 and newer make larger partition sizes more viable, careful testing and benchmarking must be performed for each workload to ensure a partition key design supports desired cluster performance. + +Specifically, these best practices should be considered as part of any partition key design: + + * The goal for a partition key must be to fit an ideal amount of data into each partition for supporting the needs of its access pattern. + * A partition key should disallow unbounded partitions: those that may grow indefinitely in size over time. For instance, in the **server_logs** examples above, using the server column as a partition key would create unbounded partitions as the number of server logs continues to increase. In contrast, using **log_hour** limits each partition to an hour of data. + * A partition key should also avoid creating a partition skew, in which partitions grow unevenly, and some are able to grow without limit over time. In the **server_logs** examples, using the server column in a scenario where one server generates considerably more logs than others would produce a partition skew. To avoid this, a useful technique is to introduce another attribute from the table to force an even distribution, even if it's necessary to create a dummy column to do so. + * It's helpful to partition time-series data with a partition key that uses a time element as well as other attributes. This protects against unbounded partitions, enables access patterns to use the time attribute in querying specific data, and allows for time-bound data deletion. The examples above each demonstrate this by using the **log_hour** time attribute. + + + +Several tools are available to help test, analyze, and monitor Cassandra partitions to check that a chosen schema is efficient and effective. By carefully designing partition keys to align well with the data and needs of the solution at hand, and following best practices to optimize partition size, you can utilize data partitions that more fully deliver on the scalability and performance potential of a Cassandra deployment. + +Dani and Jon will give a three hour tutorial at OSCON this year called: Becoming friends with... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/apache-cassandra + +作者:[Anil Inamdar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/anil-inamdar +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://opensource.com/sites/default/files/uploads/apache_cassandra_1_0.png (Cassandra data partition) +[3]: https://opensource.com/sites/default/files/uploads/apache_cassandra_2_0.png (Cassandra cluster with 3 nodes and token-based ownership) +[4]: https://www.instaclustr.com/cassandra-vnodes-how-many-should-i-use/ +[5]: https://www.instaclustr.com/resource/6-step-guide-to-apache-cassandra-data-modelling-white-paper/ diff --git a/sources/tech/20200504 Understanding systemd at startup on Linux.md b/sources/tech/20200504 Understanding systemd at startup on Linux.md new file mode 100644 index 0000000000..2d0a5ef7b6 --- /dev/null +++ b/sources/tech/20200504 Understanding systemd at startup on Linux.md @@ -0,0 +1,445 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding systemd at startup on Linux) +[#]: via: (https://opensource.com/article/20/5/systemd-startup) +[#]: author: (David Both https://opensource.com/users/dboth) + +Understanding systemd at startup on Linux +====== +systemd's startup provides important clues to help you solve problems +when they occur. +![People at the start line of a race][1] + +In [_Learning to love systemd_][2], the first article in this series, I looked at systemd's functions and architecture and the controversy around its role as a replacement for the old SystemV init program and startup scripts. In this second article, I'll start exploring the files and tools that manage the Linux startup sequence. I'll explain the systemd startup sequence, how to change the default startup target (runlevel in SystemV terms), and how to manually switch to a different target without going through a reboot. + +I'll also look at two important systemd tools. The first is the **systemctl** command, which is the primary means of interacting with and sending commands to systemd. The second is **journalctl**, which provides access to the systemd journals that contain huge amounts of system history data such as kernel and service messages (both informational and error messages). + +Be sure to use a non-production system for testing and experimentation in this and future articles. Your test system needs to have a GUI desktop (such as Xfce, LXDE, Gnome, KDE, or another) installed. + +I wrote in my previous article that I planned to look at creating a systemd unit and adding it to the startup sequence in this article. Because this article became longer than I anticipated, I will hold that for the next article in this series. + +### Exploring Linux startup with systemd + +Before you can observe the startup sequence, you need to do a couple of things to make the boot and startup sequences open and visible. Normally, most distributions use a startup animation or splash screen to hide the detailed messages that would otherwise be displayed during a Linux host's startup and shutdown. This is called the Plymouth boot screen on Red Hat-based distros. Those hidden messages can provide a great deal of information about startup and shutdown to a sysadmin looking for information to troubleshoot a bug or to just learn about the startup sequence. You can change this using the GRUB (Grand Unified Boot Loader) configuration. + +The main GRUB configuration file is **/boot/grub2/grub.cfg**, but, because this file can be overwritten when the kernel version is updated, you do not want to change it. Instead, modify the **/etc/default/grub** file, which is used to modify the default settings of **grub.cfg**. + +Start by looking at the current, unmodified version of the **/etc/default/grub** file: + + +``` +[root@testvm1 ~]# cd /etc/default ; cat grub +GRUB_TIMEOUT=5 +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +GRUB_DEFAULT=saved +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora_testvm1-swap rd.lvm. +lv=fedora_testvm1/root rd.lvm.lv=fedora_testvm1/swap rd.lvm.lv=fedora_ +testvm1/usr rhgb quiet" +GRUB_DISABLE_RECOVERY="true" +[root@testvm1 default]# +``` + +Chapter 6 of the [GRUB documentation][3] contains a list of all the possible entries in the **/etc/default/grub** file, but I focus on the following: + + * I change **GRUB_TIMEOUT**, the number of seconds for the GRUB menu countdown, from five to 10 to give a bit more time to respond to the GRUB menu before the countdown hits zero. + * I delete the last two parameters on **GRUB_CMDLINE_LINUX**, which lists the command-line parameters that are passed to the kernel at boot time. One of these parameters, **rhgb** stands for Red Hat Graphical Boot, and it displays the little Fedora icon animation during the kernel initialization instead of showing boot-time messages. The other, the **quiet** parameter, prevents displaying the startup messages that document the progress of the startup and any errors that occur. I delete both **rhgb** and **quiet** because sysadmins need to see these messages. If something goes wrong during boot, the messages displayed on the screen can point to the cause of the problem. + + + +After you make these changes, your GRUB file will look like: + + +``` +[root@testvm1 default]# cat grub +GRUB_TIMEOUT=10 +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +GRUB_DEFAULT=saved +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora_testvm1-swap rd.lvm. +lv=fedora_testvm1/root rd.lvm.lv=fedora_testvm1/swap rd.lvm.lv=fedora_ +testvm1/usr" +GRUB_DISABLE_RECOVERY="false" +[root@testvm1 default]# +``` + +The **grub2-mkconfig** program generates the **grub.cfg** configuration file using the contents of the **/etc/default/grub** file to modify some of the default GRUB settings. The **grub2-mkconfig** program sends its output to **STDOUT**. It has a **-o** option that allows you to specify a file to send the datastream to, but it is just as easy to use redirection. Run the following command to update the **/boot/grub2/grub.cfg** configuration file: + + +``` +[root@testvm1 grub2]# grub2-mkconfig > /boot/grub2/grub.cfg +Generating grub configuration file ... +Found linux image: /boot/vmlinuz-4.18.9-200.fc28.x86_64 +Found initrd image: /boot/initramfs-4.18.9-200.fc28.x86_64.img +Found linux image: /boot/vmlinuz-4.17.14-202.fc28.x86_64 +Found initrd image: /boot/initramfs-4.17.14-202.fc28.x86_64.img +Found linux image: /boot/vmlinuz-4.16.3-301.fc28.x86_64 +Found initrd image: /boot/initramfs-4.16.3-301.fc28.x86_64.img +Found linux image: /boot/vmlinuz-0-rescue-7f12524278bd40e9b10a085bc82dc504 +Found initrd image: /boot/initramfs-0-rescue-7f12524278bd40e9b10a085bc82dc504.img +done +[root@testvm1 grub2]# +``` + +Reboot your test system to view the startup messages that would otherwise be hidden behind the Plymouth boot animation. But what if you need to view the startup messages and have not disabled the Plymouth boot animation? Or you have, but the messages stream by too fast to read? (Which they do.) + +There are a couple of options, and both involve log files and systemd journals—which are your friends. You can use the **less** command to view the contents of the **/var/log/messages** file. This file contains boot and startup messages as well as messages generated by the operating system during normal operation. You can also use the **journalctl** command without any options to view the systemd journal, which contains essentially the same information: + + +``` +[root@testvm1 grub2]# journalctl +\-- Logs begin at Sat 2020-01-11 21:48:08 EST, end at Fri 2020-04-03 08:54:30 EDT. -- +Jan 11 21:48:08 f31vm.both.org kernel: Linux version 5.3.7-301.fc31.x86_64 ([mockbuild@bkernel03.phx2.fedoraproject.org][4]) (gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC)) #1 SMP Mon Oct > +Jan 11 21:48:08 f31vm.both.org kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.3.7-301.fc31.x86_64 root=/dev/mapper/VG01-root ro resume=/dev/mapper/VG01-swap rd.lvm.lv=VG01/root rd> +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-provided physical RAM map: +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x0000000100000000-0x000000041fffffff] usable +Jan 11 21:48:08 f31vm.both.org kernel: NX (Execute Disable) protection: active +Jan 11 21:48:08 f31vm.both.org kernel: SMBIOS 2.5 present. +Jan 11 21:48:08 f31vm.both.org kernel: DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 +Jan 11 21:48:08 f31vm.both.org kernel: Hypervisor detected: KVM +Jan 11 21:48:08 f31vm.both.org kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 +Jan 11 21:48:08 f31vm.both.org kernel: kvm-clock: cpu 0, msr 30ae01001, primary cpu clock +Jan 11 21:48:08 f31vm.both.org kernel: kvm-clock: using sched offset of 8250734066 cycles +Jan 11 21:48:08 f31vm.both.org kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns +Jan 11 21:48:08 f31vm.both.org kernel: tsc: Detected 2807.992 MHz processor +Jan 11 21:48:08 f31vm.both.org kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved +Jan 11 21:48:08 f31vm.both.org kernel: e820: remove [mem 0x000a0000-0x000fffff] usable +<snip> +``` + +I truncated this datastream because it can be hundreds of thousands or even millions of lines long. (The journal listing on my primary workstation is 1,188,482 lines long.) Be sure to try this on your test system. If it has been running for some time—even if it has been rebooted many times—huge amounts of data will be displayed. Explore this journal data because it contains a lot of information that can be very useful when doing problem determination. Knowing what this data looks like for a normal boot and startup can help you locate problems when they occur. + +I will discuss systemd journals, the **journalctl** command, and how to sort through all of that data to find what you want in more detail in a future article in this series. + +After GRUB loads the kernel into memory, it must first extract itself from the compressed version of the file before it can perform any useful work. After the kernel has extracted itself and started running, it loads systemd and turns control over to it. + +This is the end of the boot process. At this point, the Linux kernel and systemd are running but unable to perform any productive tasks for the end user because nothing else is running, there's no shell to provide a command line, no background processes to manage the network or other communication links, and nothing that enables the computer to perform any productive function. + +Systemd can now load the functional units required to bring the system up to a selected target run state. + +### Targets + +A systemd target represents a Linux system's current or desired run state. Much like SystemV start scripts, targets define the services that must be present for the system to run and be active in that state. Figure 1 shows the possible run-state targets of a Linux system using systemd. As seen in the first article of this series and in the systemd bootup man page (man bootup), there are other intermediate targets that are required to enable various necessary services. These can include **swap.target**, **timers.target**, **local-fs.target**, and more. Some targets (like **basic.target**) are used as checkpoints to ensure that all the required services are up and running before moving on to the next-higher level target. + +Unless otherwise changed at boot time in the GRUB menu, systemd always starts the **default.target**. The **default.target** file is a symbolic link to the true target file. For a desktop workstation, this is typically going to be the **graphical.target**, which is equivalent to runlevel 5 in SystemV. For a server, the default is more likely to be the **multi-user.target**, which is like runlevel 3 in SystemV. The **emergency.target** file is similar to single-user mode. Targets and services are systemd units. + +The following table, which I included in the previous article in this series, compares the systemd targets with the old SystemV startup runlevels. The systemd target aliases are provided by systemd for backward compatibility. The target aliases allow scripts—and sysadmins—to use SystemV commands like **init 3** to change runlevels. Of course, the SystemV commands are forwarded to systemd for interpretation and execution. + +**systemd targets** | **SystemV runlevel** | **target aliases** | **Description** +---|---|---|--- +default.target | | | This target is always aliased with a symbolic link to either **multi-user.target** or **graphical.target**. systemd always uses the **default.target** to start the system. The **default.target** should never be aliased to **halt.target**, **poweroff.target**, or **reboot.target**. +graphical.target | 5 | runlevel5.target | **Multi-user.target** with a GUI +| 4 | runlevel4.target | Unused. Runlevel 4 was identical to runlevel 3 in the SystemV world. This target could be created and customized to start local services without changing the default **multi-user.target**. +multi-user.target | 3 | runlevel3.target | All services running, but command-line interface (CLI) only +| 2 | runlevel2.target | Multi-user, without NFS, but all other non-GUI services running +rescue.target | 1 | runlevel1.target | A basic system, including mounting the filesystems with only the most basic services running and a rescue shell on the main console +emergency.target | S | | Single-user mode—no services are running; filesystems are not mounted. This is the most basic level of operation with only an emergency shell running on the main console for the user to interact with the system. +halt.target | | | Halts the system without powering it down +reboot.target | 6 | runlevel6.target | Reboot +poweroff.target | 0 | runlevel0.target | Halts the system and turns the power off + +Each target has a set of dependencies described in its configuration file. systemd starts the required dependencies, which are the services required to run the Linux host at a specific level of functionality. When all of the dependencies listed in the target configuration files are loaded and running, the system is running at that target level. If you want, you can review the systemd startup sequence and runtime targets in the first article in this series, [_Learning to love systemd_][2]. + +### Exploring the current target + +Many Linux distributions default to installing a GUI desktop interface so that the installed systems can be used as workstations. I always install from a Fedora Live boot USB drive with an Xfce or LXDE desktop. Even when I'm installing a server or other infrastructure type of host (such as the ones I use for routers and firewalls), I use one of these installations that installs a GUI desktop. + +I could install a server without a desktop (and that would be typical for data centers), but that does not meet my needs. It is not that I need the GUI desktop itself, but the LXDE installation includes many of the other tools I use that are not in a default server installation. This means less work for me after the initial installation. + +But just because I have a GUI desktop does not mean it makes sense to use it. I have a 16-port KVM that I can use to access the KVM interfaces of most of my Linux systems, but the vast majority of my interaction with them is via a remote SSH connection from my primary workstation. This way is more secure and uses fewer system resources to run **multi-user.target** compared to **graphical.target.** + +To begin, check the default target to verify that it is the **graphical.target**: + + +``` +[root@testvm1 ~]# systemctl get-default +graphical.target +[root@testvm1 ~]# +``` + +Now verify the currently running target. It should be the same as the default target. You can still use the old method, which displays the old SystemV runlevels. Note that the previous runlevel is on the left; it is **N** (which means None), indicating that the runlevel has not changed since the host was booted. The number 5 indicates the current target, as defined in the old SystemV terminology: + + +``` +[root@testvm1 ~]# runlevel +N 5 +[root@testvm1 ~]# +``` + +Note that the runlevel man page indicates that runlevels are obsolete and provides a conversion table. + +You can also use the systemd method. There is no one-line answer here, but it does provide the answer in systemd terms: + + +``` +[root@testvm1 ~]# systemctl list-units --type target +UNIT                   LOAD   ACTIVE SUB    DESCRIPTION                 +basic.target           loaded active active Basic System               +cryptsetup.target      loaded active active Local Encrypted Volumes     +getty.target           loaded active active Login Prompts               +graphical.target       loaded active active Graphical Interface         +local-fs-pre.target    loaded active active Local File Systems (Pre)   +local-fs.target        loaded active active Local File Systems         +multi-user.target      loaded active active Multi-User System           +network-online.target  loaded active active Network is Online           +network.target         loaded active active Network                     +nfs-client.target      loaded active active NFS client services         +nss-user-lookup.target loaded active active User and Group Name Lookups +paths.target           loaded active active Paths                       +remote-fs-pre.target   loaded active active Remote File Systems (Pre)   +remote-fs.target       loaded active active Remote File Systems         +rpc_pipefs.target      loaded active active rpc_pipefs.target           +slices.target          loaded active active Slices                     +sockets.target         loaded active active Sockets                     +sshd-keygen.target     loaded active active sshd-keygen.target         +swap.target            loaded active active Swap                       +sysinit.target         loaded active active System Initialization       +timers.target          loaded active active Timers                     + +LOAD   = Reflects whether the unit definition was properly loaded. +ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +SUB    = The low-level unit activation state, values depend on unit type. + +21 loaded units listed. Pass --all to see loaded but inactive units, too. +To show all installed unit files use 'systemctl list-unit-files'. +``` + +This shows all of the currently loaded and active targets. You can also see the **graphical.target** and the **multi-user.target**. The **multi-user.target** is required before the **graphical.target** can be loaded. In this example, the **graphical.target** is active. + +### Switching to a different target + +Making the switch to the **multi-user.target** is easy: + + +``` +`[root@testvm1 ~]# systemctl isolate multi-user.target` +``` + +The display should now change from the GUI desktop or login screen to a virtual console. Log in and list the currently active systemd units to verify that **graphical.target** is no longer running: + + +``` +`[root@testvm1 ~]# systemctl list-units --type target` +``` + +Be sure to use the **runlevel** command to verify that it shows both previous and current "runlevels": + + +``` +[root@testvm1 ~]# runlevel +5 3 +``` + +### Changing the default target + +Now, change the default target to the **multi-user.target** so that it will always boot into the **multi-user.target** for a console command-line interface rather than a GUI desktop interface. As the root user on your test host, change to the directory where the systemd configuration is maintained and do a quick listing: + + +``` +[root@testvm1 ~]# cd /etc/systemd/system/ ; ll +drwxr-xr-x. 2 root root 4096 Apr 25  2018  basic.target.wants +<snip> +lrwxrwxrwx. 1 root root   36 Aug 13 16:23  default.target -> /lib/systemd/system/graphical.target +lrwxrwxrwx. 1 root root   39 Apr 25  2018  display-manager.service -> /usr/lib/systemd/system/lightdm.service +drwxr-xr-x. 2 root root 4096 Apr 25  2018  getty.target.wants +drwxr-xr-x. 2 root root 4096 Aug 18 10:16  graphical.target.wants +drwxr-xr-x. 2 root root 4096 Apr 25  2018  local-fs.target.wants +drwxr-xr-x. 2 root root 4096 Oct 30 16:54  multi-user.target.wants +<snip> +[root@testvm1 system]# +``` + +I shortened this listing to highlight a few important things that will help explain how systemd manages the boot process. You should be able to see the entire list of directories and links on your virtual machine. + +The **default.target** entry is a symbolic link (symlink, soft link) to the directory **/lib/systemd/system/graphical.target**. List that directory to see what else is there: + + +``` +`[root@testvm1 system]# ll /lib/systemd/system/ | less` +``` + +You should see files, directories, and more links in this listing, but look specifically for **multi-user.target** and **graphical.target**. Now display the contents of **default.target**, which is a link to **/lib/systemd/system/graphical.target**: + + +``` +[root@testvm1 system]# cat default.target +#  SPDX-License-Identifier: LGPL-2.1+ +# +#  This file is part of systemd. +# +#  systemd is free software; you can redistribute it and/or modify it +#  under the terms of the GNU Lesser General Public License as published by +#  the Free Software Foundation; either version 2.1 of the License, or +#  (at your option) any later version. + +[Unit] +Description=Graphical Interface +Documentation=man:systemd.special(7) +Requires=multi-user.target +Wants=display-manager.service +Conflicts=rescue.service rescue.target +After=multi-user.target rescue.service rescue.target display-manager.service +AllowIsolate=yes +[root@testvm1 system]# +``` + +This link to the **graphical.target** file describes all of the prerequisites and requirements that the graphical user interface requires. I will explore at least some of these options in the next article in this series. + +To enable the host to boot to multi-user mode, you need to delete the existing link and create a new one that points to the correct target. Make the [PWD][5] **/etc/systemd/system**, if it is not already: + + +``` +[root@testvm1 system]# rm -f default.target +[root@testvm1 system]# ln -s /lib/systemd/system/multi-user.target default.target +``` + +List the **default.target** link to verify that it links to the correct file: + + +``` +[root@testvm1 system]# ll default.target +lrwxrwxrwx 1 root root 37 Nov 28 16:08 default.target -> /lib/systemd/system/multi-user.target +[root@testvm1 system]# +``` + +If your link does not look exactly like this, delete it and try again. List the content of the **default.target** link: + + +``` +[root@testvm1 system]# cat default.target +#  SPDX-License-Identifier: LGPL-2.1+ +# +#  This file is part of systemd. +# +#  systemd is free software; you can redistribute it and/or modify it +#  under the terms of the GNU Lesser General Public License as published by +#  the Free Software Foundation; either version 2.1 of the License, or +#  (at your option) any later version. + +[Unit] +Description=Multi-User System +Documentation=man:systemd.special(7) +Requires=basic.target +Conflicts=rescue.service rescue.target +After=basic.target rescue.service rescue.target +AllowIsolate=yes +[root@testvm1 system]# +``` + +The **default.target**—which is really a link to the **multi-user.target** at this point—now has different requirements in the **[Unit]** section. It does not require the graphical display manager. + +Reboot. Your virtual machine should boot to the console login for virtual console 1, which is identified on the display as tty1. Now that you know how to change the default target, change it back to the **graphical.target** using a command designed for the purpose. + +First, check the current default target: + + +``` +[root@testvm1 ~]# systemctl get-default +multi-user.target +[root@testvm1 ~]# systemctl set-default graphical.target +Removed /etc/systemd/system/default.target. +Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target. +[root@testvm1 ~]# +``` + +Enter the following command to go directly to the **graphical.target** and the display manager login page without having to reboot: + + +``` +`[root@testvm1 system]# systemctl isolate default.target` +``` + +I do not know why the term "isolate" was chosen for this sub-command by systemd's developers. My research indicates that it may refer to running the specified target but "isolating" and terminating all other targets that are not required to support the target. However, the effect is to switch targets from one run target to another—in this case, from the multi-user target to the graphical target. The command above is equivalent to the old init 5 command in SystemV start scripts and the init program. + +Log into the GUI desktop, and verify that it is working as it should. + +### Summing up + +This article explored the Linux systemd startup sequence and started to explore two important systemd tools, **systemctl** and **journalctl**. It also explained how to switch from one target to another and to change the default target. + +The next article in this series will create a new systemd unit and configure it to run during startup. It will also look at some of the configuration options that help determine where in the sequence a particular unit will start, for example, after networking is up and running. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][6] [to systemd][6]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][7] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][8]'s [description of systemd][9]. + * [Linux.com][10]'s "More systemd fun" offers more advanced systemd [information and tips][11]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][12] + * [systemd for Administrators, Part I][13] + * [systemd for Administrators, Part II][14] + * [systemd for Administrators, Part III][15] + * [systemd for Administrators, Part IV][16] + * [systemd for Administrators, Part V][17] + * [systemd for Administrators, Part VI][18] + * [systemd for Administrators, Part VII][19] + * [systemd for Administrators, Part VIII][20] + * [systemd for Administrators, Part IX][21] + * [systemd for Administrators, Part X][22] + * [systemd for Administrators, Part XI][23] + + + +Alison Chiaken, a Linux kernel and systems programmer at Mentor Graphics, offers a preview of her... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-startup + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/start_line.jpg?itok=9reaaW6m (People at the start line of a race) +[2]: https://opensource.com/article/20/4/systemd +[3]: http://www.gnu.org/software/grub/manual/grub +[4]: mailto:mockbuild@bkernel03.phx2.fedoraproject.org +[5]: https://en.wikipedia.org/wiki/Pwd +[6]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[7]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[8]: http://Freedesktop.org +[9]: http://www.freedesktop.org/wiki/Software/systemd +[10]: http://Linux.com +[11]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[12]: http://0pointer.de/blog/projects/systemd.html +[13]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[14]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[15]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[16]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[17]: http://0pointer.de/blog/projects/three-levels-of-off.html +[18]: http://0pointer.de/blog/projects/changing-roots +[19]: http://0pointer.de/blog/projects/blame-game.html +[20]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[21]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[22]: http://0pointer.de/blog/projects/instances.html +[23]: http://0pointer.de/blog/projects/inetd.html diff --git a/sources/tech/20200505 8 open source video games to play.md b/sources/tech/20200505 8 open source video games to play.md new file mode 100644 index 0000000000..ac0577d96b --- /dev/null +++ b/sources/tech/20200505 8 open source video games to play.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 open source video games to play) +[#]: via: (https://opensource.com/article/20/5/open-source-fps-games) +[#]: author: (Aman Gaur https://opensource.com/users/amangaur) + +8 open source video games to play +====== +These games are fun and free to play, a way to connect with friends, and +an opportunity to make an old favorite even better. +![Gaming on a grid with penguin pawns][1] + +Video games are a big business. That's great for the industry's longevity—not to mention for all the people working in programming and graphics. But it can take a lot of work, time, and money to keep up with all the latest gaming crazes. If you feel like playing a few quick rounds of a video game without investing in a new console or game franchise, then you'll be happy to know that there are plenty of open source combat games you can download, play, share, and even modify (if you're inclined to programming) for free. + +First-person shooters (FPS) are one of the most popular categories of video games. They are centered around the perspective of the protagonist (the player), and they often offer weapon-based advancement. As you get better at the game, you survive longer, you get better weapons, and you increase your power. FPS games have a distinct look and feel, which is reflected in the category's name: players see everything—their weapons and the game world—in first person, as if they're looking through their player character's eyes. + +If you want to give one a try, check out the following eight great open source FPS games. + +### Xonotic + +![Xonotic][2] + +[Xonotic][3] is a fast-paced, arena-based FPS game. It is a popular game in the open source world. One reason could be the fact that it has never been a mainstream game. It offers a variety of weapons and enemies that are thrown right at you mercilessly from the start. Demanding quick action and response, it is an experience that will keep you on the edge of your seats. The game is available under the GPLv3+ license. + +### Wolfenstein Enemy Territory + +![Wolfenstein Enemy Territory][4] + +Wolfenstein has been a major franchise in gaming for many years. If you are a fan of gore and glory, then you've probably already heard of this game (if not, you'll love it once you try it). [Wolfenstein Enemy Territory][5] is an early iteration of the popular World War II game. It became free to play in 2003, and its [source code][6] is provided under the GPLv3. To play, however, you must own the game data (or recreate it yourself) separately (which remains under its original EULA). + +### Doom + +![Doom][7] + +[Doom][8] is a wildly popular game that was also an early example of games on Linux—way back in 2004. There are many iterations of the game, many of which have been released as open source. The game is about acquiring a teleportation device that's been captured by demons, so the violence, while gory, is low on realism. The source code for the game was provided under the GPL, but many versions require that you own the game for the game assets. There are dozens of ports and adaptations, including [Freedoom][9] (with free assets), [Dhewm3][10], [RBDoom-3-BFG][11], and many more. Try a few and pick your favorite! + +### Smokin' Guns + +![Smokin' Guns][12] + +If you're a fan of the Old West and six-shooters, this FPS is for you. From cowboys to gunslingers and with a captivating background score, [Smokin' Guns][13] has it all. It's a semi-realistic simulation of the old spaghetti western. On your way through the game, you face multiple enemies and get multiple weapons, so there's always the promise of excitement and danger around the corner. The game is free and open source under the terms of the GPLv2. + +### Nexuiz + +![Nexuiz][14] + +[Nexuiz][15] (classic) is another great FPS that's free to play on multiple platforms. The game is based on the Quake engine and has been made open source under the GNU GPLv2. The game offers multiple modes, including online, LAN party, and bot training. The game features sophisticated weapons and fast action. It's brutal and exciting, with an objective: kill as many opponents as possible before they get you. + +Note that the open source version of Nexuiz is not the same as the version built on CryEngine3 that is sold on Steam. + +### .kkrieger + +![kkrieger][16] + +[.Kkrieger][17] was developed in 2004 by .theprodukkt, a German demogroup. The game was developed using an unreleased (at the time) engine known as Werkkzeug. This game might feel a little slow to many, but it still offers an intense experience. The approaching enemies are slow, but their sheer number makes it confusing to know which one to take down first. It's an onslaught, and you have to shoot through layers of enemies before you reach the final boss. It was released in a rather raw form on [GitHub][18] by its creators under a BSD license with some public domain components. + +### Warsow + +![Warsow][19] + +If you've ever played Borderlands 2, then imagine [Warsow][20] as an arena-style Borderlands. The game is built on a modernized Quake II engine, and its plot takes a simple approach: Kill as many opponents as possible. The team with the most number of kills wins. Despite its simplicity, it features amazing weaponry and lots of great trick moves, like circle jumping, bunny hopping, double jumping, ramp sliding, and so on. It makes for an engaging multiplayer session, and it's been recognized by multiple online leagues as a worthy game for their competitions. Get the source code from [GitHub][21] or install the game from your software repository. + +### World of Padman + +![World of Padman][22] + +[The World of Padman][23] may be the last game on this list, but it's one of the most unique. Designed by PadWorld Entertainment, World of Padman takes a different twist graphically and introduces you to quirky and whimsical characters in a colorful (albeit cartoonishly violent) world. It's based on the ioquake3 engine, and its unique style and uproarious gameplay have earned it a featured place in multiple gaming magazines. You can download the source code from [GitHub][24]. + +### Give one a shot + +A game that becomes open source can act as a template for something great, whether it's a wholly open source version of an old classic, a remix of a beloved game, or an entirely new platform built on an old reliable engine. + +Open source gaming is important for many reasons: it provides users with a fun diversion, a way to connect with friends, and an opportunity for programmers and designers to hack within an existing framework. If titles like Doom weren't made open source, a little bit of video game history would be lost. Instead, it endures and has the opportunity to grow even more. + +Try an open source game, and watch your six. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/open-source-fps-games + +作者:[Aman Gaur][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/amangaur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game_pawn_grid_linux.png?itok=4gERzRkg (Gaming on a grid with penguin pawns) +[2]: https://opensource.com/sites/default/files/uploads/xonotic.jpg (Xonotic) +[3]: https://www.xonotic.org/download/ +[4]: https://opensource.com/sites/default/files/uploads/wolfensteinenemyterritory.jpg (Wolfenstein Enemy Territory) +[5]: https://www.splashdamage.com/games/wolfenstein-enemy-territory/ +[6]: https://github.com/id-Software/Enemy-Territory +[7]: https://opensource.com/sites/default/files/uploads/doom.jpg (Doom) +[8]: https://github.com/id-Software/DOOM +[9]: https://freedoom.github.io/ +[10]: https://dhewm3.org/ +[11]: https://github.com/RobertBeckebans/RBDOOM-3-BFG/ +[12]: https://opensource.com/sites/default/files/uploads/smokinguns.jpg (Smokin' Guns) +[13]: https://www.smokin-guns.org/downloads +[14]: https://opensource.com/sites/default/files/uploads/nexuiz.jpg (Nexuiz) +[15]: https://sourceforge.net/projects/nexuiz/ +[16]: https://opensource.com/sites/default/files/uploads/kkrieger.jpg (kkrieger) +[17]: https://web.archive.org/web/20120204065621/http://www.theprodukkt.com/kkrieger +[18]: https://github.com/farbrausch/fr_public +[19]: https://opensource.com/sites/default/files/uploads/warsow.jpg (Warsow) +[20]: https://www.warsow.net/download +[21]: https://github.com/Warsow +[22]: https://opensource.com/sites/default/files/uploads/padman.jpg (World of Padman) +[23]: https://worldofpadman.net/en/ +[24]: https://github.com/PadWorld-Entertainment diff --git a/sources/tech/20200505 Analyzing data science code with R and Emacs.md b/sources/tech/20200505 Analyzing data science code with R and Emacs.md new file mode 100644 index 0000000000..ebcfadbe92 --- /dev/null +++ b/sources/tech/20200505 Analyzing data science code with R and Emacs.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Analyzing data science code with R and Emacs) +[#]: via: (https://opensource.com/article/20/5/r-emacs-data-science) +[#]: author: (Peter Prevos https://opensource.com/users/danderzei) + +Analyzing data science code with R and Emacs +====== +Emacs' versatility and extensibility bring the editor's full power into +play for writing data science code. +![metrics and data shown on a computer screen][1] + +Way back in 2012, _Harvard Business Review_ published an article that proclaimed "data scientist" to be the [sexiest job][2] of the 21st century. Interest in data science has exploded since then. Many great open source projects, such as [Python][3] and the [R language][4] for statistical computing, have facilitated the rapid developments in how we analyze data. + +I started my career using pencil and paper and moved to spreadsheets. Now the R language is my weapon of choice when I need to create value from data. Emacs is another one of my favorite tools. This article briefly explains how to use the [Emacs Speaks Statistics][5] (ESS) package to get started with developing R projects in this venerable editor. + +The vast majority of R developers use the [RStudio][6] IDE to manage their projects. RStudio is a powerful open source editor with specialized functionality to develop data science projects. RStudio is a great integrated development environment (IDE), but its editing functions are limited. + +Using Emacs to write data science code means that you have access to the full power of this extensible editor. I prefer using Emacs for my data science projects because I can do many other tasks within the same application, leveraging the multifunctionality of this venerable editor. If you are just getting started with Emacs, then please first read Seth Kenlon's [Emacs getting started][7] article. + +### Setting up Emacs for R + +Emacs is an almost infinitely extensible text editor, which unfortunately means that many things don't work the way you want them to out of the box. Before you can write and execute R scripts, you need to install some packages and configure them. The ESS package provides an interface between Emacs and R. Other packages, such as [Company][8] and [highlight-parentheses][9] help with completion and balancing parentheses. + +Emacs uses a version of Lisp for configuration. The lines of [Emacs Lisp][10] code below install the required extensions and define a minimal configuration to get you started. These lines were tested for GNU Emacs version 26.3. + +Copy these lines and save them in a file named **init.el** in your **.emacs.d** folder. This is the folder that Emacs uses to store configurations, including the [init file][11]. If you already have an init file, then you can append these lines to your config. This minimal configuration is enough to get you started. + + +``` +;; Elisp file for R coding with Emacs + +;; Add MELPA repository and initialise the package manager +(require 'package) +(add-to-list 'package-archives +             '("melpa" . "")) +(package-initialize) + +;; Install use-package,in case it does not exist yet +;; The use-package software will install all other packages as required +(unless (package-installed-p 'use-package) +  (package-refresh-contents) +  (package-install 'use-package)) + +;; ESS configurationEmacs Speaks Statistics +(use-package ess +  :ensure t +) + +;; Auto completion +(use-package company +  :ensure t +  :config +  (setq company-idle-delay 0) +  (setq company-minimum-prefix-length 2) +  (global-company-mode t) +) + +; Parentheses +(use-package highlight-parentheses +  :ensure t +  :config +  (progn +    (highlight-parentheses-mode) +    (global-highlight-parentheses-mode)) +  ) +``` + +### Using the R console + +To start an R console session, press **M-x R** and hit **Enter** (**M** is the Emacs way to denote the **Alt** or **Command** key). ESS will ask you to nominate a working directory, which defaults to the folder of the current buffer. You can use more than one console in the same Emacs session by repeating the R command. + +Emacs opens a new buffer for your new R console. You can also use the **Up** and **Down** arrow keys to go to previous lines and re-run them. Use the **Ctrl** and **Up/Down** arrow keys to recycle old commands. + +The Company ("complete anything") package manages autocompletion in both the console and R scripts. When entering a function, the mini-buffer at the bottom of the screen shows the relevant parameters. When the autocompletion dropdown menu appears, you can press **F1** to view the chosen option's Help file before you select it. + +The [highlight-parentheses][9] package does what its name suggests. Several other Emacs packages are available to help you balance parentheses and other structural elements in your code. + +### Writing R scripts + +Emacs recognizes R mode for any buffer with a **.R** extension (the file extension is case-sensitive). Open or create a new file with the **C-x C-f** shortcut and type the path and file name. You can start writing your code and use all of the powerful editing techniques that Emacs provides. + +Several functions are available to evaluate the code. You can evaluate each line separately with **C-<return>**, while **C-c C-c** will evaluate a contiguous region. Keying **C-c C-b** will evaluate the whole buffer. + +When you evaluate some code, Emacs will use any running console or ask you to open a new console to run the code. + +The output of any plotting functions appears in a window outside of Emacs. If you prefer to view the output within Emacs, then you need to save the output to disk and open the resulting file in a separate buffer. + +![Literate programming in Org mode, the ESS buffer, and graphics output.][12] + +Literate programming in Org mode, the ESS buffer, and graphics output. + +### Advanced use + +This article provides a brief introduction to using R in Emacs. Many parameters can be fine-tuned to make Emacs behave according to your preferences, but it would take too much space to cover them here. The [ESS manual][13] describes these in detail. You can also extend functionality with additional packages. + +Org mode can integrate R code, providing a productive platform for literate programming. If you prefer to use RMarkdown, the [Polymode][14] package has you covered. + +Emacs has various packages to make your editing experience more efficient. The best part of using Emacs to write R code is that the program is more than just an IDE; it is a malleable computer system that you can configure to match your favorite workflow. + +Learning how to configure Emacs can be daunting. The best way to learn quickly is to copy ideas from people who share their configurations. Miles McBain manages a [list of Emacs configurations][15] that could be useful if you want to explore using the R language in Emacs further. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/r-emacs-data-science + +作者:[Peter Prevos][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/danderzei +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://hbr.org/2012/10/data-scientist-the-sexiest-job-of-the-21st-century +[3]: https://www.python.org/ +[4]: https://www.r-project.org/ +[5]: https://ess.r-project.org/ +[6]: https://opensource.com/article/18/2/getting-started-RStudio-IDE +[7]: https://opensource.com/article/20/3/getting-started-emacs +[8]: https://company-mode.github.io/ +[9]: https://github.com/tsdh/highlight-parentheses.el +[10]: https://en.wikipedia.org/wiki/Emacs_Lisp +[11]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html +[12]: https://opensource.com/sites/default/files/uploads/r-ess-screenshot.jpg (Literate programming in Org mode, the ESS buffer, and graphics output.) +[13]: https://ess.r-project.org/index.php?Section=documentation&subSection=manuals +[14]: https://github.com/polymode/polymode +[15]: https://github.com/MilesMcBain/esscss diff --git a/sources/tech/20200507 Using the systemctl command to manage systemd units.md b/sources/tech/20200507 Using the systemctl command to manage systemd units.md new file mode 100644 index 0000000000..e305cee36c --- /dev/null +++ b/sources/tech/20200507 Using the systemctl command to manage systemd units.md @@ -0,0 +1,618 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the systemctl command to manage systemd units) +[#]: via: (https://opensource.com/article/20/5/systemd-units) +[#]: author: (David Both https://opensource.com/users/dboth) + +Using the systemctl command to manage systemd units +====== +Units are the basis of everything in systemd. +![woman on laptop sitting at the window][1] + +In the first two articles in this series, I explored the Linux systemd startup sequence. In the [first article][2], I looked at systemd's functions and architecture and the controversy around its role as a replacement for the old SystemV init program and startup scripts. And in the [second article][3], I examined two important systemd tools, systemctl and journalctl, and explained how to switch from one target to another and to change the default target. + +In this third article, I'll look at systemd units in more detail and how to use the systemctl command to explore and manage units. I'll also explain how to stop and disable units and how to create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup. + +### Preparation + +All of the experiments in this article should be done as the root user (unless otherwise specified). Some of the commands that simply list various systemd units can be performed by non-root users, but the commands that make changes cannot. Make sure to do all of these experiments only on non-production hosts or virtual machines (VMs). + +One of these experiments requires the sysstat package, so install it before you move on. For Fedora and other Red Hat-based distributions you can install sysstat with: + + +``` +`dnf -y install sysstat` +``` + +The sysstat RPM installs several statistical tools that can be used for problem determination. One is [System Activity Report][4] (SAR), which records many system performance data points at regular intervals (every 10 minutes by default). Rather than run as a daemon in the background, the sysstat package installs two systemd timers. One timer runs every 10 minutes to collect data, and the other runs once a day to aggregate the daily data. In this article, I will look briefly at these timers but wait to explain how to create a timer in a future article. + +### systemd suite + +The fact is, systemd is more than just one program. It is a large suite of programs all designed to work together to manage nearly every aspect of a running Linux system. A full exposition of systemd would take a book on its own. Most of us do not need to understand all of the details about how all of systemd's components fit together, so I will focus on the programs and components that enable you to manage various Linux services and deal with log files and journals. + +### Practical structure + +The structure of systemd—outside of its executable files—is contained in its many configuration files. Although these files have different names and identifier extensions, they are all called "unit" files. Units are the basis of everything systemd. + +Unit files are ASCII plain-text files that are accessible to and can be created or modified by a sysadmin. There are a number of unit file types, and each has its own man page. Figure 1 lists some of these unit file types by their filename extensions and a short description of each. + +systemd unit | Description +---|--- +.automount | The **.automount** units are used to implement on-demand (i.e., plug and play) and mounting of filesystem units in parallel during startup. +.device | The **.device** unit files define hardware and virtual devices that are exposed to the sysadmin in the **/dev/directory**. Not all devices have unit files; typically, block devices such as hard drives, network devices, and some others have unit files. +.mount | The **.mount** unit defines a mount point on the Linux filesystem directory structure. +.scope | The **.scope** unit defines and manages a set of system processes. This unit is not configured using unit files, rather it is created programmatically. Per the **systemd.scope** man page, “The main purpose of scope units is grouping worker processes of a system service for organization and for managing resources.” +.service | The **.service** unit files define processes that are managed by systemd. These include services such as crond cups (Common Unix Printing System), iptables, multiple logical volume management (LVM) services, NetworkManager, and more. +.slice | The **.slice** unit defines a “slice,” which is a conceptual division of system resources that are related to a group of processes. You can think of all system resources as a pie and this subset of resources as a “slice” out of that pie. +.socket | The **.socket** units define interprocess communication sockets, such as network sockets. +.swap | The **.swap** units define swap devices or files. +.target | The **.target** units define groups of unit files that define startup synchronization points, runlevels, and services. Target units define the services and other units that must be active in order to start successfully. +.timer | The **.timer** unit defines timers that can initiate program execution at specified times. + +### systemctl + +I looked at systemd's startup functions in the [second article][3], and here I'll explore its service management functions a bit further. systemd provides the **systemctl** command that is used to start and stop services, configure them to launch (or not) at system startup, and monitor the current status of running services. + +In a terminal session as the root user, ensure that root's home directory ( **~** ) is the [PWD][5]. To begin looking at units in various ways, list all of the loaded and active systemd units. systemctl automatically pipes its [stdout][6] data stream through the **less** pager, so you don't have to: + + +``` +[root@testvm1 ~]# systemctl +UNIT                                       LOAD   ACTIVE SUB       DESCRIPTION               +proc-sys-fs-binfmt_misc.automount          loaded active running   Arbitrary Executable File> +sys-devices-pci0000:00-0000:00:01.1-ata7-host6-target6:0:0-6:0:0:0-block-sr0.device loaded a> +sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device loaded active plugged   82540EM Gigabi> +sys-devices-pci0000:00-0000:00:05.0-sound-card0.device loaded active plugged   82801AA AC'97> +sys-devices-pci0000:00-0000:00:08.0-net-enp0s8.device loaded active plugged   82540EM Gigabi> +sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loa> +sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loa> +<snip – removed lots of lines of data from here> + +LOAD   = Reflects whether the unit definition was properly loaded. +ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +SUB    = The low-level unit activation state, values depend on unit type. + +206 loaded units listed. Pass --all to see loaded but inactive units, too. +To show all installed unit files use 'systemctl list-unit-files'. +``` + +As you scroll through the data in your terminal session, look for some specific things. The first section lists devices such as hard drives, sound cards, network interface cards, and TTY devices. Another section shows the filesystem mount points. Other sections include various services and a list of all loaded and active targets. + +The sysstat timers at the bottom of the output are used to collect and generate daily system activity summaries for SAR. SAR is a very useful problem-solving tool. (You can learn more about it in Chapter 13 of my book [_Using and Administering Linux: Volume 1, Zero to SysAdmin: Getting Started_][7].) + +Near the very bottom, three lines describe the meanings of the statuses (loaded, active, and sub). Press **q** to exit the pager. + +Use the following command (as suggested in the last line of the output above) to see all the units that are installed, whether or not they are loaded. I won't reproduce the output here, because you can scroll through it on your own. The systemctl program has an excellent tab-completion facility that makes it easy to enter complex commands without needing to memorize all the options: + + +``` +`[root@testvm1 ~]# systemctl list-unit-files` +``` + +You can see that some units are disabled. Table 1 in the man page for systemctl lists and provides short descriptions of the entries you might see in this listing. Use the **-t** (type) option to view just the timer units: + + +``` +[root@testvm1 ~]# systemctl list-unit-files -t timer +UNIT FILE                    STATE   +[chrony-dnssrv@.timer][8]         disabled +dnf-makecache.timer          enabled +fstrim.timer                 disabled +logrotate.timer              disabled +logwatch.timer               disabled +[mdadm-last-resort@.timer][9]     static   +mlocate-updatedb.timer       enabled +sysstat-collect.timer        enabled +sysstat-summary.timer        enabled +systemd-tmpfiles-clean.timer static   +unbound-anchor.timer         enabled +``` + +You could do the same thing with this alternative, which provides considerably more detail: + + +``` +[root@testvm1 ~]# systemctl list-timers +Thu 2020-04-16 09:06:20 EDT  3min 59s left n/a                          n/a           systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service +Thu 2020-04-16 10:02:01 EDT  59min left    Thu 2020-04-16 09:01:32 EDT  49s ago       dnf-makecache.timer          dnf-makecache.service +Thu 2020-04-16 13:00:00 EDT  3h 57min left n/a                          n/a           sysstat-collect.timer        sysstat-collect.service +Fri 2020-04-17 00:00:00 EDT  14h left      Thu 2020-04-16 12:51:37 EDT  3h 49min left mlocate-updatedb.timer       mlocate-updatedb.service +Fri 2020-04-17 00:00:00 EDT  14h left      Thu 2020-04-16 12:51:37 EDT  3h 49min left unbound-anchor.timer         unbound-anchor.service +Fri 2020-04-17 00:07:00 EDT  15h left      n/a                          n/a           sysstat-summary.timer        sysstat-summary.service + +6 timers listed. +Pass --all to see loaded but inactive timers, too. +[root@testvm1 ~]# +``` + +Although there is no option to do systemctl list-mounts, you can list the mount point unit files: + + +``` +[root@testvm1 ~]# systemctl list-unit-files -t mount +UNIT FILE                     STATE     +-.mount                       generated +boot.mount                    generated +dev-hugepages.mount           static   +dev-mqueue.mount              static   +home.mount                    generated +proc-fs-nfsd.mount            static   +proc-sys-fs-binfmt_misc.mount disabled +run-vmblock\x2dfuse.mount     disabled +sys-fs-fuse-connections.mount static   +sys-kernel-config.mount       static   +sys-kernel-debug.mount        static   +tmp.mount                     generated +usr.mount                     generated +var-lib-nfs-rpc_pipefs.mount  static   +var.mount                     generated + +15 unit files listed. +[root@testvm1 ~]# +``` + +The STATE column in this data stream is interesting and requires a bit of explanation. The "generated" states indicate that the mount unit was generated on the fly during startup using the information in **/etc/fstab**. The program that generates these mount units is **/lib/systemd/system-generators/systemd-fstab-generator,** along with other tools that generate a number of other unit types. The "static" mount units are for filesystems like **/proc** and **/sys**, and the files for these are located in the **/usr/lib/systemd/system** directory. + +Now, look at the service units. This command will show all services installed on the host, whether or not they are active: + + +``` +`[root@testvm1 ~]# systemctl --all -t service` +``` + +The bottom of this listing of service units displays 166 as the total number of loaded units on my host. Your number will probably differ. + +Unit files do not have a filename extension (such as **.unit**) to help identify them, so you can generalize that most configuration files that belong to systemd are unit files of one type or another. The few remaining files are mostly **.conf** files located in **/etc/systemd**. + +Unit files are stored in the **/usr/lib/systemd** directory and its subdirectories, while the **/etc/systemd/** directory and its subdirectories contain symbolic links to the unit files necessary to the local configuration of this host. + +To explore this, make **/etc/systemd** the PWD and list its contents. Then make **/etc/systemd/system** the PWD and list its contents, and list the contents of at least a couple of the current PWD's subdirectories. + +Take a look at the **default.target** file, which determines which runlevel target the system will boot to. In the second article in this series, I explained how to change the default target from the GUI (**graphical.target**) to the command-line only (**multi-user.target**) target. The **default.target** file on my test VM is simply a symlink to **/usr/lib/systemd/system/graphical.target**. + +Take a few minutes to examine the contents of the **/etc/systemd/system/default.target** file: + + +``` +[root@testvm1 system]# cat default.target +#  SPDX-License-Identifier: LGPL-2.1+ +# +#  This file is part of systemd. +# +#  systemd is free software; you can redistribute it and/or modify it +#  under the terms of the GNU Lesser General Public License as published by +#  the Free Software Foundation; either version 2.1 of the License, or +#  (at your option) any later version. + +[Unit] +Description=Graphical Interface +Documentation=man:systemd.special(7) +Requires=multi-user.target +Wants=display-manager.service +Conflicts=rescue.service rescue.target +After=multi-user.target rescue.service rescue.target display-manager.service +AllowIsolate=yes +``` + +Note that this requires the **multi-user.target**; the **graphical.target** cannot start if the **multi-user.target** is not already up and running. It also says it "wants" the **display-manager.service** unit. A "want" does not need to be fulfilled in order for the unit to start successfully. If the "want" cannot be fulfilled, it will be ignored by systemd, and the rest of the target will start regardless. + +The subdirectories in **/etc/systemd/system** are lists of wants for various targets. Take a few minutes to explore the files and their contents in the **/etc/systemd/system/graphical.target.wants** directory. + +The **systemd.unit** man page contains a lot of good information about unit files, their structure, the sections they can be divided into, and the options that can be used. It also lists many of the unit types, all of which have their own man pages. If you want to interpret a unit file, this would be a good place to start. + +### Service units + +A Fedora installation usually installs and enables services that particular hosts do not need for normal operation. Conversely, sometimes it doesn't include services that need to be installed, enabled, and started. Services that are not needed for the Linux host to function as desired, but which are installed and possibly running, represent a security risk and should—at minimum—be stopped and disabled and—at best—should be uninstalled. + +The systemctl command is used to manage systemd units, including services, targets, mounts, and more. Take a closer look at the list of services to identify services that will never be used: + + +``` +[root@testvm1 ~]# systemctl --all -t service +UNIT                           LOAD      ACTIVE SUB        DESCRIPTION                             +<snip> +chronyd.service                loaded    active running    NTP client/server                       +crond.service                  loaded    active running    Command Scheduler                       +cups.service                   loaded    active running    CUPS Scheduler                           +dbus-daemon.service            loaded    active running    D-Bus System Message Bus                 +<snip> +● ip6tables.service           not-found inactive dead     ip6tables.service                   +● ipset.service               not-found inactive dead     ipset.service                       +● iptables.service            not-found inactive dead     iptables.service                     +<snip> +firewalld.service              loaded    active   running  firewalld - dynamic firewall daemon +<snip> +● ntpd.service                not-found inactive dead     ntpd.service                         +● ntpdate.service             not-found inactive dead     ntpdate.service                     +pcscd.service                  loaded    active   running  PC/SC Smart Card Daemon +``` + +I have pruned out most of the output from the command to save space. The services that show "loaded active running" are obvious. The "not-found" services are ones that systemd is aware of but are not installed on the Linux host. If you want to run those services, you must install the packages that contain them. + +Note the **pcscd.service** unit. This is the PC/SC smart-card daemon. Its function is to communicate with smart-card readers. Many Linux hosts—including VMs—have no need for this reader nor the service that is loaded and taking up memory and CPU resources. You can stop this service and disable it, so it will not restart on the next boot. First, check its status: + + +``` +[root@testvm1 ~]# systemctl status pcscd.service +● pcscd.service - PC/SC Smart Card Daemon +   Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled) +   Active: active (running) since Fri 2019-05-10 11:28:42 EDT; 3 days ago +     Docs: man:pcscd(8) + Main PID: 24706 (pcscd) +    Tasks: 6 (limit: 4694) +   Memory: 1.6M +   CGroup: /system.slice/pcscd.service +           └─24706 /usr/sbin/pcscd --foreground --auto-exit + +May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon. +``` + +This data illustrates the additional information systemd provides versus SystemV, which only reports whether or not the service is running. Note that specifying the **.service** unit type is optional. Now stop and disable the service, then re-check its status: + + +``` +[root@testvm1 ~]# systemctl stop pcscd ; systemctl disable pcscd +Warning: Stopping pcscd.service, but it can still be activated by: +  pcscd.socket +Removed /etc/systemd/system/sockets.target.wants/pcscd.socket. +[root@testvm1 ~]# systemctl status pcscd +● pcscd.service - PC/SC Smart Card Daemon +   Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled) +   Active: failed (Result: exit-code) since Mon 2019-05-13 15:23:15 EDT; 48s ago +     Docs: man:pcscd(8) + Main PID: 24706 (code=exited, status=1/FAILURE) + +May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon. +May 13 15:23:15 testvm1 systemd[1]: Stopping PC/SC Smart Card Daemon... +May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Main process exited, code=exited, status=1/FAIL> +May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Failed with result 'exit-code'. +May 13 15:23:15 testvm1 systemd[1]: Stopped PC/SC Smart Card Daemon. +``` + +The short log entry display for most services prevents having to search through various log files to locate this type of information. Check the status of the system runlevel targets—specifying the "target" unit type is required: + + +``` +[root@testvm1 ~]# systemctl status multi-user.target +● multi-user.target - Multi-User System +   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Multi-User System. +[root@testvm1 ~]# systemctl status graphical.target +● graphical.target - Graphical Interface +   Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface. +[root@testvm1 ~]# systemctl status default.target +● graphical.target - Graphical Interface +   Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface. +``` + +The default target is the graphical target. The status of any unit can be checked in this way. + +### Mounts the old way + +A mount unit defines all of the parameters required to mount a filesystem on a designated mount point. systemd can manage mount units with more flexibility than those using the **/etc/fstab** filesystem configuration file. Despite this, systemd still uses the **/etc/fstab** file for filesystem configuration and mounting purposes. systemd uses the **systemd-fstab-generator** tool to create transient mount units from the data in the **fstab** file. + +I will create a new filesystem and a systemd mount unit to mount it. If you have some available disk space on your test system, you can do it along with me. + +_Note that the volume group and logical volume names may be different on your test system. Be sure to use the names that are pertinent to your system._ + +You will need to create a partition or logical volume, then make an EXT4 filesystem on it. Add a label to the filesystem, **TestFS**, and create a directory for a mount point **/TestFS**. + +To try this on your own, first, verify that you have free space on the volume group. Here is what that looks like on my VM where I have some space available on the volume group to create a new logical volume: + + +``` +[root@testvm1 ~]# lsblk +NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +sda             8:0    0  120G  0 disk +├─sda1          8:1    0    4G  0 part /boot +└─sda2          8:2    0  116G  0 part +  ├─VG01-root 253:0    0    5G  0 lvm  / +  ├─VG01-swap 253:1    0    8G  0 lvm  [SWAP] +  ├─VG01-usr  253:2    0   30G  0 lvm  /usr +  ├─VG01-home 253:3    0   20G  0 lvm  /home +  ├─VG01-var  253:4    0   20G  0 lvm  /var +  └─VG01-tmp  253:5    0   10G  0 lvm  /tmp +sr0            11:0    1 1024M  0 rom   +[root@testvm1 ~]# vgs +  VG   #PV #LV #SN Attr   VSize    VFree   +  VG01   1   6   0 wz--n- <116.00g <23.00g +``` + +Then create a new volume on **VG01** named **TestFS**. It does not need to be large; 1GB is fine. Then create a filesystem, add the filesystem label, and create the mount point: + + +``` +[root@testvm1 ~]# lvcreate -L 1G -n TestFS VG01 +  Logical volume "TestFS" created. +[root@testvm1 ~]# mkfs -t ext4 /dev/mapper/VG01-TestFS +mke2fs 1.45.3 (14-Jul-2019) +Creating filesystem with 262144 4k blocks and 65536 inodes +Filesystem UUID: 8718fba9-419f-4915-ab2d-8edf811b5d23 +Superblock backups stored on blocks: +        32768, 98304, 163840, 229376 + +Allocating group tables: done                             +Writing inode tables: done                             +Creating journal (8192 blocks): done +Writing superblocks and filesystem accounting information: done + +[root@testvm1 ~]# e2label /dev/mapper/VG01-TestFS TestFS +[root@testvm1 ~]# mkdir /TestFS +``` + +Now, mount the new filesystem: + + +``` +[root@testvm1 ~]# mount /TestFS/ +mount: /TestFS/: can't find in /etc/fstab. +``` + +This will not work because you do not have an entry in **/etc/fstab**. You can mount the new filesystem even without the entry in **/etc/fstab** using both the device name (as it appears in **/dev**) and the mount point. Mounting in this manner is simpler than it used to be—it used to require the filesystem type as an argument. The mount command is now smart enough to detect the filesystem type and mount it accordingly. + +Try it again: + + +``` +[root@testvm1 ~]# mount /dev/mapper/VG01-TestFS /TestFS/ +[root@testvm1 ~]# lsblk +NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +sda               8:0    0  120G  0 disk +├─sda1            8:1    0    4G  0 part /boot +└─sda2            8:2    0  116G  0 part +  ├─VG01-root   253:0    0    5G  0 lvm  / +  ├─VG01-swap   253:1    0    8G  0 lvm  [SWAP] +  ├─VG01-usr    253:2    0   30G  0 lvm  /usr +  ├─VG01-home   253:3    0   20G  0 lvm  /home +  ├─VG01-var    253:4    0   20G  0 lvm  /var +  ├─VG01-tmp    253:5    0   10G  0 lvm  /tmp +  └─VG01-TestFS 253:6    0    1G  0 lvm  /TestFS +sr0              11:0    1 1024M  0 rom   +[root@testvm1 ~]# +``` + +Now the new filesystem is mounted in the proper location. List the mount unit files: + + +``` +`[root@testvm1 ~]# systemctl list-unit-files -t mount` +``` + +This command does not show a file for the **/TestFS** filesystem because no file exists for it. The command **systemctl status TestFS.mount** does not display any information about the new filesystem either. You can try it using wildcards with the **systemctl status** command: + + +``` +[root@testvm1 ~]# systemctl status *mount +● usr.mount - /usr +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) +    Where: /usr +     What: /dev/mapper/VG01-usr +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) + +<SNIP> +● TestFS.mount - /TestFS +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Fri 2020-04-17 16:02:26 EDT; 1min 18s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS + +● run-user-0.mount - /run/user/0 +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Thu 2020-04-16 08:52:29 EDT; 1 day 5h ago +    Where: /run/user/0 +     What: tmpfs + +● var.mount - /var +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) since Thu 2020-04-16 12:51:34 EDT; 1 day 1h ago +    Where: /var +     What: /dev/mapper/VG01-var +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) +    Tasks: 0 (limit: 19166) +   Memory: 212.0K +      CPU: 5ms +   CGroup: /system.slice/var.mount +``` + +This command provides some very interesting information about your system's mounts, and your new filesystem shows up. The **/var** and **/usr** filesystems are identified as being generated from **/etc/fstab**, while your new filesystem simply shows that it is loaded and provides the location of the info file in the **/proc/self/mountinfo** file. + +Next, automate this mount. First, do it the old-fashioned way by adding an entry in **/etc/fstab**. Later, I'll show you how to do it the new way, which will teach you about creating units and integrating them into the startup sequence. + +Unmount **/TestFS** and add the following line to the **/etc/fstab** file: + + +``` +`/dev/mapper/VG01-TestFS  /TestFS       ext4    defaults        1 2` +``` + +Now, mount the filesystem with the simpler **mount** command and list the mount units again: + + +``` +[root@testvm1 ~]# mount /TestFS +[root@testvm1 ~]# systemctl status *mount +<SNIP> +● TestFS.mount - /TestFS +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Fri 2020-04-17 16:26:44 EDT; 1min 14s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +<SNIP> +``` + +This did not change the information for this mount because the filesystem was manually mounted. Reboot and run the command again, and this time specify **TestFS.mount** rather than using the wildcard. The results for this mount are now consistent with it being mounted at startup: + + +``` +[root@testvm1 ~]# systemctl status TestFS.mount +● TestFS.mount - /TestFS +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) since Fri 2020-04-17 16:30:21 EDT; 1min 38s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) +    Tasks: 0 (limit: 19166) +   Memory: 72.0K +      CPU: 6ms +   CGroup: /system.slice/TestFS.mount + +Apr 17 16:30:21 testvm1 systemd[1]: Mounting /TestFS... +Apr 17 16:30:21 testvm1 systemd[1]: Mounted /TestFS. +``` + +### Creating a mount unit + +Mount units may be configured either with the traditional **/etc/fstab** file or with systemd units. Fedora uses the **fstab** file as it is created during the installation. However, systemd uses the **systemd-fstab-generator** program to translate the **fstab** file into systemd units for each entry in the **fstab** file. Now that you know you can use systemd **.mount** unit files for filesystem mounting, try it out by creating a mount unit for this filesystem. + +First, unmount **/TestFS**. Edit the **/etc/fstab** file and delete or comment out the **TestFS** line. Now, create a new file with the name **TestFS.mount** in the **/etc/systemd/system** directory. Edit it to contain the configuration data below. The unit file name and the name of the mount point _must_ be identical, or the mount will fail: + + +``` +# This mount unit is for the TestFS filesystem +# By David Both +# Licensed under GPL V2 +# This file should be located in the /etc/systemd/system directory + +[Unit] +Description=TestFS Mount + +[Mount] +What=/dev/mapper/VG01-TestFS +Where=/TestFS +Type=ext4 +Options=defaults + +[Install] +WantedBy=multi-user.target +``` + +The **Description** line in the **[Unit]** section is for us humans, and it provides the name that's shown when you list mount units with **systemctl -t mount**. The data in the **[Mount]** section of this file contains essentially the same data that would be found in the **fstab** file. + +Now enable the mount unit: + + +``` +[root@testvm1 etc]# systemctl enable TestFS.mount +Created symlink /etc/systemd/system/multi-user.target.wants/TestFS.mount → /etc/systemd/system/TestFS.mount. +``` + +This creates the symlink in the **/etc/systemd/system** directory, which will cause this mount unit to be mounted on all subsequent boots. The filesystem has not yet been mounted, so you must "start" it: + + +``` +`[root@testvm1 ~]# systemctl start TestFS.mount` +``` + +Verify that the filesystem has been mounted: + + +``` +[root@testvm1 ~]# systemctl status TestFS.mount +● TestFS.mount - TestFS Mount +   Loaded: loaded (/etc/systemd/system/TestFS.mount; enabled; vendor preset: disabled) +   Active: active (mounted) since Sat 2020-04-18 09:59:53 EDT; 14s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +    Tasks: 0 (limit: 19166) +   Memory: 76.0K +      CPU: 3ms +   CGroup: /system.slice/TestFS.mount + +Apr 18 09:59:53 testvm1 systemd[1]: Mounting TestFS Mount... +Apr 18 09:59:53 testvm1 systemd[1]: Mounted TestFS Mount. +``` + +This experiment has been specifically about creating a unit file for a mount, but it can be applied to other types of unit files as well. The details will be different, but the concepts are the same. Yes, I know it is still easier to add a line to the **/etc/fstab** file than it is to create a mount unit. But this is a good example of how to create a unit file because systemd does not have generators for every type of unit. + +### In summary + +This article looked at systemd units in more detail and how to use the systemctl command to explore and manage units. It also showed how to stop and disable units and create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup. + +In the next article in this series, I will take you through a recent problem I had during startup and show you how I circumvented it using systemd. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][10] [to systemd][10]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][11] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][12]'s [description of systemd][13]. + * [Linux.com][14]'s "More systemd fun" offers more advanced systemd [information and tips][15]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][16] + * [systemd for Administrators, Part I][17] + * [systemd for Administrators, Part II][18] + * [systemd for Administrators, Part III][19] + * [systemd for Administrators, Part IV][20] + * [systemd for Administrators, Part V][21] + * [systemd for Administrators, Part VI][22] + * [systemd for Administrators, Part VII][23] + * [systemd for Administrators, Part VIII][24] + * [systemd for Administrators, Part IX][25] + * [systemd for Administrators, Part X][26] + * [systemd for Administrators, Part XI][27] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-units + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/article/20/4/systemd +[3]: https://opensource.com/article/20/4/systemd-startup +[4]: https://en.wikipedia.org/wiki/Sar_%28Unix%29 +[5]: https://en.wikipedia.org/wiki/Pwd +[6]: https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout) +[7]: http://www.both.org/?page_id=1183 +[8]: mailto:chrony-dnssrv@.timer +[9]: mailto:mdadm-last-resort@.timer +[10]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[11]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[12]: http://Freedesktop.org +[13]: http://www.freedesktop.org/wiki/Software/systemd +[14]: http://Linux.com +[15]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[16]: http://0pointer.de/blog/projects/systemd.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[18]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[19]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[20]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[21]: http://0pointer.de/blog/projects/three-levels-of-off.html +[22]: http://0pointer.de/blog/projects/changing-roots +[23]: http://0pointer.de/blog/projects/blame-game.html +[24]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[25]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[26]: http://0pointer.de/blog/projects/instances.html +[27]: http://0pointer.de/blog/projects/inetd.html diff --git a/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md b/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md new file mode 100644 index 0000000000..ea3aa01866 --- /dev/null +++ b/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A guide to setting up your Open Source Program Office (OSPO) for success) +[#]: via: (https://opensource.com/article/20/5/open-source-program-office) +[#]: author: (J. Manrique Lopez de la Fuente https://opensource.com/users/jsmanrique) + +A guide to setting up your Open Source Program Office (OSPO) for success +====== +Learn how to best grow and maintain your open source communities and +allies. +![community team brainstorming ideas][1] + +Companies create Open Source Program Offices (OSPO) to manage their relationship with the open source ecosystems they depend on. By understanding the company's open source ecosystem, an OSPO is able to maximize the company's return on investment and reduce the risks of consuming, contributing to, and releasing open source software. Additionally, since the company depends on its open source ecosystem, ensuring its health and sustainability shall ensure the company's health, sustainable growth, and evolution. + +### How has OSPO become vital to companies and their open source ecosystem? + +Marc Andreessen has said that "software is eating the world," and more recently, it could be said that open source is eating the software world. But how is that process happening? + +Companies get involved with open source projects in several ways. These projects comprise the company's open source ecosystem, and their relationships and interactions can be seen through Open Source Software's (OSS) inbound and outbound processes. + +From the OSS inbound point of view, companies use it to build their own solutions and their own infrastructure. OSS gets introduced because it's part of the code their technology providers use, or because their own developers add open source components to the company's information technology (IT) infrastructure. + +From the OSS outbound point of view, some companies contribute to OSS projects. That contribution could be part of the company's requirements for their solutions that need certain fixes in upstream projects. For example, Samsung contributes to certain graphics-related projects to ensure its hardware has software support once it gets into the market. In some other cases, contributing to OSS is a mechanism to retain talent by allowing the people to contribute to projects different from their daily work. + +Some companies release their own open source projects as an outbound OSS process. For companies like Red Hat or GitLab, it would be expected. But, there are increasingly more non-software companies releasing a lot of OSS, like Lyft. + +![OSS inbound and outbound processes][2] + +OSS inbound and outbound processes + +Ultimately, all of these projects involved in the inbound and outbound OSS flow are the company's OSS ecosystem. And like any living being, the company's health and sustainability depend on the ecosystem that surrounds it. + +### OSPO responsibilities + +Following the species and their ecosystem, people working in the OSPO team could be seen as the rangers in the organization's OSS ecosystem. They take care of the ecosystem and its relationship with the company, to keep everything healthy and sustainable. + +When the company consumes open source software projects, they need to be aware of licenses and compliance, to check the project's health, to ensure there are no security flaws, and, in some cases, to identify talented community members for potential hiring processes. + +When the company contributes to open source software projects, they need to be sure there are no Intellectual Property (IP) issues, to ensure the company contributions' footprint and its leadership in the projects, and sometimes, also to help talented people stay engaged with the company through their contributions. + +And when the company releases and maintains open source projects, they are responsible for ensuring community engagement and growth, for checking there are no IP issues, that the company maintains its footprint and leadership, and perhaps, to attract new talent to the company. + +Have you realized the whole set of skills required in an OSPO team? When I've asked people working in OSPO about the size of their teams, the number is around 1 to 5 people per 1,000 developers in the company. That's a small team to monitor a lot of people and their potential OSS related activity. + +### How to manage an OSPO + +With all these activities in OSPO people's minds and all the resources they need to worry about, how are they able to manage all of this? + +There are at least a couple of open source communities with valuable knowledge and resources available for them: + + * The [TODO Group][3] is "an open group of companies who want to collaborate on practices, tools, and other ways to run successful and effective open source projects and programs." For example, they have a complete set of [guides][4] with best practices for and from companies running OSPOS. + * The [CHAOSS (Community Health Analytics for Open Source Software)][5] community develops metrics, methodologies, and software for managing open source project health and sustainability. (See more on CHAOSS' active communities and working groups below). + + + +OSPO managers need to report a lot of information to the rest of the company to answer many questions related to their OSS inbound and outbound processes, i.e., Which projects are we using in our organization? What's the health of those projects? Who are the key people in those projects? Which projects are we contributing to? Which projects are we releasing? How are we dealing with community contributions? Who are the key contributors? + +### Data-driven OSPO + +As William Edwards Deming said, "Without data, you are just a person with an opinion." + +Having opinions is not a bad thing, but having opinions based on data certainly makes it easier to understand, discuss, and determine the processes best suited to your company and its goals. CHAOSS is the recommended community to look to for guidance about metrics strategies and tools. + +Recently, the CHAOSS community has released [a new set of metric definitions][6]. These metrics are only subsets of all the ones being discussed in the focus areas of each working group (WG): + + * [Common WG][7]: Defines the metrics that are used by both working groups or are important for community health, but that do not cleanly fit into one of the other existing working groups. Areas of interest include organizational affiliation, responsiveness, and geographic coverage. + * [Diversity and Inclusion WG][8]: Gathers experiences regarding diversity and inclusion in open source projects with the goal of understanding, from a qualitative and quantitative point of view, how diversity and inclusion can be measured. + * [Evolution WG][9]: Refines the metrics that inform evolution and works with software implementations. + * [Risk WG][10]: Refines the metrics that inform risk and works with software implementations. + * [Value WG][11]: Focuses on industry-standard metrics for economic value in open source. Their main goal is to publish trusted industry-standard value metrics—a kind of S&P for software development and an authoritative source for metrics significance and industry norms. + + + +On the tooling side, projects like [Augur][12], [Cregit][13], and [GrimoireLab][14] are the reference tools that report these metrics, but also many others related to OSPO activities. They are also the seed for new tools and solutions provided by the OSS community like [Cauldron.io][15], a SaaS open source solution to ease OSS ecosystem analysis. + +![CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io][16] + +CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io + +All these metrics and data are useless without a metrics strategy. Usually, the first approach is to try to measure as much as possible, producing overwhelming reports and dashboards full of charts and data. What is the value of that? + +Experience has shown that a very valid approach is the [Goal, Questions, Metrics (GQM)][17] strategy. But how do we put that in practice in an OSPO? + +First of all, we need to understand the company's goals when using, consuming, contributing to, or releasing and maintaining OSS projects. The usual goals are related to market positioning, required upstream features development, and talent attraction or retention. Based on these goals, we should write down related questions that can be answered with numbers, like the following: + +#### Who/how many are the core maintainers of my OSS ecosystem projects? + +![Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io][18] + +Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io + +People contribute through different mechanisms or tools (code, issues, comments, tests, etc.). Measuring the core contributors (those that have done 80% of the contributions), the regular ones (those that have done 15% of the contributions), and the casual ones (those have made 5% of the contributions) can answer questions related to participation over time, but also how people move between the different buckets. Adding affiliation information helps to identify external core contributors. + +#### Where are the contributions happening? + +![Uber OSS activity based on location. Source: uber.biterg.io][19] + +Uber OSS activity based on location. Source: uber.biterg.io + +The growth of OSS ecosystems is also related to OSS projects spread across the world. Understanding that spread helps OSPO, and the company, to manage actions that improve support for people from different countries and regions. + +#### What is the company's OSS network? + +![Uber OSS network. Source: uber.biterg.io][20] + +Uber OSS network. Source: uber.biterg.io + +The company's OSS ecosystem includes those projects that the company's people contribute to. Understanding which projects they contribute to offers insight into which technologies or OSS components are interesting to people, and which companies or organizations the company collaborates with. + +#### How is the company dealing with contributions? + +![Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io][21] + +Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io + +One of the goals when releasing OSS projects is to grow the community around them. Measuring how the company handles contributions to its projects from outside its boundaries helps to understand how "welcoming" it is and identifies mentors (or bottlenecks) and opportunities to lower the barrier to contribute. + +#### Consumers vs. maintainers + +Over the last months, we have been hearing that corporations are taking OSS for free without contributing back. The typical arguments are that these corporations are making millions of dollars thanks to free work, plus the issue of OSS project maintainer burnout due to users' complaints and requests for free support. + +The system is unbalanced; usually, the number of users exceeds the number of maintainers. Is that good or bad? Having users for our software is (or should be) good. But we need to manage expectations on both sides. + +From the corporation's point of view, consuming OSS without care is very, very risky. + +OSPO can play an important role in educating the company about the risks they are facing, and how to reduce them by contributing back to their OSS ecosystem. Remember, a company's overall sustainability could rely heavily on its ecosystem sustainability. + +A good strategy is to start shifting your company from being pure OSS consumers to becoming contributors to their OSS inbound projects. From just submitting issues and asking questions to help solve issues, answering questions, and even sending patches, contributing helps grow and maintain the project while giving back to the community. It doesn't happen immediately, but over time, the company will be perceived as an OSS ecosystem citizen. Eventually, some people from the company could end up helping to maintain those projects too. + +And what about money? There are plenty of ways to support the OSS ecosystem financially. Some examples: + + * Business initiatives like [Tidelift][22], or [OpenCollective][23] + * Foundations and their supporting mechanisms, like [Software Freedom Conservancy][24], or [CommunityBridge][25] from the Linux Foundation + * Self-funding programs (like [Indeed][26] and [Salesforce][27] have done) + * Emerging gig development approaches like [Github Sponsors][28] or [Patreon][29] + + + +Last but not least, companies need to avoid the "not invented here" syndrome. For some OSS projects, there might be companies providing consulting, customization, maintenance, and/or support services. Instead of taking OSS and spending time and people to self-host, self-customize, or try to bring those kinds of services in-house, it might be smarter and more efficient to hire some of those companies to do the thought work. + +As a final remark, I would like to emphasize the importance of an OSPO for a company to succeed and grow in the current market. As shepherds of the company's OSS ecosystem, they are the best people in the organization to understand how the ecosystem works and flows, and they should be empowered to manage, monitor, and make recommendations and decisions to ensure sustainability and growth. + +Does your organization have an OSPO yet? + +Six common traits of successful open source programs, and a look back at how the open source... + +Why would a company not in the business of software development create an open source program... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/open-source-program-office + +作者:[J. Manrique Lopez de la Fuente][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jsmanrique +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting_discussion_brainstorm.png?itok=7_m4CC8S (community team brainstorming ideas) +[2]: https://opensource.com/sites/default/files/uploads/ospo_1.png (OSS inbound and outbound processes) +[3]: https://todogroup.org/ +[4]: https://todogroup.org/guides/ +[5]: https://chaoss.community/ +[6]: https://chaoss.community/metrics/ +[7]: https://github.com/chaoss/wg-common +[8]: https://github.com/chaoss/wg-diversity-inclusion +[9]: https://github.com/chaoss/wg-evolution +[10]: https://github.com/chaoss/wg-risk +[11]: https://github.com/chaoss/wg-value +[12]: https://github.com/chaoss/augur +[13]: https://github.com/cregit +[14]: https://chaoss.github.io/grimoirelab/ +[15]: https://cauldron.io/ +[16]: https://opensource.com/sites/default/files/uploads/ospo_2.png (CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io) +[17]: https://en.wikipedia.org/wiki/GQM +[18]: https://opensource.com/sites/default/files/uploads/ospo_3.png (Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io) +[19]: https://opensource.com/sites/default/files/uploads/ospo_4.png (Uber OSS activity based on location. Source: uber.biterg.io) +[20]: https://opensource.com/sites/default/files/uploads/ospo_5_0.png (Uber OSS network. Source: uber.biterg.io) +[21]: https://opensource.com/sites/default/files/uploads/ospo_6.png (Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io) +[22]: https://tidelift.com/ +[23]: https://opencollective.com/ +[24]: https://sfconservancy.org/ +[25]: https://funding.communitybridge.org/ +[26]: https://engineering.indeedblog.com/blog/2019/02/sponsoring-osi/ +[27]: https://sustain.codefund.fm/23 +[28]: https://help.github.com/en/github/supporting-the-open-source-community-with-github-sponsors +[29]: https://www.patreon.com/ diff --git a/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md b/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md new file mode 100644 index 0000000000..5ce9ce0a1f --- /dev/null +++ b/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source underpins coronavirus IoT and robotics solutions) +[#]: via: (https://opensource.com/article/20/5/robotics-covid19) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +Open source underpins coronavirus IoT and robotics solutions +====== +From sanitization of equipment and facilities to plotting the spread of +the virus, robots are playing an active role in combating COVID-19. +![Three giant robots and a person][1] + +The tech sector is quietly having a boom during the COVID-19 pandemic. Open source developers are getting involved with many aspects of the fight against the coronavirus, [using Python to visualize its spread][2] and helping to repurpose data acquisition systems to perform contact tracing. + +However, one of the most exciting areas of current research is the use of robotics to contain the spread of the coronavirus. In the last few weeks, robots have been deployed in critical environments—particularly in hospitals and on airplanes—to help staff sterilize surfaces and objects. + +Most of these robots are produced by tech startups, who have seen an opportunity to prove the worth of their proprietary systems. Many of them, however, rely on [open source cloud and IoT tools][3] that have been developed by the open source community. + +In this article, we'll take a look at how robotics are being used to fight the disease, the IoT infrastructure that underpins these systems, and finally, the security and privacy concerns that their increased use is highlighting. + +### Robots and COVID-19 + +Around the world, robots are being deployed to help the fight against COVID-19. The most direct use of robots has been in healthcare facilities, and China has taken the lead when it comes to deploying robots in hospitals. + +For example, a field hospital that recently opened in Wuhan—where the virus originated—is [making extensive use of robots][4] to help healthcare workers care for patients. Some of these robots provide food, drink, and medicine to patients, and others are used to clean parts of the hospital. + +Other companies, such as the Texas startup Xenex Disinfection Services, are using robots and UV light to deactivate viruses, bacteria, and spores on surfaces in airports. Still others, like Dimer UVC Innovations, are focusing on making robots that can [improve aircraft hygiene][5]. + +Not all of the "robots" deployed against the disease are anthropomorphic, though. The same field hospital in Wuhan that is using human-like robots is also making extensive use of less obviously "robotic" IoT devices. + +Patients entering the hospital are screened by networked 5G thermometers to alert staff for anyone showing a high fever, and patients wear smart bracelets and rings equipped with sensors. These are synced with CloudMinds' AI platform, and patients' vital signs, including temperature, heart rate, and blood oxygen levels, can be monitored. + +### Robots and the IoT + +Even when these robots appear to be independent entities, they make [extensive use of the IoT][6]. In other words, although patients may feel that they are being cared for by a robot that can make its own decisions, in reality, these robots are controlled by large, distributed sensing and data processing systems. + +Although many of the robots being deployed are the proprietary property of the tech firms who produce their hardware, their functioning is based on an ecosystem of software that is largely open source. + +This observation is an important one because it overturns one of the primary misconceptions about the [way that AI is used today][7][,][7] whether in a healthcare setting or elsewhere. Most research into robotics today does not seek to embed fully intelligent AI systems into robots themselves but, instead, uses centralized AI systems to control a wide variety of far less "smart" IoT devices. + +This observation, in turn, highlights two key points about the robots currently being developed and used to fight COVID-19. One is that they rely on a software ecosystem—much of it open source—that has been developed in a truly collaborative process involving thousands of engineers. The second is that the networked nature of these robots makes them vulnerable to exploitation. + +### Security and privacy + +This vulnerability to cybersecurity threats has led some analysts to raise questions about the wisdom of widespread deployment of IoT-driven robotics, whether in the healthcare system or anywhere else. Spyware in the IoT [remains a huge problem][8], and some fear that by integrating IoT systems into healthcare, we may be exposing more data—and more sensitive data—to intruders. + +Even where developers are careful to build security into these devices, the sheer number of components they rely on makes DevSecOps processes difficult to implement. Especially in this current time of crisis, many software engineers have been forced to accelerate the release of new components, and this could lead to them being vulnerable. If a company is rushing to bring a healthcare robot onto the market in response to COVID-19, it's unlikely that the open source code that these devices run on will be [properly audited][9]. + +And even if companies are able to maintain the integrity of their DevSecOps processes while still accelerating development, it's far from certain that patients themselves understand the privacy implications of delegating their care to IoT devices. Many lack the open source privacy tools [necessary to keep their data private][10] when browsing the internet, let alone those that should be deployed to protect sensitive healthcare data. + +### The future + +In short, the deployment of robots in the fight against COVID-19 is highlighting long-standing concerns about the integrity, security, and privacy of IoT systems more generally. Professionals in this field have long argued that [IoT audits][11] and [embedded Linux systems][12] should be the standard for IoT development, but in the current crisis, their warnings are likely to be ignored. + +This is worrying because it's likely that IoT systems will be increasingly used in healthcare in the coming decade. So whilst the COVID-19 pandemic will provide a proof of their utility in this sector, it should also not be used as an excuse to roll out poorly secured, poorly audited IoT software in highly sensitive environments. + +Open source isn’t just changing the way we interact with the world, it’s changing the way the world... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/robotics-covid19 + +作者:[Sam Bocetta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_robots.png?itok=TOZgajrd (Three giant robots and a person) +[2]: https://opensource.com/article/20/4/python-data-covid-19 +[3]: https://opensource.com/article/18/7/digital-transformation-strategy-think-cloud +[4]: https://www.cnbc.com/2020/03/18/how-china-is-using-robots-and-telemedicine-to-combat-the-coronavirus.html +[5]: https://www.therobotreport.com/company-offers-germ-killing-robot-to-airports-to-address-coronavirus-outbreak/ +[6]: https://www.cloudwards.net/what-is-the-internet-of-things/ +[7]: https://opensource.com/article/17/3/5-big-ways-ai-rapidly-invading-our-lives +[8]: https://blog.eccouncil.org/spyware-in-the-iot-what-does-it-mean-for-your-online-privacy/ +[9]: https://opensource.com/article/17/10/doc-audits +[10]: https://privacyaustralia.net/privacy-tools/ +[11]: https://opensource.com/article/19/11/how-many-iot-devices +[12]: https://opensource.com/article/17/3/embedded-linux-iot-ecosystem diff --git a/sources/tech/20200511 How I track my home-s energy consumption with open source.md b/sources/tech/20200511 How I track my home-s energy consumption with open source.md new file mode 100644 index 0000000000..10dfaa5f8e --- /dev/null +++ b/sources/tech/20200511 How I track my home-s energy consumption with open source.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I track my home's energy consumption with open source) +[#]: via: (https://opensource.com/article/20/5/energy-monitoring) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +How I track my home's energy consumption with open source +====== +These open source components help you find ways to save money and +conserve resources. +![lightbulb drawing outline][1] + +An important step towards optimizing energy consumption is knowing your actual consumption. My house was built during the oil crisis in the 1970s, and due to the lack of a natural gas connection, the builders decided to use electricity to do all of the heating (water and home heating). This is not unusual for this area of Germany, and it remains an appropriate solution in countries that depend highly on nuclear power. + +Electricity prices here are quite high (around € 0.28/kWh), so I decided to monitor my home's energy consumption to get a feel for areas where I could save some energy. + +I used to work for a company that sold energy-monitoring systems for industrial customers. While this company mostly used proprietary software, you can set up a similar smart monitoring and logging solution for your home based on open source components. This article will show you how. + +In Germany, the grid operator owns the electricity meter. The grid operator is obliged to provide an interface on its metering device to enable the customer to access the meter reading. Here is the metering device on my home: + +![Actaris ACE3000 electricity meter][2] + +Actaris ACE3000 Type 110 (dry contact located behind the marked cover) + +Generally, almost every metering device has at least a [dry contact][3]—as my electricity meter does—that you can use to log metering. As you can see, my electricity meter has two counters: The upper one is for the day tariff (6am to 10pm), and the lower one is for the night tariff (10pm to 6am). The night tariff is a bit cheaper. Two-tariff meters are usually found only in houses with electric heating. + +### Design + +A reliable energy-monitoring solution for private use should meet the following requirements: + + * Logging of metering impulses (dry contact) + * 24/7 operation + * Energy-saving operation + * Visualization of consumption data + * Long-term recording of consumption data + * Connectivity (e.g., Ethernet, USB, WiFi, etc.) + * Affordability + + + +I choose the Siemens SIMATIC IOT2020 as my hardware platform. This industrial-proven device is based on an Intel Quark x86 CPU, has programmable interrupts, and is compatible with many Arduino shields. + +![Siemens SIMATIC IOT2020][4] + +Siemens SIMATIC IOT2020 + +The Siemens device comes without an SD card and, therefore, without an operating system. Luckily, you can find a current Yocto-based Linux OS image and instructions on how to flash the SD card in the [Siemens forum][5]. + +In addition to the hardware platform, you also need some accessories. The following materials list shows the minimum components you need. Each item includes links to the parts I purchased, so you can get a sense of the project's costs. + +#### Materials list + + * [Siemens SIMATIC IoT2020 unit][6] + * [Siemens I/O Shield for SIMATIC IoT2000 series][7] + * [microSD card][8] (2GB or more) + * [CSL 300Mbit USB-WLAN adapter][9] + * 24V power supply (I used a 2.1A [TDK-Lambda DRB50-24-1][10], which I already owned). You could use a less expensive power supply with less power: the SIMATIC IOT2020 has a maximum current of 1.4A, and the dry contact needs an additional 0.1A (24V / 220Ω). + * 5 terminal blocks ([Weidmueller WDU 2.5mm][11]) + * 2 terminal cross-connecting bridges ([Weidmueller WQV][12]) + * [DIN rail][13] (~300 mm) + * [220Ω / 3W resistor][14] + * Wire + + + +Here is the assembled result: + +![Mounted and hooked up energy logger][15] + +Energy logger mounted and hooked up + +Unfortunately, I didn't have enough space at the rear wall of the cabinet; therefore, the DIN rail with the mounted parts lies on the ground. + +The connections between the meter and the Siemens device look like this: + +![Wiring between meter and energy logger][16] + +### How it works + +A dry contact is a current interface. When the electricity meter triggers, a current of 0.1A starts flowing between **s0+** and **s0-**. On **DI0**, the voltage rises to 24V and triggers an interrupt. When the electricity meter disconnects **s0+** and **s0-**, **DI0** is grounded over the resistor. + +On my device, the contact closes 1,000 times per kWh (this value varies between metering devices). + +To count these peaks reliably, I created [a C program][17] that registers an interrupt service routine on the DI0 input and counts upwards in memory. Once a minute, the values from memory are written to an [SQLite][18] database. + +The overall meter reading is also written to a text file and can be preset with a starting value. This acts as a copy of the overall metering value of the meter in the cabinet. + +![Energy logger architecture][19] + +Energy logger architecture + +The data is visualized using [Node-RED][20], and I can access overviews, like the daily consumption dashboard below, over a web-based GUI. + +![Node-RED based GUI][21] + +Daily overview in the Node-RED GUI + +For the daily overview, I calculate the hourly costs based on the consumption data (the large bar chart). On the top-left of the dashboard you can see the actual power; below that is the daily consumption (energy and costs). The water heater for the shower causes the large peak in the bar chart. + +### A reliable system + +Aside from a lost timestamp during a power failure (the real-time clock in the Siemens device is not backed by a battery by default), everything has been working fine for more than one-and-a-half years. + +If you can set up the whole Linux system completely from the command line, you'll get a reliable and flexible system with the ability to link interrupt service routines to the I/O level. + +Because the I/O Shield runs on standard control voltage (24V), you can extend its functionality with the whole range of standardized industrial components (e.g., relays, sensors, actors, etc.). And, due to its open architecture, this system can be extended easily and applied to other applications, like for monitoring gas or water consumption or as a weather station, a simple controller for tasks, and more. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/energy-monitoring + +作者:[Stephan Avenwedde][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Collaboration%20for%20health%20innovation.png?itok=s4O5EX2w (lightbulb drawing outline) +[2]: https://opensource.com/sites/default/files/uploads/openenergylogger_1_electricity_meter.jpg (Actaris ACE3000 electricity meter) +[3]: https://en.wikipedia.org/wiki/Dry_contact +[4]: https://opensource.com/sites/default/files/uploads/openenergylogger_2_siemens_device.jpg (Siemens SIMATIC IOT2020) +[5]: https://support.industry.siemens.com/tf/ww/en/posts/new-example-image-version-online/189090/?page=0&pageSize=10 +[6]: https://de.rs-online.com/web/p/products/1244037 +[7]: https://de.rs-online.com/web/p/products/1354133 +[8]: https://de.rs-online.com/web/p/micro-sd-karten/7582584/ +[9]: https://www.amazon.de/300Mbit-WLAN-Adapter-Hochleistungs-Antennen-Dual-Band/dp/B00LLIOT34 +[10]: https://de.rs-online.com/web/p/products/8153133 +[11]: https://de.rs-online.com/web/p/din-schienenklemmen-ohne-sicherung/0425190/ +[12]: https://de.rs-online.com/web/p/din-schienenklemmen-zubehor/0202574/ +[13]: https://de.rs-online.com/web/p/din-schienen/2835729/ +[14]: https://de.rs-online.com/web/p/widerstande-durchsteckmontage/2142673/ +[15]: https://opensource.com/sites/default/files/uploads/openenergylogger_3_assembled_device.jpg (Mounted and hooked up energy logger) +[16]: https://opensource.com/sites/default/files/uploads/openenergylogger_4_wiring.png (Wiring between meter and energy logger) +[17]: https://github.com/hANSIc99/OpenEnergyLogger +[18]: https://www.sqlite.org/index.html +[19]: https://opensource.com/sites/default/files/uploads/openenergylogger_5_architecure.png (Energy logger architecture) +[20]: https://nodered.org/ +[21]: https://opensource.com/sites/default/files/uploads/openenergylogger_6_dashboard.png (Node-RED based GUI) diff --git a/sources/tech/20200511 Start using systemd as a troubleshooting tool.md b/sources/tech/20200511 Start using systemd as a troubleshooting tool.md new file mode 100644 index 0000000000..372be7660e --- /dev/null +++ b/sources/tech/20200511 Start using systemd as a troubleshooting tool.md @@ -0,0 +1,269 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Start using systemd as a troubleshooting tool) +[#]: via: (https://opensource.com/article/20/5/systemd-troubleshooting-tool) +[#]: author: (David Both https://opensource.com/users/dboth) + +Start using systemd as a troubleshooting tool +====== +While systemd is not really a troubleshooting tool, the information in +its output points the way toward solving problems. +![Magnifying glass on code][1] + +No one would really consider systemd to be a troubleshooting tool, but when I encountered a problem on my webserver, my growing knowledge of systemd and some of its features helped me locate and circumvent the problem. + +The problem was that my server, yorktown, which provides name services, DHCP, NTP, HTTPD, and SendMail email services for my home office network, failed to start the Apache HTTPD daemon during normal startup. I had to start it manually after I realized that it was not running. The problem had been going on for some time, and I recently got around to trying to fix it. + +Some of you will say that systemd itself is the cause of this problem, and, based on what I know now, I agree with you. However, I had similar types of problems with SystemV. (In the [first article][2] in this series, I looked at the controversy around systemd as a replacement for the old SystemV init program and startup scripts. If you're interested in learning more about systemd, read the [second][3] and [third][4] articles, too.) No software is perfect, and neither systemd nor SystemV is an exception, but systemd provides far more information for problem-solving than SystemV ever offered. + +### Determining the problem + +The first step to finding the source of this problem is to determine the httpd service's status: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +   Active: failed (Result: exit-code) since Thu 2020-04-16 11:54:37 EDT; 15min ago +     Docs: man:httpd.service(8) +  Process: 1101 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) + Main PID: 1101 (code=exited, status=1/FAILURE) +   Status: "Reading configuration..." +      CPU: 60ms + +Apr 16 11:54:35 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 11:54:37 yorktown.both.org httpd[1101]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 192.168.0.52:80 +Apr 16 11:54:37 yorktown.both.org httpd[1101]: no listening sockets available, shutting down +Apr 16 11:54:37 yorktown.both.org httpd[1101]: AH00015: Unable to open logs +Apr 16 11:54:37 yorktown.both.org systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE +Apr 16 11:54:37 yorktown.both.org systemd[1]: httpd.service: Failed with result 'exit-code'. +Apr 16 11:54:37 yorktown.both.org systemd[1]: Failed to start The Apache HTTP Server. +[root@yorktown ~]# +``` + +This status information is one of the systemd features that I find much more useful than anything SystemV offers. The amount of helpful information here leads me easily to a logical conclusion that takes me in the right direction. All I ever got from the old **chkconfig** command is whether or not the service is running and the process ID (PID) if it is. That is not very helpful. + +The key entry in this status report shows that HTTPD cannot bind to the IP address, which means it cannot accept incoming requests. This indicates that the network is not starting fast enough to be ready for the HTTPD service to bind to the IP address because the IP address has not yet been set. This is not supposed to happen, so I explored my network service systemd startup configuration files; all appeared to be correct with the right "after" and "requires" statements. Here is the **/lib/systemd/system/httpd.service** file from my server: + + +``` +# Modifying this file in-place is not recommended, because changes                                                                                     +# will be overwritten during package upgrades.  To customize the                                                                                       +# behaviour, run "systemctl edit httpd" to create an override unit.                                                                                   +                                                                                                                                                      +# For example, to pass additional options (such as -D definitions) to                                                                                 +# the httpd binary at startup, create an override unit (as is done by                                                                                 +# systemctl edit) and enter the following:                                                                                                             +                                                                                                                                                      +#       [Service]                                                                                                                                     +#       Environment=OPTIONS=-DMY_DEFINE                                                                                                               +                                                                                                                                                      +[Unit]                                                                                                                                                 +Description=The Apache HTTP Server                                                                                                                     +Wants=httpd-init.service                                                                                                                               +After=network.target remote-fs.target nss-lookup.target httpd-init.service                                                                             +Documentation=man:httpd.service(8)                                                                                                                     +                                                                                                                                                      +[Service]                                                                                                                                             +Type=notify                                                                                                                                           +Environment=LANG=C                                                                                                                                     +                                                                                                                                                      +ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND                                                                                                       +ExecReload=/usr/sbin/httpd $OPTIONS -k graceful                                                                                                       +# Send SIGWINCH for graceful stop                                                                                                                     +KillSignal=SIGWINCH                                                                                                                                   +KillMode=mixed                                                                                                                                         +PrivateTmp=true                                                                                                                                       +                                                                                                                                                      +[Install]                                                                                                                                             +WantedBy=multi-user.target +``` + +The **httpd.service** unit file explicitly specifies that it should load after the **network.target** and the **httpd-init.service** (among others). I tried to find all of these services using the **systemctl list-units** command and searching for them in the resulting data stream. All were present and should have ensured that the httpd service did not load before the network IP address was set. + +### First solution + +A bit of searching on the internet confirmed that others had encountered similar problems with httpd and other services. This appears to happen because one of the required services indicates to systemd that it has finished its startup—but it actually spins off a child process that has not finished. After a bit more searching, I came up with a circumvention. + +I could not figure out why the IP address was taking so long to be assigned to the network interface card. So, I thought that if I could delay the start of the HTTPD service by a reasonable amount of time, the IP address would be assigned by that time. + +Fortunately, the **/lib/systemd/system/httpd.service** file above provides some direction. Although it says not to alter it, it does indicate how to proceed: Use the command **systemctl edit httpd**, which automatically creates a new file (**/etc/systemd/system/httpd.service.d/override.conf**) and opens the [GNU Nano][5] editor. (If you are not familiar with Nano, be sure to look at the hints at the bottom of the Nano interface.) + +Add the following text to the new file and save it: + + +``` +[root@yorktown ~]# cd /etc/systemd/system/httpd.service.d/ +[root@yorktown httpd.service.d]# ll +total 4 +-rw-r--r-- 1 root root 243 Apr 16 11:43 override.conf +[root@yorktown httpd.service.d]# cat override.conf +# Trying to delay the startup of httpd so that the network is +# fully up and running so that httpd can bind to the correct +# IP address +# +# By David Both, 2020-04-16 + +[Service] +ExecStartPre=/bin/sleep 30 +``` + +The **[Service]** section of this override file contains a single line that delays the start of the HTTPD service by 30 seconds. The following status command shows the service status during the wait time: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +  Drop-In: /etc/systemd/system/httpd.service.d +           └─override.conf +           /usr/lib/systemd/system/httpd.service.d +           └─php-fpm.conf +   Active: activating (start-pre) since Thu 2020-04-16 12:14:29 EDT; 28s ago +     Docs: man:httpd.service(8) +Cntrl PID: 1102 (sleep) +    Tasks: 1 (limit: 38363) +   Memory: 260.0K +      CPU: 2ms +   CGroup: /system.slice/httpd.service +           └─1102 /bin/sleep 30 + +Apr 16 12:14:29 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 12:15:01 yorktown.both.org systemd[1]: Started The Apache HTTP Server. +[root@yorktown ~]# +``` + +And this command shows the status of the HTTPD service after the 30-second delay expires. The service is up and running correctly: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +  Drop-In: /etc/systemd/system/httpd.service.d +           └─override.conf +           /usr/lib/systemd/system/httpd.service.d +           └─php-fpm.conf +   Active: active (running) since Thu 2020-04-16 12:15:01 EDT; 1min 18s ago +     Docs: man:httpd.service(8) +  Process: 1102 ExecStartPre=/bin/sleep 30 (code=exited, status=0/SUCCESS) + Main PID: 1567 (httpd) +   Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec" +    Tasks: 213 (limit: 38363) +   Memory: 21.8M +      CPU: 82ms +   CGroup: /system.slice/httpd.service +           ├─1567 /usr/sbin/httpd -DFOREGROUND +           ├─1569 /usr/sbin/httpd -DFOREGROUND +           ├─1570 /usr/sbin/httpd -DFOREGROUND +           ├─1571 /usr/sbin/httpd -DFOREGROUND +           └─1572 /usr/sbin/httpd -DFOREGROUND + +Apr 16 12:14:29 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 12:15:01 yorktown.both.org systemd[1]: Started The Apache HTTP Server. +``` + +I could have experimented to see if a shorter delay would work as well, but my system is not that critical, so I decided not to. It works reliably as it is, so I am happy. + +Because I gathered all this information, I reported it to Red Hat Bugzilla as Bug [1825554][6]. I believe that it is much more productive to report bugs than it is to complain about them. + +### The better solution + +A couple of days after reporting this as a bug, I received a response indicating that systemd is just the manager, and if httpd needs to be ordered after some requirements are met, it needs to be expressed in the unit file. The response pointed me to the **httpd.service** man page. I wish I had found this earlier because it is a better solution than the one I came up with. This solution is explicitly targeted to the prerequisite target unit rather than a somewhat random delay. + +From the [**httpd.service** man page][7]: + +> **Starting the service at boot time** +> +> The httpd.service and httpd.socket units are _disabled_ by default. To start the httpd service at boot time, run: **systemctl enable httpd.service**. In the default configuration, the httpd daemon will accept connections on port 80 (and, if mod_ssl is installed, TLS connections on port 443) for any configured IPv4 or IPv6 address. +> +> If httpd is configured to depend on any specific IP address (for example, with a "Listen" directive) which may only become available during start-up, or if httpd depends on other services (such as a database daemon), the service _must_ be configured to ensure correct start-up ordering. +> +> For example, to ensure httpd is only running after all configured network interfaces are configured, create a drop-in file (as described above) with the following section: +> +> [Unit] +> After=network-online.target +> Wants=network-online.target + +I still think this is a bug because it is quite common—at least in my experience—to use a **Listen** directive in the **httpd.conf** configuration file. I have always used **Listen** directives, even on hosts with only a single IP address, and it is clearly necessary on hosts with multiple network interface cards (NICs) and internet protocol (IP) addresses. Adding the lines above to the **/usr/lib/systemd/system/httpd.service** default file would not cause problems for configurations that do not use a **Listen** directive and would prevent this problem for those that do. + +In the meantime, I will use the suggested solution. + +### Next steps + +This article describes a problem I had with starting the Apache HTTPD service on my server. It leads you through the problem determination steps I took and shows how I used systemd to assist. I also covered the circumvention I implemented using systemd and the better solution that followed from my bug report. + +As I mentioned at the start, it is very likely that this is the result of a problem with systemd, specifically the configuration for httpd startup. Nevertheless, systemd provided me with the tools to locate the likely source of the problem and to formulate and implement a circumvention. Neither solution really resolves the problem to my satisfaction. For now, the root cause of the problem still exists and must be fixed. If that is simply adding the recommended lines to the **/usr/lib/systemd/system/httpd.service** file, that would work for me. + +One of the things I discovered during this is process is that I need to learn more about defining the sequences in which things start. I will explore that in my next article, the fifth in this series. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][8] [to systemd][8]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][9] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][10]'s [description of systemd][11]. + * [Linux.com][12]'s "More systemd fun" offers more advanced systemd [information and tips][13]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][14] + * [systemd for Administrators, Part I][15] + * [systemd for Administrators, Part II][16] + * [systemd for Administrators, Part III][17] + * [systemd for Administrators, Part IV][18] + * [systemd for Administrators, Part V][19] + * [systemd for Administrators, Part VI][20] + * [systemd for Administrators, Part VII][21] + * [systemd for Administrators, Part VIII][22] + * [systemd for Administrators, Part IX][23] + * [systemd for Administrators, Part X][24] + * [systemd for Administrators, Part XI][25] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-troubleshooting-tool + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://opensource.com/article/20/4/systemd +[3]: https://opensource.com/article/20/4/systemd-startup +[4]: https://opensource.com/article/20/4/understanding-and-using-systemd-units +[5]: https://www.nano-editor.org/ +[6]: https://bugzilla.redhat.com/show_bug.cgi?id=1825554 +[7]: https://www.mankier.com/8/httpd.service#Description-Starting_the_service_at_boot_time +[8]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[9]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[10]: http://Freedesktop.org +[11]: http://www.freedesktop.org/wiki/Software/systemd +[12]: http://Linux.com +[13]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[14]: http://0pointer.de/blog/projects/systemd.html +[15]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[16]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[18]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[19]: http://0pointer.de/blog/projects/three-levels-of-off.html +[20]: http://0pointer.de/blog/projects/changing-roots +[21]: http://0pointer.de/blog/projects/blame-game.html +[22]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[23]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[24]: http://0pointer.de/blog/projects/instances.html +[25]: http://0pointer.de/blog/projects/inetd.html diff --git a/sources/tech/20200511 Tips and tricks for optimizing container builds.md b/sources/tech/20200511 Tips and tricks for optimizing container builds.md new file mode 100644 index 0000000000..0a4fbed8cb --- /dev/null +++ b/sources/tech/20200511 Tips and tricks for optimizing container builds.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tips and tricks for optimizing container builds) +[#]: via: (https://opensource.com/article/20/5/optimize-container-builds) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + +Tips and tricks for optimizing container builds +====== +Try these techniques to minimize the number and length of your container +build iterations. +![Toolbox drawing of a container][1] + +How many iterations does it take to get a container configuration just right? And how long does each iteration take? Well, if you answered "too many times and too long," then my experiences are similar to yours. On the surface, creating a configuration file seems like a straightforward exercise: implement the same steps in a configuration file that you would perform if you were installing the system by hand. Unfortunately, I've found that it usually doesn't quite work that way, and a few "tricks" are handy for such DevOps exercises. + +In this article, I'll share some techniques I've found that help minimize the number and length of iterations. In addition, I'll outline a few good practices beyond the [standard ones][2]. + +In the [tutorial repository][3] from my previous article about [containerizing build systems][4], I've added a folder called **/tutorial2_docker_tricks** with an example covering some of the tricks that I'll walk through in this post. If you want to follow along and you have Git installed, you can pull it locally with: + + +``` +`$ git clone https://github.com/ravi-chandran/dockerize-tutorial` +``` + +The tutorial has been tested with Docker Desktop Edition, although it should work with any compatible Linux container system (like [Podman][5]). + +### Save time on container image build iterations + +If the Dockerfile involves downloading and installing a 5GB file, each iteration of **docker image build** could take a lot of time even with good network speeds. And forgetting to include one item to be installed can mean rebuilding all the layers after that point. + +One way around that challenge is to use a local HTTP server to avoid downloading large files from the internet multiple times during **docker image build** iterations. To illustrate this by example, say you need to create a container image with Anaconda 3 under Ubuntu 18.04. The Anaconda 3 installer is a ~0.5GB file, so this will be the "large" file for this example. + +Note that you don't want to use the **COPY** instruction, as it creates a new layer. You should also delete the large installer after using it to minimize the container image size. You could use [multi-stage builds][6], but I've found the following approach sufficient and quite effective. + +The basic idea is to use a Python-based HTTP server locally to serve the large file(s) and have the Dockerfile **wget** the large file(s) from this local server. Let's explore the details of how to set this up effectively. As a reminder, you can access the [full example][7]. + +The necessary contents of the folder **tutorial2_docker_tricks/** in this example repository are: + + +``` +tutorial2_docker_tricks/ +├── build_docker_image.sh                   # builds the docker image +├── run_container.sh                        # instantiates a container from the image +├── install_anaconda.dockerfile             # Dockerfile for creating our target docker image +├── .dockerignore                           # used to ignore contents of the installer/ folder from the docker context +├── installer                               # folder with all our large files required for creating the docker image +│   └── Anaconda3-2019.10-Linux-x86_64.sh   # from +└── workdir                                 # example folder used as a volume in the running container +``` + +The key steps of the approach are: + + * Place the large file(s) in the **installer/** folder. In this example, I have the large Anaconda installer file **Anaconda3-2019.10-Linux-x86_64.sh**. You won't find this file if you clone my [Git repository][8] because only you, as the container image creator, need this source file. The end users of the image don't. [Download the installer][9] to follow along with the example. + * Create the **.dockerignore** file and have it ignore the **installer/** folder to avoid Docker copying all the large files into the build context. + * In a terminal, **cd** into the **tutorial2_docker_tricks/** folder and execute the build script as **./build_docker_image.sh**. + * In **build_docker_image.sh**, start the Python HTTP server to serve any files from the **installer/** folder: [code] cd installer +python3 -m http.server --bind 10.0.2.15 8888 & +cd .. +``` +* If you're wondering about the strange internet protocol (IP) address, I'm working with a VirtualBox Linux VM, and **10.0.2.15** shows up as the address of the Ethernet adapter when I run **ifconfig**. This IP seems to be the convention used by VirtualBox. If your setup is different, you'll need to update this IP address to match your environment and then update **build_docker_image.sh** and **install_anaconda.dockerfile**. The server's port number is set to **8888** for this example. Note that the IP and port numbers could be passed in as build arguments, but I've hard-coded them for brevity. +* Since the HTTP server is set to run in the background, stop the server near the end of the script with the **kill -9** command using an [elegant approach][10] I found: [code]`kill -9 `ps -ef | grep http.server | grep 8888 | awk '{print $2}'` +``` + * Note that this same **kill -9** is also used earlier in the script (before starting the HTTP server). In general, when I iterate on any build script that I might deliberately interrupt, this ensures a clean start of the HTTP server each time. + * In the [Dockerfile][11], there is a **RUN wget** instruction that downloads the Anaconda installer from the local HTTP server. It also deletes the installer file and cleans up after the installation. Most importantly, all these actions are performed within the same layer to keep the image size to a minimum: [code] # install Anaconda by downloading the installer via the local http server +ARG ANACONDA +RUN wget --no-proxy -O ~/anaconda.sh \ +    && /bin/bash ~/anaconda.sh -b -p /opt/conda \ +    && rm ~/anaconda.sh \ +    && rm -fr /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* +``` + * This file runs the wrapper script, **anaconda.sh**, and cleans up large files by removing them with **rm**. + * After the build is complete, you should see an image **anaconda_ubuntu1804:v1**. (You can list the images with **docker image ls**.) + * You can instantiate a container from this image using **./run_container.sh** at the terminal while in the folder **tutorial2_docker_tricks/**. You can verify that Anaconda is installed with: [code] $ ./run_container.sh +$ python --version +Python 3.7.5 +$ conda --version +conda 4.8.0 +$ anaconda --version +anaconda Command line client (version 1.7.2) +``` + * You'll note that **run_container.sh** sets up a volume **workdir**. In this example repository, the folder **workdir/** is empty. This is a convention I use to set up a volume where I can have my Python and other scripts that are independent of the container image. + + + +### Minimize container image size + +Each **RUN** command is equivalent to executing a new shell, and each **RUN** command creates a layer. The naive approach of mimicking installation instructions with separate **RUN** commands may eventually break at one or more interdependent steps. If it happens to work, it will typically result in a larger image. Chaining multiple installation steps in one **RUN** command and including the **autoremove**, **autoclean**, and **rm** commands (as in the example below) is useful to minimize the size of each layer. Some of these steps may not be needed, depending on what's being installed. However, since these steps take an insignificant amount of time, I always throw them in for good measure at the end of **RUN** commands invoking **apt-get**: + + +``` +RUN apt-get update \ +    && DEBIAN_FRONTEND=noninteractive \ +       apt-get -y --quiet --no-install-recommends install \ +       # list of packages being installed go here \ +    && apt-get -y autoremove \ +    && apt-get clean autoclean \ +    && rm -fr /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* +``` + +Also, ensure that you have a **.dockerignore** file in place to ignore items that don't need to be sent to the Docker build context (such as the Anaconda installer file in the earlier example). + +### Organize the build tool I/O + +For software build systems, the build inputs and outputs—all the scripts that configure and invoke the tools—should be outside the image and the eventually running container. The container itself should remain stateless so that different users will have identical results with it. I covered this extensively in my [previous article][4] but wanted to emphasize it because it's been a useful convention for my work. These inputs and outputs are best accessed by setting up container volumes. + +I've had to use a container image that provides data in the form of source code and large pre-built binaries. As a software developer, I was expected to edit the code in the container. This was problematic, because containers are by default stateless: they don't save data within the container, because they're designed to be disposable. But I worked on it, and at the end of each day, I stopped the container and had to be careful not to remove it, because the state had to be maintained so I could continue work the next day. The disadvantage of this approach was that there would be a divergence of development state had there been more than one person working on the project. The value of having identical build systems across developers is somewhat lost with this approach. + +### Generate output as non-root user + +An important aspect of I/O concerns the ownership of the output files generated when running the tools in the container. By default, since Docker runs as **root**, the output files would be owned by **root**, which is unpleasant. You typically want to work as a non-root user. Changing the ownership after the build output is generated can be done with scripts, but it is an additional and unnecessary step. It's best to set the [**USER**][12] argument in the Dockerfile at the earliest point possible: + + +``` +ARG USERNAME +# other commands... +USER ${USERNAME} +``` + +The **USERNAME** can be passed in as a build argument (**\--build-arg**) when executing the **docker image build**. You can see an example of this in the example [Dockerfile][11] and corresponding [build script][13]. + +Some portions of the tools may also need to be installed as a non-root user. So the sequence of installations in the Dockerfile may need to be different from the way it's done if you are installing manually and directly under Linux. + +### Non-interactive installation + +Interactivity is the opposite of container automation. I've found the + + +``` +`DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends` +``` + +options for the **apt-get install** instruction (as in the example above) necessary to prevent the installer from opening dialog boxes. Note that these options should be used as part of the **RUN** instruction. The **DEBIAN_FRONTEND=noninteractive** should not be set as an environment variable (**ENV**) in the Dockerfile, as this [FAQ explains][14], as it will be inherited by the containers. + +### Log your build and run output + +Debugging why a build failed is a common task, and logs are a great way to do this. Save a TypeScript of everything that happened during the container image build or container run session using the **tee** utility in a Bash script. In other words, add **|& tee $BASH_SOURCE.log** to the end of the **docker image build** and the **docker image run** commands in your scripts. See the examples in the [image build][13] and [container run][15] scripts. + +What this **tee**-ing technique does is generate a file with the same name as the Bash script but with a **.log** extension appended to it so that you know which script it originated from. Everything you see printed to the terminal when running the script will get logged to this file with a similar name. + +This is especially valuable for users of your container images to report issues to you when something doesn't work. You can ask them to send you the log file to help diagnose the issue. Many tools generate so much output that it easily overwhelms the default size of the terminal's buffer. Relying only on the terminal's buffer capacity to copy-paste error messages may not be sufficient for diagnosing issues because earlier errors may have been lost. + +I've found this to be useful, even in the container image-building scripts, especially when using the Python-based HTTP server discussed above. The server generates so many lines during a download that it typically overwhelms the terminal's buffer. + +### Deal with proxies elegantly + +In my work environment, proxies are required to reach the internet for downloading the resources in **RUN apt-get** and **RUN wget** commands. The proxies are typically inferred from the environment variables **http_proxy** or **https_proxy**. While **ENV** commands can be used to hard-code such proxy settings in the Dockerfile, there are multiple issues with using **ENV** for proxies directly. + +If you are the only one who will ever build the container, then perhaps this will work. But the Dockerfile couldn't be used by someone else at a different location with a different proxy setting. Another issue is that the IT department could change the proxy at some point, resulting in a Dockerfile that won't work any longer. Furthermore, the Dockerfile is a precise document specifying a configuration-controlled system, and every change will be scrutinized by quality assurance. + +One simple approach to avoid hard-coding the proxy is to pass your local proxy setting as a build argument in the **docker image build** command: + + +``` +docker image build \ +    --build-arg MY_PROXY= +``` + +And then, in the Dockerfile, set the environment variables based on the build argument. In the example shown here, you can still set a default proxy value that can be overridden by the build argument above: + + +``` +# set a default proxy +ARG MY_PROXY=MY_PROXY= +ENV http_proxy=$MY_PROXY +ENV https_proxy=$MY_PROXY +``` + +### Summary + +These techniques have helped me significantly reduce the time it takes to create container images and debug them when they go wrong. I continue to be on the lookout for additional best practices to add to my list. I hope you find the above techniques useful. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/optimize-container-builds + +作者:[Ravi Chandran][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/toolbox-learn-draw-container-yearbook.png?itok=xDbwz1pP (Toolbox drawing of a container) +[2]: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ +[3]: https://github.com/ravi-chandran/dockerize-tutorial +[4]: https://opensource.com/article/20/4/how-containerize-build-system +[5]: https://podman.io/getting-started/installation +[6]: https://docs.docker.com/develop/develop-images/multistage-build/ +[7]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/ +[8]: https://github.com/ravi-chandran/dockerize-tutorial/ +[9]: https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh +[10]: https://stackoverflow.com/a/37214138 +[11]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/install_anaconda.dockerfile +[12]: https://docs.docker.com/engine/reference/builder/#user +[13]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/build_docker_image.sh +[14]: https://docs.docker.com/engine/faq/ +[15]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/run_container.sh diff --git a/sources/tech/20200515 How to examine processes running on Linux.md b/sources/tech/20200515 How to examine processes running on Linux.md new file mode 100644 index 0000000000..0659ab04f9 --- /dev/null +++ b/sources/tech/20200515 How to examine processes running on Linux.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to examine processes running on Linux) +[#]: via: (https://www.networkworld.com/article/3543232/how-to-examine-processes-running-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to examine processes running on Linux +====== + +Thinkstock + +There are quite a number of ways to look at running processes on Linux systems – to see what’s running, the resources that processes are using, how the system is affected by the load and how memory is being used. Each command gives you a different view, and the range of details is considerable. In this post, we’ll run through a series of commands that can help you view process details in a number of different ways. + +### ps + +While the **ps** command is the most obvious command for examining processes, the arguments that you use when running **ps** will make a big difference in how much information will be provided. With no arguments, **ps** will only show processes associated with your current login session. Add a **-u** and you'll see extended details. + +Here is a comparison: + +``` +nemo$ ps + PID TTY TIME CMD + 45867 pts/1 00:00:00 bash + 46140 pts/1 00:00:00 ps +nemo$ ps -u +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +nemo 45867 0.0 0.0 11232 5636 pts/1 Ss 19:04 0:00 -bash +nemo 46141 0.0 0.0 11700 3648 pts/1 R+ 19:16 0:00 ps -u +``` + +Using **ps -ef** will display details on all of the processes running on the system but **ps -eF** will add some additional details. + +``` +$ ps -ef | head -2 +UID PID PPID C STIME TTY TIME CMD +root 1 0 0 May10 ? 00:00:06 /sbin/init splash +$ ps -eF | head -2 +UID PID PPID C SZ RSS PSR STIME TTY TIME CMD +root 1 0 0 42108 12524 0 May10 ? 00:00:06 /sbin/init splash +``` + +Both commands show who is running the process, the process and parent process IDs, process start time, accumulated run time and the task being run. The additional fields shown when you use **F** instead of **f** include: + + * SZ: the process **size** in physical pages for the core image of the process + * RSS: the **resident set size** which shows how much memory is allocated to those parts of the process in RAM. It does not include memory that is swapped out, but does include memory from shared libraries as long as the pages from those libraries are currently in memory. It also includes stack and heap memory. + * PSR: the **processor** the process is using + + + +##### ps -fU + +You can list processes for some particular user with a command like "ps -ef | grep USERNAME", but with **ps -fU** command, you’re going to see considerably more data. This is because details of processes that are being run on the user's behalf are also included. In fact, nearly all these processes shown have been kicked off by system simply to support this user’s online session. Nemo has only just logged in and is not yet running any commands or scripts. + +``` +$ ps -fU nemo +UID PID PPID C STIME TTY TIME CMD +nemo 45726 1 0 19:04 ? 00:00:00 /lib/systemd/systemd --user +nemo 45732 45726 0 19:04 ? 00:00:00 (sd-pam) +nemo 45738 45726 0 19:04 ? 00:00:00 /usr/bin/pulseaudio --daemon +nemo 45740 45726 0 19:04 ? 00:00:00 /usr/libexec/tracker-miner-f +nemo 45754 45726 0 19:04 ? 00:00:00 /usr/bin/dbus-daemon --sessi +nemo 45829 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd +nemo 45856 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd-fuse /run +nemo 45862 45706 0 19:04 ? 00:00:00 sshd: nemo@pts/1 +nemo 45864 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-udisks2-vo +nemo 45867 45862 0 19:04 pts/1 00:00:00 -bash +nemo 45878 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-afc-volume +nemo 45883 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-goa-volume +nemo 45887 45726 0 19:04 ? 00:00:00 /usr/libexec/goa-daemon +nemo 45895 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-mtp-volume +nemo 45896 45726 0 19:04 ? 00:00:00 /usr/libexec/goa-identity-se +nemo 45903 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-gphoto2-vo +nemo 45946 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd-metadata +``` + +Note that the only process with an assigned TTY is Nemo's shell and that the parent of all of the other processes is **systemd**. + +You can supply a comma-separated list of usernames instead of a single name. Just be prepared to be looking at quite a bit more data. + +#### top and ntop + +The **top** and **ntop** commands will help when you want to get an idea which processes are using the most resources and allow you to reorder your view depending on what criteria you want to use to rank the processes (e.g., highest CPU or memory use). + +``` +top - 11:51:27 up 1 day, 21:40, 1 user, load average: 0.08, 0.02, 0.01 +Tasks: 211 total, 1 running, 210 sleeping, 0 stopped, 0 zombie +%Cpu(s): 5.0 us, 0.5 sy, 0.0 ni, 94.3 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5944.4 total, 3527.4 free, 565.1 used, 1851.9 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 5084.3 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 999 root 20 0 394660 14380 10912 S 8.0 0.2 0:46.54 udisksd + 65224 shs 20 0 314268 9824 8084 S 1.7 0.2 0:00.34 gvfs-ud+ + 2034 gdm 20 0 314264 9820 7992 S 1.3 0.2 0:06.25 gvfs-ud+ + 67909 root 20 0 0 0 0 I 0.3 0.0 0:00.09 kworker+ + 1 root 20 0 168432 12532 8564 S 0.0 0.2 0:09.93 systemd + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd +``` + +Use **shift+m** to sort by memory use and **shift+p** to go back to sorting by CPU usage (the default). + +#### /proc + +A tremendous amount of information is available on running processes in the **/proc** directory. In fact, if you haven't visited **/proc** quite a few times, you might be astounded by the amount of details available. Just keep in mind that **/proc** is a very different kind of file system. As an interface to kernel data, it provides a view of process details that are currently being used by the system. + +Some of the more useful **/proc** files for viewing include **cmdline**, **environ**, **fd**, **limits** and **status**. The following views provide some samples of what you might see. + +The **status** file shows the process that is running (bash), its status, the user and group ID for the person running bash, a full list of the groups the user is a member of and the process ID and parent process ID. + +``` +$ head -11 /proc/65333/status +Name: bash +Umask: 0002 +State: S (sleeping) +Tgid: 65333 +Ngid: 0 +Pid: 65333 +PPid: 65320 +TracerPid: 0 +Uid: 1000 1000 1000 1000 +Gid: 1000 1000 1000 1000 +FDSize: 256 +Groups: 4 11 24 27 30 46 118 128 500 1000 +... +``` + +The **cmdline** file shows the command line used to start the process. + +``` +$ cat /proc/65333/cmdline +-bash +``` + +The **environ** file shows the environment variables that are in effect. + +``` +$ cat environ +USER=shsLOGNAME=shsHOME=/home/shsPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/gamesSHELL=/bin/bashTERM=xtermXDG_SESSION_ID=626XDG_RUNTIME_DIR=/run/user/1000DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/busXDG_SESSION_TYPE=ttyXDG_SESSION_CLASS=userMOTD_SHOWN=pamLANG=en_US.UTF-8SSH_CLIENT=192.168.0.19 9385 22SSH_CONNECTION=192.168.0.19 9385 192.168.0.11 22SSH_TTY=/dev/pts/0$ +``` + +The **fd** file shows the file descriptors. Note how they reflect the pseudo-tty that is being used (pts/0). + +``` +$ ls -l /proc/65333/fd +total 0 +lrwx------ 1 shs shs 64 May 12 09:45 0 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:45 1 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:45 2 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:56 255 -> /dev/pts/0 +$ who +shs pts/0 2020-05-12 09:45 (192.168.0.19) +``` + +The **limits** file contains information about the limits imposed on the process. + +``` +$ cat limits +Limit Soft Limit Hard Limit Units +Max cpu time unlimited unlimited seconds +Max file size unlimited unlimited bytes +Max data size unlimited unlimited bytes +Max stack size 8388608 unlimited bytes +Max core file size 0 unlimited bytes +Max resident set unlimited unlimited bytes +Max processes 23554 23554 processes +Max open files 1024 1048576 files +Max locked memory 67108864 67108864 bytes +Max address space unlimited unlimited bytes +Max file locks unlimited unlimited locks +Max pending signals 23554 23554 signals +Max msgqueue size 819200 819200 bytes +Max nice priority 0 0 +Max realtime priority 0 0 +Max realtime timeout unlimited unlimited us +``` + +#### pmap + +The **pmap** command takes you in an entirely different direction when it comes to memory use. It provides a detailed map of a process’s memory usage. To make sense of this, you need to keep in mind that processes do not run entirely on their own. Instead, they make use of a wide range of system resources. The truncated **pmap** output below shows a portion of the memory map for a single user’s bash login along with some memory usage totals at the bottom. + +``` +$ pmap -x 43120 +43120: -bash +Address Kbytes RSS Dirty Mode Mapping +000055887655b000 180 180 0 r---- bash +0000558876588000 708 708 0 r-x-- bash +0000558876639000 220 148 0 r---- bash +0000558876670000 16 16 16 r---- bash +0000558876674000 36 36 36 rw--- bash +000055887667d000 40 28 28 rw--- [ anon ] +0000558876b96000 1328 1312 1312 rw--- [ anon ] +00007f0bd9a7e000 28 28 0 r---- libpthread-2.31.so +00007f0bd9a85000 68 68 0 r-x-- libpthread-2.31.so +00007f0bd9a96000 20 0 0 r---- libpthread-2.31.so +00007f0bd9a9b000 4 4 4 r---- libpthread-2.31.so +00007f0bd9a9c000 4 4 4 rw--- libpthread-2.31.so +00007f0bd9a9d000 16 4 4 rw--- [ anon ] +00007f0bd9aa1000 20 20 0 r---- libnss_systemd.so.2 +00007f0bd9aa6000 148 148 0 r-x-- libnss_systemd.so.2 +... +ffffffffff600000 4 0 0 --x-- [ anon ] +---------------- ------- ------- ------- +total kB 11368 5664 1656 + +Kbytes: size of map in kilobytes +RSS: resident set size in kilobytes +Dirty: dirty pages (both shared and private) in kilobytes +``` +``` + +``` + +Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543232/how-to-examine-processes-running-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200515 The pieces of Fedora Silverblue.md b/sources/tech/20200515 The pieces of Fedora Silverblue.md new file mode 100644 index 0000000000..04bd4e1643 --- /dev/null +++ b/sources/tech/20200515 The pieces of Fedora Silverblue.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The pieces of Fedora Silverblue) +[#]: via: (https://fedoramagazine.org/pieces-of-fedora-silverblue/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +The pieces of Fedora Silverblue +====== + +![][1] + +Fedora Silverblue provides a useful workstation build on an immutable operating system. In “[What is Silverblue?][2]“, you learned about the benefits that an immutable OS provides. But what pieces go into making it? This article examines some of the technology that powers Silverblue. + +### The filesystem + +Fedora Workstation users may find the idea of an immutable OS to be the most brain-melting part of Silverblue. What does that mean? Find some answers by taking a look at the filesystem. + +At first glance, the layout looks pretty much the same as a regular Fedora file system. It has some differences, like making _/home_ a symbolic link to _/var/home_. And you can get more answers by looking at how libostree works. libostree treats the whole tree like it’s an object, checks it into a code repository, and checks out a copy for your machine to use. + +#### libostree + +The [libostree project][3] supplies the goods for managing Silverblue’s file system. It is an upgrade system that the user can control using [rpm-ostree commands][4]. + +libostree knows nothing about packages—an upgrade means replacing one complete file system with another complete file system. libostree treats the file system tree as one atomic object (an unbreakable unit). In fact, the forerunner to Silverblue was named [Project Atomic][5]. + +The libostree project provides a library and set of tools. It’s an upgrade system that carries out these tasks. + + 1. Pull in a new file system + 2. Store the new file system + 3. Deploy the new file system + + + +##### Pull in a new file system + +Pulling in a new file system means copying an object (the entire file system) from a remote source to its own store. If you’ve worked with virtual machine image files, you already understand the concept of a file system object that you can copy. + +##### Store the new file system + +The libostree store has some source code control qualities—it stores many file system objects, and checks one out to be used as the root file system. libostree’s store has two parts: + + * a repository database at _/sysroot/ostree/repo/_ + * file systems in _/sysroot/ostree/deploy/fedora/deploy/_ + + + +libostree keeps track of what’s been checked in using commit IDs. Each commit ID can be found in a directory name, nested deep inside _/sysroot_ .A libostree commit ID is a long checksum, and looks similar to a git commit ID. + +``` +$ ls -d /sysroot/ostree/deploy/fedora/deploy/*/ +/sysroot/ostree/deploy/fedora/deploy/c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4.0/ +``` + +_rpm-ostree status_ gives a little more information about that commit ID. The output is a little confusing; it can take a while to see this file system is Fedora 31. + +``` +$ rpm-ostree status +State: idle +AutomaticUpdates: disabled +Deployments: +● ostree://fedora:fedora/31/x86_64/silverblue + Version: 31.1.9 (2019-10-23T21:44:48Z) + Commit: c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4 + GPGSignature: Valid signature by 7D22D5867F2A4236474BF7B850CB390B3C3359C4 +``` + +##### Deploy the new filesystem + +libostree deploys a new file system by checking out the new object from its store. libostree doesn’t check out a file system by copying all the files—it uses hard links instead. If you look inside the commit ID directory, you see something that looks suspiciously like the root directory. That’s because it _is_ the root directory. You can see these two directories are pointing to the same place by checking their inodes. + +``` +$ ls -di1 / /sysroot/ostree/deploy/fedora/deploy/*/ +260102 / +260102 /sysroot/ostree/deploy/fedora/deploy/c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4.0/ +``` + +This is a fresh install, so there’s only one commit ID. After a system update, there will be two. If more copies of the file system are checked into libostree’s repo, more commit IDs appear here. + +##### Upgrade process + +Putting the pieces together, the update process looks like this: + + 1. libostree checks out a copy of the file system object from the repository + 2. DNF installs packages into the copy + 3. libostree checks in the copy as a new object + 4. libostree checks out the copy to become the new file system + 5. You reboot to pick up the new system files + + + +In addition to more safety, there is more flexibility. You can do new things with libostree’s repo, like store a few different file systems and check out whichever one you feel like using. + +#### Silverblue’s root file system + +Fedora keeps its system files in all the usual Linux places, such as _/boot_ for boot files, _/etc_ for configuration files, and _/home_ for user home directories. The root directory in Silverblue looks much like the root directory in traditional Fedora, but there are some differences. + + * The filesystem has been checked out by libostree + * Some directories are now symbolic links to new locations. For example, _/home_ is a symbolic link to _/var/home_ + * _/usr_ is a read-only directory + * There’s a new directory named _/sysroot_. This is libostree’s new home + + + +#### Juggling file systems + +You can store many file systems and switch between them. This is called _rebasing_, and it’s similar to git rebasing. In fact, upgrading Silverblue to the next Fedora version is not a big package install—it’s a pull from a remote repository and a rebase. + +You could store three copies with three different desktops: one KDE, one GNOME, and one XFCE. Or three different OS versions: how about keeping the current version, the nightly build, and an old classic? Switching between them is a matter of rebasing to the appropriate file system object. + +Rebasing is also how you upgrade from one Fedora release to the next. See “[How to rebase to Fedora 32 on Silverblue][6]” for more information. + +### Flatpak + +The [Flatpak project][7] provides a way of installing applications like LibreOffice. Applications are pulled from remote repositories like [Flathub][8]. It’s a kind of package manager, although you won’t find the word _package_ in the [docs][9]. Traditional Fedora variants like Fedora Workstation can also use Flatpak, but the sandboxed nature of flatpaks make it particularly good for Silverblue. This way you do not have to do the entire ostree update process every time you wish to install an application. + +Flatpak is well-suited to desktop applications, but also works for command line applications. You can install the [vim][10] editor with the command _flatpak install flathub org.vim.Vim_ and run it with _flatpak run org.vim.Vim_. + +### toolbox + +The [toolbox project][11] provides a traditional operating system inside a container. The idea is that you can mess with the mutable OS inside your toolbox (the Fedora container) as much as you like, and leave the immutable OS outside your toolbox untouched. You pack as many toolboxes as you want on your system, so you can keep work separated. Behind the scenes, the executable _/usr/bin/toolbox_ is a shell script that uses [podman][12]. + +A fresh install does not include a default toolbox. The _toolbox create_ command checks the OS version (by reading _/usr/lib/os-release_), looks for a matching version at the Fedora container registry, and downloads the container. + +``` +$ toolbox create +Image required to create toolbox container. +Download registry.fedoraproject.org/f31/fedora-toolbox:31 (500MB)? [y/N]: y +Created container: fedora-toolbox-31 +Enter with: toolbox enter +``` + +Hundreds of packages are installed inside the toolbox. The _dnf_ command and the usual Fedora repos are set up, ready to install more. The _ostree_ and _rpm-ostree_ commands are not included – no immutable OS here. + +Each user’s home directory is mounted on their toolbox, for storing content files outside the container. + +### Put the pieces together + +Spend some time exploring Fedora Silverblue and it will become clear how these components fit together. Like other Fedora variants, all these of tools come from open source projects. You can get as up close and personal as you want, from reading their docs to contributing code. Or you can [contribute to Silverblue][13] itself. + +Join the Fedora Silverblue conversations on [discussion.fedoraproject.org][14] or in [#silverblue on Freenode IRC][15]. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/pieces-of-fedora-silverblue/ + +作者:[Nick Hardiman][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/silverblue-pieces-816x345.png +[2]: https://fedoramagazine.org/what-is-silverblue/ +[3]: https://ostree.readthedocs.io/en/latest/ +[4]: https://rpm-ostree.readthedocs.io/en/latest/manual/administrator-handbook/#administering-an-rpm-ostree-based-system +[5]: https://www.projectatomic.io/ +[6]: https://fedoramagazine.org/how-to-rebase-to-fedora-32-on-silverblue/ +[7]: https://github.com/flatpak/flatpak +[8]: https://flathub.org/ +[9]: http://docs.flatpak.org/en/latest/index.html +[10]: https://www.vim.org/ +[11]: https://github.com/containers/toolbox +[12]: https://github.com/containers/libpod +[13]: https://silverblue.fedoraproject.org/contribute +[14]: https://discussion.fedoraproject.org/c/desktop/silverblue +[15]: https://webchat.freenode.net/#silverblue diff --git a/sources/tech/20200516 Fatih-s question.md b/sources/tech/20200516 Fatih-s question.md new file mode 100644 index 0000000000..1225c624a8 --- /dev/null +++ b/sources/tech/20200516 Fatih-s question.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fatih’s question) +[#]: via: (https://dave.cheney.net/2020/05/16/fatihs-question) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Fatih’s question +====== + +A few days ago Fatih posted [this question][1] on twitter. + +I’m going to attempt to give my answer, however to do that I need to apply some simplifications as my previous attempts to answer it involved a lot of phrases like _a pointer to a pointer_, and other unhelpful waffling. Hopefully my simplified answer can be useful in building a mental framework to answer Fatih’s original question. + +### Restating the question + +Fatih’s original tweet showed [four different variations][2] of `json.Unmarshal`. I’m going to focus on the last two, which I’ll rewrite a little: + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +type Result struct { + Foo string `json:"foo"` +} + +func main() { + content := []byte(`{"foo": "bar"}`) + var result1, result2 *Result + + err := json.Unmarshal(content, &result1) + fmt.Println(result1, err) // &{bar} + + err = json.Unmarshal(content, result2) + fmt.Println(result2, err) // json: Unmarshal(nil *main.Result) +} +``` + +Restated in words, `result1` and `result2` are the same type; `*Result`. Decoding into `result1` works as expected, whereas decoding into `result2` causes the `json` package to complain that the value passed to `Unmarshal` is `nil`. However, both values were declared without an initialiser so both would have taken on the type’s zero value, `nil`. + +Eagle eyed readers will have spotted that the reason for the difference is the first` `invocation is passed `&result1`, while the second is passed `result2`, but this explanation is unsatisfactory because the documentation for `json.Unmarshal` states: + +> Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. **If v is nil or not a pointer**, Unmarshal returns an InvalidUnmarshalError. + +Which is confusing because `result1` and `result2` _are_ pointers. Furthermore, without initialisation, both _are_ `nil`. Now, the documentation is correct (as you’d expect from a package that has been hammered on for a decade), but explaining _why_ takes a little more investigation. + +### Functions receive a copy of their arguments + +Every assignment in Go is a copy, this includes function arguments and return values. + +``` +package main + +import ( + "fmt" +) + +func increment(v int) { + v++ +} + +func main() { + v := 1 + increment(v) + fmt.Println(v) // 1 +} +``` + +In this example, `increment` is operating on a _copy_ of `main`‘s `v`. This is because the `v` declared in `main` and `increment`‘s `v` parameter have different addresses in memory. Thus changes to `increment`‘s `v` cannot affect the contents of `main`‘s `v`. + +``` +package main + +import ( + "fmt" +) + +func increment(v *int) { + *v++ +} + +func main() { + v := 1 + increment(&v) + fmt.Println(v) // 2 +} +``` + +If we wanted to write `increment` in a way that it could affect the contents of its caller we would need to pass a reference, a pointer, to `main.v`.[1][3] This example demonstrates why `json.Unmarshal` needs a pointer to the value to decode JSON into. + +### Pointers to pointers + +Returning to the original question, both `result1` and `result2` are declared as `*Result`, that is, pointers to a `Result` value. We established that you have to pass the address of caller’s value to `json.Unmarshal` otherwise it won’t be able to alter the contents of the caller’s value. Why then must we pass the address of `result1`, a `**Result`, a pointer to a pointer to a `Result`, for the operation to succeed. + +To explain this another detour is required. Consider this code: + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +type Result struct { + Foo *string `json:"foo"` +} + +func main() { + content := []byte(`{"foo": "bar"}`) + var result1 *Result + + err := json.Unmarshal(content, &result1) + fmt.Printf("%#v %v", result1, err) // &main.Result{Foo:(*string)(0xc0000102f0)} +} +``` + +In this example `Result` contains a pointer typed field, `Foo *string`. During JSON decoding `Unmarshal` allocated a new `string` value, stored the value `bar` in it, then placed the address of the string in `Result.Foo`. This behaviour is quite handy as it frees the caller from having to initialise `Result.Foo` and makes it easier to detect when a field was not initialised because the JSON did not contain a value. Beyond the convenience this offers for simple examples it would be prohibitively difficult for the caller to properly initialise all the reference type fields in a structure before decoding unknown JSON without first inspecting the incoming JSON which itself may be problematic if the input is coming from an `io.Reader` without the ability to rewind the input. + +> To unmarshal JSON into a pointer, Unmarshal first handles the case of the JSON being the JSON literal null. In that case, Unmarshal sets the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into the value pointed at by the pointer. **If the pointer is nil, Unmarshal allocates a new value for it to point to**. + +`json.Unmarshal`‘s handling of pointer fields is clearly documented, and works as you would expect, allocating a new value whenever there is a need to decode into a pointer shaped field. It is this behaviour that gives us a hint to what is happening in the original example. + +We’ve seen that when `json.Unmarshal` encounters a field which points to `nil` it will allocate a new value of the correct type and assign its address the field before proceeding. Not only is does behaviour is applied recursively–for example in the case of a complex structure which contains pointers to other structures–but it also applies to the _value passed to `Unmarshal`._ + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +func main() { + content := []byte(`1`) + var result *int + + err := json.Unmarshal(content, &result) + fmt.Println(*result, err) // 1 +} +``` + +In this example `result` is not a struct, but a simple `*int` which, lacking an initialiser, defaults to `nil`. After JSON decoding, `result` now points to an `int` with the value `1`. + +### Putting the pieces together + +Now I think I’m ready to take a shot at answering Fatih’s question. + +`json.Unmarshal` requires the address of the variable you want to decode into, otherwise it would decode into a temporary copy which would be discard on return. Normally this is done by declaring a value, then passing its address, or explicitly initialising the the value + +``` +var result1 Result +err := json.Unmarshal(content, &result1) // this is fine + +var result2 = new(Result) +err = json.Unmarshal(content, result2) // and this + +var result3 = &Result{} +err = json.Unmarshal(content, result3) // this is also fine +``` + +In all three cases the address that the `*Result` points too is not `nil`, it points to initialised memory that `json.Unmarshal` decodes into. + +Now consider what happens when `json.Unmarshal` encounters this + +``` +var result4 *Result +err = json.Unmarshal(content, result4) // err json: Unmarshal(nil *main.Result) +``` + +`result2`, `result3`, and the expression `&result1` point to a `Result`. However `result4`, even though it has the same type as the previous three, does not point to initialised memory, it points to `nil`. Thus, according to the examples we saw previously, before `json.Unmarshal` can decode into it, the memory `result4` points too must be initialised. + +However, because each function receives a copy of its arguments, the caller’s `result4` variable and the copy inside `json.Unmarshal` are unique. `json.Unmarshal` can allocate a new `Result` value and decode into it, but it cannot alter `result4` to point to this new value because it was not provided with a reference to `result4`, only a copy of its contents. + + 1. This does not violate the _everything is a copy_ rule, a copy of a pointer to `main.v` still points to `main.v`.[][4] + + + +#### Related posts: + + 1. [Should methods be declared on T or *T][5] + 2. [Ice cream makers and data races][6] + 3. [Understand Go pointers in less than 800 words or your money back][7] + 4. [Slices from the ground up][8] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/16/fatihs-question + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/fatih/status/1260683136842608640 +[2]: https://play.golang.org/p/g2yUIYrV67F +[3]: tmp.dRxkHxYRQS#easy-footnote-bottom-1-4153 (This does not violate the everything is a copy rule, a copy of a pointer to main.v still points to main.v.) +[4]: tmp.dRxkHxYRQS#easy-footnote-1-4153 +[5]: https://dave.cheney.net/2016/03/19/should-methods-be-declared-on-t-or-t (Should methods be declared on T or *T) +[6]: https://dave.cheney.net/2014/06/27/ice-cream-makers-and-data-races (Ice cream makers and data races) +[7]: https://dave.cheney.net/2017/04/26/understand-go-pointers-in-less-than-800-words-or-your-money-back (Understand Go pointers in less than 800 words or your money back) +[8]: https://dave.cheney.net/2018/07/12/slices-from-the-ground-up (Slices from the ground up) diff --git a/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md b/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md new file mode 100644 index 0000000000..b02822c4fa --- /dev/null +++ b/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Fedora to implement REST API in JavaScript: part 2) +[#]: via: (https://fedoramagazine.org/using-fedora-to-implement-rest-api-in-javascript-part-2/) +[#]: author: (Vaclav Keil https://fedoramagazine.org/author/vaclavk/) + +Using Fedora to implement REST API in JavaScript: part 2 +====== + +![][1] + +In [part 1][2] previously, you saw how to quickly create a simple API service using Fedora Workstation, Express, and JavaScript. This article shows you the simplicity of how to create a new API. This part shows you how to: + + * Install a DB server + * Build a new route + * Connect a new datasource + * Use Fedora terminal to send and receive data + + + +### Generating an app + +Please refer to the [previous article][2] for more details. But to make things simple, change to your work directory and generate an app skeleton. +``` + +``` + +$ cd our-work-directory +$ npx express-generator –no-view –git /myApp +$ cd myApp +$ npm i +``` + +``` + +### Installing a database server + +In this part, we’ll install MariaDB database. MariaDB is the Fedora default database. + +``` +$ dnf module list mariadb | sort -u ## lists the streams available +$ sudo dnf module install mariadb:10.3 ##10.4 is the latest +``` + +_Note: the default profile is mariadb/server_. + +For those who need to spin up a Docker container a ready made container with Fedora 31 is available. + +``` +$ docker pull registry.fedoraproject.org/f31/mariadb +$ docker run -d --name mariadb_database -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 registry.fedoraproject.org/f31/mariadb +``` + +Now start the MariaDB service. + +``` +$ sudo systemctl start mariadb +``` + +If you’d like the service to start at boot, you can also enable it in systemd: + +``` +$ sudo systemctl enable mariadb ## start at boot +``` + +Next, setup the database as needed: + +``` +$ mysql -u root -p ## root password is blank +MariaDB> CREATE DATABASE users; +MariaDB> create user dbuser identified by ‘123456‘; +MariaDB> grant select, insert, update, create, drop on users.* to dbuser; +MariaDB> show grants for dbuser; +MariaDB> \q +``` + +A database connector is needed to use the database with Node.js. + +``` +$ npm install mariadb ## installs MariaDB Node.js connector +``` + +We’ll leverage Sequelize in this sample API. Sequelize is a promise-based Node.js ORM (Object Relational Mapper) for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. + +``` +$ npm install sequelize ## installs Sequelize +``` + +### Connecting a new datasource + +Now, create a new _db_ folder and create a new file _sequelize.js_ there: + +``` +const Sequelize = require('sequelize'), + sequelize = new Sequelize(process.env.db_name || 'users', process.env.db_user || 'dbuser', process.env.db_pass || '123456', { + host: 'localhost', + dialect: 'mariadb', + ssl: true +}) + +module.exports = sequelize +``` + +_Note: For the sake of completeness I‘m including a link to the related Github repo: _ + +Let‘s create a new file _models/user.js_. A nice feature of a Sequelize model is that it helps us to create the necessary tables and colums automatically. The code snippet responsible for doing this is seen below: + +``` +sequelize.sync({ +force: false +}) +``` + +Note: never switch to true with a production database – it would _drop your tables at app start_! + +We will refer to the earlier created sequelize.js this way: + +``` +const sequelize = require('../db/sequelize') +``` + +### Building new routes + +Next, you’ll create a new file _routes/user.js_. You already have _routes/users.js_ from the previous article. You can copy and paste the code in and proceed with editing it. + +You’ll also need a reference to the previously created model. + +``` +const User = require('../models/user') +``` + +Change the route path to _/users_ and also create a new **post** method route. + +Mind the async – await keywords there. An interaction with a database will take some time and this one will do the trick. Yes, an async function returns a promise and this one makes promises easy to use. + +_Note: This code is not production ready, since it would also need to include an authentication feature._ + +We‘ll make the new route working this way: + +``` +const userRouter = require('./routes/user') +app.use(userRouter) +``` + +Let‘s also remove the existing _usersRouter_. The _routes/users.js_ can be deleted too. + +``` +$ npm start +``` + +With the above command, you can launch your new app. + +### Using the terminal to send and retrieve data + +Let’s create a new database record through the post method: + +``` +$ curl -d 'name=Adam' http://localhost:3000/users +``` + +To retrieve the data created through the API, do an HTTP GET request: + +``` +$ curl http://localhost:3000/users +``` + +The console output of the curl command is a JSON array containing data of all the records in the _Users_ table. + +_Note: This is not really the usual end result — an application consumes the API finally. The API will usually also have endpoints to update and remove data._ + +### More automation + +Let‘s assume we might want to create an API serving many tables. It‘s possible and very handy to automatically generate models for Sequelize from our database. Sequelize-auto will do the heavy lifting for us. The resulting files (_models.js_) would be placed and imported within the _/models_ directory. + +``` +$ npm install sequelize-auto +``` + +A node.js connector is needed to use this one and we have it already installed for MariaDB. + +### Conclusion + +It‘s possible to develop and run an API using Fedora, Fedora default MariaDB, JavaScript and efficiently develop a solution like with a noSQL database. For those used to working with MongoDB or a similar noSQL database, Fedora and MariaDB are important open-source enablers. + +* * * + +_Photo by [Mazhar Zandsalimi][3] on [Unsplash][4]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-fedora-to-implement-rest-api-in-javascript-part-2/ + +作者:[Vaclav Keil][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/vaclavk/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/javascript-api-2-816x345.jpg +[2]: https://fedoramagazine.org/using-fedora-to-quickly-implement-rest-api-with-javascript/ +[3]: https://unsplash.com/@m47h4r?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[4]: https://unsplash.com/s/photos/javascript?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md b/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md new file mode 100644 index 0000000000..e610f7eb2f --- /dev/null +++ b/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Windows Subsystem for Linux to open Linux on Windows 10 machines) +[#]: via: (https://www.networkworld.com/article/3543845/how-to-use-windows-subsystem-for-linux-to-open-linux-on-windows-10-machines.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to use Windows Subsystem for Linux to open Linux on Windows 10 machines +====== +Opening a Linux terminal on a Windows 10 desktop can help you practice your Linux skills and explore Windows from an entirely different point of view. In this post, we look at Ubuntu 18.04 running through Windows Subsystem for Linux (WSL). +[Nicolas Solerieu modified by IDG Comm. / Linux][1] [(CC0)][2] + +Believe it or not, it's possible to open a Linux terminal on a Windows 10 system and you might be surprised how much Linux functionality you’ll be able to get by doing so. + +You can run Linux commands, traipse around the provided Linux file system and even take a novel look at Windows files. The experience isn’t altogether different than opening a terminal window on a Linux desktop, with a few interesting exceptions. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +What is needed to make this happen is something called the Windows Subsystem for Linux (WSL) and a Windows 10 x86 PC. + +### Linux versions for WSL + +There are a number of options for running Linux on top of Windows. The Linux OS choices include: + + * [Ubuntu 16.04 LTS][4] + * [Ubuntu 18.04 LTS][5] + * [openSUSE Leap 15.1][6] + * [SUSE Linux Enterprise Server 12 SP5][7] + * [SUSE Linux Enterprise Server 15 SP1][8] + * [Kali Linux][9] + * [Debian GNU/Linux][10] + * [Fedora Remix for WSL][11] + * [Pengwin][12] + * [Pengwin Enterprise][13] + * [Alpine WSL][14] + + + +Ubuntu 18.04 LTS is just one option and, in this post, we’ll take a look at how the terminal runs on Windows using this particular distribution and how much it feels like working on a Linux system directly. + +If you want to look into the process of putting an Ubuntu distribution on your Windows system, you can start with this page: + + + +As part of the initial setup of installing your Linux on Windows terminal, you’ll be asked to create your user account. Once you do that and open the terminal, you can start to explore. One of the most noticeable differences between your Linux-on-Windows terminal and a terminal window on a Linux system is that examining processes isn’t going to show you much. After all, Windows will be providing the bulk of the required OS support. You’re likely to see something like this: + +``` +myacct@hostname:~$ ps -ef +UID PID PPID C STIME TTY TIME CMD +root 1 0 0 12:45 ? 00:00:00 /init +root 7 1 0 12:45 tty1 00:00:00 /init +shs 8 7 0 12:45 tty1 00:00:00 -bash +shs 166 8 0 13:32 tty1 00:00:00 ps -ef +``` + +Yes, that's it. + +If you’re anything like me, one of your next moves might be to get a handle on the available commands. If you just count the files in the **/bin** and **/usr/bin** directories, you should see that there are a lot of commands: + +``` +myacct@hostname:~$ ls /bin | wc -l +171 +myacct@hostname:~$ ls /usr/bin | wc -l +707 +``` + +You can list available commands with commands like these (output truncated for this post): + +``` +myacct@hostname:~$ ls /bin | head -25 | column +bash btrfs-map-logical bunzip2 bzegrep bzip2recover +btrfs btrfs-select-super busybox bzexe bzless +btrfs-debug-tree btrfs-zero-log bzcat bzfgrep bzmore +btrfs-find-root btrfsck bzcmp bzgrep cat +btrfs-image btrfstune bzdiff bzip2 chacl + +myacct@hostname:~$ ls /usr/bin | head -25 | column +NF aa-exec apport-cli apt apt-extracttempl* +VGAuthService acpi_listen apport-collect apt-add-repository apt-ftparchive +X11 add-apt-repository apport-unpack apt-cache apt-get +[ addpart appres apt-cdrom apt-key +aa-enabled apport-bug apropos apt-config apt-mark +``` + +You can update the system with **apt** commands (sudo apt update, sudo apt upgrade). You can even use Linux commands to move to the Windows disk partitions as you like and . Notice the last three entries in the output below. These represent several drives on the system. + +``` +myacct@hostname:~$ df -k +Filesystem 1K-blocks Used Available Use% Mounted on +rootfs 973067784 326920584 646147200 34% / +none 973067784 326920584 646147200 34% /dev +none 973067784 326920584 646147200 34% /run +none 973067784 326920584 646147200 34% /run/lock +none 973067784 326920584 646147200 34% /run/shm +none 973067784 326920584 646147200 34% /run/user +cgroup 973067784 326920584 646147200 34% /sys/fs/cgroup +C:\ 973067784 326920584 646147200 34% /mnt/c <== C drive +I:\ 976760000 231268208 745491792 24% /mnt/I <== external drive +L:\ 409599996 159240 409440756 1% /mnt/l <== USB thumb drive +``` + +If you’re interested in moving out of the Linux space and into the Windows portion of the file system within your **WSL** session, you can do that easily. Replace “myname” with your Windows account name and a **cd /mnt/c/Users/_myname_/Desktop** will take you to your Windows desktop. From there, don’t be surprised if in listing your files you see **WRL####.tmp** files that don’t seem to exist when you look at your desktop and don’t show up if you look at your files by opening a command prompt. These appear to be temporary files used by Windows for document management. You might also see files listed that look like **‘~$nux notes.docx’** – perhaps ghosts of files that were once located on your desktop. You won’t see those files when you look at your desktop on Windows – even using a **cmd** window. + +Note that you’ll also see Windows directories such as **‘Program Files’** in single quotes when listed in your Linux terminal as you would any file with blanks included in their names. You can even start a Windows executable from your Linux terminal. For example: + +``` +myacct@hostname: $ cd /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0 +myacct@hostname: $ powershell.exe +``` + +If you do this, type **exit** when you want to end the **powershell** session. + +Linux commands all seem to work as expected, though I don’t get any output when I run the **who** command. + +Windows **.txt** files will display with **cat** commands, but the last line in a file will likely be displayed on the same line as the following shell prompt. This is because these files won’t end with a linefeed as Linux text files do. + +You can create other accounts and switch user to them (e.g., **su – nemo**) if you like, but not log into them directly. + +You can also update the system with apt commands (**sudo apt update**, **sudo apt upgrade**). + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543845/how-to-use-windows-subsystem-for-linux-to-open-linux-on-windows-10-machines.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/4gRNmhGzYZE +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.microsoft.com/store/apps/9pjn388hp8c9 +[5]: https://www.microsoft.com/store/apps/9N9TNGVNDL3Q +[6]: https://www.microsoft.com/store/apps/9NJFZK00FGKV +[7]: https://www.microsoft.com/store/apps/9MZ3D1TRP8T1 +[8]: https://www.microsoft.com/store/apps/9PN498VPMF3Z +[9]: https://www.microsoft.com/store/apps/9PKR34TNCV07 +[10]: https://www.microsoft.com/store/apps/9MSVKQC78PK6 +[11]: https://www.microsoft.com/store/apps/9n6gdm4k2hnc +[12]: https://www.microsoft.com/store/apps/9NV1GV1PXZ6P +[13]: https://www.microsoft.com/store/apps/9N8LP0X93VCP +[14]: https://www.microsoft.com/store/apps/9p804crf0395 +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md b/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md new file mode 100644 index 0000000000..a112f4ca6d --- /dev/null +++ b/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Silverblue, an introduction for developers) +[#]: via: (https://fedoramagazine.org/fedora-silverblue-brings-future-tech-to-the-desktop/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +Fedora Silverblue, an introduction for developers +====== + +![][1] + +The Fedora [Silverblue project][2] takes Fedora workstation, libostree and podman, puts them in a blender, and creates a new Immutable Fedora Workstation. Fedora Silverblue is an OS that stops you from changing the core system files arbitrarily, and readily allows you to change the environment system files. The article [What is Silverblue][3] describes the big picture, and this article drills down into details for the developer. + +Fedora Silverblue ties together a few different projects to make a system that is a git-like object, capable of layering packages, and has a container focused work flow. Silverblue is not the only distribution going down this road. It is the desktop equivalent of [CoreOS][4], the server OS used by [Red Hat Openshift][5]. + +Silverblue’s idea of ‘immutable’ has nothing to do with immutable layers in a container. Silverblue keeps system files immutable by making them read-only. + +### Why immutable? + +Has an upgrade left your system in an unusable state? Have you wondered why one server in a pool of identical machines is being weird? These problems can happen when one system library – one tiny little file out of hundreds – is corrupted, badly configured or the wrong version. Or maybe your upgrade works fine but it’s not what you’d hoped for, and you want to roll back to the previous state. + +An immutable OS is intended to stop problems like these biting you. This is not an easy thing to achieve – simple changes, like flipping the file system between read-write and read-only, may only change a fault-finding headache to a maintenance headache. + +Freezing the system is good news for sysadmins, but what about developers? Setting up a development environment means heavily customizing the system, and filling it with living code that changes over time. The answer is partly a case of combining components, and partly the ability to swap between OS versions. + +### How it works + +So how do you get the benefits of immutability without losing the ability to do your work? If you’re thinking ‘containers’, good guess – part of the solution uses [podman][6]. But much of the work happens underneath the container layer, at the OS level. + +Fedora Silverblue ties together a few different projects to turn an immutable OS into a usable workstation. Silverblue uses libostree to provide the base system, lets you edit config files in /etc/, and provides three different ways to install packages. + + * [rpm-ostree][7] installs RPM packages, similar to DNF in the traditional Fedora workstation. Use this for things that shouldn’t go in containers, like KVM/libvirt. + * [flatpak][8] installs packages from a central flathub repo. This is the one-stop shop for graphical desktop apps like LibreOffice. + * The traditional _dnf install_ still works, but only inside a [toolbox][9] (a Fedora container). A developer’s workbench goes in a toolbox. + + + +If you want to know more about these components, check out [Pieces of Silverblue][10]. + +### Rolling back and pinning upgrades + +All operating systems need upgrades. Features are added, security holes are plugged and bugs are squashed. But sometimes an upgrade is not a developer’s friend. + +A developer depends on many things to get the job done. A good development environment is stuffed with libraries, editors, toolchains and apps that are controlled by the OS, not the developer. An upgrade may cause trouble. Have any of these situations happened to you? + + * A new encryption library is too strict, and an upgrade stopped an API working. + * Code works well, but has deprecated syntax. An upgrade brought error-throwing misery. + * The development environment is lovingly hand-crafted. An upgrade broke dependencies and added conflicts. + + + +In a traditional environment, unpicking a troublesome upgrade is hard. In Silverblue, it’s easy. Silverblue keeps two copies of the OS – your current upgrade and your previous version. Point the OS at the previous version, reboot, and you’ve got your old system files back. + +You aren’t limited to two copies of your file system – you can keep more by pinning your favorite versions. Dusty Mabe, one of the engineers who has been working on the system since the [Project Atomic][11] days, describes how to pin extra copies of the OS in his article [Pinning Deployments in OSTree Based Systems][12]. + +Your home directory is not affected by rolling back. Rpm-ostree does not touch /etc/ and /var/. + +### System updates and package installs + +Silverblue’s rpm-ostree treats all the files as one object, stored in a repository. The working file system is a checked-out copy of this object. After a system update, you get two objects in that repository – one current object and one updated object. The updated object is checked out and becomes the new file system. + +You install your workhorse applications in toolboxes, which provide container isolation. And you install your desktop applications using Flatpak. + +This new OS requires a shift in approach. For instance, you don’t have to keep only one copy of your system files – you can store a few and select which one you use. That means you can swap back and forth between an old Fedora release and the rawhide (development) version in a matter of minutes. + +### Build your own Silverblue VM + +You can safely install Fedora Silverblue in a VM on your workstation. If you’ve got a hypervisor and half an hour to spare (10 minutes for ISO download, and 20 minutes for the build), you can see for yourself. + + 1. Download Fedora Silverblue ISO from + 2. (not Fedora workstation from ). + 3. Boot a VM with the Fedora Silverblue ISO. You can squeeze Fedora into compute resources of 1 CPU, 1024MiB of memory and 12GiB of storage, but bigger is better. + 4. Answer [Anaconda][13]’s questions. + 5. Wait for the [Gnome][14] desktop to appear. + 6. Answer [Initial Setup][15]’s questions. + + + +Then you’re ready to set up your developer’s tools. If you’re looking for an IDE, check these out. Use flatpak on the desktop to install them. + + * [Gnome Builder][16] (Gnome’s official IDE) + * [Eclipse][17] + * [Code::Blocks][18] + + + +Finally, use the CLI to create your first toolbox. Load it with modules using [npm][19], [gem][20], [pip][21], [git][22] or your other favorite tools. + +### Help! + +If you get stuck, ask questions at the [forum][23]. + +If you’re looking for ideas about how to use Silverblue, read articles in the [magazine][24]. + +### Is Silverblue for you? + +Silverblue is full of shiny new tech. That in itself is enough to attract the cool kids, like moths to a flame. But this OS is not for everyone. It’s a young system, so some bugs will still be lurking in there. And pioneering tech requires a change of habit – that’s extra cognitive load that the new user may not want to take on. + +The OS brings immutable benefits, like keeping your system files safe. It also brings some drawbacks, like the need to reboot after adding system packages. Silverblue also enables new ways of working. If you want to explore new directions in the OS, find out if Silverblue brings benefits to your work. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-silverblue-brings-future-tech-to-the-desktop/ + +作者:[Nick Hardiman][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/silverblue-introfordev-816x345.png +[2]: https://silverblue.fedoraproject.org/ +[3]: https://fedoramagazine.org/what-is-silverblue/ +[4]: http://coreos.com/ +[5]: https://www.openshift.com/products/container-platform +[6]: https://github.com/containers/libpod +[7]: https://rpm-ostree.readthedocs.io/en/latest/ +[8]: https://docs.flatpak.org/en/latest/ +[9]: https://github.com/containers/toolbox +[10]: https://fedoramagazine.org/pieces-of-fedora-silverblue/ +[11]: https://www.projectatomic.io/ +[12]: https://www.projectatomic.io/blog/2018/05/pinning-deployments-ostree-based-systems/ +[13]: https://fedoraproject.org/wiki/Anaconda +[14]: https://www.gnome.org/ +[15]: https://fedoraproject.org/wiki/InitialSetup +[16]: https://wiki.gnome.org/Apps/Builder +[17]: https://www.eclipse.org/ide/ +[18]: http://www.codeblocks.org/ +[19]: https://www.npmjs.com/package/package +[20]: https://rubygems.org/ +[21]: https://pypi.org/ +[22]: https://git-scm.com/ +[23]: https://discussion.fedoraproject.org/c/desktop/silverblue/6 +[24]: https://fedoramagazine.org/?s=silverblue diff --git a/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md b/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md new file mode 100644 index 0000000000..77e3cfb5ed --- /dev/null +++ b/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Glico (Weighted Rock Paper Scissors)) +[#]: via: (https://theartofmachinery.com/2020/05/21/glico_weighted_rock_paper_scissors.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Glico (Weighted Rock Paper Scissors) +====== + +This still isn’t the blog post I said I was going to write about now, but I figured some game theory would make a good post at the moment, especially when a lot of people I know are working at home with kids who need entertaining. Here’s some stuff about a traditional Japanese kids’ game called Glico, a form of weighted Rock Paper Scissors (RPS). + +### Glico + +I’ll assume you’re familiar with regular RPS. It’s pretty obvious how to play well: the three plays, “rock”, “paper” and “scissors”, are equally strong, so the only trick is to play them unpredictably enough. + +But what happens if the three plays have different values? Weighted RPS, under the name “Glico”, has been a well-known Japanese children’s game since at least before WWII, but let me explain an English adaptation. Traditionally it’s played starting at the bottom of a flight of stairs, and the aim is to get to the top first. Players can climb up steps by winning rounds of RPS. The trick is that the number of steps depends on the winning hand in each round. A player who wins with “rock” gets to climb up four steps by spelling out R-O-C-K, and similarly “paper” is worth five steps and “scissors” worth eight. This simple twist to the game creates whole new layers of offence and defence as players struggle to win with “scissors” as much as possible, without being too predictable and vulnerable. + +(The rules for the Japanese version vary by region, but usually “rock” is worth 3 steps, while “paper” and “scissors” are worth 6. The mnemonic is that “rock”, “paper” and “scissors” are referred to as グー, パー and チョキ respectively, and the words spelled out when playing are グリコ (“Glico”, a food/confectionary brand), パイナップル (pineapple) and チョコレート (chocolate).) + +Just a few notes before getting into the maths: The game works best with two players, but in the traditional rules for three or more players, each round is handled by having multiple rematches. Each time there’s a clear winning hand (e.g., two players with “paper” beating one with “rock”) the losers are eliminated until there’s one winner. That can take a long time, so cycling systematically between pairs of players might be faster for several players. (I’ll assume two players from now on.) Also, older kids sometimes add an extra challenge by requiring an exact landing at the top of the stairs to win. For example, if you’re five steps from the top, only “paper” will win; “scissors” will overshoot by three steps, and you’ll end up three steps back down from the top. Be warned: that makes gameplay a lot harder. + +### Calculating the optimal strategy + +Simple strategies like “just play rock” are what game theorists call “pure strategies”. By design, no pure strategy in RPS is better than all others, and an adaptive opponent can quickly learn to exploit any pure strategy (e.g., by always playing “paper” against someone who always plays “rock”). Any decent player will play RPS with something like a “mixed strategy” (selecting from the pure strategies at random, maybe with different probabilities). Game theory tells us that finite, two-player, zero-sum games always have optimal mixed strategies — i.e., a mixed strategy that’s as good or better than any other, even against an adaptive opponent. You might do better by exploiting a weak opponent, but you can’t do better against a perfect one. In plain RPS, the statistically unbeatable strategy is to play each hand with equal probability (\frac{1}{3}). + +Glico is made up of multiple rounds of weighted RPS. A truly optimal player won’t just use one set of probabilities (p_{r}), (p_{p}) and (p_{s}) for playing “rock”, “paper” and “scissors” each round. The optimal probabilities will vary depending the position of both players on the stairs. For example, a player who is four steps from winning is either happy with any winning hand, or only wants “rock”, depending on the rules, and (theoretically) both players should recognise that and adapt their probabilities accordingly. However, it’s more practical to play with an optimal greedy strategy — i.e., assuming everyone is just trying to get the maximum step value each round. + +I’ll calculate an optimal greedy strategy for weighted RPS in two ways. One way is longer but uses nothing but high school algebra and logical thinking, while the other way uses the power of linear programming. + +#### The longer way + +The greedy version of Glico has no end goal; the players are just trying to win points. It helps with solving the game if we make it zero sum — any time you win (N) points, your opponent loses (N) points, and vice versa. That just scales and shifts the score per round, so it doesn’t change the optimal strategy. Why do it? We know that optimal players can’t get any advantage over each other because the game is symmetric. If the game is zero sum, that means that no strategy can have an expected value of more than 0 points. That lets us write some equations. For example, playing “rock” might win you 4 points against “scissors”, or lose you 5 against “paper”. Against an optimal opponent, we can say + +[4p_{s} - 5p_{p} \leq 0] + +Is the inequality necessary? When would a pure strategy have a negative value against a non-adaptive but optimal player? Imagine if we added a fourth pure strategy, “bomb”, that simply gave 1000 points to the opponent. Obviously no optimal player would ever play “bomb”, so (p_{b} = 0). Playing “bomb” against an optimal player would have expected value -1000. We can say that some pure strategies are just _bad_: they have suboptimal value against an optimal opponent, and an optimal player will never play them. Other pure strategies have optimal value against an optimal opponent, and they’re reasonable to include in an optimal strategy. + +Bad pure strategies aren’t always as obvious as “bomb”, but we can argue that none of the pure strategies in RPS are bad. “Rock” is the only way to beat “scissors”, and “paper” is the only way to beat “rock”, and “scissors” is the only way to beat “paper”. At least one must be in the optimal strategy, so we can expect them all to be. So let’s make that (\leq) into (=), and add the equations for playing “paper” and “scissors”, plus the fact that these are probabilities that add up to 1: + +[\begin{matrix} {4p_{s} - 5p_{p}} & {= 0} \ {5p_{r} - 8p_{s}} & {= 0} \ {8p_{p} - 4p_{r}} & {= 0} \ {p_{r} + p_{p} + p_{s}} & {= 1} \ \end{matrix}] + +That’s a system of linear equations that can be solved algorithmically using Gaussian elimination — either by hand or by using any good numerical algorithms software. I won’t go into the details, but here’s the solution: + +[\begin{matrix} p_{r} & {= 0.4706} \ p_{p} & {= 0.2353} \ p_{s} & {= 0.2941} \ \end{matrix}] + +Even though it’s worth the least, an optimal player will play “rock” almost half the time to counterattack “scissors”. The rest of the time is split between “paper” and “scissors”, with a slight bias towards “scissors”. + +#### The powerful way + +The previous solution needed special-case analysis: it exploited the symmetry of the game, and made some guesses about how good/bad the pure strategies are. What about games that are more complex, or maybe not even symmetric (say, because one player has a handicap)? There’s a more general solution using what’s called linear programming (which dates to when “programming” just meant “scheduling” or “planning”). + +By the way, linear programming (LP) has a funny place in computer science. There are some industries and academic circles where LP and generalisations like mixed integer programming are super hot. Then there are computer science textbooks that never even mention them, so there are industries where the whole topic is pretty much unheard of. It might be because it wasn’t even known for a long time if LP problems can be solved in polynomial time (they can), so LP doesn’t have the same theoretical elegance as, say, shortest path finding, even if it has a lot of practical use. + +Anyway, solving weighted RPS with LP is pretty straightforward. We just need to describe the game using a bunch of linear inequalities in multiple variables, and express strategic value as a linear function that can be optimised. That’s very similar to what was done before, but this time we won’t try to guess at the values of any strategies. We’ll just assume we’re choosing values (p_{r}), (p_{p}) and (p_{s}) to play against an opponent who scores an average (v) against us each round. The opponent is smart enough to choose a strategy that’s as least as good as any pure strategy, so we can say + +[\begin{matrix} {4p_{s} - 5p_{p}} & {\leq v} \ {5p_{r} - 8p_{s}} & {\leq v} \ {8p_{p} - 4p_{r}} & {\leq v} \ \end{matrix}] + +The opponent can only play some combination of “rock”, “paper” and “scissors”, so (v) can’t be strictly greater than all of them — at least one of the inequalities above must be tight. To model the gameplay fully, the only other constraints we need are the rules of probability: + +[\begin{matrix} {p_{r} + p_{p} + p_{s}} & {= 1} \ p_{r} & {\geq 0} \ p_{p} & {\geq 0} \ p_{s} & {\geq 0} \ \end{matrix}] + +Now we’ve modelled the problem, we just need to express what needs to be optimised. That’s actually dead simple: we just want to minimise (v), the average score the opponent can win from us. An LP solver can find a set of values for all variables that minimises (v) within the constraints, and we can read off the optimal strategy directly. + +I’ve tried a few tools, and the [Julia][1] library [JuMP][2] has my current favourite FOSS API for throwaway optimisation problems. Here’s some code: + +``` +# You might need Pkg.add("JuMP"); Pkg.add("GLPK") +using JuMP +using GLPK + +game = Model(GLPK.Optimizer) + +@variable(game, 0 <= pr <= 1) +@variable(game, 0 <= pp <= 1) +@variable(game, 0 <= ps <= 1) +@variable(game, v) + +@constraint(game, ptotal, pr + pp + ps == 1) +@constraint(game, rock, 4*ps - 5*pp <= v) +@constraint(game, paper, 5*pr - 8*ps <= v) +@constraint(game, scissors, 8*pp - 4*pr <= v) + +@objective(game, Min, v) + +println(game) +optimize!(game) + +println("Opponent's value: ", value(v)) +println("Rock: ", value(pr)) +println("Paper: ", value(pp)) +println("Scissors: ", value(ps)) +``` + +Here’s the output: + +``` +Min v +Subject to + ptotal : pr + pp + ps = 1.0 + rock : 4 ps - 5 pp - v ≤ 0.0 + paper : 5 pr - 8 ps - v ≤ 0.0 + scissors : 8 pp - 4 pr - v ≤ 0.0 + pr ≥ 0.0 + pp ≥ 0.0 + ps ≥ 0.0 + pr ≤ 1.0 + pp ≤ 1.0 + ps ≤ 1.0 + +Opponent's value: 0.0 +Rock: 0.47058823529411764 +Paper: 0.23529411764705882 +Scissors: 0.29411764705882354 +``` + +As argued in the previous solution, the best value the opponent can get against the optimal player is 0. + +### What does optimality mean? + +The optimal solution was calculated assuming an all-powerful opponent. It guarantees that even the best weighted RPS player can’t get an advantage over you, but it turns out you can’t get an advantage over a terrible player, either, if you insist on playing this “optimal” strategy. That’s because weighted RPS has no bad plays, in the sense that “bomb” is bad. _Any_ strategy played against the above “optimal” strategy will have expected value of 0, so it’s really a defensive, or “safe” strategy. To play truly optimally and win against a bad player, you’ll have to adapt your strategy. For example, if your opponent plays “scissors” too often and “paper” not enough, you should adapt by playing “rock” more often. Of course, your opponent might just be pretending to be weak, and could start taking advantage of your deviation from the safe strategy. + +Games don’t always work out like that. For example, in theory, you could derive an optimal safe strategy for more complex games like poker. Such a strategy would tend to win against normal humans because even the best normal humans make bad poker plays. On the other hand, a “shark” at the table might be able to win against the “fish” faster by exploiting their weaknesses more aggressively. If you’re thinking of using LP to directly calculate a strategy for Texas Hold’em, though, sorry, but you’ll hit a combinatorial explosion of pure strategies as you account for all the cases like “if I’m dealt AJ on the big blind and I call a four-blind raise from the button preflop and then the flop is a rainbow 3K9…”. Only heavily simplified toy poker games are solvable with the general approach. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/05/21/glico_weighted_rock_paper_scissors.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://julialang.org/ +[2]: https://github.com/JuliaOpt/JuMP.jl diff --git a/sources/tech/20200521 Use the internet from the command line with curl.md b/sources/tech/20200521 Use the internet from the command line with curl.md new file mode 100644 index 0000000000..c580ea0879 --- /dev/null +++ b/sources/tech/20200521 Use the internet from the command line with curl.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use the internet from the command line with curl) +[#]: via: (https://opensource.com/article/20/5/curl-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Use the internet from the command line with curl +====== +Download our new curl cheat sheet. Curl is a fast and efficient way to +pull the information you need from the internet without using a +graphical interface. +![Cheat Sheet cover image][1] + +Curl is commonly considered a non-interactive web browser. That means it's able to pull information from the internet and display it in your terminal or save it to a file. This is literally what web browsers, such as Firefox or Chromium, do except they _render_ the information by default, while curl downloads and displays raw information. In reality, the curl command does much more and has the ability to transfer data to or from a server using one of many supported protocols, including HTTP, FTP, SFTP, IMAP, POP3, LDAP, SMB, SMTP, and many more. It's a useful tool for the average terminal user, a vital convenience for the sysadmin, and a quality assurance tool for microservices and cloud developers. + +Curl is designed to work without user interaction, so unlike Firefox, you must think about your interaction with online data from start to finish. For instance, if you want to view a web page in Firefox, you launch a Firefox window. After Firefox is open, you type the website you want to visit into the URL field or a search engine. Then you navigate to the site and click on the page you want to see. + +The same concepts apply to curl, except you do it all at once: you launch curl at the same time you feed it the internet location you want and tell it whether you want to the data to be saved in your terminal or to a file. The complexity increases when you have to interact with a site that requires authentication or with an API, but once you learn the **curl** command syntax, it becomes second nature. To help you get the hang of it, we collected the pertinent syntax information in a handy [cheat sheet][2]. + +### Download a file with curl + +You can download a file with the **curl** command by providing a link to a specific URL. If you provide a URL that defaults to **index.html**, then the index page is downloaded, and the file you downloaded is displayed on your terminal screen. You can pipe the output to less or tail or any other command: + + +``` +$ curl "" | tail -n 4 +    <h1>Example Domain</h1> +    <p>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.</p> +    <p><a href="[https://www.iana.org/domains/example"\>More][3] information...</a></p> +</div></body></html> +``` + +Because some URLs contain special characters that your shell normally interprets, it's safest to surround your URL in quotation marks. + +Some files don't translate well to being displayed in a terminal. You can use the **\--remote-name** option to cause the file to be saved according to what it's called on the server: + + +``` +$ curl --remote-name "" +$ ls +linux-distro.iso +``` + +Alternatively, you can use the **\--output** option to name your download whatever you want: + + +``` +`curl "http://example.com/foo.html" --output bar.html` +``` + +### List contents of a remote directory with curl + +Because curl is non-interactive, it's difficult to browse a page for downloadable elements. Provided that the remote server you're connecting to allows it, you can use **curl** to list the contents of a directory: + + +``` +`$ curl --list-only "https://example.com/foo/"` +``` + +### Continue a partial download + +If you're downloading a very large file, you might find that you have to interrupt the download. Curl is intelligent enough to determine where you left off and continue the download. That means the next time you're downloading a 4GB Linux distribution ISO and something goes wrong, you never have to go back to the start. The syntax for **\--continue-at** is a little unusual: if you know the byte count where your download was interrupted, you can provide it; otherwise, you can use a lone dash (**-**) to tell curl to detect it automatically: + + +``` +`$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso"` +``` + +### Download a sequence of files + +If you need to download several files—rather than just one big file—curl can help with that. Assuming you know the location and file-name pattern of the files you want to download, you can use curl's sequencing notation: the start and end point between a range of integers, in brackets. For the output filename, use **#1** to indicate the first variable: + + +``` +`$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp"` +``` + +If you need to use another variable to represent another sequence, denote each variable in the order it appears in the command. For example, in this command, **#1** refers to the directories **images_000** through **images_009**, while **#2** refers to the files **file_1.webp** through **file_4.webp**: + + +``` +$ curl "" \ +\--output "file_#1-#2.webp" +``` + +### Download all PNG files from a site + +You can do some rudimentary web scraping to find what you want to download, too, using only **curl** and **grep**. For instance, say you need to download all images associated with a web page you're archiving. First, download the page referencing the images. Pipe the page to grep with a search for the image type you're targeting (PNG in this example). Finally, create a **while** loop to construct a download URL and to save the files to your computer: + + +``` +$ curl |\ +grep --only-matching 'src="[^"]*.[png]"' |\ +cut -d\" -f2 |\ +while read i; do \ +curl " -o "${i##*/}"; \ +done +``` + +This is just an example, but it demonstrates how flexible curl can be when combined with a Unix pipe and some clever, but basic, parsing. + +### Fetch HTML headers + +Protocols used for data exchange have a lot of metadata embedded in the packets that computers send to communicate. HTTP headers are components of the initial portion of data. It can be helpful to view these headers (especially the response code) when troubleshooting your connection to a site: + + +``` +curl --head "" +HTTP/2 200 +accept-ranges: bytes +age: 485487 +cache-control: max-age=604800 +content-type: text/html; charset=UTF-8 +date: Sun, 26 Apr 2020 09:02:09 GMT +etag: "3147526947" +expires: Sun, 03 May 2020 09:02:09 GMT +last-modified: Thu, 17 Oct 2019 07:18:26 GMT +server: ECS (sjc/4E76) +x-cache: HIT +content-length: 1256 +``` + +### Fail quickly + +A 200 response is the usual HTTP indicator of success, so it's what you usually expect when you contact a server. The famous 404 response indicates that a page can't be found, and 500 means there was a server error. + +To see what errors are happening during negotiation, add the **\--show-error** flag: + + +``` +`$ curl --head --show-error "http://opensource.ga"` +``` + +These can be difficult for you to fix unless you have access to the server you're contacting, but curl generally tries its best to resolve the location you point it to. Sometimes when testing things over a network, seemingly endless retries just waste time, so you can force curl to exit upon failure quickly with the **\--fail-early** option: + + +``` +`curl --fail-early "http://opensource.ga"` +``` + +### Redirect query as specified by a 3xx response + +The 300 series of responses, however, are more flexible. Specifically, the 301 response means that a URL has been moved permanently to a different location. It's a common way for a website admin to relocate content while leaving a "trail" so people visiting the old location can still find it. Curl doesn't follow a 301 redirect by default, but you can make it continue on to a 301 destination by using the **\--location** option: + + +``` +$ curl "" | grep title +<title>301 Moved Permanently</title> +$ curl --location "" +<title>Internet Assigned Numbers Authority</title> +``` + +### Expand a shortened URL + +The **\--location** option is useful when you want to look at shortened URLs before visiting them. Shortened URLs can be useful for social networks with character limits (of course, this may not be an issue if you use a [modern and open source social network][4]) or for print media in which users can't just copy and paste a long URL. However, they can also be a little dangerous because their destination is, by nature, concealed. By combining the **\--head** option to view just the HTTP headers and the **\--location** option to unravel the final destination of a URL, you can peek into a shortened URL without loading the full resource: + + +``` +$ curl --head --location \ +"" +``` + +### [Download our curl cheat sheet][2] + +Once you practice thinking about the process of exploring the web as a single command, curl becomes a fast and efficient way to pull the information you need from the internet without bothering with a graphical interface. To help you build it into your usual workflow, we've created a [curl cheat sheet][2] with common curl uses and syntax, including an overview of using it to query an API. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/curl-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/downloads/curl-command-cheat-sheet +[3]: https://www.iana.org/domains/example"\>More +[4]: https://opensource.com/article/17/4/guide-to-mastodon diff --git a/sources/tech/20200522 A beginner-s guide to web scraping with Python.md b/sources/tech/20200522 A beginner-s guide to web scraping with Python.md new file mode 100644 index 0000000000..010744161b --- /dev/null +++ b/sources/tech/20200522 A beginner-s guide to web scraping with Python.md @@ -0,0 +1,493 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A beginner's guide to web scraping with Python) +[#]: via: (https://opensource.com/article/20/5/web-scraping-python) +[#]: author: (Julia Piaskowski https://opensource.com/users/julia-piaskowski) + +A beginner's guide to web scraping with Python +====== +Get some hands-on experience with essential Python tools to scrape +complete HTML sites. +![HTML code][1] + +There are plenty of great books to help you learn Python, but who actually reads these A to Z? (Spoiler: not me). + +Many people find instructional books useful, but I do not typically learn by reading a book front to back. I learn by doing a project, struggling, figuring some things out, and then reading another book. So, throw away your book (for now), and let's learn some Python. + +What follows is a guide to my first scraping project in Python. It is very low on assumed knowledge in Python and HTML. This is intended to illustrate how to access web page content with Python library [requests][2] and parse the content using [BeatifulSoup4][3], as well as JSON and [pandas][4]. I will briefly introduce [Selenium][5], but I will not delve deeply into how to use that library—that topic deserves its own tutorial. Ultimately I hope to show you some tricks and tips to make web scraping less overwhelming. + +### Installing our dependencies + +All the resources from this guide are available at my [GitHub repo][6]. If you need help installing Python 3, check out the tutorials for [Linux][7], [Windows][8], and [Mac][9]. + + +``` +$ python3 -m venv +$ source venv/bin/activate +$ pip install requests bs4 pandas +``` + +If you like using JupyterLab, you can run all the code using this [notebook][10]. There are a lot of ways to [install JupyterLab][11], and this is one of them: + + +``` +# from the same virtual environment as above, run: +$ pip install jupyterlab +``` + +### Setting a goal for our web scraping project + +Now we have our dependencies installed, but what does it take to scrape a webpage?  + +Let's take a step back and be sure to clarify our goal. Here is my list of requirements for a successful web scraping project. + + * We are gathering information that is worth the effort it takes to build a working web scraper. + * We are downloading information that can be legally and ethically gathered by a web scraper. + * We have some knowledge of how to find the target information in HTML code. + * We have the right tools: in this case, it's the libraries **BeautifulSoup** and **requests**. + * We know (or are willing to learn) how to parse JSON objects. + * We have enough data skills to use **pandas**. + + + +A comment on HTML: While HTML is the beast that runs the Internet, what we mostly need to understand is how tags work. A tag is a collection of information sandwiched between angle-bracket enclosed labels. For example, here is a pretend tag, called "pro-tip": + + +``` +<pro-tip> All you need to know about html is how tags work </pro-tip> +``` + +We can access the information in there ("All you need to know…") by calling its tag "pro-tip." How to find and access a tag will be addressed further in this tutorial. For more of a look at HTML basics, check out [this article][12]. + +### What to look for in a web scraping project + +Some goals for gathering data are more suited for web scraping than others. My guidelines for what qualifies as a good project are as follows. + +There is no public API available for the data. It would be much easier to capture structured data through an API, and it would help clarify both the legality and ethics of gathering the data. There needs to be a sizable amount of structured data with a regular, repeatable format to justify this effort. Web scraping can be a pain. BeautifulSoup (bs4) makes this easier, but there is no avoiding the individual idiosyncrasies of websites that will require customization. Identical formatting of the data is not required, but it does make things easier. The more "edge cases" (departures from the norm) present, the more complicated the scraping will be. + +Disclaimer: I have zero legal training; the following is not intended to be formal legal advice. + +On the note of legality, accessing vast troves of information can be intoxicating, but just because it's possible doesn't mean it should be done. + +There is, thankfully, public information that can guide our morals and our web scrapers. Most websites have a [robots.txt][13] file associated with the site, indicating which scraping activities are permitted and which are not. It's largely there for interacting with search engines (the ultimate web scrapers). However, much of the information on websites is considered public information. As such, some consider the robots.txt file as a set of recommendations rather than a legally binding document. The robots.txt file does not address topics such as ethical gathering and usage of the data. + +Questions I ask myself before beginning a scraping project: + + * Am I scraping copyrighted material? + * Will my scraping activity compromise individual privacy? + * Am I making a large number of requests that may overload or damage a server? + * Is it possible the scraping will expose intellectual property I do not own? + * Are there terms of service governing use of the website, and am I following those? + * Will my scraping activities diminish the value of the original data? (for example, do I plan to repackage the data as-is and perhaps siphon off website traffic from the original source)? + + + +When I scrape a site, I make sure I can answer "no" to all of those questions. + +For a deeper look at the legal concerns, see the 2018 publications [Legality and Ethics of Web Scraping by Krotov and Silva][14] and [Twenty Years of Web Scraping and the Computer Fraud and Abuse Act by Sellars][15]. + +### Now it's time to scrape! + +After assessing the above, I came up with a project. My goal was to extract addresses for all Family Dollar stores in Idaho. These stores have an outsized presence in rural areas, so I wanted to understand how many there are in a rather rural state. + +The starting point is the [location page for Family Dollar][16]. + +![Family Dollar Idaho locations page][17] + +To begin, let's load up our prerequisites in our Python virtual environment. The code from here is meant to be added to a Python file (_scraper.py_ if you're looking for a name) or be run in a cell in JupyterLab. + + +``` +import requests # for making standard html requests +from bs4 import BeautifulSoup # magical tool for parsing html data +import json # for parsing data +from pandas import DataFrame as df # premier library for data organization +``` + +Next, we request data from our target URL. + + +``` +page = requests.get("") +soup = BeautifulSoup(page.text, 'html.parser') +``` + +BeautifulSoup will take HTML or XML content and transform it into a complex tree of objects. Here are several common object types that we will use. + + * **BeautifulSoup**—the parsed content + * **Tag**—a standard HTML tag, the main type of bs4 element you will encounter + * **NavigableString**—a string of text within a tag + * **Comment**—a special type of NavigableString + + + +There is more to consider when we look at **requests.get()** output. I've only used **page.text()** to translate the requested page into something readable, but there are other output types: + + * **page.text()** for text (most common) + * **page.content()** for byte-by-byte output + * **page.json()** for JSON objects + * **page.raw()** for the raw socket response (no thank you) + + + +I have only worked on English-only sites using the Latin alphabet. The default encoding settings in **requests** have worked fine for that. However, there is a rich internet world beyond English-only sites. To ensure that **requests** correctly parses the content, you can set the encoding for the text: + + +``` +page = requests.get(URL) +page.encoding = 'ISO-885901' +soup = BeautifulSoup(page.text, 'html.parser') +``` + +Taking a closer look at BeautifulSoup tags, we see: + + * The bs4 element **tag** is capturing an HTML tag + * It has both a name and attributes that can be accessed like a dictionary: **tag['someAttribute']** + * If a tag has multiple attributes with the same name, only the first instance is accessed. + * A tag's children are accessed via **tag.contents**. + * All tag descendants can be accessed with **tag.contents**. + * You can always access the full contents as a string with: **re.compile("your_string")** instead of navigating the HTML tree. + + + +### Determine how to extract relevant content + +Warning: this process can be frustrating. + +Extraction during web scraping can be a daunting process filled with missteps. I think the best way to approach this is to start with one representative example and then scale up (this principle is true for any programming task). Viewing the page's HTML source code is essential. There are a number of ways to do this. + +You can view the entire source code of a page using Python in your terminal (not recommended). Run this code at your own risk: + + +``` +print(soup.prettify()) +``` + +While printing out the entire source code for a page might work for a toy example shown in some tutorials, most modern websites have a massive amount of content on any one of their pages. Even the 404 page is likely to be filled with code for headers, footers, and so on. + +It is usually easiest to browse the source code via **View Page Source** in your favorite browser (right-click, then select "view page source"). That is the most reliable way to find your target content (I will explain why in a moment). + +![Family Dollar page source code][18] + +  + +In this instance, I need to find my target content—an address, city, state, and zip code—in this vast HTML ocean. Often, a simple search of the page source (**ctrl + F**) will yield the section where my target location is located. Once I can actually see an example of my target content (the address for at least one store), I look for an attribute or tag that sets this content apart from the rest. + +It would appear that first, I need to collect web addresses for different cities in Idaho with Family Dollar stores and visit those websites to get the address information. These web addresses all appear to be enclosed in a **href** tag. Great! I will try searching for that using the **find_all** command: + + +``` +dollar_tree_list = soup.find_all('href') +dollar_tree_list +``` + +Searching for **href** did not yield anything, darn. This might have failed because **href** is nested inside the class **itemlist**. For the next attempt, search on **item_list**. Because "class" is a reserved word in Python, **class_** is used instead. The bs4 function **soup.find_all()** turned out to be the Swiss army knife of bs4 functions. + + +``` +dollar_tree_list = soup.find_all(class_ = 'itemlist') +for i in dollar_tree_list[:2]: +  print(i) +``` + +Anecdotally, I found that searching for a specific class was often a successful approach. We can learn more about the object by finding out its type and length. + + +``` +type(dollar_tree_list) +len(dollar_tree_list) +``` + +The content from this BeautifulSoup "ResultSet" can be extracted using **.contents**. This is also a good time to create a single representative example. + + +``` +example = dollar_tree_list[2] # a representative example +example_content = example.contents +print(example_content) +``` + +Use **.attr** to find what attributes are present in the contents of this object. Note: **.contents** usually returns a list of exactly one item, so the first step is to index that item using the bracket notation. + + +``` +example_content = example.contents[0] +example_content.attrs +``` + +Now that I can see that **href** is an attribute, that can be extracted like a dictionary item: + + +``` +example_href = example_content['href'] +print(example_href) +``` + +### Putting together our web scraper + +All that exploration has given us a path forward. Here's the cleaned-up version of the logic we figured out above. + + +``` +city_hrefs = [] # initialise empty list + +for i in dollar_tree_list: +    cont = i.contents[0] +    href = cont['href'] +    city_hrefs.append(href) + +#  check to be sure all went well +for i in city_hrefs[:2]: +  print(i) +``` + +The output is a list of URLs of Family Dollar stores in Idaho to scrape. + +That said, I still don't have address information! Now, each city URL needs to be scraped to get this information. So we restart the process, using a single, representative example. + + +``` +page2 = requests.get(city_hrefs[2]) # again establish a representative example +soup2 = BeautifulSoup(page2.text, 'html.parser') +``` + +![Family Dollar map and code][19] + +The address information is nested within **type= "application/ld+json"**. After doing a lot of geolocation scraping, I've come to recognize this as a common structure for storing address information. Fortunately, **soup.find_all()** also enables searching on **type**. + + +``` +arco = soup2.find_all(type="application/ld+json") +print(arco[1]) +``` + +The address information is in the second list member! Finally! + +I extracted the contents (from the second list item) using **.contents** (this is a good default action after filtering the soup). Again, since the output of contents is a list of one, I indexed that list item: + + +``` +arco_contents = arco[1].contents[0] +arco_contents +``` + +Wow, looking good. The format presented here is consistent with the JSON format (also, the type did have "**json**" in its name). A JSON object can act like a dictionary with nested dictionaries inside. It's actually a nice format to work with once you become familiar with it (and it's certainly much easier to program than a long series of RegEx commands). Although this structurally looks like a JSON object, it is still a bs4 object and needs a formal programmatic conversion to JSON to be accessed as a JSON object: + + +``` +arco_json =  json.loads(arco_contents) + +[/code] [code] + +type(arco_json) +print(arco_json) +``` + +In that content is a key called **address** that has the desired address information in the smaller nested dictionary. This can be retrieved thusly: + + +``` +arco_address = arco_json['address'] +arco_address +``` + +Okay, we're serious this time. Now I can iterate over the list store URLs in Idaho: + + +``` +locs_dict = [] # initialise empty list + +for link in city_hrefs: +  locpage = requests.get(link)   # request page info +  locsoup = BeautifulSoup(locpage.text, 'html.parser') +      # parse the page's content +  locinfo = locsoup.find_all(type="application/ld+json") +      # extract specific element +  loccont = locinfo[1].contents[0]   +      # get contents from the bs4 element set +  locjson = json.loads(loccont)  # convert to json +  locaddr = locjson['address'] # get address +  locs_dict.append(locaddr) # add address to list +``` + +### Cleaning our web scraping results with pandas + +We have loads of data in a dictionary, but we have some additional crud that will make reusing our data more complex than it needs to be. To do some final data organization steps, we convert to a pandas data frame, drop the unneeded columns "**@type**" and "**country**"), and check the top five rows to ensure that everything looks alright. + + +``` +locs_df = df.from_records(locs_dict) +locs_df.drop(['@type', 'addressCountry'], axis = 1, inplace = True) +locs_df.head(n = 5) +``` + +Make sure to save results!! + + +``` +df.to_csv(locs_df, "family_dollar_ID_locations.csv", sep = ",", index = False) +``` + +We did it! There is a comma-separated list of all the Idaho Family Dollar stores. What a wild ride. + +### A few words on Selenium and data scraping + +[Selenium][5] is a common utility for automatic interaction with a webpage. To explain why it's essential to use at times, let's go through an example using Walgreens' website. **Inspect Element** provides the code for what is displayed in a browser: + +![Walgreens location page and code][20] + +  + +While **View Page Source** provides the code for what **requests** will obtain: + +![Walgreens source code][21] + +When these two don't agree, there are plugins modifying the source code—so, it should be accessed after the page has loaded in a browser. **requests** cannot do that, but **Selenium** can. + +Selenium requires a web driver to retrieve the content. It actually opens a web browser, and this page content is collected. Selenium is powerful—it can interact with loaded content in many ways (read the documentation). After getting data with **Selenium**, continue to use **BeautifulSoup** as before: + + +``` +url = "[https://www.walgreens.com/storelistings/storesbycity.jsp?requestType=locator\&state=ID][22]" +driver = webdriver.Firefox(executable_path = 'mypath/geckodriver.exe') +driver.get(url) +soup_ID = BeautifulSoup(driver.page_source, 'html.parser') +store_link_soup = soup_ID.find_all(class_ = 'col-xl-4 col-lg-4 col-md-4') +``` + +I didn't need Selenium in the case of Family Dollar, but I do keep it on hand for those times when rendered content differs from source code. + +### Wrapping up + +In conclusion, when using web scraping to accomplish a meaningful task: + + * Be patient + * Consult the manuals (these are very helpful) + + + +If you are curious about the answer: + +![Family Dollar locations map][23] + +There are many many Family Dollar stores in America. + +The complete source code is: + + +``` +import requests +from bs4 import BeautifulSoup +import json +from pandas import DataFrame as df + +page = requests.get("") +soup = BeautifulSoup(page.text, 'html.parser') + +# find all state links +state_list = soup.find_all(class_ = 'itemlist') + +state_links = [] + +for i in state_list: +    cont = i.contents[0] +    attr = cont.attrs +    hrefs = attr['href'] +    state_links.append(hrefs) + +# find all city links +city_links = [] + +for link in state_links: +    page = requests.get(link) +    soup = BeautifulSoup(page.text, 'html.parser') +    familydollar_list = soup.find_all(class_ = 'itemlist') +    for store in familydollar_list: +        cont = store.contents[0] +        attr = cont.attrs +        city_hrefs = attr['href'] +        city_links.append(city_hrefs) +# to get individual store links +store_links = [] + +for link in city_links: +    locpage = requests.get(link) +    locsoup = BeautifulSoup(locpage.text, 'html.parser') +    locinfo = locsoup.find_all(type="application/ld+json") +    for i in locinfo: +        loccont = i.contents[0] +        locjson = json.loads(loccont) +        try: +            store_url = locjson['url'] +            store_links.append(store_url) +        except: +            pass + +# get address and geolocation information +stores = [] + +for store in store_links: +    storepage = requests.get(store) +    storesoup = BeautifulSoup(storepage.text, 'html.parser') +    storeinfo = storesoup.find_all(type="application/ld+json") +    for i in storeinfo: +        storecont = i.contents[0] +        storejson = json.loads(storecont) +        try: +            store_addr = storejson['address'] +            store_addr.update(storejson['geo']) +            stores.append(store_addr) +        except: +            pass + +# final data parsing +stores_df = df.from_records(stores) +stores_df.drop(['@type', 'addressCountry'], axis = 1, inplace = True) +stores_df['Store'] = "Family Dollar" + +df.to_csv(stores_df, "family_dollar_locations.csv", sep = ",", index = False) +``` + +\-- +_Author's note: This article is an adaptation of a [talk I gave at PyCascades][24] in Portland, Oregon on February 9, 2020._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/web-scraping-python + +作者:[Julia Piaskowski][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/julia-piaskowski +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_html_code.png?itok=VjUmGsnl (HTML code) +[2]: https://requests.readthedocs.io/en/master/ +[3]: https://beautiful-soup-4.readthedocs.io/en/latest/ +[4]: https://pandas.pydata.org/ +[5]: https://www.selenium.dev/ +[6]: https://github.com/jpiaskowski/pycas2020_web_scraping +[7]: https://opensource.com/article/20/4/install-python-linux +[8]: https://opensource.com/article/19/8/how-install-python-windows +[9]: https://opensource.com/article/19/5/python-3-default-mac +[10]: https://github.com/jpiaskowski/pycas2020_web_scraping/blob/master/example/Familydollar_location_scrape-all-states.ipynb +[11]: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html +[12]: https://opensource.com/article/20/4/build-websites +[13]: https://www.contentkingapp.com/academy/robotstxt/ +[14]: https://www.researchgate.net/publication/324907302_Legality_and_Ethics_of_Web_Scraping +[15]: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3221625 +[16]: https://locations.familydollar.com/id/ +[17]: https://opensource.com/sites/default/files/uploads/familydollar1.png (Family Dollar Idaho locations page) +[18]: https://opensource.com/sites/default/files/uploads/familydollar2.png (Family Dollar page source code) +[19]: https://opensource.com/sites/default/files/uploads/familydollar3.png (Family Dollar map and code) +[20]: https://opensource.com/sites/default/files/uploads/walgreens1.png (Walgreens location page and code) +[21]: https://opensource.com/sites/default/files/uploads/walgreens2.png (Walgreens source code) +[22]: https://www.walgreens.com/storelistings/storesbycity.jsp?requestType=locator\&state=ID +[23]: https://opensource.com/sites/default/files/uploads/family_dollar_locations.png (Family Dollar locations map) +[24]: https://2020.pycascades.com/talks/adventures-in-babysitting-webscraping-for-python-and-html-novices/ diff --git a/sources/tech/20200522 Fast data modeling with JavaScript.md b/sources/tech/20200522 Fast data modeling with JavaScript.md new file mode 100644 index 0000000000..9c565d6e90 --- /dev/null +++ b/sources/tech/20200522 Fast data modeling with JavaScript.md @@ -0,0 +1,452 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fast data modeling with JavaScript) +[#]: via: (https://opensource.com/article/20/5/data-modeling-javascript) +[#]: author: (Szymon https://opensource.com/users/schodevio) + +Fast data modeling with JavaScript +====== +This tutorial showcases a method to model data in just a few minutes. +![Analytics: Charts and Graphs][1] + +As a backend developer at the [Railwaymen][2], a software house in Kraków, Poland, some of my tasks rely on models that manipulate and customize data retrieved from a database. When I wanted to improve my skills in frontend frameworks, I [chose Vue][3], and I thought it would be good to have a similar way to model data in a store. I started with some libraries that I found through [NPM][4], but they offered many more features than I needed. + +So I decided to build my own solution, and I was very surprised that the base took less than 15 lines of code and is very flexible. I implemented this solution in an open source application which I developed and called [Evally][5] - a web app that helps businesses keep track of their employees' performance reviews and professional development. It reminds managers or HR representatives about employees' upcoming evaluations and gathers all of the data needed to assess their performance in the fairest way. + +### Model and list + +The only things you need to do are to create a class and use the defaultsDeep function in the [Lodash][6] JavaScript library: + + +``` +`_.defaultsDeep(object, [sources])` +``` + +Arguments: + + * `object (Object)`: The destination object + * `[sources] (...Object)`: The source objects + + + +Returns: + + * `(Object)`: Returns object + + + +This helper function: [Lodash Docs][7] + +> "Assigns recursively own and inherited enumerable string keyed properties of source objects to the destination object for all destination properties that resolve to undefined. Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored." + +For example: + + +``` +_.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }) + // => { 'a': { 'b': 2, 'c': 3 } } +``` + +That's all! To try it out, create a file called **base.js** and import the defaultsDeep function from the Lodash package: + + +``` + // base.js + import defaultsDeep from "lodash/defaultsDeep"; +``` + +Next, create and export the Model class, where constructor will use the Lodash helper function to assign values to all passed attributes and initialize the attributes that were not received with default values: + + +``` + // base.js + // ... + + export class Model { +   constructor(attributes = {}) { +     defaultsDeep(this, attributes, this.defaults); +   } + } +``` + +Now, create your first real model, Employee, with attributes for firstName, lastName, position and hiredAt where "position" defines "Programmer" as the default value: + + +``` + // employee.js + import { Model } from "./base.js"; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + } +``` + +Next, begin creating employees: + + +``` +// app.js + import { Employee } from "./employee.js"; + + const programmer = new Employee({ +   firstName: "Will", +   lastName: "Smith" + }); + + // => Employee { + //   firstName: "Will", + //   lastName: "Smith", + //   position: "Programmer", + //   hiredAt: "", + //   constructor: Object + // } + + const techLeader = new Employee({ +   firstName: "Charles", +   lastName: "Bartowski", +   position: "Tech Leader" + }); + + // => Employee { + //   firstName: "Charles", + //   lastName: "Bartowski", + //   position: "Tech Leader", + //   hiredAt: "", + //   constructor: Object + // } +``` + +You have two employees, and the first one's position is assigned from the defaults. Here's how multiple employees can be defined: + + +``` + // base.js + + // ... + + export class List { +   constructor(items = []) { +     this.models = items.map(item => new this.model(item)); +   } + } + +[/code] [code] + + // employee.js + import { Model, List } from "./base.js"; + + // … + + export class EmployeesList extends List { +   get model() { +     return Employee; +   } + } +``` + +The List class constructor maps an array of received items into an array of desired models. The only requirement is to provide a correct model class name: + + +``` + // app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + const employees = new EmployeesList([ +   { +     firstName: "Will", +     lastName: "Smith" +   }, +   { +     firstName: "Charles", +     lastName: "Bartowski", +     position: "Tech Leader" +   } + ]); + + // => EmployeesList {models: Array[2], constructor: Object} + //  models: Array[2] + //   0: Employee + //     firstName: "Will" + //     lastName: "Smith" + //     position: "Programmer" + //     hiredAt: "" + //     <constructor>: "Employee" + //   1: Employee + //     firstName: "Charles" + //     lastName: "Bartowski" + //     position: "Tech Leader" + //     hiredAt: "" + //     <constructor>: "Employee" + //   <constructor>: "EmployeesList" +``` + +### Ways to use this approach + +This simple solution allows you to keep your data structure in one place and avoid code repetition. The [DRY][8] principle rocks! You can also customize your models as needed, such as in the following examples. + +#### Custom getters + +Do you need one attribute to be dependent on the others? No problem; you can do this by improving your Employee model: + + +``` +// employee.js + import { Model } from "./base.js"; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + +   get fullName() { +     return [this.firstName, this.lastName].join(' ') +   } + + } + +[/code] [code] + +// app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + console.log(techLeader.fullName); + // => Charles Bartowski +``` + +Now you don't have to repeat the code to do something as simple as displaying the employee's full name. + +#### Date formatting + +Model is a good place to define other formats for given attributes. The best examples are dates: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + +   get formattedHiredDate() { +     if (!this.hiredAt) return "---"; + +     return moment(this.hiredAt).format('MMMM DD, YYYY'); +   } + } + +[/code] [code] + +// app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + techLeader.hiredAt = "2020-05-01"; + + console.log(techLeader.formattedHiredDate); + // => May 01, 2020 +``` + +Another case related to dates (which I discovered developing the Evally app) is the ability to operate with different date formats. Here's an example that uses datepicker: + + 1. All employees fetched from the database have the hiredAt date in the format: +YEAR-MONTH-DAY, e.g., 2020-05-01 + 2. You need to display the hiredAt date in a more friendly format: +MONTH DAY, YEAR, e.g., May 01, 2020 + 3. A datepicker uses the format: +DAY-MONTH-YEAR, e.g., 01-05-2020 + + + +Resolve this issue with: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { + +   // … + +   get formattedHiredDate() { +     if (!this.hiredAt) return "---"; + +     return moment(this.hiredAt).format('MMMM DD, YYYY'); +   } + +   get hiredDate() { +     return ( +       this.hiredAt +         ? moment(this.hiredAt).format('DD-MM-YYYY') +         : '' +     ); +   } + +   set hiredDate(date) { +     const mDate = moment(date, 'DD-MM-YYYY'); +  +     this.hiredAt = ( +       mDate.isValid() +         ? mDate.format('YYYY-MM-DD') +         : '' +     ); +   } + } +``` + +This adds getter and setter functions to handle datepicker's functionality. + + +``` + // Get date from server + techLeader.hiredAt = '2020-05-01'; + console.log(techLeader.formattedHiredDate); + // => May 01, 2020 + + // Datepicker gets date + console.log(techLeader.hiredDate); + // => 01-05-2020 + + // Datepicker sets new date + techLeader.hiredDate = '15-06-2020'; + + // Display new date + console.log(techLeader.formattedHiredDate); + // => June 15, 2020 +``` + +This makes it very simple to manage multiple date formats. + +#### Storage for model-related information + +Another use for a model class is storing general information related to the model, like paths for routing: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { + +   // … + +   static get routes() { +     return { +       employeesPath: '/api/v1/employees', +       employeePath: id => `/api/v1/employees/${id}` +     } +   } + + } + +[/code] [code] + + // Path for POST requests + console.log(Employee.routes.employeesPath) + + // Path for GET request + console.log(Employee.routes.employeePath(1)) +``` + +### Customize the list of models + +Don't forget about the List class, which you can customize as needed: + + +``` +// employee.js + import { Model, List } from "./base.js"; + + // … + + export class EmployeesList extends List { +   get model() { +     return Employee; +   } + +   findByFirstName(val) { +     return this.models.find(item => item.firstName === val); +   } + +   filterByPosition(val) { +     return this.models.filter(item => item.position === val); +   } + } + +[/code] [code] + + console.log(employees.findByFirstName('Will')) + // => Employee { + //   firstName: "Will", + //   lastName: "Smith", + //   position: "Programmer", + //   hiredAt: "", + //   constructor: Object + // } + + console.log(employees.filterByPosition('Tech Leader')) + // => [Employee] + //     0: Employee + //       firstName: "Charles" + //       lastName: "Bartowski" + //       position: "Tech Leader" + //       hiredAt: "" + //       <constructor>: "Employee" +``` + +### Summary + +This simple structure for data modeling in JavaScript should save you some development time. You can add new functions whenever you need them to keep your code cleaner and easier to maintain. All of this code is available in my [CodeSandbox][9], so try it out and let me know how it goes by leaving a comment below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/data-modeling-javascript + +作者:[Szymon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/schodevio +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://railwaymen.org/ +[3]: https://blog.railwaymen.org/vue-vs-react-which-one-is-better-for-your-app-similarities-differences +[4]: https://www.npmjs.com/ +[5]: https://github.com/railwaymen/evally +[6]: https://lodash.com/ +[7]: https://lodash.com/docs/4.17.15 +[8]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself +[9]: https://codesandbox.io/s/02jsdatamodels-1mhtb diff --git a/sources/tech/20200524 Diamond interface composition in Go 1.14.md b/sources/tech/20200524 Diamond interface composition in Go 1.14.md new file mode 100644 index 0000000000..611bb2c39e --- /dev/null +++ b/sources/tech/20200524 Diamond interface composition in Go 1.14.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Diamond interface composition in Go 1.14) +[#]: via: (https://dave.cheney.net/2020/05/24/diamond-interface-composition-in-go-1-14) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Diamond interface composition in Go 1.14 +====== + +Per the [overlapping interfaces proposal][1], Go 1.14 now permits embedding of interfaces with overlapping method sets. This is a brief post explain what this change means: + +Let’s start with the definition of the three key interfaces from the `io` package; `io.Reader`, `io.Writer`, and `io.Closer`: + +``` +package io + +type Reader interface { + Read([]byte) (int, error) +} + +type Writer interface { + Write([]byte) (int, error) +} + +type Closer interface { + Close() error +} +``` + +Just as embedding a type inside a struct allows the embedded type’s fields and methods to be accessed as if it were declared on the embedding type[1][2], the process is true for interfaces. Thus there is no difference between explicitly declaring + +``` +type ReadCloser interface { + Read([]byte) (int, error) + Close() error +} +``` + +and using embedding to compose the interface + +``` +type ReadCloser interface { + Reader + Closer +} +``` + +You can even mix and match + +``` +type WriteCloser interface { + Write([]byte) (int, error) + Closer +} +``` + +However, prior to Go 1.14, if you continued to compose interface declarations in this manner you would likely find that something like this, + +``` +type ReadWriteCloser interface { + ReadCloser + WriterCloser +} +``` + +would fail to compile + +``` +% go build interfaces.go +command-line-arguments +./interfaces.go:27:2: duplicate method Close +``` + +Fortunately, with Go 1.14 this is no longer a limitation, thus solving problems that typically occur with diamond-shaped embedding graphs. + +However, there is a catch that I ran into attempting to demonstrate this feature to the local user group–this feature is only enabled when the Go compiler uses the 1.14 (or later) spec. + +As near as I can make out the rules for which version of the Go spec is used during compilation appear to be: + + 1. If your source code is stored inside `GOPATH` (or you have _disabled_ modules with `GO111MODULE=off`) then the version of the Go spec used to compile with matches the version of the compiler you are using. Said another way, if you have Go 1.13 installed, your Go version is 1.13. If you have Go 1.14 installed, your version is 1.14. No surprises here. + 2. If your source code is stored outside `GOPATH` (or you have forced modules on with `GO111MODULE=on`) then the `go` tool will take the Go version from the `go.mod` file. + 3. If there is no Go version listed in `go.mod` then the version of the spec will be the version of Go installed. This is identical to point 1. + 4. If you are in module mode, either by being outside `GOPATH` or with `GO111MODULE=on`, but there is no `go.mod` file in the current, or any parent, directory then the version of the Go spec used to compile your code defaults to Go 1.13. + + + +The last point caught me out. + + 1. It is said that embedding promotes the type’s fields and methods.[][3] + + + +### Related posts: + + 1. [Struct composition with Go][4] + 2. [term: low level serial with a high level interface][5] + 3. [Accidental method value][6] + 4. [How does the go build command work ?][7] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/24/diamond-interface-composition-in-go-1-14 + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/proposal/blob/master/design/6977-overlapping-interfaces.md +[2]: tmp.nUQHg5BP9T#easy-footnote-bottom-1-4179 (It is said that embedding promotes the type’s fields and methods.) +[3]: tmp.nUQHg5BP9T#easy-footnote-1-4179 +[4]: https://dave.cheney.net/2015/05/22/struct-composition-with-go (Struct composition with Go) +[5]: https://dave.cheney.net/2014/05/08/term-low-level-serial-with-a-high-level-interface (term: low level serial with a high level interface) +[6]: https://dave.cheney.net/2014/05/19/accidental-method-value (Accidental method value) +[7]: https://dave.cheney.net/2013/10/15/how-does-the-go-build-command-work (How does the go build command work ?) diff --git a/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md b/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md new file mode 100644 index 0000000000..616ee5971a --- /dev/null +++ b/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (CopyQ Clipboard Manager for Keeping a Track of Clipboard History) +[#]: via: (https://itsfoss.com/copyq-clipboard-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +CopyQ Clipboard Manager for Keeping a Track of Clipboard History +====== + +How do you copy-paste text? Let me guess. You either use the right click menu to copy-paste or use Ctrl+C to copy a text and Ctrl+V to paste the text. The text copied this way is saved to ‘clipboard’. The [clipboard][1] is a special location in the memory of your system that stores cut or copied text (and in some cases images). + +But have you ever been in a situation where you had a text copied and then you copy another text and then realize you needed the text you copied earlier? Trust me, it happens a lot. + +Instead of wondering about finding the previous text to copy again, you can use a clipboard manager. + +A clipboard manager is a handy little tool that keeps a history of the text you had copied. If you need to use the earlier copied text, you can use the clipboard manager to copy it again. + +![Clipboard][2] + +There are several clipboard managers available for Linux. In this article, I’ll cover one such tool that goes by the name CopyQ. + +### CopyQ Clipboard Manager + +[CopyQ][3] is nifty clipboard manager that has plenty of features to manage your system’s clipboard. It is an open source software available for free for major Linux distributions. + +Like any other clipboard manager, CopyQ monitors the system clipboard and saves its content. It can save both text and images from the clipboard. + +CopyQ sits in the system tray and you can easily access it from there. From the system tray, just click on the text that you want. It will automatically copy this text and you would notice that the copied text moves on to the top of the saved clipboards. + +![][4] + +In the system tray, it shows only the five recent clips. You can open the main window using the “Show/hide main window” option in the system tray. CopyQ saves up to 200 clips. You may edit the clipboard items here. + +![][5] + +You may also set a keyboard shortcut to bring the clipboard with a few key combination. This option is available in Preferences->Shortcuts. + +![][6] + +If you decide to use it, I advise enabling the autostart so that CopyQ runs automatically when you start your system. By default, it saves 200 items in the history and that’s a lot in my opinion. You may want to change that as well. + +![][7] + +CopyQ is an advanced clipboard manager with plenty of additional features. You can search for text in the saved clipboard items. You can sort, create, edit or change the order of the clipboard items. + +You can ignore clipboard copied from some windows or containing some text. You can also temporarily disable clipboard saving. CopyQ also supports [Vim][8]-like editor and shortcut for Vim fans. + +There are many more features that you may explore on your own. For me, the most notable feature is that it gives me easy access to older copied text, and I am happy with that. + +### Installing CopyQ on Linux + +CopyQ is available for Linux, Windows and macOS. You can get the executable file for Windows and macOS [from its website][3]. + +For Linux, CopyQ is available in the repositories of all major Linux distributions. Which means that you can find it in your software center or install it using your distribution’s package manager. + +Ubuntu users may find it in the software center if [universe repository is enabled][9]. + +![CopyQ in Ubuntu Software Center][10] + +Alternatively, you can use the apt command to install it: + +``` +sudo apt install copyq +``` + +Ubuntu users also have the option to [use the official PPA][11] and always get the latest stable CopyQ version. For example, at the time of writing this article, CopyQ version in Ubuntu 20.04 is 3.10 while [PPA has newer version][12] 3.11. It’s your choice really. + +``` +sudo add-apt-repository ppa:hluk/copyq +sudo apt update +sudo apt install copyq +``` + +You may also want to know [how to remove PPA][13] later. + +### Do you use a clipboard manager? + +I find it surprising that many people are not even aware of an essential utility like clipboard manager. For me, it’s one of the [essential productivity tools on Linux][14]. + +As I mentioned at the beginning of the article, there are several clipboard managers available for Linux. CopyQ is one of such tools. Do you use or know of some other similar clipboard tool? Why not let us know in the comments? + +If you started using CopyQ after reading this article, do share your experience with it. What you liked and what you didn’t like? The comment section is all yours. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/copyq-clipboard-manager/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.computerhope.com/jargon/c/clipboar.htm +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/clipboard.png?ssl=1 +[3]: https://hluk.github.io/CopyQ/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-system-tray.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-main-window.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-shortcuts.png?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-auto-start.png?ssl=1 +[8]: https://itsfoss.com/vim-8-release-install/ +[9]: https://itsfoss.com/ubuntu-repositories/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-software-center.png?resize=800%2C474&ssl=1 +[11]: https://itsfoss.com/ppa-guide/ +[12]: https://launchpad.net/~hluk/+archive/ubuntu/copyq +[13]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[14]: https://itsfoss.com/productivity-tips-ubuntu/ diff --git a/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md b/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md new file mode 100644 index 0000000000..fb2b9005ea --- /dev/null +++ b/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Debian’s Decision to Drop Old Drivers has Upset Vintage Hardware Users) +[#]: via: (https://itsfoss.com/debian-dropping-old-drivers/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Debian’s Decision to Drop Old Drivers has Upset Vintage Hardware Users +====== + +It is always a tough decision to drop support for older hardware for the latest Linux distribution releases. Just like [Ubuntu decided to drop support for 32-bit systems][1], Debian’s X Strike Force (XFS) team decided to drop a list of input and video drivers. + +### Debian is considering to drop support for really old hardware + +![][2] + +In case you didn’t know, the XFS team is responsible for maintaining packages the [X Window System][3] in [Debian][4]. And, the list of drivers that [they want to remove][5] are: + + * xserver-xorg-input-aiptek + * xserver-xorg-input-elographics + * xserver-xorg-input-mtrack + * xserver-xorg-input-mutouch + * xserver-xorg-input-void + * server-xorg-video-ast + * xserver-xorg-video-mach64 + + + * xserver-xorg-video-neomagic + * xserver-xorg-video-r128 + * xserver-xorg-video-savage + * xserver-xorg-video-siliconmotion + * xserver-xorg-video-sisusb + * xserver-xorg-video-tdfx + * xserver-xorg-video-trident + + + +So, Mach 64, [ATI Rage R128][6], Savage, Silicon Motion, SiS, Trident, and NeoMagic are some of the graphics chipsets that would be affected. The reason (as stated by them) to drop these drivers is: + +> They are either unmaintained upstream or provide no value to the distribution. + +Now, that could make sense, if the packages are no longer maintained. But, upstream some of these X.org drivers are still **maintained** even if there are no frequent updates to them. For instance, in 2018, a [new display driver update was released for the ATI RAGE 128][7], as reported by Phoronix. + +### Vintage hardware owners are going to be upset + +Obviously, the vintage hardware users aren’t quite happy with the decision because a handful of people still own (or actively use) old hardware i.e. around 20 years older. + +From the original list of drivers mentioned in the [bug report][5], **Geode display driver** was initially decided to be removed but wasn’t dropped. + +It was also reported that the “**xserver-xorg-video-r128**” driver is required for older Apple hardware (iMac). And, a user reported about the missing video driver on his iMac. + +For most of the users, this decision may not actually affect any “production” systems because I don’t think anyone is probably going to utilize 20-year old hardware for commercial purposes. + +The hobbyists and collectors who like to preserve older tech are surely going to be impacted by this decision. + +### Wrapping Up + +In my opinion, dropping the support for incredibly dated hardware is not entirely a bad move. + +But, if there is a demand for the support of vintage hardware, the fair share of users who want the drivers to be added in Debian should help maintain those packages. If not, I don’t think it won’t be a wise choice to have an unmaintained piece of code in Debian. + +What do you think about this? Feel free to share your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/debian-dropping-old-drivers/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-drops-32-bit-desktop/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/debian-bug-report-driver-drop.jpg?ssl=1 +[3]: https://en.wikipedia.org/wiki/X_Window_System +[4]: https://www.debian.org/ +[5]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955603 +[6]: https://en.wikipedia.org/wiki/ATI_Rage_series +[7]: https://www.phoronix.com/scan.php?page=news_item&px=ATI-RAGE-128-DDX-6.11.0 diff --git a/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md b/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md new file mode 100644 index 0000000000..bfeb5635ce --- /dev/null +++ b/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (EU Parliament Strongly Recommends Developing and Using Open Source Software) +[#]: via: (https://itsfoss.com/eu-parliament-recommends-open-source/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +EU Parliament Strongly Recommends Developing and Using Open Source Software +====== + +Europe is choosing open source more than ever. Not just limited to [EU Commissions’ decision to use Signal messaging app][1] but also [open science][2] and the [adoption of open source software by European universities][3]. + +Now, in a recent [press release][4] by the [European Pirate Party][5], it looks like the EU Parliament is urging EU institutions to use open-source software. All thanks to the Pirate amendments for encouraging the use of open-source software. + +The EU Parliament not just encourages the use of open-source software, but they have also advised to prioritize development of open-source software by the EU institutions. + +So, not just aiming to adopt using open-source software but to develop open-source software. And, that’s definitely good news! + +More use of open-source software, why not? To give you some more details, here’s what they mentioned in the press release: + +> **In practice, from now on, all IT solutions developed by and for the EU institutions will first need to be assessed against the possibility of using Open Source solutions. Assessments will then have to be reported back to the Budgetary Control Committee of the Parliament on an annual basis, during the discharge procedure. This is a strong call for enhancing our important citizens right to transparent and trustworthy information.** + +### Important decision to remove vendor lock-ins + +![Public Money Public Code Campaign][6] + +No matter who made this happen — this decision of preferring open-source software over proprietary will not just help the open-source community but also helps the EU institutions in a variety of ways. + +Especially, relying on open-source software removes the overhead of vendor lock-ins. In other words, an EU institution does not have to rely on vendor to manage/maintain the software. + +The press release also addressed this by mentioning: + +> It is essential for the European institutions to retain control over its own technical systems, especially in a context of disinformation and foreign interference. Open Source promotes local technical support, leads to rapid development of software and helps to avoid dependency on specific suppliers or vendor lock-in effects, which exist when only one company is in charge of software or even the entire IT infrastructure supply. + +Any responsible local organization can take up the task while the community can still help in any way it can. This could also reduce the cost of maintaining the software among other things like improving the security of a software in a collaborative manner. + +### Is this a big win for open-source community? + +![][7] + +Yes, and no. We’ve seen a lot of recommendations made by the governments (or the EU government in general) to choose open-source software to keep things more secure yet transparent. + +Pirate’s Vice-President of EU Parliament, **Marcel Kolaja**, mentions some advantages of this decision as well: + +_It’s a milestone for transparent and open digitization of the European institutions. From now on, the Open Source ecosystem has a stepping ground for offering Open Source solutions and the Pirates will gladly play the role of the guardians and will try to solve and highlight any attempt to bypass this strong recommendation. It’s a really important step to remove vendor lock-ins in the Parliament“_ + +So, this will definitely help them earn trust of their citizens by providing digital transparency while also encouraging public participation to improve the software as well. Of course, this will also help introduce the concept of open-source software to many who were unaware of it in some way. + +Also, ensuring open-source software for publicly financed software will enhance the meaning of freedom of speech/privacy/press. + +In a nutshell, these decisions do have a positive impact in one way or the other. + +But, the implementations of these decisions will decide how effective it’s going to be to put the words in action. + +### Wrapping Up + +I’m happy with the decision by EU Parliament here — even though I’m not a European. I guess, this should encourage other government bodies to take similar decisions or steps to ensure digital transparency while earning the trust of their citizens. + +To get more details on the decision, you can refer to the [official press release by the European Pirate Party][4]. + +What do you think about it? Let me know your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/eu-parliament-recommends-open-source/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/eu-commission-switches-to-signal/ +[2]: https://ec.europa.eu/research/openscience/index.cfm?pg=openaccess +[3]: https://opensource.com/article/20/5/open-source-higher-education +[4]: https://european-pirateparty.eu/european-parliament-strongly-recommends-any-software-developed-by-and-for-the-eu-institutions-to-be-made-publicly-available-under-free-and-open-source-software-licence/ +[5]: https://en.wikipedia.org/wiki/European_Pirate_Party +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/public-money-public-code.png?resize=800%2C420&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/eu-parliament-open-source.jpg?ssl=1 diff --git a/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md b/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md new file mode 100644 index 0000000000..eda3a2990e --- /dev/null +++ b/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Encrypt Your Files Before Uploading it to Cloud With Cryptomator) +[#]: via: (https://itsfoss.com/cryptomator/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Encrypt Your Files Before Uploading it to Cloud With Cryptomator +====== + +_**Open source software highlight of this week is Cryptomator. It is a unique free and open-source encryption software that lets you encrypt your data before uploading it to the cloud.**_ + +There are several [cloud services available for Linux][1] and almost all of them do not offer [end to end encryption][2], at least not by default. + +Usually, the connection between your device and the server is secure. But your data stored on the server is not encrypted. Employees with direct access to the infrastructure at your cloud service providers may access this data. + +Of course, these companies have strict policies against such intrusion but a rogue employee can do a lot of damage. Remember the incident when a [departing Twitter employee deactivated the account of US President Donald Trump][3]. + +If you are one of the privacy cautious people, you would want the ease of cloud storage but with the added security layer of encrypted storage. + +Now some [services like pCloud do provide end to end encryption][4] but that comes at an additional cost. If you could afford that, well and good. If not, you can use a free and open source tool like [Cryptomator][5]. + +Cryptomator helps you secure your data by encrypting it before uploading it to any cloud storage services. In this article, I’m going to highlight the key features of Cryptomator along with instructions to use it. + +### Cryptomator: Add an encryption layer to your cloud data + +![][6] + +Cryptomator is a solution to encrypt your data locally before uploading it to the cloud. + +With this, you can create vaults locally and sync them to the cloud storage services you use. + +It’s very easy to use and you don’t need to have any specific technical knowledge to encrypt your data – that’s what Cryptomator is tailored for. + +### Features of Cryptomator + +Cryptomator is a simple encryption tool with the essential features. Here’s what it offers: + + * [AES][7] and 256-bit Encryption for files. + * Ability to create a vault and sync it with the cloud storage service + * Optional recovery key for your master password of the vault + * Cross-platform support (Linux, Windows, macOS, Android, and iOS) + * Supports the dark theme for a one-time license fee. + * Supports [WebDAV][8], [FUSE][9], and [Dokany][10] for easy integration with your operating system. + + + +Do note that the [Android][11] and [iOS][12] apps are paid apps that you have to purchase separately while the desktop program is completely free to use. Also, you need to purchase a one-time license to unlock the dark mode. Don’t blame them please. They need to make some money in order to develop this open source software. + +### Installing Cryptomator on Linux + +Cryptomater provides an AppImage file that you can download to get started on any Linux distribution. + +You can get it from its [official download page][13]. In case you don’t know, please read [how to use an AppImage file][14] to get started. + +[Download Cryptomator][5] + +### How To Use Cryptomator? + +Attention! + +Encryption is a double-edged sword. It can protect you and it can hurt you as well. +If you are encrypting your data and you forgot your encryption key, you’ll lose access to that data forever. +Cryptomator provides a recovery key option so please be careful with both password and the recovery key. Don’t forget it or lose the recovery key. + +Once you have installed Cryptomator, it’s really easy to use it following the user interface or the [official documentation][15]. + +But, to save you some time, I’ll highlight a few important things that you should know: + +#### Setup Your Vault + +![][16] + +After launching Cryptomator, you need to create the vault where you want to have your encrypted data. + +This can be an existing location or a new custom directory as per your requirements. + +Now that you proceed creating a new vault, you will also observe that you can open an existing vault as well (if you had one already). So, always have a backup of your vault, just in case. + +![][17] + +Here, I am assuming that you are a new user. So, obviously, proceed to create a new vault and give it a name: + +![][18] + +Next, you need to specify a storage location. If you already use OneDrive, Dropbox, Google Drive, or something similar, it might detect it automatically. + +![][19] + +However, if it doesn’t, like in my case (I use [pCloud][20]), you can select the cloud-synced directory or any other custom location manually. + +Once you select the location, you just need to create a password for it. It’s best to create a strong password that you can remember. + +![][21] + +Also, I’d suggest you to opt for the recovery key and store it in a separate USB drive or just print it on a paper. + +![][22] + +And, that’s it. You’re done creating your secure vault that you can sync with the cloud. + +![][23] + +Now, how do you add files to it? Let’s take a look: + +#### Adding Files To A Vault + +_**Note:** You can’t just go into the folder that you created from the file manager and files there. Follow the steps below to add files properly in your encrypted vault._ + +Once you’ve created your vault, you just need to unlock it by typing the password as shown in the image below. If you’re on your personal computer, you can choose to save the password without needing to enter it every time you access the vault. However, I advise not to do that. Manually entering the password help in remembering it. + +![][24] + +Next, after unlocking the vault, you just need to click on “**Reveal Vault**” or reveal drive to open it using **File Manager** where you can access/modify or add files to it. + +#### Backup / Recover Your Vault + +You should simply copy-paste the folder you create to another USB drive or somewhere else other than your cloud storage folder to ensure that you have a backup of your vault. + +![][25] + +It’s important to have the **masterkey.cryptomator** file of the vault in order to open it. + +#### Upgrades, Preferences & Settings + +Note + +You should enable the auto-updates feature to ensure that you will have the most stable and error-free version automatically. + +Apart from the most important functions of the Cryptomator app, you will get a couple of other features to tweak, such as: + + * Change the type of your virtual drive + * Tweak the vault to read-only mode + + + +You can explore the **Vault options** and the settings on Cryptomator to know about what else you can do. + +**Wrapping Up** + +Now that you know about Cryptomator, you can easily encrypt your important data locally before uploading them to the cloud. + +What do you think about Cryptomator? Let us know your thoughts in the comments down below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cryptomator/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/cloud-services-linux/ +[2]: https://en.wikipedia.org/wiki/End-to-end_encryption +[3]: https://www.theverge.com/2017/11/2/16600732/donald-trump-twitter-account-gone-realdonaldtrump +[4]: https://partner.pcloud.com/r/22317 +[5]: https://cryptomator.org/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-ft.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard +[8]: https://en.wikipedia.org/wiki/WebDAV +[9]: https://en.wikipedia.org/wiki/Filesystem_in_Userspace +[10]: https://en.wikipedia.org/wiki/Dokan_Library +[11]: https://play.google.com/store/apps/details?id=org.cryptomator&hl=en_US +[12]: https://apps.apple.com/us/app/cryptomator/id953086535 +[13]: https://cryptomator.org/downloads/ +[14]: https://itsfoss.com/use-appimage-linux/ +[15]: https://docs.cryptomator.org +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-add-vault.jpg?ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-create-open-vault.jpg?ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-add-vault-name.jpg?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-vault-location.jpg?ssl=1 +[20]: https://itsfoss.com/recommends/pcloud/ +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-pass.jpg?ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-recovery.jpg?ssl=1 +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-vault-success.jpg?ssl=1 +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-unlock.jpg?ssl=1 +[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-master.jpg?ssl=1 diff --git a/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md b/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md new file mode 100644 index 0000000000..87ddb6b839 --- /dev/null +++ b/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md @@ -0,0 +1,179 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Assign Static IP Address on Ubuntu Linux) +[#]: via: (https://itsfoss.com/static-ip-ubuntu/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Assign Static IP Address on Ubuntu Linux +====== + +_**Brief: In this tutorial, you’ll learn how to assign static IP address on Ubuntu and other Linux distributions. Both command line and GUI methods have been discussed.**_ + +IP addresses on Linux Systems in most cases are assigned by [Dynamic Host Configuration Protocol][1] (DHCP) servers. IP addresses assigned this way are dynamic which means that the IP address might change when you [restart your Ubuntu system][2]. It’s not necessary but it may happen. + +_**Dynamic IP is not an issue for normal desktop Linux users in most cases**_. It could become an issue if you have employed some special kind of networking between your computers. + +For example, you can [share your keyboard and mouse between Ubuntu and Raspberry Pi][3]. The configuration uses IP addresses of both system. If the IP address changes dynamically, then your setup won’t work. + +Another use case is with servers or remotely administered desktops. It is easier to set static addresses on those systems for connection stability and consistency between the users and applications. + +In this tutorial, I’ll show you how to set up static IP address on Ubuntu based Linux distributions. Let me show you the command line way first and then I’ll show the graphical way of doing it on desktop. + +### Method 1: Assign static IP in Ubuntu using command line + +![][4] + +**Note for desktop users**: Use static IP only when you need it. Automatic IP saves you a lot of headache in handling network configuration. + +#### Step 1: Get the name of network interface and the default gateway + +The first thing you need to know is the name of the network interface for which you have to set up the static IP. + +You can either use ip command or the network manager CLI like this: + +``` +nmcli d +``` + +In my case, it shows my Ethernet (wired) network is called enp0s25: + +``` +Ubuntu> nmcli d +DEVICE TYPE STATE CONNECTION +enp0s25 ethernet unmanaged -- +lo loopback unmanaged -- +``` + +Next, you should note the [default gateway IP using the Linux command][5] **ip route**: + +``` +ip route +default via 192.168.31.1 dev enp0s25 proto dhcp metric 600 +169.254.0.0/16 dev enp0s25 scope link metric 1000 +192.168.31.0/24 dev enp0s25 proto kernel scope link src 192.168.31.36 metric 600 +``` + +As you can guess, the default gateway is 192.168.31.1 for me. + +#### Step 2: Locate Netplan configuration + +Ubuntu 18.04 LTS and later versions use [Netplan][6] for managing the network configuration. Netplan configuration are driven by .yaml files located in **/etc/netplan** directory. + +By default, you should see a .yaml file named something like 01-network-manager-all.yaml, 50-cloud-init.yaml, 01-netcfg.yaml. + +Whatever maybe the name, its content should look like this: + +``` +# Let NetworkManager manage all devices on this system +network: + version: 2 + renderer: NetworkManager +``` + +You need to edit this file for using static IP. + +#### Step 3: Edit Netplan configuration for assigning static IP + +_**Just for the sake of it, make a backup of your yaml file.**_ + +Please make sure to use the correct yaml file name in the commands from here onward. + +Use nano editor with sudo to open the yaml file like this: + +``` +sudo nano /etc/netplan/01-netcfg.yaml +``` + +Please note that _**yaml files use spaces for indentation**_. If you use tab or incorrect indention, your changes won’t be saved. + +You should edit the file and make it look like this by providing the actual details of your IP address, gateway, interface name etc. + +``` +network: + version: 2 + renderer: networkd + ethernets: + enp0s25: + dhcp4: no + addresses: + - 192.168.31.16/24 + gateway4: 192.168.31.1 + nameservers: + addresses: [8.8.8.8, 1.1.1.1] +``` + +In the above file, I have set the static IP to 192.168.31.16. + +Save the file and apply the changes with this command: + +``` +sudo netplan apply +``` + +You can verify it by [displaying your ip address in the terminal][7] with ‘ip a’ command. + +Revert the changes and go back to dynamic IP + +If you don’t want to use the static IP address anymore, you can revert easily. + +If you have backed up the original yaml file, you can delete the new one and use the backup one. + +Otherwise, you can change the yaml file again and make it look like this: + +``` +network: + version: 2 + renderer: networkd + ethernets: + enp0s25: + dhcp4: yes +``` + +### Method 2: Switch to static IP address in Ubuntu graphically + +If you are on desktop, using the graphical method is easier and faster. + +Go to the settings and look for network settings. Click the gear symbol adjacent to your network connection. + +![][8] + +Next, you should go to the IPv4 tab. Under the IPv4 Method section, click on Manual. + +In the Addresses section, enter the IP static IP address you want, netmask is usually 24 and you already know your gateway IP with the ip route command. + +You may also change the DNS server if you want. You can keep Routes section to Automatic. + +![][9] + +Once everything is done, click on Apply button. See, how easy it is to set a static IP address graphically. + +If you haven’t read my previous article on [how to change MAC Address][10], you may want to read in conjunction with this one. + +More networking related articles will be rolling out, let me know your thoughts at the comments below and stay connected to our social media. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/static-ip-ubuntu/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol +[2]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[3]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/static-ip-ubuntu.jpg?ssl=1 +[5]: https://linuxhandbook.com/find-gateway-linux/ +[6]: https://netplan.io/ +[7]: https://itsfoss.com/check-ip-address-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/assign-static-ip-1.jpg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/assign-static-ip-2.jpg?ssl=1 +[10]: https://itsfoss.com/change-mac-address-linux/ diff --git a/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md b/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md new file mode 100644 index 0000000000..eba596bcb9 --- /dev/null +++ b/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Compress PDF in Linux [GUI & Terminal]) +[#]: via: (https://itsfoss.com/compress-pdf-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Compress PDF in Linux [GUI & Terminal] +====== + +_**Brief: Learn how to reduce the size of a PDF file in Linux. Both command line and GUI methods have been discussed.**_ + +I was filling some application form and it asked to upload the necessary documents in PDF format. Not a big issue. I gathered all the [scanned images and combined them in one PDF using gscan2pdf tool][1]. + +The problem came when I tried to upload this PDF file. The upload failed because it exceeded the maximum file size limit. This only meant that I needed to somehow reduce the size of the PDF file. + +Now, you may use an online PDF compressing website but I don’t trust them. A file with important documents uploading to an unknown server is not a good idea. You could never be sure that they don’t keep a copy your uploaded PDF document. + +This is the reason why I prefer compressing PDF files on my system rather than uploading it to some random server. + +In this quick tutorial, I’ll show you how to reduce the size of PDF files in Linux. I’ll show both command line and GUI methods. + +### Method 1: Reduce PDF file size in Linux command line + +![][2] + +You can use [Ghostscript][3] command line tool for compressing a PDF file. Most Linux distributions include the open source version of Ghostscript already. However, you can still try to install it just to make sure. + +On Debian/Ubuntu based distributions, use the following command to install Ghostscript: + +``` +sudo apt install ghostscript +``` + +Now that you have made sure that Ghostscript is installed, you can use the following command to reduce the size of your PDF file: + +``` +gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf +``` + +In the above command, you should add the correct path of the input and out PDF file. + +The command looks scary and confusing. I advise copying and pasting most of it. What you need to know is the dPDFSETTINGS parameter. This is what determines the compression level and thus the quality of your compressed PDF file. + +dPDFSETTINGS | Description +---|--- +/prepress (default) | Higher quality output (300 dpi) but bigger size +/ebook | Medium quality output (150 dpi) with moderate output file size +/screen | Lower quality output (72 dpi) but smallest possible output file size + +Do keep in mind that some PDF files may not be compressed a lot or at all. Applying compression on some PDF files may even produce a file bigger than the original. There is not much you can do in such cases. + +### Method 2: Compress PDF files in Linux using GUI tool + +I understand that not everyone is comfortable with command line tool. The [PDF editors in Linux][4] doesn’t help much with compression. This is why we at It’s FOSS worked on creating a GUI version of the Ghostscript command that you saw above. + +[Panos][5] from It’s FOSS team [worked on creating a Python-Qt based GUI wrapper for the Ghostscript][6]. The tool gives you a simple UI where you can select your input file, select a compression level and click on the compress button to compress the PDF file. + +![][7] + +The compressed PDF file is saved in the same folder as the original PDF file. Your original PDF file remains untouched. The compressed file is renamed by appending -compressed to the original file name. + +If you are not satisfied with the compression, you can choose another compression level and compress the file again. + +You may find the source code of the PDF Compressor on our GitHub repository. To let you easily use the tool, we have packaged it in AppImage format. Please [refer to this guide to know how to use AppImage][8]. + +[Download PDF Compressor (AppImage)][9] + +Please keep in mind that the tool is in early stages of developments. You may experience some issues. If you do, please let us know in the comments or even better, [file a bug here][10]. + +We’ll try to add more packages (Snap, Deb, PPAs etc) in the future releases. If you have experience with the development and packaging, please feel free to give us a hand. + +Would you like It’s FOSS team to work on creating more such small desktop tools in future? Your feedback and suggestions are welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/compress-pdf-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/compress-pdf-linux.jpg?ssl=1 +[3]: https://www.ghostscript.com/ +[4]: https://itsfoss.com/pdf-editors-linux/ +[5]: https://github.com/libreazer +[6]: https://github.com/itsfoss/compress-pdf +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/compress-PDF.jpg?fit=800%2C448&ssl=1 +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://github.com/itsfoss/compress-pdf/releases/download/0.1/compress-pdf-v0.1-x86_64.AppImage +[10]: https://github.com/itsfoss/compress-pdf/issues diff --git a/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md b/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md new file mode 100644 index 0000000000..1fc324e817 --- /dev/null +++ b/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Linux Mint in VirtualBox [Screenshot Tutorial]) +[#]: via: (https://itsfoss.com/install-linux-mint-in-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Install Linux Mint in VirtualBox [Screenshot Tutorial] +====== + +_**Brief: One of safest and easiest ways to try Linux Mint is inside a virtual machine. Your real system doesn’t change at all. Learn how to install Linux Mint in VirtualBox in this tutorial.**_ + +[Linux Mint][1] is considered one of the [best distributions for new Linux users][2]. Its flagship Cinnamon DE is one of the most popular desktop environment giving your system a look and feel of classic Window-styled desktop. + +If you want to try Linux Mint and see if it fits your need, you could try installing it in a virtual machine. This way, you run Linux Mint inside your current system without changing your system’s partition or boot order. One of the safest way out there as you get to run Linux like a regular desktop application inside your current operating system. + +![][3] + +Oracle’s open source virtualization tool [VirtualBox][4] is available for free on all major desktop operating systems i.e. Windows, Linux and macOS. + +In this beginner’s tutorial, I’ll show you the steps for installing Linux Mint in VirtualBox. I am including the screenshots for each step so that you can easily follow the tutorial. + +### Installing Linux Mint in VirtualBox + +You can follow the steps on any operating system be it Windows, Linux or macOS. You just need to install VirtualBox on your operating system and rest of the steps remain the same. + +**Step 1:** [Download VirtualBox from its website][4] and install it by double-clicking on the downloaded file. + +![][5] + +Next, install the latest version of Linux Mint’s ISO file from its website. + +[Download Linux Mint ISO][6] + +**Step 2:** Once your virtual Box is up & running we are ready to get started. Click the New button, click Next on the virtual machine wizard. + +![Create a new Virtual Machine][7] + +Initially you need to specify the following: + + * Name: Any preferred name for your VM like Linux Mint + * Type: Linux + * Version: Ubuntu (64 bit) as Linux Mint is an Ubuntu-based distribution + + + +Before configuring any hardware resource value, please make sure that are aware of the [system requirements][8]. + +2 GB RAM would be okay but won’t give you a good experience. 3 GB is a comfortable amount if your system has 8 GB of RAM. I choose to set my Virtual Machine to 4096 MB (4 GB) because my system has plenty of RAM. + +RAM consumption + +One of the common confusion is regarding the RAM consumption. Let’s say your Windows system has 8 GB of RAM and you assign 3 GB of RAM to Linux Mint in VirtualBox. + +If you are running Linux Mint inside VirtualBox, your real system (called host system) will have 5 GB of RAM available for consumption. + +If you are not running Linux Mint inside VirtualBox, at that moment, the entire 8 GB will be available to the host system. + +**Step 3:** Next, choose a Virtual Hard disk now option and click create. + +Choose the virtual storage allocation method (Recommended Dynamically allocated). Set your storage location for virtual hard disk by browsing drive and then specify the size of virtual hard disk (it could be anything from 12-20 GB). + +![Dynamic allocation can save you space if you don’t need the maximum allowance][9] + +**Step (4 (optional advanced settings):** Once Virtual machine has been created, click on the settings button in menu: + +![][10] + +Now, go to the Display section. Specify the Video memory (128 MB) and check “Enable 3D Acceleration”. + +![Don’t forget to enable the 3D Acceleration][11] + +Then click on System Tab → Processor and choose how many threads would you like to allocate. + +My system is a 4 core/4 thread system and I choose to assign half of the CPU capability i.e. 2 threads. + +![Select CPU cores as per the distribution requirements][12] + +Once you have configured everything click ok. + +**Step 5:** In the System settings, go to Storage (from the left sidebar). Click on the [Optical Drive] Empty as shown in the image below. + +You’ll be asked to browse to the Linux Mint ISO file you had downloaded earlier. + +![][13] + +Once you select your ISO, click on the start button and that’s it! Now the ISO will start running as if you are booting from a live USB. + +Next, you need to press enter whilst your option is start Linux Mint as per the picture below. + +![][14] + +**Step 6:** Let’s start the installation procedure. + +Choose the language you want for your Linux Mint virtual machine. + +![Choose your native language][15] + +I’m based in the UK, so I have a UK keyboard layout. You can choose the one you want. + +![Choose your keyboard layout according to your hardware configuration][16] + +You may check the box to download and install any third-party software during the installation. + +![You may install media codecs while installing Linux Mint][17] + +You can proceed to erase the disk and install Linux Mint. + +Erase disk? Really? + +This step may seem scary because you may think that it will harm your real system. + +Let me assure you that it won’t do any damage to your actual disk. Remember you created 10-20 GB of virtual disk in step 3? Now you are inside that disk. + +When it asks for erasing the disk, it is erasing the virtual disk created for it. It doesn’t impact your real system disk and its data. + +![It is safe to erase your disk only at a Virtual Machine level][18] + +Next, select your time zone and click continue. You may [change time zone in Linux][19] later as well. + +![][20] + +You will be prompted to create your user account, your host name (computer’s name) and to choose a password. Once done, click continue to finalize the installation. + +![][21] + +Please wait a few minutes for the process to complete. + +![Wait a few minutes for the process to finish][22] + +The installation has now finished. Click on “Restart now”. + +![Well done! You have successfully installed Linux Mint][23] + +When you reach this step, Linux Mint will be installed and ready to use! + +![][24] + +You don’t have an installation medium so just power off the virtual machine. + +![][25] + +Now to use your virtual machine, click on the start button. + +![][26] + +You can explore a fully functional system, and at this time if you shut down Linux Mint like it was physically installed, it will automatically power off the virtual machine. + +![][27] + +Enjoy Linux Mint in VirtualBox. I hope you were able to install Linux Mint in VirtualBox. If you face any issues, please let me know in the comment section. I’ll try to help you out. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-linux-mint-in-virtualbox/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxmint.com/ +[2]: https://itsfoss.com/best-linux-beginners/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-linux-mint-in-virtualbox.png?ssl=1 +[4]: https://www.virtualbox.org/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?ssl=1 +[6]: https://www.linuxmint.com/download.php +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/1.-Create-new.jpg?ssl=1 +[8]: https://blog.linuxmint.com/?p=3832 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/2.-Create-virtual-hard-disk.jpg?resize=800%2C472&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/3.-settings.jpg?resize=800%2C470&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/4.-display.jpg?resize=800%2C472&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/5.-cpu.jpg?resize=800%2C468&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/6.-choose-iso.jpg?resize=800%2C472&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/7.-boot.jpg?resize=800%2C459&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/8.-choose-language.png?resize=800%2C679&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/9.-English-UK.png?resize=800%2C679&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/10.-install-third-party-software.png?resize=800%2C679&ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/11.-installation-type.png?resize=800%2C679&ssl=1 +[19]: https://itsfoss.com/change-timezone-ubuntu/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/12.-timezone.png?resize=800%2C679&ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/13.-user-account.png?resize=800%2C679&ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/14.-installation-screen.png?resize=800%2C679&ssl=1 +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/15.-installation-finish.png?resize=800%2C679&ssl=1 +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/16.-remove-the-media.png?resize=800%2C679&ssl=1 +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/17.-power-off.png?resize=800%2C678&ssl=1 +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/18.-init-the-fresh-installed-mint.png?resize=800%2C476&ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/19.-Linux-mint-19.3-final.png?resize=800%2C469&ssl=1 diff --git a/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md b/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md new file mode 100644 index 0000000000..afd1a08e49 --- /dev/null +++ b/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LanguageTool Review: Free and Open Source Grammar Checker) +[#]: via: (https://itsfoss.com/languagetool-review/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +LanguageTool Review: Free and Open Source Grammar Checker +====== + +This week’s open source software highlight is [LanguageTool][1]. It is a proofreading software that checks the grammar, style and spelling in more than 20 languages. + +I have been using it for past several days and I feel confident enough to review it and share my experience with it. I have used the popular proofreading tool [Grammarly][2] in the past and I’ll make some comparison between these two tools. + +### LanguageTool: Open source proofreading software + +![][3] + +[LanguageTool][1] grammar checker is available in [multiple formats][4]: + + * You can copy-paste your text on its website. + * You can install browser extension that will check for errors as you type anything, anywhere in the web browser. + * You can install a Java-based desktop application for offline usage. + * You can install add-on for LibreOffice and MS Office. + * Add-ons are also [available for a number of other software][5] like Sublime Text, Thunderbird, Vim, Visual Studio Code etc. + * [Android app][6] is also available. + * API is also available if you want to use LanguageTool in your software or service. API offering comes under premium services. + + + +You can find source code of LanguageTool and its related assets on [their GitHub repository][7]. + +[LanguageTool also has a premium version][8] that you can purchase. The premium version offers additional error checks. + +I am using LanguageTool premium version as a browser extension. Almost all the writing I do is online and thus the browser extension is perfect for me. + +The most convenient way to try LanguageTool is by using its browser extension. Install the browser add-on and next time you type anything in the browser, LanguageTool will start checking your text for grammatical and spelling errors. It will also check for styling errors. + +### Experience with LanguageTool: How good is it? + +LanguageTool leaves a good first impression. It starts checking for errors as you start typing. + +Different types of errors have different color codes. Spelling mistakes are highlighted in red color, grammatical mistakes are in yellow colors and styling errors have a blueish shade. + +Clicking on the error suggestion replaces your text with the suggested one. You may also ignore the suggestion. You’ll also see number of issues identified by LanguageTool in the current text check. + +![Spelling mistake identified by LanguageTool][9] + +#### Personal dictionary + +You can also create your personal directory and add words in it. This is helpful because no proofreading tool can give a green light to technical terms like systemd, iptables and brand names like [WireGuard][10]. To avoid these words labeled as spelling mistakes, add them to your personal dictionary. + +You may edit your personal dictionary from your LanguageTool account. + +![LanguageTool Personal Dictionary][11] + +#### Details on the error suggestion + +If it finds grammatical errors, it also gives a quick explanation of the error. You can get more details by clicking the tool tip which takes you to a reputable external source. + +![You can get additional details on the errors][12] + +#### Synonym suggestion (in beta) + +If you double-click on a word, it will also suggest synonyms. + +![][13] + +#### Are there any privacy issues? + +If you use the online services of LanguageTool, your text is sent to their servers over an **encrypted** connection. All their servers are hosted at Hetzner Online GmbH in Germany. + +LanguageTool states that it doesn’t store any text that you check using its services. You can read their privacy policy [here][14]. + +The free to use languagetool.org website shows ads (there are no third-party ads in the browser add-on). To test their claim of “sending text over an encrypted server”, I typed sample text containing words like vacuum cleaner, laptop etc. + +Thankfully, the displayed ad on their website was nothing related to the text I typed. I haven’t noticed any vacuum cleaner ads on the websites I visit or on Facebook. That’s a good thing. + +#### It doesn’t work flawlessly all the time + +No software is perfect and LanguageTool is not an exception. While it is helpful in finding obvious spelling and grammatical mistakes, it struggles in some simple scenario. + +For example, if a sentence contains several blank spaces together, LanguageTool failed to find an issue with that. + +![Too many whitespaces and yet it went undetected][15] + +This is weird because if I look at their ‘error rules’, I can see a [whitespace repetition rule][16]. I think this rule is applicable only for the Java-based LanguageTool apps, not the browser add-on I am using. + +I also found some other cases where LanguageTool should have identified errors but it didn’t. For example, it didn’t alert for the missing ‘to’ in the text below: + +![LanguageTool fails to find the missing “to”][17] + +When I checked it against the [Grammarly free version][2], it was able to point it out. + +![Grammarly was quick to identify it][18] + +I also found an infinite loop of suggestion. It first suggests using syntaxes as plural of syntax. + +![Suggestion for using ‘syntaxes’][19] + +And then it doesn’t accept ‘syntaxes’ as a valid word. + +![And then it doesn’t accept ‘syntaxes’][20] + +I have seen such “infinite error loop” with Grammarly as well in the past, so I won’t be too hard on LanguageTool for such issues. + +### Conclusion + +Despite some hiccups, I am satisfied with LanguageTool proofreading tool. Both free and premium version are good enough for finding obvious spelling mistakes and grammatical errors. + +The premium version offers over 2500 additional error checks and it costs around $15-$70 per year depending on your geographical region. This is a lot cheaper than [Grammarly][2] which costs $140 per year. + +I opted for the premium version because it will help this open-source project. Premium users also get email support. + +You are not forced to go premium, of course. You can use the free version and if you have some questions or need support, there is a [community forum][21] that you can join for free. + +LanguageTool can certainly be considered one of the [essential open-source tools for writers][22]. I am going to continue using LanguageTool. If you find grammatical or spelling mistakes in It’s FOSS articles in the future, blame LanguageTool, not me. Just kidding :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/languagetool-review/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://languagetool.org/ +[2]: https://itsfoss.com/recommends/grammarly/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool.png?fit=800%2C593&ssl=1 +[4]: https://languagetool.org/compare +[5]: http://wiki.languagetool.org/software-that-supports-languagetool-as-a-plug-in-or-add-on +[6]: https://play.google.com/store/apps/details?id=org.softcatala.corrector +[7]: https://github.com/languagetool-org/ +[8]: https://languagetoolplus.com/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/langaugetool-error-detection.png?ssl=1 +[10]: https://itsfoss.com/wireguard/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-personal-dictionary.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-error-explanation.png?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-synonym-suggestion.png?ssl=1 +[14]: https://languagetoolplus.com/legal/privacy +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-whitespaces.png?ssl=1 +[16]: https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang=en +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-3.jpg?fit=800%2C219&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-grammarly.jpg?fit=800%2C272&ssl=1 +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion.png?ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-1.png?ssl=1 +[21]: https://forum.languagetool.org/ +[22]: https://itsfoss.com/open-source-tools-writers/ diff --git a/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md b/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md new file mode 100644 index 0000000000..d1d80bcb5d --- /dev/null +++ b/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using ‘apt search’ and ‘apt show’ Commands to Search and Find Details of Packages in Ubuntu) +[#]: via: (https://itsfoss.com/apt-search-command/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Using ‘apt search’ and ‘apt show’ Commands to Search and Find Details of Packages in Ubuntu +====== + +_**This is a detailed beginners guide to apt search command. Using apt search and apt show commands, you can get details of the available versions, dependencies, repositories and other important information about packages in Ubuntu.**_ + +Have you ever wondered if a certain package is available to install via [apt package manager][1]? + +Have you wondered if the package offered by [Ubuntu repositories][2] are the latest one or not? + +The apt package manager in [Ubuntu][3] and many other distribution provides two handy [apt command options][4] for this purpose. + +The apt search command looks for the provided string in the name and description of the packages. + +``` +apt search package_name +``` + +The apt show command provides detailed information on a package: + +``` +apt show package_name +``` + +The commands don’t require you to [be root in Ubuntu][5]. Here’s an example of these commands: + +![][6] + +### Why would you want to use apt search or apt show command? + +Let’s say you want to [install Gambas programming language in Ubuntu][7]. You are happy with your knowledge of the apt command so you decided to use the command line for installing application. + +You open a terminal and use the apt command to install gambas but it results in [unable to locate package error][8]. + +``` +sudo apt install gambas +Reading package lists... Done +Building dependency tree +Reading state information... Done +E: Unable to locate package gambas +``` + +Why did Ubuntu not find the gambas package? Because there is no such package called gambas. Instead, it is available as gambas3. This is a situation where you could take the advantage of the apt search command. + +Let’s move to apt show command. This command provides detailed information about a package, its repository, dependencies and a lot more. + +Knowing what version of a package is available from the official repository could help you in deciding whether you should install it from some other sources. + +Quick recall + +The apt package manager works on a local database/cache of available packages from various repositories. This database contains the information about the available package version, dependencies etc. It doesn’t contain the entire package itself. The packages are downloaded from the remote repositories. + +When you run the sudo apt update command, this cache is created/updated in the /var/lib/apt/lists/ directory. The apt search and apt show commands utilize this cache. + +The term package is used for an application, program, software. + +### Search for available packages using apt search command + +![][9] + +Let me continue the gambas example. Say, you search for + +``` +apt search gambas +``` + +It will give you a huge list of packages that have “gambas” in its name or description. This output list is in alphabetical order. + +Now, you’ll of course have to make some intelligent prediction about the package you want. In this example, the first result says “Complete visual development environment for Gambas”. This gives you a good hint that this is the main package you are looking for. + +![][10] + +Why so many packages associated with gambas? Because a number of these gambas packages are probably dependencies that will installed automatically if you install the gambas3 package. If you use the _‘apt show gambas3_‘ command, it will show all the dependencies that will be installed with gambas3 package. + +Some of these listed packages could be libraries that a developer may need in some special cases while developing her/his software. + +#### Use apt search for package name only + +By default, apt search command looks for the searched term in both the name of the package and its description. + +You may narrow down the search by instructing the apt command to search for package names only. + +``` +apt search --names-only search_term +``` + +If you are following this as a tutorial, give it a try. Check the output with search term ‘transitional’ with and without –names-only option and you’ll see how the output changes. + +``` +apt search transitional +apt search --names-only transitional +``` + +**Bonus Tip**: You can use ‘apt list –installed’ command to [look for installed packages in Ubuntu][11]. + +### Get detailed information on a package using apt show command + +The output of the apt search commands a brief introduction of the packages. If you want more details, use the apt show command. + +``` +apt show exact_package_name +``` + +The apt show command works on the exact package name and it gives you a lot more information on the package. You get: + + * Version information + * Repository information + * Origin and maintainer of the package information + * Where to file a bug + * Download and installation size + * Dependencies + * Detailed description of the package + * And a lot more + + + +Here’s an example: + +![][12] + +You need to give the exact package name otherwise the apt show won’t work. The good thing is that tab completion works apt show command. + +As you can see in the previous image, you have plenty of information that you may found helpful. + +The apt show command also works on installed packages. In that case, you can see which source the package was installed from. Was it a PPA or some third-party repository or universe or the main repository itself? + +Personally, I use apt show a lot. This helps me know if the package version provided by Ubuntu is the latest or not. Pretty handy tool! + +### Conclusion + +If you read my detailed [guide on the difference between apt and apt-get commands][13], you would know that this ‘apt search’ command works similar to ‘apt-cache search’. There is no such command as “apt-get search”. + +The purpose of creating apt command is to give you one tool with only enough option to manage the packages in your Debian/Ubuntu system. The apt-get, apt-cache and other apt tools still exist, and they can be used in scripting for more complex scenarios. + +I hope you found this introduction to **apt search** and **apt show** commands useful. I welcome your questions and suggestions on this topic. + +If you liked it, please share it on various Linux forums and communities you frequent. That helps us a lot. Thank you. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/apt-search-command/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.debian.org/Apt +[2]: https://itsfoss.com/ubuntu-repositories/ +[3]: https://ubuntu.com/ +[4]: https://itsfoss.com/apt-command-guide/ +[5]: https://itsfoss.com/root-user-ubuntu/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-apt-show-example-800x493.png?resize=800%2C493&ssl=1 +[7]: https://itsfoss.com/install-gambas-ubuntu/ +[8]: https://itsfoss.com/unable-to-locate-package-error-ubuntu/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-command.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-command-example.png?fit=800%2C297&ssl=1 +[11]: https://itsfoss.com/list-installed-packages-ubuntu/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-show-command-example-800x474.png?resize=800%2C474&ssl=1 +[13]: https://itsfoss.com/apt-vs-apt-get-difference/ diff --git a/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md b/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md new file mode 100644 index 0000000000..6cfd9f34de --- /dev/null +++ b/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What to do When You See “Repository does not have a release file” Error in Ubuntu) +[#]: via: (https://itsfoss.com/repository-does-not-have-release-file-error-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What to do When You See “Repository does not have a release file” Error in Ubuntu +====== + +One of the [several ways of installing software in Ubuntu][1] is by using PPA or adding third-party repositories. A few magical lines give you easy access to a software or its newer version that is not available by default in [Ubuntu][2]. + +All thing looks well and good until you get habitual of adding additional third-party repositories and one day, you see an error like this while [updating Ubuntu][3]: + +**E: The repository ‘ focal Release’ does not have a Release file. +N: Updating from such a repository can’t be done securely, and is therefore disabled by default. +N: See apt-secure(8) manpage for repository creation and user configuration details.** + +In this tutorial for Ubuntu beginners, I’ll explain what does this error mean, why do you see it and what can you do to handle this error? + +### Understanding “Repository does not have a release file” error + +![][4] + +Let’s go step by step here. The error message is: + +**E: The repository ‘ focal release’ does not have a release file** + +The important part of this error message is “focal release”. + +You probably already know that [each Ubuntu release has a codename][5]. For Ubuntu 20.04, the codename is Focal Fossa. The “focal” in the error message indicates Focal Fossa which is Ubuntu 20.04. + +The error is basically telling you that though you have added a third-party repository to your system’s sources list, this new repository is not available for your current Ubuntu version. + +_**Why so? Because probably you are using a new version of Ubuntu and the developer has not made the software available for this new version.**_ + +At this point, I highly recommend reading my detailed guides on [PPA][6] and [Ubuntu repositories][7]. These two articles will give you a better, in-depth knowledge of the topic. Trust me, you won’t be disappointed. + +### How to know if the PPA/third party is available for your Ubuntu version [Optional] + +First you should [check your Ubuntu version and its codename][8] using ‘lsb_release -a’ command: + +``` +[email protected]:~$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 20.04 LTS +Release: 20.04 +Codename: focal +``` + +As you can see, the codename it shows is focal. Now the next thing you can do is to go to the website of the software in question. + +This could be the tricky part but you can figure it out with some patience and effort. + +In the example here, the error complained about ****. It is a PPA repository and you may easily find its webpage. How, you may ask. + +Use Google or a [Google alternative search engine][9] like Duck Duck Go and search for “ppa numix”. This should give you the first result from [launchpad.net][10] which is the website used for hosting PPA related code. + +On the webpage of the PPA, you can go to the “Overview of published packages” and filter it by the codename of your Ubuntu version: + +![][11] + +For non-PPA third-party repository, you’ll have to check of the official website of the software and see if the repository is available for your Ubuntu version or not. + +### What to do if the repository is not available for your Ubuntu version + +In case when the repository in question is not available for your Ubuntu version, here’s what you can do: + + * Delete the troublesome repository from your list of repository so that you don’t see the error every time you run the update. + * Get the software from another source (if it is possible). + + + +To delete the troublesome repository, start Software & Updates tool: + +![][12] + +Go to the Other Software tab and look for the repository in question. Highlight it and then click on Remove button to delete it from your system. + +![Remove Ppa][13] + +This will [delete the PPA][14] or the repository in question. + +Next step is to get the software from some other source and that’s totally subjective. In some cases, you can still download the DEB file from the PPA website and use the software (I have explained the steps in the [PPA guide][6]). Alternatively, you can check the project’s website if there is a Snap/Flatpak or Python version of the software available. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/repository-does-not-have-release-file-error-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-remove-software-manjaro/ +[2]: https://ubuntu.com/ +[3]: https://itsfoss.com/update-ubuntu/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Repository-does-not-have-a-release-file.png?ssl=1 +[5]: https://itsfoss.com/linux-code-names/ +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://itsfoss.com/ubuntu-repositories/ +[8]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[9]: https://itsfoss.com/privacy-search-engines/ +[10]: https://launchpad.net/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/check-repo-version.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/remove-ppa.jpg?ssl=1 +[14]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ diff --git a/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md b/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md new file mode 100644 index 0000000000..871439e73a --- /dev/null +++ b/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create interactive content in WordPress with the H5P plugin) +[#]: via: (https://opensource.com/article/20/5/h5p-wordpress) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Create interactive content in WordPress with the H5P plugin +====== +Turn your WordPress site into an interactive learning management system +with this open source plugin. +![Family learning and reading together at night in a room][1] + +WordPress is best known as a website content management system, but it also a great [learning management system][2] (LMS) for delivering online courses. If that is what you are looking for out of WordPress, then [H5P][3] should be the top plugin on your list. + +H5P is a way to create and share interactive HTML5 content, including presentations, games, quizzes, forms, and more, in a browser. You can download a wide variety of content types from H5P's [Examples and Downloads][4] page, or you can create unique content to embed in your WordPress site. + +H5P provides plugins and integrations for WordPress, Moodle, Drupal, Canvas, Brightspace, Blackboard, and more. In this article, I will show how to use H5P in WordPress to create a reading comprehension quiz for students. + +### Install the H5P plugin + +The first step is to install the plugin. Log into your WordPress admin panel, go to **Plugins**, select **Add New**, and search for **H5P** in the Plugins field. When you find it, select **Install Now**. + +![Adding the H5P plugin][5] + +(Don Watkins, [CC BY-SA 4.0][6]) + +H5P should now appear in the list of installed plugins. Be sure to **Activate** the plugin by going to the H5P menu at the bottom of your WordPress admin panel and clicking the button. You will see the following display—be sure to consent so you can connect to the H5P Hub. + +![H5P consent option][7] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Now you can begin adding H5P content to your WordPress installation. + +### Create a quiz + +One of my favorite poems is Robert Frost's "The Road Not Taken." Suppose you are teaching a class that is studying this poem, and one of your objectives is for your students to remember the poem's author. First, create a new WordPress post on your site that contains the poem's text and its author. + +![Creating a WordPress post][8] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Now you want to test your students' comprehension with an HTML5 interactive content embedded below the poem. + +In the WordPress admin panel, look near the bottom for the **H5P Content** menu and select it. In the menu that appears, click **Add New**. + +![H5P Content menu][9] + +(Don Watkins, [CC BY-SA 4.0][6]) + +You will see an array of content options that are available. Since you want to create a multiple-choice quiz, look for the **Multiple Choice** option and click **Get** to its right. + +![H5P content types][10] + +(Don Watkins, [CC BY-SA 4.0][6]) + +A form will open for you to start creating the quiz. Fill in the required fields (marked with a red asterisk)—give your quiz a title (e.g., "Road Not Taken Quiz"), enter a question (e.g., "Who wrote, 'The Road Not Taken'?") and correct and incorrect answers, and select the correct answer in the dialog box. When you finish creating the quiz, save the content. + +![H5P quiz][11] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### Embed the quiz in a post + +Now you're ready to insert the quiz exactly where you want it to appear in your post. Open the post where you want to put the quiz (e.g., "The Road Not Taken" post) in your WordPress editor, and you should see an **Add H5P** button near the top of the interface. Place your cursor wherever you want the quiz to appear in the post, and click **Add H5P**. Your H5P content will appear in a dialog box like this: + +![H5P list of interactive content][12] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Select the content you want, and H5P will insert an embed code (e.g., `[h5p id="1"]`) in the post, like this: + +![H5P embed code in a post][13] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Save your post, then open it in your browser. The quiz is exactly where you wanted it to appear in the post: + +![H5P quiz shown in the post][14] + +(Don Watkins, [CC BY-SA 4.0][6]) + +When a student answers this question correctly, they get pleasant visual feedback: + +![Correct answer selection][15] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### The possibilities are endless + +H5P offers a wide range of options to add interactivity to WordPress posts. In this example, you could have created a more complex set of multiple-choice questions. H5P also has lots of other content types, including interactive video, arithmetic quizzes, an audio recorder, image hotspots, fill-in-the-blank quizzes, and [many more][4]. + +H5P also provides [excellent documentation][16] and [great tutorials][17] to help anyone who wants to use the plugin on their WordPress site. H5P software is open source under the [MIT License][18] with the code available on [GitHub][19]. H5P also welcomes contributions to the community; check out the [developer guide][20] for more information. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/h5p-wordpress + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/family_learning_kids_night_reading.png?itok=6K7sJVb1 (Family learning and reading together at night in a room) +[2]: https://en.wikipedia.org/wiki/Learning_management_system +[3]: https://h5p.org/ +[4]: https://h5p.org/content-types-and-applications +[5]: https://opensource.com/sites/default/files/uploads/addplugins-h5p.png (Adding the H5P plugin) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/h5p-consent.png (H5P consent option) +[8]: https://opensource.com/sites/default/files/uploads/wordpress-post.png (WordPress post) +[9]: https://opensource.com/sites/default/files/uploads/h5p-content-menu.png (H5P Content menu) +[10]: https://opensource.com/sites/default/files/uploads/h5p-content-types.png (H5P content types) +[11]: https://opensource.com/sites/default/files/uploads/h5p-multiple-choice-quiz.png (H5P quiz) +[12]: https://opensource.com/sites/default/files/uploads/h5p-insert-interactive-content.png (H5P list of interactive content) +[13]: https://opensource.com/sites/default/files/uploads/h5p-embedded-content.png (H5P embed code in a post) +[14]: https://opensource.com/sites/default/files/uploads/h5p-quiz.png (H5P quiz shown in the post) +[15]: https://opensource.com/sites/default/files/uploads/h5p-correct-answer.png (Correct answer selection) +[16]: https://h5p.org/documentation/setup/wordpress +[17]: https://h5p.org/documentation/for-authors/tutorials +[18]: https://h5p.org/MIT-licensed +[19]: https://github.com/h5p +[20]: https://h5p.org/developers diff --git a/sources/tech/20200527 Manage startup using systemd.md b/sources/tech/20200527 Manage startup using systemd.md new file mode 100644 index 0000000000..c0ff18a13d --- /dev/null +++ b/sources/tech/20200527 Manage startup using systemd.md @@ -0,0 +1,567 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage startup using systemd) +[#]: via: (https://opensource.com/article/20/5/manage-startup-systemd) +[#]: author: (David Both https://opensource.com/users/dboth) + +Manage startup using systemd +====== +Learn how systemd determines the order services start, even though it is +essentially a parallel system. +![Penguin with green background][1] + +While setting up a Linux system recently, I wanted to know how to ensure that dependencies for services and other units were up and running before those dependent services and units start. Specifically, I needed more knowledge of how systemd manages the startup sequence, especially in determining the order services are started in what is essentially a parallel system. + +You may know that SystemV (systemd's predecessor, as I explained in the [first article][2] in this series) orders the startup sequence by naming the startup scripts with an SXX prefix, where XX is a number from 00 to 99. SystemV then uses the sort order by name and runs each start script in sequence for the desired runlevel. + +But systemd uses unit files, which can be created or modified by a sysadmin, to define subroutines for not only initialization but also for regular operation. In the [third article][3] in this series, I explained how to create a mount unit file. In this fifth article, I demonstrate how to create a different type of unit file—a service unit file that runs a program at startup. You can also change certain configuration settings in the unit file and use the systemd journal to view the location of your changes in the startup sequence. + +### Preparation + +Make sure you have removed `rhgb` and `quiet` from the `GRUB_CMDLINE_LINUX=` line in the `/etc/default/grub` file, as I showed in the [second article][4] in this series. This enables you to observe the Linux startup message stream, which you'll need for some of the experiments in this article. + +### The program + +In this tutorial, you will create a simple program that enables you to observe a message during startup on the console and later in the systemd journal. + +Create the shell program `/usr/local/bin/hello.sh` and add the following content. You want to ensure that the result is visible during startup and that you can easily find it when looking through the systemd journal. You will use a version of the "Hello world" program with some bars around it, so it stands out. Make sure the file is executable and has user and group ownership by root with [700 permissions][5] for security: + + +``` +#!/usr/bin/bash +# Simple program to use for testing startup configurations +# with systemd. +# By David Both +# Licensed under GPL V2 +# +echo "###############################" +echo "######### Hello World! ########" +echo "###############################" +``` + +Run this program from the command line to verify that it works correctly: + + +``` +[root@testvm1 ~]# hello.sh +############################### +######### Hello World! ######## +############################### +[root@testvm1 ~]# +``` + +This program could be created in any scripting or compiled language. The `hello.sh` program could also be located in other places based on the [Linux filesystem hierarchical structure][6] (FHS). I place it in the `/usr/local/bin` directory so that it can be easily run from the command line without having to prepend a path when I type the command. I find that many of the shell programs I create need to be run from the command line and by other tools such as systemd. + +### The service unit file + +Create the service unit file `/etc/systemd/system/hello.service` with the following content. This file does not need to be executable, but for security, it does need user and group ownership by root and [644][7] or [640][8] permissions: + + +``` +# Simple service unit file to use for testing +# startup configurations with systemd. +# By David Both +# Licensed under GPL V2 +# + +[Unit] +Description=My hello shell script + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/hello.sh + +[Install] +WantedBy=multi-user.target +``` + +Verify that the service unit file performs as expected by viewing the service status. Any syntactical errors will show up here: + + +``` +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) +[root@testvm1 ~]# +``` + +You can run this "oneshot" service type multiple times without problems. The oneshot type is intended for services where the program launched by the service unit file is the main process and must complete before systemd starts any dependent process. + +There are seven service types, and you can find an explanation of each (along with the other parts of a service unit file) in the [systemd.service(5)][9] man page. (You can also find more information in the [resources][10] at the end of this article.) + +As curious as I am, I wanted to see what an error might look like. So, I deleted the "o" from the `Type=oneshot` line, so it looked like `Type=neshot`, and ran the command again: + + +``` +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) + +May 06 08:50:09 testvm1.both.org systemd[1]: /etc/systemd/system/hello.service:12: Failed to parse service type, ignoring: neshot +[root@testvm1 ~]# +``` + +These results told me precisely where the error was and made it very easy to resolve the problem. + +Just be aware that even after you restore the `hello.service` file to its original form, the error will persist. Although a reboot will clear the error, you should not have to do that, so I went looking for a method to clear out persistent errors like this. I have encountered service errors that require the command `systemctl daemon-reload` to reset an error condition, but that did not work in this case. The error messages that can be fixed with this command always seem to have a statement to that effect, so you know to run it. + +It is, however, recommended that you run `systemctl daemon-reload` after changing a unit file or creating a new one. This notifies systemd that the changes have been made, and it can prevent certain types of issues with managing altered services or units. Go ahead and run this command. + +After correcting the misspelling in the service unit file, a simple `systemctl restart hello.service` cleared the error. Experiment a bit by introducing some other errors into the `hello.service` file to see what kinds of results you get. + +### Start the service + +Now you are ready to start the new service and check the status to see the result. Although you probably did a restart in the previous section, you can start or restart a oneshot service as many times as you want since it runs once and then exits. + +Go ahead and start the service (as shown below), and then check the status. Depending upon how much you experimented with errors, your results may differ from mine: + + +``` +[root@testvm1 ~]# systemctl start hello.service +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) + +May 10 10:37:49 testvm1.both.org hello.sh[842]: ######### Hello World! ######## +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:54:45 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ######### Hello World! ######## +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:54:45 testvm1.both.org systemd[1]: Finished My hello shell script. +[root@testvm1 ~]# +``` + +Notice in the status command's output that the systemd messages indicate that the `hello.sh` script started and the service completed. You can also see the output from the script. This display is generated from the journal entries of the most recent invocations of the service. Try starting the service several times, and then run the status command again to see what I mean. + +You should also look at the journal contents directly; there are multiple ways to do this. One way is to specify the record type identifier, in this case, the name of the shell script. This shows the journal entries for previous reboots as well as the current session. As you can see, I have been researching and testing for this article for some time now: + + +``` +[root@testvm1 ~]# journalctl -t hello.sh +<snip> +\-- Reboot -- +May 08 15:55:47 testvm1.both.org hello.sh[840]: ############################### +May 08 15:55:47 testvm1.both.org hello.sh[840]: ######### Hello World! ######## +May 08 15:55:47 testvm1.both.org hello.sh[840]: ############################### +\-- Reboot -- +May 08 16:01:51 testvm1.both.org hello.sh[840]: ############################### +May 08 16:01:51 testvm1.both.org hello.sh[840]: ######### Hello World! ######## +May 08 16:01:51 testvm1.both.org hello.sh[840]: ############################### +\-- Reboot -- +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:37:49 testvm1.both.org hello.sh[842]: ######### Hello World! ######## +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ######### Hello World! ######## +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +[root@testvm1 ~]# +``` + +To locate the systemd records for the `hello.service` unit, you can search on systemd. You can use **G+Enter** to page to the end of the journal entries and then scroll back to locate the ones you are interested in. Use the `-b` option to show only the entries for the most recent startup: + + +``` +[root@testvm1 ~]# journalctl -b -t systemd +<snip> +May 10 10:37:49 testvm1.both.org systemd[1]: Starting SYSV: Late init script for live image.... +May 10 10:37:49 testvm1.both.org systemd[1]: Started SYSV: Late init script for live image.. +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:37:50 testvm1.both.org systemd[1]: Starting D-Bus System Message Bus... +May 10 10:37:50 testvm1.both.org systemd[1]: Started D-Bus System Message Bus. +``` + +I copied a few other journal entries to give you an idea of what you might find. This command spews all of the journal lines pertaining to systemd—109,183 lines when I wrote this. That is a lot of data to sort through. You can use the pager's search facility, which is usually `less`, or you can use the built-in `grep` feature. The `-g` (or `--grep=`) option uses Perl-compatible regular expressions: + + +``` +[root@testvm1 ~]# journalctl -b -t systemd -g "hello" +[root@testvm1 ~]# journalctl -b -t systemd -g "hello" +\-- Logs begin at Tue 2020-05-05 18:11:49 EDT, end at Sun 2020-05-10 11:01:01 EDT. -- +May 10 10:37:49 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:54:45 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:54:45 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:54:45 testvm1.both.org systemd[1]: Finished My hello shell script. +[root@testvm1 ~]# +``` + +You could use the standard GNU `grep` command, but that would not show the log metadata in the first line. + +If you do not want to see just the journal entries pertaining to your `hello` service, you can narrow things down a bit by specifying a time range. For example, I will start with the beginning time of `10:54:00` on my test VM, which was the start of the minute the entries above are from. ****Note that the `--since=` option must be enclosed in quotes and that this option can also be expressed as `-S "