Merge pull request #7 from LCTT/master

update from lctt
This commit is contained in:
Qian.Sun 2021-04-04 20:27:08 +08:00 committed by GitHub
commit e81aea087a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1558 additions and 370 deletions

View File

@ -0,0 +1,107 @@
[#]: collector: (lujun9972)
[#]: translator: (wyxplus)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13262-1.html)
[#]: subject: (How to set up a homelab from hardware to firewall)
[#]: via: (https://opensource.com/article/19/3/home-lab)
[#]: author: (Michael Zamot https://opensource.com/users/mzamot)
如何从硬件到防火墙建立一个家庭实验室
======
> 了解一下用于构建自己的家庭实验室的硬件和软件方案。
![](https://img.linux.net.cn/data/attachment/album/202104/02/215222t2fiqpt17gfpkkii.jpg)
你有想过创建一个家庭实验室吗?或许你想尝试不同的技术,构建开发环境、亦或是建立自己的私有云。拥有一个家庭实验室的理由很多,本教程旨在使入门变得更容易。
规划家庭实验室时,需要考虑三方面:硬件、软件和维护。我们将在这里查看前两方面,并在以后的文章中讲述如何节省维护计算机实验室的时间。
### 硬件
在考虑硬件需求时,首先要考虑如何使用实验室以及你的预算、噪声、空间和电力使用情况。
如果购买新硬件过于昂贵,请搜索当地的大学、广告以及诸如 eBay 或 Craigslist 之类的网站,能获取二手服务器的地方。它们通常很便宜,并且服务器级的硬件可以使用很多年。你将需要三类硬件:虚拟化服务器、存储设备和路由器/防火墙。
#### 虚拟化服务器
一个虚拟化服务器允许你去运行多个共享物理机资源的虚拟机,同时最大化利用和隔离资源。如果你弄坏了一台虚拟机,无需重建整个服务器,只需虚拟一个好了。如果你想进行测试或尝试某些操作而不损坏整个系统,仅需要新建一个虚拟机来运行即可。
在虚拟服务器中,需考虑两个最重要的因素是 CPU 的核心数及其运行速度以及内存容量。如果没有足够的资源够全部虚拟机共享,那么它们将被过度分配并试着获取其他虚拟机的 CPU 的周期和内存。
因此,考虑一个多核 CPU 的平台。你要确保 CPU 支持虚拟化指令(因特尔的 VT-x 指令集和 AMD 的 AMD-V 指令集)。能够处理虚拟化的优质的消费级处理器有因特尔的 i5 或 i7 和 AMD 的 Ryzen 处理器。如果你考虑服务器级的硬件,那么因特尔的志强系列和 AMD 的 EPYC 都是不错的选择。内存可能很昂贵,尤其是最近的 DDR4 内存。当我们估计所需多少内存时,请为主机操作系统的内存至少分配 2 GB 的空间。
如果你担心电费或噪声,则诸如因特尔 NUC 设备之类的解决方案虽然外形小巧、功耗低、噪音低,但是却以牺牲可扩展性为代价。
#### NAS
如果希望装有硬盘驱动器的计算机存储你的所有个人数据,电影,图片等,并为虚拟化服务器提供存储,则需要<ruby>网络附加存储<rt>Network-attached storage</rt></ruby>NAS
在大多数情况下,你不太可能需要一颗强力的 CPU。实际上许多商业 NAS 的解决方案使用低功耗的 ARM CPU。支持多个 SATA 硬盘的主板是必须的。如果你的主板没有足够的端口,请使用<ruby>主机总线适配器<rt>host bus adapter</rt><ruby>HBASAS 控制器添加额外的端口。
网络性能对于 NAS 来说是至关重要的,因此最好选择<ruby>千兆<rt>gigabit</rt></ruby>网络(或更快网络)。
内存需求根据你的文件系统而有所不同。ZFS 是 NAS 上最受欢迎的文件系统之一,你需要更多内存才能使用诸如缓存或重复数据删除之类的功能。<ruby>纠错码<rt>Error-correcting code</rt></ruby>ECC的内存是防止数据损坏的最佳选择但在购买前请确保你的主板支持。最后但同样重要的不要忘记使用<ruby>不间断电源<rt>uninterruptible power supply</rt></ruby>UPS因为断电可能会使得数据出错。
#### 防火墙和路由器
你是否曾意识到,廉价的路由器/防火墙通常是保护你的家庭网络不受外部环境影响的主要部分?这些路由器很少及时收到安全更新(如果有的话)。现在害怕了吗?好吧,[确实][2]
通常,你不需要一颗强大的 CPU 或是大量内存来构建你自己的路由器/防火墙,除非你需要高吞吐率或是执行 CPU 密集型任务,像是虚拟私有网络服务器或是流量过滤。在这种情况下,你将需要一个支持 AES-NI 的多核 CPU。
你可能想要至少 2 个千兆或更快的<ruby>以太网卡<rt>Ethernet network interface cards</rt></ruby>NIC这不是必需的但我推荐使用一个管理型交换机来连接你自己的装配的路由器以创建 VLAN 来进一步隔离和保护你的网络。
![Home computer lab PfSense][4]
### 软件
在选择完你的虚拟化服务器、NAS 和防火墙/路由器后,下一步是探索不同的操作系统和软件,以最大程度地发挥其作用。尽管你可以使用 CentOS、Debian或 Ubuntu 之类的常规 Linux 发行版,但是与以下软件相比,它们通常花费更多的时间进行配置和管理。
#### 虚拟化软件
[KVM][5]<ruby>基于内核的虚拟机<rt>Kernel-based Virtual Machine</rt></ruby>)使你可以将 Linux 变成虚拟机监控程序以便可以在同一台机器中运行多个虚拟机。最好的是KVM 作为 Linux 的一部分,它是许多企业和家庭用户的首选。如果你愿意,可以安装 [libvirt][6] 和 [virt-manager][7] 来管理你的虚拟化平台。
[Proxmox VE][8] 是一个强大的企业级解决方案,并且是一个完全开源的虚拟化和容器平台。它基于 Debian使用 KVM 作为其虚拟机管理程序,并使用 LXC 作为容器。Proxmox 提供了强大的网页界面、API并且可以扩展到许多群集节点这很有用因为你永远不知道何时实验室容量不足。
[oVirt][9]RHV是另一种使用 KVM 作为虚拟机管理程序的企业级解决方案。不要因为它是企业级的就意味着你不能在家中使用它。oVirt 提供了强大的网页界面和 API并且可以处理数百个节点如果你运行那么多服务器我可不想成为你的邻居。oVirt 用于家庭实验室的潜在问题是它需要一套最低限度的节点:你将需要一个外部存储(例如 NAS和至少两个其他虚拟化节点你可以只在一个节点上运行但你会遇到环境维护方面的问题
#### 网络附加存储软件
[FreeNAS][10] 是最受欢迎的开源 NAS 发行版,它基于稳定的 FreeBSD 操作系统。它最强大的功能之一是支持 ZFS 文件系统,该文件系统提供了数据完整性检查、快照、复制和多个级别的冗余(镜像、条带化镜像和条带化)。最重要的是,所有功能都通过功能强大且易于使用的网页界面进行管理。在安装 FreeNAS 之前,请检查硬件是否支持,因为它不如基于 Linux 的发行版那么广泛。
另一个流行的替代方法是基于 Linux 的 [OpenMediaVault][11]。它的主要功能之一是模块化带有可扩展和添加特性的插件。它包括的功能包括基于网页管理界面CIFS、SFTP、NFS、iSCSI 等协议,以及卷管理,包括软件 RAID、资源配额<ruby>访问控制列表<rt>access control lists</rt></ruby>ACL和共享管理。由于它是基于 Linux 的,因此其具有广泛的硬件支持。
#### 防火墙/路由器软件
[pfSense][12] 是基于 FreeBSD 的开源企业级路由器和防火墙发行版。它可以直接安装在服务器上,甚至可以安装在虚拟机中(以管理虚拟或物理网络并节省空间)。它有许多功能,可以使用软件包进行扩展。尽管它也有命令行访问权限,但也可以完全使用网页界面对其进行管理。它具有你所希望路由器和防火墙提供的所有功能,例如 DHCP 和 DNS以及更高级的功能例如入侵检测IDS和入侵防御IPS系统。你可以侦听多个不同接口或使用 VLAN 的网络,并且只需鼠标点击几下即可创建安全的 VPN 服务器。pfSense 使用 pf这是一种有状态的数据包筛选器它是为 OpenBSD 操作系统开发的,使用类似 IPFilter 的语法。许多公司和组织都有使用 pfSense。
* * *
考虑到所有的信息,是时候动手开始建立你的实验室了。在之后的文章中,我将介绍运行家庭实验室的第三方面:自动化进行部署和维护。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/3/home-lab
作者:[Michael Zamot (Red Hat)][a]
选题:[lujun9972][b]
译者:[wyxplus](https://github.com/wyxplus)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mzamot
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb
[2]: https://opensource.com/article/18/5/how-insecure-your-router
[3]: /file/427426
[4]: https://opensource.com/sites/default/files/uploads/pfsense2.png (Home computer lab PfSense)
[5]: https://www.linux-kvm.org/page/Main_Page
[6]: https://libvirt.org/
[7]: https://virt-manager.org/
[8]: https://www.proxmox.com/en/proxmox-ve
[9]: https://ovirt.org/
[10]: https://freenas.org/
[11]: https://www.openmediavault.org/
[12]: https://www.pfsense.org/

View File

@ -3,22 +3,22 @@
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)
[#]: collector: (lujun9972)
[#]: translator: (wyxplus)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13263-1.html)
如何用 C++ 读写文件
======
如果你知道如何在 C++ 中使用<ruby>输入输出<rt>I/O</rt></ruby>流,那么你便能够(原则上)处理任何类型的输入输出设备。
> 如果你知道如何在 C++ 中使用输入输出I/O那么原则上你便能够处理任何类型的输入输出设备。
![Computer screen with files or windows open][1]
![](https://img.linux.net.cn/data/attachment/album/202104/02/224507a2fq6ofotf4ff4rf.jpg)
在 C++ 中,可以通过将输入输出流与流运算符 `>>``<<` 结合使用来进行文件读写。当读写文件的时候,这些运算符将应用于代表硬盘驱动器上文件类的实例上。这种基于流的方法有个巨大的优势:从 C++ 的角度,无论你要读取或写入的内容是文件、数据库、控制台,亦或是你通过网络连接的另外一台电脑,这都无关紧要。因此,知道如何使用流运算符来写入文件能够被用到其他领域。
在 C++ 中,对文件的读写可以通过使用输入输出流与流运算符 `>>``<<` 来进行。当读写文件的时候,这些运算符被应用于代表硬盘驱动器上文件类的实例上。这种基于流的方法有个巨大的优势:从 C++ 的角度,无论你要读取或写入的内容是文件、数据库、控制台,亦或是你通过网络连接的另外一台电脑,这都无关紧要。因此,知道如何使用流运算符来写入文件能够被用到其他领域。
### 输入输出流类
C++ 标准库提供了 [ios_base][2] 类。该类充当所有 I/O 流的基类,例如 [basic_ofstream][3] 和 [basic_ifstream][4]。本例将使用特殊的类型来读写字符,`ifstream``ofstream`
C++ 标准库提供了 [ios_base][2] 类。该类作为所有 I/O 流的基类,例如 [basic_ofstream][3] 和 [basic_ifstream][4]。本例将使用读/写字符的专用类型 `ifstream``ofstream`
- `ofstream`:输出文件流,并且其能通过插入运算符 `<<` 来实现。
- `ifstream`:输入文件流,并且其能通过提取运算符 `>>` 来实现。
@ -31,11 +31,11 @@ C++ 标准库提供了 [ios_base][2] 类。该类充当所有 I/O 流的基类
本例程是非常简单:实例化了一个 `ofstream` 来写入,和实例化一个 `ifstream` 来读取。
```
#include &lt;iostream&gt; // cout, cin, cerr etc...
#include &lt;fstream&gt; // ifstream, ofstream
#include &lt;string&gt;
#include <iostream> // cout, cin, cerr etc...
#include <fstream> // ifstream, ofstream
#include <string>
int main()
{
@ -50,12 +50,13 @@ int main()
std::ofstream fileSink(sFilename); // Creates an output file stream
if (!fileSink) {
std::cerr &lt;&lt; "Canot open " &lt;&lt; sFilename &lt;&lt; std::endl;
std::cerr << "Canot open " << sFilename << std::endl;
exit(-1);
}
/* std::endl will automatically append the correct EOL */
fileSink &lt;&lt; "Hello Open Source World!" &lt;&lt; std::endl;
fileSink << "Hello Open Source World!" << std::endl;
/******************************************
* *
@ -66,17 +67,17 @@ int main()
std::ifstream fileSource(sFilename); // Creates an input file stream
if (!fileSource) {
std::cerr &lt;&lt; "Canot open " &lt;&lt; sFilename &lt;&lt; std::endl;
std::cerr << "Canot open " << sFilename << std::endl;
exit(-1);
}
else {
// Intermediate buffer
std::string buffer;
// By default, the &gt;&gt; operator reads word by workd (till whitespace)
while (fileSource &gt;&gt; buffer)
// By default, the >> operator reads word by workd (till whitespace)
while (fileSource >> buffer)
{
std::cout &lt;&lt; buffer &lt;&lt; std::endl;
std::cout << buffer << std::endl;
}
}
@ -88,22 +89,20 @@ int main()
![Console screenshot][8]
(Stephan Avenwedde, [CC BY-SA 4.0][9])
这是个简易、适合初学者的例子。如果你想去使用该代码在你自己的应用中,最好遵从以下建议:
这是个简化的、适合初学者的例子。如果你想去使用该代码在你自己的应用中,请注意以下几点:
* 文件流在程序结束的时候自动关闭。如果你想继续执行,那么应该通过调用 `close()` 方法手动关闭。
* 这些文件流类继承自 [basic_ios][10](在多个级别上),并且重载了 `!` 运算符。这使你可以进行简单的检查是否可以访问该流。在 [cppreference.com][11] 上,你可以找到该检查何时会(或不会)成功的概述,并且可以进一步实现错误处理。
* 这些文件流类继承自 [basic_ios][10](在多个层次上),并且重载了 `!` 运算符。这使你可以进行简单的检查是否可以访问该流。在 [cppreference.com][11] 上,你可以找到该检查何时会(或不会)成功的概述,并且可以进一步实现错误处理。
* 默认情况下,`ifstream` 停在空白处并跳过它。要逐行读取直到到达 [EOF][13] ,请使用 `getline(...)` 方法。
* 为了读写二进制文件,请将 `std::ios::binary` 标志传递给构造函数:这样可以防止 [EOL][13] 字符附加到每一行。
* 为了读写二进制文件,请将 `std::ios::binary` 标志传递给构造函数:这样可以防止 [EOL][13] 字符附加到每一行。
### 从系统角度进行写入
写入文件时,数据将写入系统的内存写入缓冲区中。当系统收到系统调用 [sync][14] 时,此缓冲区的内容将被写入硬盘。这也是你在不告知系统的情况下,不要卸下 U 盘的原因。通常,守护进程会定期调用 _sync_。为了安全起见,也可以手动调用 _sync_
写入文件时,数据将写入系统的内存写入缓冲区中。当系统收到系统调用 [sync][14] 时,此缓冲区的内容将被写入硬盘。这也是你在不告知系统的情况下,不要卸下 U 盘的原因。通常,守护进程会定期调用 `sync`。为了安全起见,也可以手动调用 `sync()`
```
#include &lt;unistd.h&gt; // needs to be included
#include <unistd.h> // needs to be included
sync();
```
@ -119,7 +118,7 @@ via: https://opensource.com/article/21/3/ccc-input-output
作者:[Stephan Avenwedde][a]
选题:[lujun9972][b]
译者:[wyxplus](https://github.com/wyxplus)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,67 @@
[#]: subject: (Why you should care about service mesh)
[#]: via: (https://opensource.com/article/21/3/service-mesh)
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13261-1.html)
为什么需要关心服务网格
======
> 在微服务环境中,服务网格为开发和运营提供了好处。
![](https://img.linux.net.cn/data/attachment/album/202104/02/201409os5r13omp5p5bssb.jpg)
很多开发者不知道为什么要关心<ruby>[服务网格][2]<rt>Service Mesh</rt></ruby>。这是我在开发者见面会、会议和实践研讨会上关于云原生架构的微服务开发的演讲中经常被问到的问题。我的回答总是一样的:“只要你想简化你的微服务架构,它就应该运行在 Kubernetes 上。”
关于简化,你可能也想知道,为什么分布式微服务必须设计得如此复杂才能在 Kubernetes 集群上运行。正如本文所解释的那样,许多开发人员通过服务网格解决了微服务架构的复杂性,并通过在生产中采用服务网格获得了额外的好处。
### 什么是服务网格?
服务网格是一个专门的基础设施层,用于提供一个透明的、独立于代码的 polyglot 方式,以消除应用代码中的非功能性微服务能力。
![Before and After Service Mesh][3]
### 为什么服务网格对开发者很重要
当开发人员将微服务部署到云时,无论业务功能如何,他们都必须解决非功能性微服务功能,以避免级联故障。这些功能通常可以体现在服务发现、日志、监控、<ruby>韧性<rt>resiliency</rt></ruby>、认证、<ruby>弹性<rt>elasticity</rt></ruby>和跟踪等方面。开发人员必须花费更多的时间将它们添加到每个微服务中,而不是开发实际的业务逻辑,这使得微服务变得沉重而复杂。
随着企业加速向云计算转移,服务网格 可以提高开发人员的生产力。Kubernetes 加服务网格平台不需要让服务负责处理这些复杂的问题,也不需要在每个服务中添加更多的代码来处理云原生的问题,而是负责向运行在该平台上的任何应用(现有的或新的,用任何编程语言或框架)提供这些服务。那么微服务就可以轻量级,专注于其业务逻辑,而不是云原生的复杂性。
### 为什么服务网格对运维很重要
这并没有回答为什么运维团队需要关心在 Kubernetes 上运行云原生微服务的服务网格。因为运维团队必须确保在 Kubernetes 环境上的大型混合云和多云上部署新的云原生应用的强大安全性、合规性和可观察性。
服务网格由一个用于管理代理路由流量的控制平面和一个用于注入<ruby>边车<rt>Sidecar</rt></ruby>的数据平面组成。边车允许运维团队做一些比如添加第三方安全工具和追踪所有服务通信中的流量,以避免安全漏洞或合规问题。服务网格还可以通过在图形面板上可视化地跟踪指标来提高观察能力。
### 如何开始使用服务网格
对于开发者和运维人员,以及从应用开发到平台运维来说,服务网格可以更有效地管理云原生功能。
你可能想知道从哪里开始采用服务网格来配合你的微服务应用和架构。幸运的是,有许多开源的服务网格项目。许多云服务提供商也在他们的 Kubernetes 平台中提供 服务网格。
![CNCF Service Mesh Landscape][5]
你可以在 [CNCF Service Mesh Landscape][6] 页面中找到最受欢迎的服务网格项目和服务的链接。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/service-mesh
作者:[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/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds)
[2]: https://www.redhat.com/en/topics/microservices/what-is-a-service-mesh
[3]: https://opensource.com/sites/default/files/uploads/vm-vs-service-mesh.png (Before and After Service Mesh)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/uploads/service-mesh-providers.png (CNCF Service Mesh Landscape)
[6]: https://landscape.cncf.io/card-mode?category=service-mesh&grouping=category

View File

@ -3,28 +3,30 @@
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: (DCOLIVERSUN)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13264-1.html)
NewsFlash: 一款 Feedly 支持的新型开源 Feed 阅读器
NewsFlash: 一款支持 Feedly 的现代开源 Feed 阅读器
======
有些人可能认为 RSS 阅读器已经不再但它们仍然坚持在这里特别是当你不希望看到的东西都是来自大型科技企业算法的时候。Feed 阅读器可以帮你自助选择阅读来源。
![](https://img.linux.net.cn/data/attachment/album/202104/03/001037r2udx6u6xqu5sqzu.jpg)
我最近遇到一个很棒的 RSS 阅读器 NewsFlash。它支持通过基于 web 的 Feed 阅读器增加 feed例如 [Feedly][1] 和 NewsBlur。如果你已经使用这种服务就不必人工导入 feed这节省了你的工作
有些人可能认为 RSS 阅读器已经不再但它们仍然坚持在这里特别是当你不想让大科技算法来决定你应该阅读什么的时候。Feed 阅读器可以帮你自助选择阅读来源
NewsFlash 恰好是 [FeedReadeer][2] 的精神继承者FeedReader 初创开发人员也参与其中。
我最近遇到一个很棒的 RSS 阅读器 NewsFlash。它支持通过基于网页的 Feed 阅读器增加 feed例如 [Feedly][1] 和 NewsBlur。这是一个很大的安慰因为如果你已经使用这种服务就不必人工导入 feed这节省了你的工作。
NewsFlash 恰好是 [FeedReadeer][2] 的精神继承者,原来的 FeedReader 开发人员也参与其中。
如果你正在找适用的 RSS 阅读器,我们整理了 [Linux Feed 阅读器][3] 列表供您参考。
### NewsFlash: 一款补充基于 web 的 RSS 阅读器账户的 Feed 阅读器
### NewsFlash: 一款补充网页 RSS 阅读器账户的 Feed 阅读器
![][4]
请注意NewsFlash 不仅针对基于 web 的 RSS feed 账户进行修改,而且你可以选择使用本地 RSS feed不必在多设备间同步。
请注意NewsFlash 并不只是针对基于网页的 RSS feed 账户量身定做的,你也可以选择使用本地 RSS feed不必在多设备间同步。
不过,如果你在用支持基于 web 的 feed 阅读器,那么 NewsFlash 特别有用。
不过,如果你在用是任何一款支持的基于网页的 feed 阅读器,那么 NewsFlash 特别有用。
这里,我将重点介绍 NewsFlash 提供的一些功能。
@ -42,22 +44,14 @@ NewsFlash 恰好是 [FeedReadeer][2] 的精神继承者FeedReader 初创开
* 支持自定义字体
* 支持多主题(包括深色主题)
* 启动/禁止缩略图
* 细粒度调整常规同步间隔时间
* 支持基于 web 的 Feed 账户,例如 Feedly、Fever、NewsBlur、feedbin、Miniflux
* 细粒度调整定期同步间隔时间
* 支持基于网页的 Feed 账户,例如 Feedly、Fever、NewsBlur、feedbin、Miniflux
除上述功能外,当你调整窗口大小时,还可以打开阅读器视图,这是一个细腻的补充功能。
![newsflash 截图1][6]
账户重新设置也很容易,不过需要删除所有本地数据。是的,你可以手动清除缓存并设置到期时间,以便所有你想看的 feed 用户数据都存在本地。
**推荐阅读:**
![][7]
#### [6 款 Linux 最佳 Feed 阅读器][3]
你是否想用 RSS feed 来订阅你喜欢网站的最新消息?看一看 Linux 最佳 Feed 阅读器吧。
账户重新设置也很容易,这将删除所有本地数据。是的,你可以手动清除缓存并设置到期时间,并为你关注的所有 feed 设置一个用户数据存在本地的到期时间。
### 在 Linux 上安装 NewsFlash
@ -67,11 +61,11 @@ NewsFlash 恰好是 [FeedReadeer][2] 的精神继承者FeedReader 初创开
幸运的是,[Flatpak][10] 软件包可以让你轻松在 Linux 发行版上安装 NewsFlash。具体请参阅我们的 [Flatpak 指南][11]。
你可以参考 NewsFlash 的 [GitLab页面][12] 去解决大部分问题。
你可以参考 NewsFlash 的 [GitLab 页面][12] 去解决大部分问题。
### 结束语
我现在用 NewsFlash 作为桌面本地解决方案,不用基于 web 的服务。你可以通过直接导出 OPML 文件在移动 feed 应用上得到相同的 feed。这已经被我验证过了。
我现在用 NewsFlash 作为桌面本地解决方案,不用基于网页的服务。你可以通过直接导出 OPML 文件在移动 feed 应用上得到相同的 feed。这已经被我验证过了。
用户界面易于使用,也提供了数一数二的新版 UX。虽然这个 RSS 阅读器看似简单,但提供了你可以找到的所有重要功能。
@ -84,7 +78,7 @@ via: https://itsfoss.com/newsflash-feedreader/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[DCOLIVERSUN](https://github.com/DCOLIVERSUN)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,139 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (wyxplus)
[#]: 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

View File

@ -2,7 +2,7 @@
[#]: via: (https://jvns.ca/blog/2021/03/31/dnspeep-tool/)
[#]: author: (Julia Evans https://jvns.ca/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (wyxplus)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,194 @@
[#]: subject: (Partition a drive on Linux with GNU Parted)
[#]: via: (https://opensource.com/article/21/4/linux-parted-cheat-sheet)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Partition a drive on Linux with GNU Parted
======
Learn the basics of partitioning a new storage device, then download our
cheat sheet to keep info close at hand.
![Cheat Sheet cover image][1]
In the 21st century, we tend to take data storage for granted. We have lots of it, it's relatively affordable, and there are many different types of storage available. No matter how much cloud storage space you're given for free, there's nothing quite like having a physical hard drive for your really important (or really big, when you live on a slow network) data. However, few hard drives are sold right off the shelf, ready to use—in an ideal configuration, at least. Whether you're buying a new drive or setting up a system with a different configuration, you need to know how to partition a drive on Linux.
This article demonstrates GNU Parted, one of the best tools for partitioning drives. If you prefer to use a graphical application instead of a terminal command, read my article on [formatting drives for Linux][2].
### Disk labels, partitions, and filesystems
A hard drive doesn't _technically_ require much software to serve as a storage device. However, using a drive without modern conventions like a partition table and filesystem is difficult, impractical, and unsafe for your data.
There are three important concepts you need to know about hard drives:
* A **disk label** or **partition table** is metadata placed at the start of a drive, serving as a clue for the computer reading it about what kind of storage is available and where it's located on the drive.
* A **partition** is a boundary identifying where a filesystem is located. For instance, if you have a 512GB drive, you can have a partition on that device that takes up the entire drive (512GB), or two partitions that each take 256GB each, or three partitions taking up some other variation of sizes, and so on.
* A **filesystem** is a storage scheme agreed upon by a hard drive and a computer. A computer must know how to read a filesystem to piece together all the data stored on the drive, and it must know how to write data back to the filesystem to maintain the data's integrity.
The GNU Parted application manages the first two concepts: disk labels and partitions. Parted has some awareness of filesystems, but it leaves the details of filesystem implementation to other tools like `mkfs`.
**[Download the [GNU Parted cheat sheet][3]]**
### Locating the drive
Before using GNU Parted, you must be certain where your drive is located on your system. First, attach the hard drive you want to format to your system, and then use the `parted` command to see what's attached to your computer:
```
$ parted /dev/sda print devices
/dev/sda (2000GB)
/dev/sdb (1000GB)
/dev/sdc (1940MB)
```
The device you most recently attached gets a name later in the alphabet than devices that have been attached longer. In this example, `/dev/sdc` is most likely the drive I just attached. I can confirm that by its size because I know that the USB thumb drive I attached is only 2GB (1940MB is close enough), compared to my workstation's main drives, which are terabytes in size. If you're not sure, then you can get more information about the drive you think is the one you want to partition:
```
$ parted /dev/sdc print
Model: Yoyodyne Tiny Drive 1.0 (scsi)    
Disk /dev/sdc: 1940MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2048kB  1024kB  BS           Bloat  Hidden
 2      2049kB  1939MB  1937MB  FAT32        MyDrive
```
Some drives provide more metadata than others. This one identifies itself as a drive from Yoyodyne, which is exactly the branding on the physical drive. Furthermore, it contains a small hidden partition at the front of the drive with some bloatware followed by a Windows-compatible FAT32 partition. This is definitely the drive I intend to reformat.
Before continuing, _make sure_ you have identified the correct drive you want to partition. _Repartitioning the wrong drive results in lost data._ For safety, all potentially destructive commands in this article reference the `/dev/sdX` device, which you are unlikely to have on your system.
### Creating a disk label or partition table
To create a partition on a drive, the drive must have a disk label. A disk label is also called a _partition table_, so Parted accepts either term.
To create a disk label, use the `mklabel` or `mktable` subcommand:
```
`$ parted /dev/sdX mklabel gpt`
```
This command creates a **gpt** label at the front of the drive located at `/dev/sdX`, erasing any label that may exist. This is a quick process because all that's being replaced is metadata about partitions.
### Creating a partition
To create a partition on a drive, use the `mkpart` subcommand, followed by an optional name for your partition, followed by the partition's start and end points. If you only need one partition on your drive, then sizing is easy: start at 1 and end at 100%. Use the `--align opt` option to allow Parted to adjust the position of the partition boundaries for best performance:
```
$ parted /dev/sdX --align opt \
mkpart example 1 100%
```
View your new partition with the `print` subcommand:
```
$ parted /dev/sdX print
Model: Yoyodyne Tiny Drive 1.0 (scsi)
Disk /dev/sdi: 1940MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number  Start   End     Size  
 1      1049kB  1939MB  1938MB
```
You don't have to use the whole disk for one partition. The advantage to a partition is that more than one filesystem can exist on a drive without interfering with the other partition(s). When sizing partitions, you can use the `unit` subcommand to set what kind of measurements you want to use. Parted understands sectors, cylinders, heads, bytes, kilobytes, megabytes, gigabytes, terabytes, and percentages.
You can also specify what filesystem you intend to use a partition for. This doesn't create the filesystem, but it does provide metadata that could be useful to you later.
Here's a 50-50 split, one for an XFS filesystem and another for an EXT4 filesystem:
```
$ parted /dev/sdX --align opt \
mkpart xfs 1 50%
$ parted /dev/sdX --align opt \
mkpart ext4 51% 100%
```
### Naming a partition
In addition to marking what filesystem a partition is for, you can also name each partition. Some file managers and utilities read partition names, which can help you identify drives. For instance, I often have several different drives attached on my media workstation, each belonging to a different project. When creating these drives, I name both the partition and the filesystem so that, no matter how I'm looking at my system, the locations with important data are clearly labeled.
To name a partition, you must know its number:
```
$ parted /dev/sdX print
[...]
Number  Start   End     Size   File system  Name     Flags
 1      1049kB  990MB   989MB  xfs          example
 2      1009MB  1939MB  930MB  ext4         noname
```
To name partition 1:
```
$ parted /dev/sdX name 1 example
$ parted /dev/sdX print
[...]
Number  Start   End     Size   File system  Name     Flags
 1      1049kB  990MB   989MB  xfs          example
 2      1009MB  1939MB  930MB  ext4         noname
```
### Create a filesystem
For your drive to be useful, you must create a filesystem in your new partition. GNU Parted doesn't do that because it's only a partition manager. The Linux command to create a filesystem on a drive is `mkfs`, but there are helpful utilities aliased for you to use to create a specific kind of filesystem. For instance, `mkfs.ext4` creates an EXT4 filesystem, while `mkfs.xfs` creates an XFS filesystem, and so on.
Your partition is located "in" the drive, so instead of creating a filesystem on `/dev/sdX`, you create your filesystem in `/dev/sdX1` for the first partition, `/dev/sdX2` for the second partition, and so on.
Here's an example of creating an XFS filesystem:
```
`$ sudo mkfs.xfs -L mydrive /dev/sdX1`
```
### Download our cheat sheet
Parted is a flexible and powerful command. You can issue it commands, as demonstrated in this article, or activate an interactive mode so that you're constantly "connected" to a drive you specify:
```
$ parted /dev/sdX
(parted) print
[...]
Number  Start   End     Size   File system  Name     Flags
 1      1049kB  990MB   989MB  xfs          example
 2      1009MB  1939MB  930MB  ext4         noname
(parted) name 1 mydrive
(parted)
```
If you intend to use Parted often, [download our GNU Parted cheat sheet][3] so that you have all the subcommands you need close at hand.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/linux-parted-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/article/18/11/partition-format-drive-linux#gui
[3]: https://opensource.com/downloads/parted-cheat-sheet

View File

@ -0,0 +1,104 @@
[#]: subject: (20 ways to be more productive and respect yourself)
[#]: via: (https://opensource.com/article/21/4/productivity-roundup)
[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
20 ways to be more productive and respect yourself
======
Open source tools and more efficient processes can give you an edge over
your to-do list.
![Kanban-style organization action][1]
The need to be productive is ingrained in who we are as human beings on some level. We oftentimes have to do yoga and meditate and breathe deeply in order to consciously slow down our minds and bodies, but when we do it helps us focus and be more productive when the time comes. Instead of constantly moving and doing, we should take periods of thoughtful breaks... or veg out in front of the TV or a sunset. And sleep at night! Then, when we're ready again, we can tackle that to-do list. Rinse and repeat.
Honoring this cycle of moving through active and restful states, our productivity series this year brought to us by author [Kevin Sonney][2] showcases open source tools and more efficient processes while paying attention to healthy practices for incorporating them and respecting the person doing the implementing, you.
### Tools and technology
The software, the apps, and the programs... they are the tools we wield when we're ready to sit down and get stuff done. Here are nine open source tools you should know.
* [Improve your productivity with this lightweight Linux desktop][3]
* [3 plain text note-taking tools][4]
* [How to use KDE's productivity suite, Kontact][5]
* [How Nextcloud is the ultimate open source productivity suite][6]
* [Schedule appointments with an open source alternative to Doodle][7]
* [Use Joplin to find your notes faster][8]
* [Use your Raspberry Pi as a productivity powerhouse][9]
### Processes and practices
#### Email
Despite the criticism, is email still a favorite way for you to get stuff done? Improve on this process even more with these tips:
* [3 email rules to live by in 2021][10]
* [3 steps to achieving Inbox Zero][11]
* [Organize your task list using labels][12]
* [3 tips for automating your email filters][13]
* [3 email mistakes and how to avoid them][14]
#### Calendars
We often need to work with others and ask important questions to get work done and tasks completed, so scheduling meetings is an important part of being productive.
* [Gain control of your calendar with this simple strategy][15]
#### Mind games
Preparing and caring for our mental state while we work is critical to being productive. Kevin shows us how to prioritize, reflect, take care, reduce stress, rest, and focus.  
* [How I prioritize tasks on my to-do list][16]
* [Tips for incorporating self-care into your daily routine][17]
* [Why keeping a journal improves productivity][18]
* [3 stress-free steps to tackling your task list][19]
* [4 tips for preventing notification fatigue][20]
* [Open source tools and tips for staying focused][21]
* [How I de-clutter my digital workspace][22]
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/productivity-roundup
作者:[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/kanban_trello_organize_teams_520.png?itok=ObNjCpxt (Kanban-style organization action)
[2]: https://opensource.com/users/ksonney
[3]: https://opensource.com/article/21/1/elementary-linux
[4]: https://opensource.com/article/21/1/plain-text
[5]: https://opensource.com/article/21/1/kde-kontact
[6]: https://opensource.com/article/21/1/nextcloud-productivity
[7]: https://opensource.com/article/21/1/open-source-scheduler
[8]: https://opensource.com/article/21/1/notes-joplin
[9]: https://opensource.com/article/21/1/raspberry-pi-productivity
[10]: https://opensource.com/article/21/1/email-rules
[11]: https://opensource.com/article/21/1/inbox-zero
[12]: https://opensource.com/article/21/1/labels
[13]: https://opensource.com/article/21/1/email-filter
[14]: https://opensource.com/article/21/1/email-mistakes
[15]: https://opensource.com/article/21/1/calendar-time-boxing
[16]: https://opensource.com/article/21/1/prioritize-tasks
[17]: https://opensource.com/article/21/1/self-care
[18]: https://opensource.com/article/21/1/open-source-journal
[19]: https://opensource.com/article/21/1/break-down-tasks
[20]: https://opensource.com/article/21/1/alert-fatigue
[21]: https://opensource.com/article/21/1/stay-focused
[22]: https://opensource.com/article/21/1/declutter-workspace

View File

@ -0,0 +1,240 @@
[#]: subject: (A practical guide to using the git stash command)
[#]: via: (https://opensource.com/article/21/4/git-stash)
[#]: author: (Ramakrishna Pattnaik https://opensource.com/users/rkpattnaik780)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
A practical guide to using the git stash command
======
Learn how to use the git stash command and when you should use it.
![woman on laptop sitting at the window][1]
Version control is an inseparable part of software developers' daily lives. It's hard to imagine any team developing software without using a version control tool. It's equally difficult to envision any developer who hasn't worked with (or at least heard of) Git. In the 2018 Stackoverflow Developer Survey, 87.2% of the 74,298 participants [use Git][2] for version control.
Linus Torvalds created git in 2005 for developing the Linux kernel. This article walks through the `git stash` command and explores some useful options for stashing changes. It assumes you have basic familiarity with [Git concepts][3] and a good understanding of the working tree, staging area, and associated commands.
### Why is git stash important?
The first thing to understand is why stashing changes in Git is important. Assume for a moment that Git doesn't have a command to stash changes. Suppose you are working on a repository with two branches, A and B. The A and B branches have diverged from each other for quite some time and have different heads. While working on some files in branch A, your team asks you to fix a bug in branch B. You quickly save your changes to A and try to check out branch B with `git checkout B`. Git immediately aborts the operation and throws the error, "Your local changes to the following files would be overwritten by checkout … Please commit your changes or stash them before you switch branches."
There are few ways to enable branch switching in this case:
* Create a commit at that point in branch A, commit and push your changes to fix the bug in B, then check out A again and run `git reset HEAD^` to get your changes back.
* Manually keep the changes in files not tracked by Git.
The second method is a bad idea. The first method, although appearing conventional, is less flexible because the unfinished saved changes are treated as a checkpoint rather than a patch that's still a work in progress. This is exactly the kind of scenario git stash is designed for.
Git stash saves the uncommitted changes locally, allowing you to make changes, switch branches, and perform other Git operations. You can then reapply the stashed changes when you need them. A stash is locally scoped and is not pushed to the remote by `git push`.
### How to use git stash
Here's the sequence to follow when using git stash:
1. Save changes to branch A.
2. Run `git stash`.
3. Check out branch B.
4. Fix the bug in branch B.
5. Commit and (optionally) push to remote.
6. Check out branch A
7. Run `git stash pop` to get your stashed changes back.
Git stash stores the changes you made to the working directory locally (inside your project's .git directory; `/.git/refs/stash`, to be precise) and allows you to retrieve the changes when you need them. It's handy when you need to switch between contexts. It allows you to save changes that you might need at a later stage and is the fastest way to get your working directory clean while keeping changes intact.
### How to create a stash
The simplest command to stash your changes is `git stash`:
```
$ git stash
Saved working directory and index state WIP on master; d7435644 Feat: configure graphql endpoint
```
By default, `git stash` stores (or "stashes") the uncommitted changes (staged and unstaged files) and overlooks untracked and ignored files. Usually, you don't need to stash untracked and ignored files, but sometimes they might interfere with other things you want to do in your codebase.
You can use additional options to let `git stash` take care of untracked and ignored files:
* `git stash -u` or `git stash --include-untracked` stash untracked files.
* `git stash -a` or `git stash --all` stash untracked files and ignored files.
To stash specific files, you can use the command `git stash -p` or `git stash patch`:
```
$ git stash --patch
diff --git a/.gitignore b/.gitignore
index 32174593..8d81be6e 100644
\--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 # dependencies
 node_modules/
 /.pnp
+f,fmfm
 .pnp.js
 # testing
(1/1) Stash this hunk [y,n,q,a,d,e,?]?
```
### Listing your stashes
You can view your stashes with the command `git stash list`. Stashes are saved in a last-in-first-out (LIFO) approach:
```
$ git stash list
stash@{0}: WIP on master: d7435644 Feat: configure graphql endpoint
```
By default, stashes are marked as WIP on top of the branch and commit that you created the stash from. However, this limited amount of information isn't helpful when you have multiple stashes, as it becomes difficult to remember or individually check their contents. To add a description to the stash, you can use the command `git stash save <description>`:
```
$ git stash save "remove semi-colon from schema"
Saved working directory and index state On master: remove semi-colon from schema
$ git stash list
stash@{0}: On master: remove semi-colon from schema
stash@{1}: WIP on master: d7435644 Feat: configure graphql endpoint
```
### Retrieving stashed changes
You can reapply stashed changes with the commands `git stash apply` and `git stash pop`. Both commands reapply the changes stashed in the latest stash (that is, `stash@{0}`). A `stash` reapplies the changes while `pop` removes the changes from the stash and reapplies them to the working copy. Popping is preferred if you don't need the stashed changes to be reapplied more than once.
You can choose which stash you want to pop or apply by passing the identifier as the last argument:
```
`$ git stash pop stash@{1}`
```
or
```
`$ git stash apply stash@{1}`
```
### Cleaning up the stash
It is good practice to remove stashes that are no longer needed. You must do this manually with the following commands:
* `git stash clear` empties the stash list by removing all the stashes.
* `git stash drop <stash_id>` deletes a particular stash from the stash list.
### Checking stash diffs
The command `git stash show <stash_id>` allows you to view the diff of a stash:
```
$ git stash show stash@{1}
console/console-init/ui/.graphqlrc.yml        |   4 +-
console/console-init/ui/generated-frontend.ts | 742 +++++++++---------
console/console-init/ui/package.json          |   2 +-
```
To get a more detailed diff, pass the `--patch` or `-p` flag:
```
$ git stash show stash@{0} --patch
diff --git a/console/console-init/ui/package.json b/console/console-init/ui/package.json
index 755912b97..5b5af1bd6 100644
\--- a/console/console-init/ui/package.json
+++ b/console/console-init/ui/package.json
@@ -1,5 +1,5 @@
 {
\- "name": "my-usepatternfly",
\+ "name": "my-usepatternfly-2",
  "version": "0.1.0",
  "private": true,
  "proxy": "<http://localhost:4000>"
diff --git a/console/console-init/ui/src/AppNavHeader.tsx b/console/console-init/ui/src/AppNavHeader.tsx
index a4764d2f3..da72b7e2b 100644
\--- a/console/console-init/ui/src/AppNavHeader.tsx
+++ b/console/console-init/ui/src/AppNavHeader.tsx
@@ -9,8 +9,8 @@ import { css } from "@patternfly/react-styles";
interface IAppNavHeaderProps extends PageHeaderProps {
\- toolbar?: React.ReactNode;
\- avatar?: React.ReactNode;
\+ toolbar?: React.ReactNode;
\+ avatar?: React.ReactNode;
}
export class AppNavHeader extends React.Component&lt;IAppNavHeaderProps&gt;{
  render()
```
### Checking out to a new branch
You might come across a situation where the changes in a branch and your stash diverge, causing a conflict when you attempt to reapply the stash. A clean fix for this is to use the command `git stash branch <new_branch_name stash_id>`, which creates a new branch based on the commit the stash was created _from_ and pops the stashed changes to it:
```
$ git stash branch test_2 stash@{0}
Switched to a new branch 'test_2'
On branch test_2
Changes not staged for commit:
(use "git add &lt;file&gt;..." to update what will be committed)
(use "git restore &lt;file&gt;..." to discard changes in working directory)
modified: .graphqlrc.yml
modified: generated-frontend.ts
modified: package.json
no changes added to commit (use "git add" and/or "git commit -a")
Dropped stash@{0} (fe4bf8f79175b8fbd3df3c4558249834ecb75cd1)
```
### Stashing without disturbing the stash reflog
In rare cases, you might need to create a stash while keeping the stash reference log (reflog) intact. These cases might arise when you need a script to stash as an implementation detail. This is achieved by the `git stash create` command; it creates a stash entry and returns its object name without pushing it to the stash reflog:
```
$ git stash create "sample stash"
63a711cd3c7f8047662007490723e26ae9d4acf9
```
Sometimes, you might decide to push the stash entry created via `git stash create` to the stash reflog:
```
$ git stash store -m "sample stash testing.." "63a711cd3c7f8047662007490723e26ae9d4acf9"
$ git stash list
stash @{0}: sample stash testing..
```
### Conclusion
I hope you found this article useful and learned something new. If I missed any useful options for using stash, please let me know in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/git-stash
作者:[Ramakrishna Pattnaik][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/rkpattnaik780
[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://insights.stackoverflow.com/survey/2018#work-_-version-control
[3]: https://opensource.com/downloads/cheat-sheet-git

View File

@ -0,0 +1,181 @@
[#]: subject: (Read and write files with Groovy)
[#]: via: (https://opensource.com/article/21/4/groovy-io)
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Read and write files with Groovy
======
Learn how the Groovy programming language handles reading from and
writing to files.
![Woman programming][1]
Two common tasks that new programmers need to learn are how to read from and write to files stored on a computer. Some examples are when data and configuration files created in one application need to be read by another application, or when a third application needs to write info, warnings, and errors to a log file or to save its results for someone else to use.
Every language has a few different ways to read from and write to files. This article covers some of these details in the [Groovy programming language][2], which is based on Java but with a different set of priorities that make Groovy feel more like Python. The first thing a new-to-Groovy programmer sees is that it is much less verbose than Java. The next observation is that it is (by default) dynamically typed. The third is that Groovy has closures, which are somewhat like lambdas in Java but provide access to the entire enclosing context (Java lambdas restrict what can be accessed).
My fellow correspondent Seth Kenlon has written about [Java input and output (I/O)][3]. I'll jump off from his Java code to show you how it's done in Groovy.
### Install Groovy
Since Groovy is based on Java, it requires a Java installation. You may be able to find a recent and decent version of Java and Groovy in your Linux distribution's repositories. Or you can install Groovy by following the instructions on [Groovy's download page][4]. A nice alternative for Linux users is [SDKMan][5], which you can use to get multiple versions of Java, Groovy, and many other related tools. For this article, I'm using my distro's OpenJDK11 release and SDKMan's Groovy 3.0.7 release.
### Read a file with Groovy
Start by reviewing Seth's Java program for reading files:
```
import java.io.File;
import java.util.Scanner;
import java.io.FileNotFoundException;
public class Ingest {
  public static void main([String][6][] args) {
      try {
          [File][7] myFile = new [File][7]("example.txt");
          Scanner myScanner = new Scanner(myFile);
          while (myScanner.hasNextLine()) {
              [String][6] line = myScanner.nextLine();
              [System][8].out.println(line);
          }
          myScanner.close();
      } catch ([FileNotFoundException][9] ex) {
          ex.printStackTrace();
      } //try
    } //main
} //class
```
Now I'll do the same thing in Groovy:
```
def myFile = new [File][7]('example.txt')
def myScanner = new Scanner(myFile)
while (myScanner.hasNextLine()) {
        def line = myScanner.nextLine()
        println(line)
}
myScanner.close()
```
Groovy looks like Java but less verbose. The first thing to notice is that all those `import` statements are already done in the background. And since Groovy is partly intended to be a scripting language, by omitting the definition of the surrounding `class` and `public static void main`, Groovy will construct those things in the background.
The semicolons are also gone. Groovy supports their use but doesn't require them except in cases like when you want to put multiple statements on the same line. Aaaaaaaaand the single quotes—Groovy supports either single or double quotes for delineating strings, which is handy when you need to put double quotes inside a string, like this:
```
`'"I like this Groovy stuff", he muttered to himself.'`
```
Note also that `try...catch` is gone. Groovy supports `try...catch` but doesn't require it, and it will give a perfectly good error message and stack trace just like the `ex.printStackTrace()` call does in the Java example.
Groovy adopted the `def` keyword and inference of type from the right-hand side of a statement long before Java came up with the `var` keyword, and Groovy allows it everywhere. Aside from using `def`, though, the code that does the main work looks quite similar to the Java version. Oh yeah, except that Groovy also has this nice metaprogramming ability built in, which among other things, lets you write `println()` instead of `System.out.println()`. This similarity is way more than skin deep and allows Java programmers to get traction with Groovy very quickly.
And just like Python programmers are always looking for the pythonic way to do stuff, there is Groovy that looks like Java, and then there is… groovier Groovy. This solves the same problem but uses Groovy's `with` method to make the code more DRY ("don't repeat yourself") and to automate closing the input file:
```
new Scanner(new [File][7]('example.txt')).with {
    while (hasNextLine()) {
      def line = nextLine()
      println(line)
    }
}
```
What's between `.with {` and `}` is a closure body. Notice that you don't need to write `myScanner.hasNextLine()` nor `myScanner.nextLine()` as `with` exposes those methods directly to the closure body.  Also the with gets rid of the need to code myScanner.close() and so we don't actually need to declare myScanner at all.
Run it:
```
$ groovy ingest1.groovy
Caught: java.io.[FileNotFoundException][9]: example.txt (No such file or directory)
java.io.[FileNotFoundException][9]: example.txt (No such file or directory)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native [Method][10])
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at ingest1.run(ingest1.groovy:1)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native [Method][10])
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
$
```
Note the "file not found" exception; this is because there isn't a file called `example.txt` yet. Note also that the files are from things like `java.io`.
So I'll write something into that file…
### Write data to a file with Groovy
Combining what I shared previously about, well, being "groovy":
```
new [FileWriter][11]("example.txt", true).with {
        write("Hello world\n")
        flush()
}
```
Remember that `true` after the file name means "append to the file," so you can run this a few times:
```
$ groovy exgest.groovy
$ groovy exgest.groovy
$ groovy exgest.groovy
$ groovy exgest.groovy
```
Then you can read the results with `ingest1.groovy`:
```
$ groovy ingest1.groovy
Hello world
Hello world
Hello world
Hello world
$
```
The call to `flush()` is used because the `with` / `write` combo didn't do a flush before close. Groovy isn't always shorter!
### Groovy resources
The Apache Groovy site has a lot of great [documentation][12]. Another great Groovy resource is [Mr. Haki][13]. And a really great reason to learn Groovy is to learn [Grails][14], which is a wonderfully productive full-stack web framework built on top of excellent components like Hibernate, Spring Boot, and Micronaut.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/groovy-io
作者:[Chris Hermansen][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/clhermansen
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming)
[2]: https://groovy-lang.org/
[3]: https://opensource.com/article/21/3/io-java
[4]: https://groovy.apache.org/download.html
[5]: https://sdkman.io/
[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+file
[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system
[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+filenotfoundexception
[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+method
[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+filewriter
[12]: https://groovy-lang.org/documentation.html
[13]: https://blog.mrhaki.com/
[14]: https://grails.org/

View File

@ -0,0 +1,169 @@
[#]: subject: (FreeDOS commands you need to know)
[#]: via: (https://opensource.com/article/21/4/freedos-commands)
[#]: author: (Kevin O'Brien https://opensource.com/users/ahuka)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
FreeDOS commands you need to know
======
Learn how to make, remove, copy, and do other things with directories
and files in FreeDOS.
![woman on laptop sitting at the window][1]
[FreeDOS][2], the open source implementation of DOS, provides a lightweight operating system for running legacy applications on modern hardware (or in an emulator) and for updating hardware vendor fails with a Linux-compatible firmware flasher. Getting familiar with FreeDOS is not only a fun throwback to the computing days of the past, it's an investment into gaining useful computing skills. In this article, I'll look at some of the essential commands you need to know to work on a FreeDOS system.
### Essential directory and file commands
FreeDOS uses directories to organize files on a hard drive. That means you need to use directory commands to create a structure to store your files and find the files you've stored there. The commands you need to manage your directory structure are relatively few:
* `MD` (or `MKDIR`) creates a new directory or subdirectory.
* `RD` (or `RMDIR`) removes (or deletes) a directory or subdirectory.
* `CD` (or `CHDIR`) changes from the current working directory to another directory.
* `DELTREE` erases a directory, including any files or subdirectories it contains.
* `DIR` lists the contents of the current working directory.
Because working with directories is central to what FreeDOS does, all of these (except DELTREE) are internal commands contained within COMMAND.COM. Therefore, they are loaded into RAM and ready for use whenever you boot (even from a boot disk). The first three commands have two versions: a two-letter short name and a long name. There is no difference in practice, so I'll use the short form in this article.
### Make a directory with MD
FreeDOS's `MD` command creates a new directory or subdirectory. (Actually, since the _root_ is the main directory, all directories are technically subdirectories, so I'll refer to _subdirectories_ in all examples.) An optional argument is the path to the directory you want to create, but if no path is included, the subdirectory is created in the current working subdirectory.
For example, to create a subdirectory called `letters` in your current location:
```
`C:\HOME\>MD LETTERS`
```
This creates the subdirectory `C:\letters`.
By including a path, you can create a subdirectory anywhere:
```
`C:\>MD C:\HOME\LETTERS\LOVE`
```
This has the same result as moving into `C:\HOME\LETTERS` first and then creating a subdirectory there:
```
C:\CD HOME\LETTERS
C:\HOME\LETTERS\&gt;MD LOVE
C:\HOME\LETTERS\&gt;DIR
LOVE
```
A path specification cannot exceed 63 characters, including backslashes.
### Remove a directory with RD
FreeDOS's `RD` command removes a subdirectory. The subdirectory must be empty. If it contains files or other subdirectories, you get an error message. This has an optional path argument with the same syntax as `MD`.
You cannot remove your current working subdirectory. To do that, you must `CD` to the parent subdirectory and then remove the undesired subdirectory.
### Delete files and directories with DELTREE
The `RD` command can be a little confusing because of safeguards FreeDOS builds into the command. That you cannot delete a subdirectory that has contents, for instance, is a safety measure. `DELTREE` is the solution.
`DELTREE` deletes an entire subdirectory "tree" (a subdirectory), plus all of the files it contains, plus all of the subdirectories those contain, and all of the files _they_ contain, and so on, all in one easy command. Sometimes it can be a little _too_ easy because it can wipe out so much data so quickly. It ignores file attributes, so you can wipe out hidden, read-only, and system files without knowing it.
You can even wipe out multiple trees by specifying them in the command. This would wipe out both of these subdirectories in one command:
```
`C:\>DELTREE C:\FOO C:\BAR`
```
This is one of those commands where you really ought to think twice before you use it. It has its place, definitely. I can still remember how tedious it was to go into each subdirectory, delete the individual files, check each subdirectory for contents, delete each subdirectory one at a time, then jump up one level and repeat the process. `DELTREE` is a great timesaver when you need it. But I would never use it for ordinary maintenance because one false move can do so much damage.
### Format a hard drive
The `FORMAT` command can also be used to prepare a blank hard drive to have files written to it. This formats the `D:` drive:
```
`C:\>FORMAT D:`
```
### Copy files
The `COPY` command, as the name implies, copies files from one place to another. The required arguments are the file to be copied and the path and file to copy it to. Switches include:
* `/Y` prevents a prompt when a file is being overwritten.
* `/-Y` requires a prompt when a file is being overwritten.
* `/V` verifies the contents of the copy.
This copies the file `MYFILE.TXT` from the working directory on `C:` to the root directory of the `D:` drive and renames it `EXAMPLE.TXT`:
```
`C:\>COPY MYFILE.TXT D:\EXAMPLE.TXT`
```
This copies the file `EXAMPLE.TXT` from the working directory on `C:` to the `C:\DOCS\` directory and then verifies the contents of the file to ensure that the copy is complete:
```
`C:\>COPY EXAMPLE.TXT C:\DOCS\EXAMPLE.TXT /V`
```
You can also use the `COPY` command to combine and append files. This combines the two files `MYFILE1.TXT` and `MYFILE2.TXT` and places them in a new file called `MYFILE3.TXT`:
```
`C:\>COPY MYFILE1.TXT+MYFILE2.TXT MYFILE3.TXT`
```
### Copy directories with XCOPY
The `XCOPY` command copies entire directories, along with all of their subdirectories and all of the files contained in those subdirectories. Arguments are the files and path to be copied and the destination to copy them to. Important switches are:
* `/S` copies all files in the current directory and any subdirectory within it.
* `/E` copies subdirectories, even if they are empty. This option must be used with the `/S` option.
* `/V` verifies the copies that were made.
This is a very powerful and useful command, particularly for backing up directories or an entire hard drive.
This command copies the entire contents of the directory `C:\DOCS`, including all subdirectories and their contents (except empty subdirectories) and places them on drive `D:` in the directory `D:\BACKUP\DOCS\`:
```
`C:\>XCOPY C:\DOCS D:\BACKUP\DOCS\ /S`
```
### Using FreeDOS
FreeDOS is a fun, lightweight, open source operating system. It provides lots of great utilities to enable you to get work done on it, whether you're using it to update the firmware of your motherboard or to give new life to an old computer. Learn the basics of FreeDOS. You might be surprised at how versatile it is.
* * *
_Some of the information in this article was previously published in [DOS lesson 8: Format; copy; diskcopy; Xcopy][3]; [DOS lesson 10: Directory commands][4] (both CC BY-SA 4.0); and [How to work with DOS][5]._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/freedos-commands
作者:[Kevin O'Brien][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ahuka
[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://www.freedos.org/
[3]: https://www.ahuka.com/dos-lessons-for-self-study-purposes/dos-lesson-8-format-copy-diskcopy-xcopy/
[4]: https://www.ahuka.com/dos-lessons-for-self-study-purposes/dos-lesson-10-directory-commands/
[5]: https://allaboutdosdirectoires.blogspot.com/

View File

@ -0,0 +1,144 @@
[#]: subject: (What problems do people solve with strace?)
[#]: via: (https://jvns.ca/blog/2021/04/03/what-problems-do-people-solve-with-strace/)
[#]: author: (Julia Evans https://jvns.ca/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
What problems do people solve with strace?
======
Yesterday I [asked on Twitter about what problems people are solving with strace][1] and as usual everyone really delivered! I got 200 answers and then spent a bunch of time manually categorizing them into 9 categories of problems.
All of the problems are about either finding files a program depends on, figuring out why a program is stuck or slow, or finding out why a program is failing. These generally matched up with what I use strace for myself, but there were some things I hadnt thought of too!
Im not going to explain what strace is in this post but I have a [free zine about it][2] and [a talk][3] and [lots of blog posts][4].
### problem 1: wheres the config file?
The #1 most popular problem was “this program has a configuration file and I dont know where it is”. This is probably my most common use for strace too, because its such a simple question.
This is great because there are a million ways for a program to document where its config file is (in a man page, on its website, in `--help`, etc), but theres only one way for it to actually open it (with a system call!)
### problem 2: what other files does this program depend on?
You can also use strace to find other types of files a program depends on, like:
* dynamically linked libraries (“why is my program loading the wrong version of this `.so` file?“) like [this ruby problem I debugged in 2014][5]
* where its looking for its Ruby gems (Ruby specifically came up a few times!)
* SSL root certificates
* a games save files
* a closed-source programs data files
* [which node_modules files arent being used][6]
### problem 3: why is this program hanging?
You have a program, its just sitting there doing nothing, whats going on? This one is especially easy to answer because a lot of the time you just need to run `strace -p PID` and look at what system call is currently running. You dont even have to look through hundreds of lines of output!
The answer is usually waiting for some kind of I/O. Some possible answers for “why is this stuck” (though there are a lot more!):
* its polling forever on a `select()`
* its `wait()`ing for a subprocess to finish
* its making a network request to something that isnt responding
* its doing `write()` but its blocked because the buffer is full
* its doing a `read()` on stdin and its waiting for input
Someone also gave a nice example of using strace to debug a stuck `df`: with strace df -h you can find the stuck mount and unmount it”.
### problem 4: is this program stuck?
A variation on the previous one: sometimes a program has been running for longer than you expected, and you just want to know if its stuck or of its still making progress.
As long as the program makes system calls while its running, this is super easy to answer with strace just strace it and see if its making new system calls!
### problem 5: why is this program slow?
You can use strace as a sort of coarse profiling tool `strace -t` will show the timestamp of each system call, so you can look for big gaps and find the culprit.
Here are 9 short stories from Twitter of people using strace to debug “why is this program slow?”.
* Back in 2000, a Java-based web site that I helped support was dying under modest load: pages loaded slowly, if at all. We straced the J2EE application server and found that it was reading class files one. byte. at. a. time. Devs werent using BufferedReader, classic Java mistake.
* Optimizing app startup times… running strace can be an eye-opening experience, in terms of the amount of unnecessary file system interaction going on (e.g. open/read/close on the same config file over and over again; loading gobs of font files over a slow NFS mount, etc)
* Asked myself why reading from session files in PHP (usually &lt;100 bytes) was incredibly slow. Turned out some `flock`-syscalls took ~60s
* A program was behaving abnormally slow. Used strace to figure out it was re-initializing its internal pseudo-random number generator on every request by reading from /dev/random and exhausting entropy
* Last thing I remember was attaching to a job worker and seeing just how many network calls it was making (which was unexpected).
* Why is this program so slow to start? strace shows it opening/reading the same config file thousands of times.
* Server using 100% CPU time randomly with low actual traffic. Turns out its hitting the number of open files limit accepting a socket, and retrying forever after getting EMFILE and not reporting it.
* A workflow was running super slow but no logs, ends up it was trying to do a post request that was taking 30s before timing out and then retrying 5 times… ends up the backend service was overwhelmed but also had no visibility
* using strace to notice that gethostbyname() is taking a long time to return (you cant see the `gethostbyname` directly but you can see the DNS packets in strace)
### problem 6: hidden permissions errors
Sometimes a program is failing for a mysterious reason, but the problem is just that theres some file that it doesnt have permission to open. In an ideal world programs would report those errors (“Error opening file /dev/whatever: permission denied”), but of course the world is not perfect, so strace can really help with this!
This is actually the most recent thing I used strace for: I was using an AxiDraw pen plotter and it printed out an inscrutable error message when I tried to start it. I `strace`d it and it turned out that my user just didnt have permission to open the USB device.
### problem 7: what command line arguments are being used?
Sometimes a script is running another program, and you want to know what command line flags its passing!
A couple of examples from Twitter:
* find what compiler flags are actually being used to build some code
* a command was failing due to having too long a command line
### problem 8: why is this network connection failing?
Basically the goal here is just to find which domain / IP address the network connection is being made to. You can look at the DNS request to find the domain or the `connect` system call to find the IP.
In general there are a lot of stories about using strace to debug network issues when `tcpdump` isnt available for some reason or just because its what the person is more familiar with.
### problem 9: why does this program succeed when run one way and fail when run in another way?
For example:
* the same binary works on one machine, fails on another machine
* works when you run it, fails when spawned by a systemd unit file
* works when you run it, fails when you run it as “su - user /some/script”
* works when you run it, fails when run as a cron job
Being able to compare the strace output in both cases is very helpful. Though my first step when debugging “this works as my user and fails when run in a different way on the same computer” would be “look at my environment variables”.
### what Im doing with this: slowly building some challenges
The reason Im thinking about this is that Ive been slowly working on some challenges to help people practice using strace and other command line tools. The idea is that youre given a problem to solve, a terminal, and youre free to solve it in any way you want.
So my goal is to use this to build some practice problems that you can solve with strace that reflect the kinds of problems that people actually use it for in real life.
### thats all!
There are probably more problems that can be solved with strace that I havent covered here Id love to hear what Ive missed!
I really loved seeing how many of the same uses came up over and over and over again at least 20 different people replied saying that they use strace to find config files. And as always I think its really delightful how such a simple tool (“trace system calls!”) can be used to solve so many different kinds of problems.
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2021/04/03/what-problems-do-people-solve-with-strace/
作者:[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://twitter.com/b0rk/status/1378014888405168132
[2]: https://wizardzines.com/zines/strace
[3]: https://www.youtube.com/watch?v=4pEHfGKB-OE
[4]: https://jvns.ca/categories/strace
[5]: https://jvns.ca/blog/2014/03/10/debugging-shared-library-problems-with-strace/
[6]: https://indexandmain.com/post/shrink-node-modules-with-refining

View File

@ -0,0 +1,160 @@
[#]: subject: (Converting Multiple Markdown Files into HTML or Other Formats in Linux)
[#]: via: (https://itsfoss.com/convert-markdown-files/)
[#]: author: (Bill Dyer https://itsfoss.com/author/bill/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Converting Multiple Markdown Files into HTML or Other Formats in Linux
======
Many times, when I use Markdown, I work on one file and when Im done with it, I convert it to HTML or some other format. Occasionally, I have to create a few files. When I do work with more than one Markdown file, I usually wait until I have finished them before I convert them.
I use pandoc to convert files, and its possible convert all the Markdown files in one shot.
Markdown can convert its files to .html, but if theres a chance that I will have to convert to other formats like epub, [pandoc][1] is the tool to use. I prefer to use the command line, so I will cover that first, but you can also do this in [VSCodium][2] without the command line. Ill cover that too.
### Converting multiple Markdown files to another format with Pandoc [command line method]
To get started quickly, Ubuntu, and other Debian distros can type the following commands in the terminal:
```
sudo apt-get install pandoc
```
In this example, I have four Markdown files in a directory called md_test.
```
[email protected]:~/Documents/md_test$ ls -l *.md
-rw-r--r-- 1 bdyer bdyer 3374 Apr 7 2020 file01.md
-rw-r--r-- 1 bdyer bdyer 782 Apr 2 05:23 file02.md
-rw-r--r-- 1 bdyer bdyer 9257 Apr 2 05:21 file03.md
-rw-r--r-- 1 bdyer bdyer 9442 Apr 2 05:21 file04.md
[email protected]:~/Documents/md_test$
```
There are no HTML files yet. Now Ill use Pandoc to do its magic on the collection of files. To do this, I run a one-line command that:
* calls pandoc
* reads the .md files and exports them as .html
This is the command:
```
for i in *.md ; do echo "$i" && pandoc -s $i -o $i.html ; done
```
If you are not aware already, `;` is used for [running multiple commands at once in Linux][3].
Heres what the display looks like once I have executed the command:
```
[email protected]:~/Documents/md_test$ for i in *.md ; do echo "$i" && pandoc -s $i -o $i.html ; done
file01.md
file02.md
file03.md
file04.md
[email protected]:~/Documents/md_test$
```
Let me use the `ls` command once more to see if HTML files were created:
```
[email protected]:~/Documents/md_test$ ls -l *.html
-rw-r--r-- 1 bdyer bdyer 4291 Apr 2 06:08 file01.md.html
-rw-r--r-- 1 bdyer bdyer 1781 Apr 2 06:08 file02.md.html
-rw-r--r-- 1 bdyer bdyer 10272 Apr 2 06:08 file03.md.html
-rw-r--r-- 1 bdyer bdyer 10502 Apr 2 06:08 file04.md.html
[email protected]:~/Documents/md_test$
```
The conversion was a success, and you have four HTML files ready to go on the Web server.
Pandoc is quite versatile and you can convert the markdown files to some other supported format by specifying the extension of the output files. You can understand why it is considered among the [best open source tools for writers][4].
**Recommended Read:**
![][5]
#### [11 Best Markdown Editors for Linux][6]
A list of best Markdown Editors for Linux distributions that not only look good but are also feature rich.
### Converting Markdown files to HTML using VSCodium [GUI method]
Like Ive said earlier, I normally use the command line, but I dont always use it for batch conversions, and you dont have to either. VSCode or [VSCodium][7] can do the job. You just need to add one extension, called: _Markdown-All-in-One_ which will allow you to convert more than one Markdown file in one run.
There are two ways to install the extension:
* VSCodiums terminal
* VSCodiums plug-in manager
To install the extension through VSCodiums terminal:
1. Click on `Terminal` on the menu bar. The terminal panel will open
2. Type, or [copy-and-paste, the following command in the terminal][8]:
```
codium --install-extension yzhang.markdown-all-in-one
```
**Note**: If youre using VSCode instead of VSCodium, replace the word, `codium`, in the above command, with `code`
![][9]
The second way to install is through VSCodiums plug-in, or extension, manager:
1. Click on the blocks on the left side of the VSCodium window. A list of extensions will appear. At the top of the list, there will be a search bar.
2. In the search bar, type: `Markdown All in One`. The extension will be listed at the top of the list. Click on the `Install` button to install it. If it is already installed, a gear icon will appear in place of the install button.
![][10]
Once the extension is installed, you can open the folder that contains the Markdown files you want to convert.
Click on the paper icon located on the left side of the VSCodium window. Youll be given the opportunity to choose your folder. Once a folder is open, youll need to open at least one file. You can open as many files as you want, but one is the minimum.
Once a file is open, bring up the Command Palette by pressing `CTRL+SHIFT+P`. Then, start typing `Markdown`in the search bar that will appear. As you do this, a list of Markdown related commands will appear. One of these will be `Markdown All in One: Print documents to HTML` command. Click on that one.
![][11]
Youll be asked to choose a folder containing the files. This is so an output directory (called `out`) can be made and this is where the HTML files will go. The image below shows that the HTML was made after exporting the Markdown documents. From here, you can open, view, and edit the HTML as you wish.
![][12]
By waiting to convert your Markdown files, you can concentrate more on writing. Conversion to HTML can come when youre ready and you have two ways to get that done.
--------------------------------------------------------------------------------
via: https://itsfoss.com/convert-markdown-files/
作者:[Bill Dyer][a]
选题:[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/bill/
[b]: https://github.com/lujun9972
[1]: https://pandoc.org/
[2]: https://vscodium.com/
[3]: https://itsfoss.com/run-multiple-commands-linux/
[4]: https://itsfoss.com/open-source-tools-writers/
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/10/Best-Markdown-Editors-for-Linux.jpg?fit=800%2C450&ssl=1
[6]: https://itsfoss.com/best-markdown-editors-linux/
[7]: https://itsfoss.com/vscodium/
[8]: https://itsfoss.com/copy-paste-linux-terminal/
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_terminal.jpg?resize=800%2C564&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_extension_select.jpg?resize=800%2C564&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_markdown_function_options.jpg?resize=800%2C564&ssl=1
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_html_filelist_shown.jpg?resize=800%2C564&ssl=1

View File

@ -1,111 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (wyxplus)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to set up a homelab from hardware to firewall)
[#]: via: (https://opensource.com/article/19/3/home-lab)
[#]: author: (Michael Zamot https://opensource.com/users/mzamot)
如何从硬件到防火墙建立一个家庭实验室
======
查看用于构建自己的家庭实验室的硬件和软件方案。
![][1]
你有想过创建一个家庭实验室吗?或许你想尝试不同的技术,构建开发环境、亦或是建立自己的私有云。对于拥有一个家庭实验室有很多理由,本教程旨在使入门变得更容易。
规划家庭实验室时,需要考虑三方面:硬件、软件和维护。我们将在这里查看前两方面,并在以后的文章中讲述如何节省维护计算机实验室的时间。
### 硬件
在考虑硬件需求时,首先要考虑如何使用实验室以及你的预算,噪声,空间和电源使用情况。
如果购买新硬件过于昂贵,请搜索当地的大学,广告以及诸如 eBay 或 Craigslist 之类的网站,能获取二手服务器的地方。它们通常很便宜,并且服务器级的硬件可以使用很多年。你将需要三类硬件:虚拟化服务器,存储设备和路由器/防火墙。
#### 虚拟化服务器
一个虚拟化服务器允许你去运行多个共享物理机资源的虚拟机,同时最大化利用和隔离资源。如果你打算销毁一台虚拟机,无需重建整个服务器,因为其仅是一个虚拟机。如果你想进行测试或尝试某些操作而不损坏整个系统,仅需要新建一个虚拟机来运行即可。
在虚拟服务器中,需考虑两个最重要的因素是 CPU 的核心数及其运行速度以及内存容量。如果没有足够的资源够全部虚拟机共享,那么它们将被重复分配并试着获取其他虚拟机的 CPU 的周期和内存。
因此,考虑一个多核 CPU 的平台。你要确保 CPU 支持虚拟化指令(因特尔的 VT-x 指令集和 AMD 的 AMD-V 指令集)。能够处理虚拟化优质消费级处理器有因特尔的 i5 或 i7 和 AMD 的 Ryzen 处理器。如果你考虑服务器级的硬件,那么因特尔的志强系列和 AMD 的 EPYC 都是不错的选择。内存可能很昂贵,尤其是最近的 DDR4 内存。当我们估计所需多少内存时,请为主机操作系统的内存至少分配 2 GB 的空间。
如果你担心电费或噪声,则诸如因特尔 NUC 设备之类的解决方案虽然外形小巧,功耗低,噪音低,但是却以牺牲可扩展性为代价。
#### <ruby>网络附加存储<rt>Network-attached storage</rt></ruby>NAS
如果希望装有硬盘驱动器的计算机存储你的所有个人数据电影图片等并为虚拟化服务器提供存储则需要网络附加存储NAS
在大多数情况下,你不太可能需要一颗强力的 CPU。实际上许多商业 NAS 的解决方案使用低功耗的 ARM CPU。主板能支持多个 SATA 硬盘。如果你的主板没有足够的端口,请使用<ruby>主机总线适配器<rt>host bus adapter</rt><ruby>HBASAS 控制器添加其他功能。
网络性能对于 NAS 来说是至关重要的,因此最好选择<ruby>千兆<rt>gigabit</rt></ruby>网络(或更快网络)。
内存需求将根据你的文件系统而有所不同。ZFS 是 NAS 上最受欢迎的文件系统之一,你将需要更多内存才能使用诸如缓存或重复数据删除之类的功能。<ruby>纠错码<rt>Error-correcting code</rt></ruby>ECC的内存是防止数据损坏的最佳选择但在购买前请确保你的主板支持。最后但同样重要的不要忘记使用<ruby>不间断电源<rt>uninterruptible power supply</rt></ruby>UPS因为断电可能会使得数据出错。
#### 防火墙和路由器
你是否曾意识到,廉价的路由器/防火墙通常是保护你的家庭网络不受外部环境影响的主要部分?这些路由器很少及时收到安全更新(如果有的话)。现在害怕了吗?好吧,[确实][2]
通常,你不需要一颗强大的 CPU 或是大内存来构建你自己的路由器/防火墙,除非你需要高吞吐率或是执行 CPU 密集型任务,像是 VPN 服务器或是流量过滤。在这种情况下,你将需要一个支持 AES-NI 的多核 CPU。
你可能想要至少 2 个千兆或更快的<ruby>以太网卡<rt>Ethernet network interface cards</rt></ruby>NIC这不是必需的但我推荐使用一个管理型交换机来连接你自己的装配的路由器以创建 VLAN 来进一步隔离和保护你的网络。
![Home computer lab PfSense][4]
### 软件
在选择完你的虚拟化服务器、NAS 和防火墙/路由器后,下一步是探索不同的操作系统和软件,以最大程度地发挥其作用。尽管你可以使用 CentOS、Debian或 Ubuntu 之类的常规 Linux 发行版,但是与以下软件相比,它们通常花费更多的时间进行配置和管理。
#### 虚拟化软件
**[KVM][5]**<ruby>基于内核的虚拟机<rt>Kernel-based Virtual Machine</rt></ruby>)使你可以将 Linux 变成虚拟机监控程序以便可以在同一台机器中运行多个虚拟机。最好的是KVM 作为 Linux 的一部分,它是许多企业和家庭用户的首选。如果你愿意,可以安装 **[libvirt][6]** 和 **[virt-manager][7]** 来管理你的虚拟化平台。
**[Proxmox VE][8]** 是一个强大的企业级解决方案,并且是一个完整的开源虚拟化和容器平台。它基于 Debian使用 KVM 作为其虚拟机管理程序,并使用 LXC 作为容器。Proxmox 提供了强大的网页界面API并且可以扩展到许多群集节点这很有用因为你永远不知道何时实验室容量不足。
**[oVirt][9]RHV** 是另一种使用 KVM 作为虚拟机管理程序的企业级解决方案。不要仅仅因为它是企业并不意味着你不能在家中使用它。oVirt 提供了强大的网页界面和 API并且可以处理数百个节点如果你正在运行那么多服务器我不想成为你的邻居。oVirt 用于家庭实验室的潜在问题是它至少需要一些的节点集:你将需要一个外部存储(例如 NAS和至少两个其他虚拟化节点你可以仅在一个上运行它但是你可能会在维护环境时遇到问题
#### 网络附加存储软件
**[FreeNAS][10]** 是最受欢迎的开源 NAS 发行版,它基于稳定的 FreeBSD 操作系统。它最强大的功能之一是支持 ZFS 文件系统,该文件系统提供了数据完整性检查、快照、复制和多个级别的冗余(镜像,条带化镜像和条带化)。最重要的是,所有功能都通过功能强大且易于使用的网页界面进行管理。在安装 FreeNAS 之前,请检查硬件是否支持,因为它不如基于 Linux 的发行版那么广泛。
另一个流行的替代方法是基于 Linux 的 **[OpenMediaVault][11]**。它的主要功能之一是模块化,带有可扩展和添加特性的插件。它包括的功能包括基于网页管理界面和协议,例如 CIFSSFTPNFSiSCSI。以及卷管理包括软件 RAID资源分配<ruby>访问控制列表<rt>access control lists</rt></ruby>ACL和共享管理。由于它是基于 Linux 的,因此其具有广泛的硬件支持。
#### 防火墙/路由器软件
**[pfSense][12]** 是基于 FreeBSD 的开源企业级路由器和防火墙发行版。它可以直接安装在服务器上,甚至可以安装在虚拟机中(以管理虚拟或物理网络并节省空间)。它有许多功能,可以使用软件包进行扩展。尽管它也有命令行访问权限,但也可以完全使用网页界面对其进行管理。它具有你所希望路由器和防火墙提供的所有功能,例如 DHCP 和 DNS以及更高级的功能例如入侵检测IDS和入侵防御IPS系统。你可以侦听多个不同接口或使用 VLAN 的网络,并且只需鼠标点击几下即可创建安全的 VPN 服务器。pfSense 使用 pf这是一种有状态的数据包筛选器它是使用类似于 IPFilter 的语法为 OpenBSD 操作系统开发的。许多公司和组织都有使用 pfSense。
* * *
考虑到所有的信息,是时候动手开始建立你的实验室了。在之后的文章中,我将介绍运行家庭实验室的第三方面:自动化进行部署和维护。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/3/home-lab
作者:[Michael Zamot (Red Hat)][a]
选题:[lujun9972][b]
译者:[wyxplus](https://github.com/wyxplus)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mzamot
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb
[2]: https://opensource.com/article/18/5/how-insecure-your-router
[3]: /file/427426
[4]: https://opensource.com/sites/default/files/uploads/pfsense2.png (Home computer lab PfSense)
[5]: https://www.linux-kvm.org/page/Main_Page
[6]: https://libvirt.org/
[7]: https://virt-manager.org/
[8]: https://www.proxmox.com/en/proxmox-ve
[9]: https://ovirt.org/
[10]: https://freenas.org/
[11]: https://www.openmediavault.org/
[12]: https://www.pfsense.org/

View File

@ -0,0 +1,149 @@
[#]: collector: (lujun9972)
[#]: translator: (wyxplus)
[#]: 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)
现如今你应当使用的四款开源聊天应用软件
======
现在,远程协作已作为一项必不可少的能力,让开源实时聊天成为你工具箱中必不可少的一部分吧。
![Chat bubbles][1]
清晨起床后,我们通常要做的第一件事是检查手机,看看是否有同事和朋友发来的重要信息。无论这是否是一个好习惯,但这种行为早已成为我们日常生活的一部分。
> 人是理性动物。他总能想出任何自己愿意相信的理由。
> –阿纳托尔·法朗士
无论理由是否合理,我们每天都在使用的一系列的通讯工具,例如电子邮件、电话、网络会议工具或社交网络。甚至在 COVID-19 之前,居家办公就已经使这些通信工具成为我们生活中的重要部分。随着疫情出现,居家办公成为新常态,我们交流方式的方方面面正面临着前所未有的改变,这让这些工具变得不可或缺。
### 为什么需要聊天?
作为全球团队的一部分进行远程工作时,我们必须要有一个相互协作的环境。聊天应用软件在帮助我们保持相互联系中起着至关重要的作用。与电子邮件相比,聊天应用软件可提供与全球各地的同事快速、实时的通信。
考虑选择一款聊天应用软件需要考虑很多因素。为了帮助你选择最适合你的应用软件,在本文中,我将探讨四款开源聊天应用软件和一个开源视频通信工具(用于当你需要与同事“面对面”时),然后概述在高效的通讯应用软件中,你应当考虑的一些功能。
### 四款开源聊天软件
#### Rocket.Chat
![Rocket.Chat][2]
[Rocket.Chat][3] 是一个综合性的通讯平台,其将频道分为公开房间(任何人都可以加入)和私有房间(仅受邀请)。你还可以直接将消息发送给已登录的人员。其能共享文档、链接、照片、视频和<ruby>动态图<rt>GIF</rt></ruby>,以及进行视频通话,并可以在平台中发送语音信息。
Rocket.Chat 是免费开源的软件,但是其独特之处在于其可自托管的聊天系统。你可以将其下载到你的服务器上,无论它是本地服务器或是在公有云上的虚拟专用服务器。
Rocket.Chat 是完全免费,其 [源码][4] 可在 Github 获得。许多开源项目都使用 Rocket.Chat 作为他们官方交流平台。该软件在持续不断的发展且不断更新和改进新功能。
我最喜欢 Rocket.Chat 的地方是其能够根据用户需求来进行自定义操作,并且它使用机器学习来自动化处理,在用户通讯间实时翻译信息。你也可以下载适用于你移动设备的 Rocket.Chat以便能随时随地使用。
#### IRC
![IRC on WeeChat 0.3.5][5]
[Internet Relay Chat (IRC)][6] 是一款实时、基于文本格式的通信软件。尽管其是最古老的电子通讯形式之一,但在许多知名的软件项目中仍受欢迎。
IRC 频道是单独的聊天室。它可以让你在一个开放的频道中与多人进行聊天或与某人私下一对一聊天。如果频道名称以 开头,则可以假定它是官方的聊天室,然而以 ## 开头的聊天室通常是非官方的聊天室。
[使用 IRC][7] 是很容易上手。你的 IRC 昵称可以让人们找到你,因此它必须是唯一的。但是,你可以完全自主地选择 IRC 客户端。如果你需要比标准 IRC 客户端更多功能的应用程序,则可以使用 [Riot.im][8] 连接到 IRC。
考虑到它悠久的历史,你为什么还要继续使用 IRC出于一个原因是其仍是我们所依赖的许多免费和开源项目的家园。如果你想参于开源软件开发和社区可以选择用 IRC。
#### Zulip
![Zulip][9]
[Zulip][10] 是遵循基于话题时间线模式且十分流行的群聊应用程序。在 Zulip 中,你可以订阅<ruby><rt>stream</rt></ruby>,就像在 IRC 频道或 Rocket.Chat 中一样。但是,每个 Zulip 流都会拥有一个唯一的<ruby>话题<rt>topic</rt></ruby>,该话题可帮助你以后查找对话,因此其更有条理。
与其他平台一样,它支持表情符号、图片、视频和推特预览。它还支持 LaTeX 共享数学公式或等式、Markdown 语法和共享代码的语法高亮。
Zulip 是跨平台、并提供 API 用于编写你自己的程序。我特别喜欢 Zulip 的一点是它与 GitHub 的集成整合功能:如果我正在处理某个<ruby>问题<rt>issue</rt></ruby>,则可以使用 Zulip 的标记链接<ruby>拉回<rt>pull</rt></ruby>某个请求 ID。
Zulip是开源你可以在 GitHub 上访问其[源码][11])并且免费使用,但是其已经为本地支持、[LDAP][12] 的集成整合和存储扩展提供了付费服务。
#### Let's Chat
![Let's Chat][13]
[Let's Chat][14] 是面向小型团队的自托管的聊天解决方案。它使用 Node.js 和 MongoDB 编写运行,只需鼠标点击几下即可将其部署到本地服务器或云服务器。它是免费且开源,可以在 GitHub 上查看其 [源码][15]。
Let's Chat 与其他开源聊天工具的不同之处在于其企业功能:它支持 LDAP 和 [Kerberos][16] 身份验证。它还具有新用户想要的所有功能:你可以在历史记录中搜索过往消息,并使用 @username 之类的标签来标记人员。
我喜欢 Let's Chat 的地方是它拥有私人、受密码保护的聊天室、发送图片、GIPHY 支持和代码拷贝。它不断更新,并不断增加新功能。
### 附加:开源视频聊天软件 Jitsi
![Jitsi][17]
有时,文字聊天还不够,你还可能需要与某人面谈。在这种情况下,如果不能选择面对面开会交流,那么视频聊天是最好的选择。[Jitsi][18] 是一个完全开源的,多平台且兼容 WebRTC 的视频会议工具。
Jitsi 从 Jitsi Desktop 开始,已经发展成为许多 [项目][19],包括 Jitsi Meet、Jitsi Videobridge、jibri 和 libjitsi并且每个项目都在 GitHub 上开放了 [源码][20]。
Jitsi 是安全且可扩展的,并支持诸如<ruby>联播<rt>simulcast</rt></ruby><ruby>带宽预估<rt>bandwidth estimation</rt></ruby>之类的高级视频路由的概念,还包括音频、录制、屏幕共享和拨入功能等经典功能。你可以来为你的视频聊天室设置密码以保护其不受干扰,并且它还支持通过 YouTube 进行直播。你还可以搭建自己的 Jitsi 服务器,并将其托管在本地或<ruby>虚拟专用服务器<rt>virtual private server</rt></ruby>(例如 Digital Ocean Droplet上。
我最喜欢 Jitsi 的是它是免费且低门槛的。任何人都可以通过访问 [meet.jit.si][21] 来立即召开会议,并且用户无需注册或安装即可轻松参加会议。(但是,注册的话能拥有日程安排功能。)这种入门级低门槛的视频会议服务让 Jitsi 迅速普及。
### 选择一个聊天应用软件的建议
各种各样的开源聊天应用软件可能让你很难抉择。以下是一些选择一款聊天应用软件的一般准则。
* 最好具有交互式的界面和简单的导航工具。
* 最好寻找一种功能强大且能让人们以各种方式使用它的工具。
* 如果与你所使用的工具有进行集成整合的话,可以重点考虑。一些工具与 GitHub 或 GitLab 以及某些应用程序具有良好的无缝衔接,这将是一个非常有用的功能。
* 有能托管到云主机的工具将十分方便。
* 应考虑到聊天服务的安全性。对于许多组织和个人而言,能在个人服务器上进行托管服务是不可或缺的。
* 最好选择那些具有丰富的隐私设置,并拥有私人聊天室和公共聊天室的通讯工具。
由于人们比以往任何时候都更加依赖在线服务,因此拥有备用的通讯平台是明智之举。例如,如果一个项目正在使用 Rocket.Chat则必要之时它还应具有跳转到 IRC 的能力。由于这些软件在不断更新,你可能会发现自己已经连接到多个频道,因此集成整合其他应用将变得非常有价值。
在各种可用的开源聊天服务中,你喜欢和使用哪些?这些工具又是如何帮助你进行远程办公?请在评论中分享你的想法。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/4/open-source-chat
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[wyxplus](https://github.com/wyxplus)
校对:[校对者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

View File

@ -1,70 +0,0 @@
[#]: subject: (Why you should care about service mesh)
[#]: via: (https://opensource.com/article/21/3/service-mesh)
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
为什么你要关心 Service Mesh
======
在微服务环境中Service Mesh 为开发和运营提供了好处。
![Net catching 1s and 0s or data in the clouds][1]
很多开发者不知道为什么要关心 [Service Mesh][2]。这是我在开发者见面会、会议和实践研讨会上关于云原生架构的微服务开发的演讲中经常被问到的问题。我的回答总是一样的:“只要你想简化你的微服务架构,你就应该在 Kubernetes 上运行。”
关于简化,你可能也想知道,为什么分布式微服务必须设计得如此复杂才能在 Kubernetes 集群上运行。正如本文所解释的那样,许多开发人员通过 Service Mesh 解决了微服务架构的复杂性,并通过在生产中采用 Service Mesh 获得了额外的好处。
### 什么是 Service Mesh
Service Mesh 是一个专门的基础设施层,用于提供一个透明的、独立于代码的 polyglot 方式,以消除应用代码中的非功能性微服务能力。
![Before and After Service Mesh][3]
Daniel Oh, [CC BY-SA 4.0][4]
### 为什么 Service Mesh 对开发者很重要
当开发人员将微服务部署到云时,无论业务功能如何,他们都必须解决非功能性微服务功能,以避免级联故障。这些功能通常可以体现在服务发现、日志、监控、韧性、认证、弹性和跟踪等方面。开发人员必须花费更多的时间将它们添加到每个微服务中,而不是开发实际的业务逻辑,这使得微服务变得沉重而复杂。
随着企业加速向云计算转移Service Mesh 可以提高开发人员的生产力。Kubernetes 加 Service Mesh 平台不需要让服务负责处理这些复杂的问题,也不需要在每个服务中添加更多的代码来处理云原生的问题,而是负责向运行在该平台上的任何应用(现有的或新的,用任何编程语言或框架)提供这些服务。那么微服务就可以轻量级,专注于其业务逻辑,而不是云原生的复杂性。
### 为什么 Service Mesh 对运维很重要
这并没有回答为什么运维团队需要关心在 Kubernetes 上运行云原生微服务的 Service Mesh。因为运维团队必须确保在 Kubernetes 环境上的大型混合云和多云上部署新的云原生应用的强大安全性、合规性和可观察性。
Service Mesh 由一个用于管理代理路由流量的 control plane 和一个用于注入 Sidecar 的 data plane 组成。Sidecar 允许运维团队做一些比如添加第三方安全工具和追踪所有服务通信中的流量以避免安全漏洞或合规问题。Service Mesh 还可以通过在图形面板上可视化地跟踪指标来提高观察能力。
### 如何开始使用 Service Mesh
对于开发者和运维人员以及从应用开发到平台运营来说Service Mesh 可以更有效地管理云原生功能。
你可能想知道从哪里开始采用 Service Mesh 来配合你的微服务应用和架构。幸运的是,有许多开源的 Service Mesh 项目。许多云服务提供商也在他们的 Kubernetes 平台中提供 Service Mesh。
![CNCF Service Mesh Landscape][5]
Daniel Oh, [CC BY-SA 4.0][4]
你可以在 [CNCF Service Mesh Landscape][6] 页面中找到最受欢迎的 Service Mesh 项目和服务的链接。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/service-mesh
作者:[Daniel Oh][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/daniel-oh
[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://www.redhat.com/en/topics/microservices/what-is-a-service-mesh
[3]: https://opensource.com/sites/default/files/uploads/vm-vs-service-mesh.png (Before and After Service Mesh)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/uploads/service-mesh-providers.png (CNCF Service Mesh Landscape)
[6]: https://landscape.cncf.io/card-mode?category=service-mesh&grouping=category