Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2019-12-22 07:03:05 +08:00
commit 7ca9c6f9c8
10 changed files with 932 additions and 204 deletions

View File

@ -1,17 +1,18 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11702-1.html)
[#]: subject: (How to type emoji on Linux)
[#]: via: (https://opensource.com/article/19/10/how-type-emoji-linux)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
如何在 Linux 系统中输入 emoji
======
使用 GNOME 桌面可以让你在文字中轻松加入 emoji。
![A cat under a keyboard.][1]
> 使用 GNOME 桌面可以让你在文字中轻松加入 emoji。
![](https://img.linux.net.cn/data/attachment/album/201912/22/003829tsuogoonoxunn33o.jpg)
emoji 是潜藏在 Unicode 字符空间里的有趣表情图它们已经风靡于整个互联网。emoji 可以用来在社交媒体上表示自己的心情状态,也可以作为重要文件名的视觉标签,总之它们的各种用法层出不穷。在 Linux 系统中有很多种方式可以输入 Unicode 字符,但 GNOME 桌面能让你更轻松地查找和输入 emoji。
@ -25,7 +26,6 @@ emoji 是潜藏在 Unicode 字符空间里的有趣表情图,它们已经风
例如在 Fedora 上:
```
$ sudo dnf search emoji
emoji-picker.noarch : An emoji selection tool
@ -46,35 +46,29 @@ google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emo
要开始设置,首先打开 GNOME 的设置面板。
1. 在左边侧栏中,选择“<ruby>地区与语言<rt>Region & Language</rt></ruby>”类别
2. 点击“<ruby>输入源<rt>Input Sources</rt></ruby>”选项下方的加号(+)打开“<ruby>添加输入源<rt>Add an Input Source</rt></ruby>”面板
1、在左边侧栏中选择“<ruby>地区与语言<rt>Region & Language</rt></ruby>”类别。
2、点击“<ruby>输入源<rt>Input Sources</rt></ruby>”选项下方的加号(+)打开“<ruby>添加输入源<rt>Add an Input Source</rt></ruby>”面板。
![Add a new input source][5]
3. 在“<ruby>添加输入源<rt>Add an Input Source</rt></ruby>”面板中,点击底部的菜单按钮
3、在“<ruby>添加输入源<rt>Add an Input Source</rt></ruby>”面板中,点击底部的菜单按钮。
![Add an Input Source panel][6]
4. 滑动到列表底部并选择“<ruby>其它<rt>Other</rt></ruby>
5. 在“<ruby>其它<rt>Other</rt></ruby>”列表中,找到“<ruby>其它<rt>Other</rt></ruby><ruby>快速输入<rt>Typing Booster</rt></ruby>)”
4、滑动到列表底部并选择“<ruby>其它<rt>Other</rt></ruby>”。
5、在“<ruby>其它<rt>Other</rt></ruby>”列表中,找到“<ruby>其它<rt>Other</rt></ruby><ruby>快速输入<rt>Typing Booster</rt></ruby>)”。
![Find Other \(Typing Booster\) in inputs][7]
6. 点击右上角的“<ruby>添加<rt>Add</rt></ruby>”按钮,将输入源添加到 GNOME 桌面
6、点击右上角的“<ruby>添加<rt>Add</rt></ruby>”按钮,将输入源添加到 GNOME 桌面。
以上操作完成之后,就可以关闭设置面板了。
#### 切换到快速输入
现在 GNOME 桌面的右上角会出现一个新的图标,一般情况下是当前语言的双字母缩写(例如英语是 en世界语是 eo西班牙语是 es等等。如果你按下了<ruby>超级键<rt>Super key</rt></ruby>(也就是键盘上带有 Linux 企鹅/Windows 徽标/Mac Command 标志的键)+空格键的组合键,就会切换到输入列表中的下一个输入源。在这里,我们只有两个输入源,也就是默认语言和快速输入。
现在 GNOME 桌面的右上角会出现一个新的图标,一般情况下是当前语言的双字母缩写(例如英语是 en世界语是 eo西班牙语是 es等等。如果你按下了<ruby>超级键<rt>Super key</rt></ruby>(也就是键盘上带有 Linux 企鹅/Windows 徽标/Mac Command 标志的键)+ 空格键的组合键,就会切换到输入列表中的下一个输入源。在这里,我们只有两个输入源,也就是默认语言和快速输入。
你可以尝试使用一下这个组合键,观察图标的变化。
@ -96,7 +90,7 @@ google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emo
### 使用其它切换方式
如果你觉得超级键+空格键这个组合用起来不顺手,你也可以换成其它键的组合。在 GNOME 设置面板中选择“<ruby>设备<rt>Device</rt></ruby>”→“<ruby>键盘<rt>Keyboard</rt></ruby>”。
如果你觉得超级键+空格键这个组合用起来不顺手,你也可以换成其它键的组合。在 GNOME 设置面板中选择“<ruby>设备<rt>Device</rt></ruby>”→“<ruby>键盘<rt>Keyboard</rt></ruby>”。
在“<ruby>键盘<rt>Keyboard</rt></ruby>”页面中,将“<ruby>切换到下一个输入源<rt>Switch to next input source</rt></ruby>”更改为你喜欢的组合键。
@ -106,11 +100,9 @@ google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emo
实际上,现代键盘的设计只是为了输入 26 个字母以及尽可能多的数字和符号。但 ASCII 字符的数量已经比键盘上能看到的字符多得多了,遑论上百万个 Unicode 字符。因此,如果你想要在 Linux 应用程序中输入 Unicode但又不想使用快速输入你可以尝试一下 Unicode 输入。
1. 打开任意一种支持输入 Unicode 字符的软件,但仍然使用你的默认输入语言
2. 使用 ctrl+shift+U 组合键进入 Unicode 输入模式
3. 在 Unicode 输入模式下,只需要输入某个 Unicode 字符的对应序号,就实现了对这个 Unicode 字符的输入。例如 `1F44D` 对应的是 👍,而 `2620` 则对应了 ☠。想要查看所有 Unicode 字符的对应序号,可以参考 [Unicode 规范][11]。
1. 打开任意一种支持输入 Unicode 字符的软件,但仍然使用你的默认输入语言
2. 使用 `Ctrl+Shift+U` 组合键进入 Unicode 输入模式
3. 在 Unicode 输入模式下,只需要输入某个 Unicode 字符的对应序号,就实现了对这个 Unicode 字符的输入。例如 `1F44D` 对应的是 👍,而 `2620` 则对应了 ☠。想要查看所有 Unicode 字符的对应序号,可以参考 [Unicode 规范][11]。
### emoji 的实用性
@ -127,7 +119,7 @@ via: https://opensource.com/article/19/10/how-type-emoji-linux
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[HankChow](https://github.com/HankChow)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,24 +1,26 @@
[#]: collector: (lujun9972)
[#]: translator: (hopefully2333)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11699-1.html)
[#]: subject: (How internet security works: TLS, SSL, and CA)
[#]: via: (https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority)
[#]: author: (Bryant Son https://opensource.com/users/brson)
互联网的安全是如何保证的TLSSSL和 CA
互联网的安全是如何保证的TLS、SSL 和 CA
======
你的浏览器里的锁的图标的后面是什么?
> 你的浏览器里的锁的图标的后面是什么?
![Lock][1]
每天你都会重复这件事很多次,你访问网站,这个网站需要你用用户名或者电子邮件地址,和你的密码来进行登录。银行网站,社交网站,电子邮件服务,电子商务网站,和新闻网站。这里只在使用了这种机制的网站中列举了其中一小部分。
每天你都会重复这件事很多次,访问网站,网站需要你用你的用户名或者电子邮件地址和你的密码来进行登录。银行网站、社交网站、电子邮件服务、电子商务网站和新闻网站。这里只在使用了这种机制的网站中列举了其中一小部分。
每次你登进一个这种类型的网站时,你实际上是在说:“是的,我信任这个网站,所以我愿意把我的个人信息共享给它。”这些数据可能包含你的姓名,性别,实际地址,电子邮箱地址,有时候甚至会包括你的信用卡信息。
每次你登进一个这种类型的网站时,你实际上是在说:“是的,我信任这个网站,所以我愿意把我的个人信息共享给它。”这些数据可能包含你的姓名、性别、实际地址、电子邮箱地址,有时候甚至会包括你的信用卡信息。
但是你怎么知道你可以信任这个网站?换个方式问,为了让你可以信任它,网站应该如何保护你的交易?
本文旨在阐述使网站变得安全的机制。我会首先论述 web 协议 http 和 https以及传输层安全TLS的概念后者是互联网协议IP层中的加密协议之一。然后我会解释证书颁发机构和自签名证书以及它们如何帮助保护一个网站。最后我会介绍一些开源的工具你可以使用它们来创建和管理你的证书。
本文旨在阐述使网站变得安全的机制。我会首先论述 web 协议 http 和 https以及<ruby>传输层安全<rt>Transport Layer Security</rt></ruby>TLS的概念后者是<ruby>互联网协议<rt>Internet Protocol</rt></ruby>IP层中的加密协议之一。然后我会解释<ruby>证书颁发机构<rt>certificate authority</rt></ruby>和自签名证书,以及它们如何帮助保护一个网站。最后,我会介绍一些开源的工具,你可以使用它们来创建和管理你的证书。
### 通过 https 保护路由
@ -26,13 +28,13 @@
![Certificate information][2]
默认情况下,如果一个网站使用的是 http 协议,那么它是不安全的。通过网站主机配置一个证书并添加到路由,可以把这个网站从一个不安全的 http 网站变为一个安全的 https 网站。那个锁图标通常表示这个网站是受 https 保护的。
默认情况下,如果一个网站使用的是 http 协议,那么它是不安全的。为通过网站主机的路由添加一个配置过的证书,可以把这个网站从一个不安全的 http 网站变为一个安全的 https 网站。那个锁图标通常表示这个网站是受 https 保护的。
点击证书来查看网站的 CA根据你的浏览器你可能需要下载证书来查看它。
![Certificate information][3]
点击证书来查看网站的 CA根据你的浏览器你可能需要下载证书来查看它
在这里,你可以了解有关 Opensource.com 证书的信息。例如,你可以看到 CA 是 DigiCert并以 Opensource.com 的名称提供给 Red Hat
这个证书信息可以让终端用户检查该网站是否可以安全访问。
@ -42,19 +44,19 @@
### 带有 TLS 和 SSL 的互联网协议
TLS 是旧版安全套接字层协议SSL的最新版本。理解这一点的最好方法就是仔细理解 IP 的不同协议层。
TLS 是旧版<ruby>安全套接字层协议<rt>Secure Socket Layer</rt></ruby>SSL的最新版本。理解这一点的最好方法就是仔细理解互联网协议的不同协议层。
![IP layers][4]
我们知道当今的互联网是由6个层面组成的物理层数据链路层网络层传输层安全层应用层。物理层是基础这一层是最接近实际的硬件设备的。应用层是最抽象的一层是最接近终端用户的一层。安全层可以被认为是应用层的一部分TLS 和 SSL是被设计用来在一个计算机网络中提供通信安全的加密协议它们位于安全层中。
我们知道当今的互联网是由 6 个层面组成的:物理层、数据链路层、网络层、传输层、安全层、应用层。物理层是基础这一层是最接近实际的硬件设备的。应用层是最抽象的一层是最接近终端用户的一层。安全层可以被认为是应用层的一部分TLS 和 SSL是被设计用来在一个计算机网络中提供通信安全的加密协议它们位于安全层中。
这个过程可以确保终端用户使用网络服务时,通信的安全性和保密性。
### 证书颁发机构和自签名证书
CA 是受信任的组织,它可以颁发数字证书。
<ruby>证书颁发机构<rt>Certificate authority</rt></ruby>CA是受信任的组织,它可以颁发数字证书。
TLS 和 SSL 可以使连接更安全,但是这个加密机制需要一种方式来验证它;这就是 SSL/TLS 证书。TLS 使用了一种叫做非对称加密的加密机制,这个机制有一对称为私钥和公钥的安全密钥。(这是一个非常复杂的主题,超出了本文的讨论范围,但是如果你想去了解这方面的东西,你可以阅读“密码学和公钥密码基础体系简介”)你要知道的基础内容是,证书颁发机构们,比如 GlobalSign, DigiCert,和 GoDaddy它们是受人们信任的可以颁发证书的供应商它们颁发的证书可以用于验证网站使用的 TLS/SSL 证书。网站使用的证书是导入到主机服务器里的,用于保护网站。
TLS 和 SSL 可以使连接更安全,但是这个加密机制需要一种方式来验证它;这就是 SSL/TLS 证书。TLS 使用了一种叫做非对称加密的加密机制,这个机制有一对称为私钥和公钥的安全密钥。(这是一个非常复杂的主题,超出了本文的讨论范围,但是如果你想去了解这方面的东西,你可以阅读“[密码学和公钥密码基础体系简介][5]”)你要知道的基础内容是,证书颁发机构们,比如 GlobalSign、DigiCert 和 GoDaddy它们是受人们信任的可以颁发证书的供应商它们颁发的证书可以用于验证网站使用的 TLS/SSL 证书。网站使用的证书是导入到主机服务器里的,用于保护网站。
然而如果你只是要测试一下正在开发中的网站或服务CA 证书可能对你而言太昂贵或者是太复杂了。你必须有一个用于生产目的的受信任的证书,但是开发者和网站管理员需要有一种更简单的方式来测试网站,然后他们才能将其部署到生产环境中;这就是自签名证书的来源。
@ -62,48 +64,50 @@ TLS 和 SSL 可以使连接更安全,但是这个加密机制需要一种方
### 生成证书的开源工具
有几种开源工具可以用来管理 TLS/SSL 证书。其中最著名的就是 openssl这个工具包含在很多 Linux 发行版中和 macos 中。当然,你也可以使用其他开源工具。
有几种开源工具可以用来管理 TLS/SSL 证书。其中最著名的就是 openssl这个工具包含在很多 Linux 发行版中和 MacOS 中。当然,你也可以使用其他开源工具。
| Tool Name | Description | License |
| 工具名 | 描述 | 许可证 |
| --------- | ------------------------------------------------------------------------------ | --------------------------------- |
| OpenSSL | 实现 TLS 和加密库的最著名的开源工具 | Apache License 2.0 |
| EasyRSA | 用于构建 PKI CA 的命令行实用工具 | GPL v2 |
| CFSSL | 来自 cloudflare 的 PKI/TLS 瑞士军刀 | BSD 2-Clause "Simplified" License |
| Lemur | 来自网飞的 TLS创建工具 | Apache License 2.0 |
| [OpenSSL][7] | 实现 TLS 和加密库的最著名的开源工具 | Apache License 2.0 |
| [EasyRSA][8] | 用于构建 PKI CA 的命令行实用工具 | GPL v2 |
| [CFSSL][9] | 来自 cloudflare 的 PKI/TLS 瑞士军刀 | BSD 2-Clause "Simplified" License |
| [Lemur][10] | 来自<ruby>网飞<rt>Netflix</rt></ruby>的 TLS 创建工具 | Apache License 2.0 |
如果你的目的是扩展和对用户友好,网飞的 Lemur 是一个很有趣的选择。你在网飞的技术博客上可以查看更多有关它的信息。
如果你的目的是扩展和对用户友好,网飞的 Lemur 是一个很有趣的选择。你在[网飞的技术博客][6]上可以查看更多有关它的信息。
### 如何创建一个 Openssl 证书
你可以靠自己来创建证书,下面这个案例就是使用 Openssl 生成一个自签名证书。
1. 使用 openssl 命令行生成一个私钥:
1、使用 `openssl` 命令行生成一个私钥:
```
openssl genrsa -out example.key 2048
```
![](https://opensource.com/sites/default/files/uploads/4_openssl_generatekey.jpg)
2. 使用在第一步中生成的私钥来创建一个证书签名请求CSR:
2、使用在第一步中生成的私钥来创建一个<ruby>证书签名请求<rt>certificate signing request</rt></ruby>CSR
```
openssl req -new -key example.key -out example.csr \
-subj "/C=US/ST=TX/L=Dallas/O=Red Hat/OU=IT/CN=test.example.com"
openssl req -new -key example.key -out example.csr -subj "/C=US/ST=TX/L=Dallas/O=Red Hat/OU=IT/CN=test.example.com"
```
![](https://opensource.com/sites/default/files/uploads/5_openssl_generatecsr.jpg)
3. 使用你的 CSR 和私钥创建一个证书:
3、使用你的 CSR 和私钥创建一个证书:
```
openssl x509 -req -days 366 -in example.csr \
-signkey example.key -out example.crt
openssl x509 -req -days 366 -in example.csr -signkey example.key -out example.crt
```
![](https://opensource.com/sites/default/files/uploads/6_openssl_generatecert.jpg)
### 了解更多关于互联网安全的知识
如果你想要了解更多关于互联网安全和网站安全的知识,请看我为这篇文章一起制作的 Youtube 视频。
<https://youtu.be/r0F1Hlcmjsk>
- <https://youtu.be/r0F1Hlcmjsk>
你有什么问题?发在评论里让我们知道。
@ -114,7 +118,7 @@ via: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-
作者:[Bryant Son][a]
选题:[lujun9972][b]
译者:[hopefully2333](https://github.com/hopefully2333)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -126,3 +130,7 @@ via: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-
[4]: https://opensource.com/sites/default/files/uploads/3_internetprotocol.jpg
[5]: https://opensource.com/article/18/5/cryptography-pki
[6]: https://medium.com/netflix-techblog/introducing-lemur-ceae8830f621
[7]: https://www.openssl.org/
[8]: https://github.com/OpenVPN/easy-rsa
[9]: https://github.com/cloudflare/cfssl
[10]: https://github.com/Netflix/lemur

View File

@ -0,0 +1,140 @@
[#]: collector: (lujun9972)
[#]: translator: (hj24)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11701-1.html)
[#]: subject: (How to write a Python web API with Flask)
[#]: via: (https://opensource.com/article/19/11/python-web-api-flask)
[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston)
如何使用 Flask 编写 Python Web API
======
> 这是一个快速教程,用来展示如何通过 Flask目前发展最迅速的 Python 框架之一)来从服务器获取数据。
![spiderweb diagram][1]
[Python][2] 是一个以语法简洁著称的高级的、面向对象的程序语言。它一直都是一个用来构建 RESTful API 的顶级编程语言。
[Flask][3] 是一个高度可定制化的 Python 框架可以为开发人员提供用户访问数据方式的完全控制。Flask 是一个基于 Werkzeug 的 [WSGI][4] 工具包和 Jinja 2 模板引擎的”微框架“。它是一个被设计来开发 RESTful API 的 web 框架。
Flask 是 Python 发展最迅速的框架之一很多知名网站如Netflix、Pinterest 和 LinkedIn 都将 Flask 纳入了它们的开发技术栈。下面是一个简单的示例,展示了 Flask 是如何允许用户通过 HTTP GET 请求来从服务器获取数据的。
### 初始化一个 Flask 应用
首先,创建一个你的 Flask 项目的目录结构。你可以在你系统的任何地方来做这件事。
```
$ mkdir tutorial
$ cd tutorial
$ touch main.py
$ python3 -m venv env
$ source env/bin/activate
(env) $ pip3 install flask-restful
Collecting flask-restful
Downloading https://files.pythonhosted.org/packages/17/44/6e49...8da4/Flask_RESTful-0.3.7-py2.py3-none-any.whl
Collecting Flask>=0.8 (from flask-restful)
[...]
```
### 导入 Flask 模块
然后,在你的 `main.py` 代码中导入 `flask` 模块和它的 `flask_restful` 库:
```
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class Quotes(Resource):
def get(self):
return {
'William Shakespeare': {
'quote': ['Love all,trust a few,do wrong to none',
'Some are born great, some achieve greatness, and some greatness thrust upon them.']
},
'Linus': {
'quote': ['Talk is cheap. Show me the code.']
}
}
api.add_resource(Quotes, '/')
if __name__ == '__main__':
app.run(debug=True)
```
### 运行 app
Flask 包含一个内建的用于测试的 HTTP 服务器。来测试一下这个你创建的简单的 API
```
(env) $ python main.py
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
```
启动开发服务器时将启动 Flask 应用程序,该应用程序包含一个名为 `get` 的方法来响应简单的 HTTP GET 请求。你可以通过 `wget`、`curl` 命令或者任意的 web 浏览器来测试它。
```
$ curl http://localhost:5000
{
"William Shakespeare": {
"quote": [
"Love all,trust a few,do wrong to none",
"Some are born great, some achieve greatness, and some greatness thrust upon them."
]
},
"Linus": {
"quote": [
"Talk is cheap. Show me the code."
]
}
}
```
要查看使用 Python 和 Flask 的类似 Web API 的更复杂版本,请导航至美国国会图书馆的 [Chronicling America][5] 网站,该网站可提供有关这些信息的历史报纸和数字化报纸。
### 为什么使用 Flask?
Flask 有以下几个主要的优点:
1. Python 很流行并且广泛被应用,所以任何熟悉 Python 的人都可以使用 Flask 来开发。
2. 它轻巧而简约。
3. 考虑安全性而构建。
4. 出色的文档,其中包含大量清晰,有效的示例代码。
还有一些潜在的缺点:
1. 它轻巧而简约。但如果你正在寻找具有大量捆绑库和预制组件的框架,那么这可能不是最佳选择。
2. 如果必须围绕 Flask 构建自己的框架,则你可能会发现维护自定义项的成本可能会抵消使用 Flask 的好处。
如果你要构建 Web 程序或 API可以考虑选择 Flask。它功能强大且健壮并且其优秀的项目文档使入门变得容易。试用一下评估一下看看它是否适合你的项目。
在本课中了解更多信息关于 Python 异常处理以及如何以安全的方式进行操作。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/11/python-web-api-flask
作者:[Rachel Waston][a]
选题:[lujun9972][b]
译者:[hj24](https://github.com/hj24)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/rachelwaston
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-cms-build-howto-tutorial.png?itok=bRbCJt1U (spiderweb diagram)
[2]: https://www.python.org/
[3]: https://palletsprojects.com/p/flask/
[4]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
[5]: https://chroniclingamerica.loc.gov/about/api

View File

@ -0,0 +1,63 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (2020 technology must haves, a guide to Kubernetes etcd, and more industry trends)
[#]: via: (https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends)
[#]: author: (Tim Hildred https://opensource.com/users/thildred)
2020 technology must haves, a guide to Kubernetes etcd, and more industry trends
======
A weekly look at open source community, market, and industry trends.
![Person standing in front of a giant computer screen with numbers, data][1]
As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update.
## [Gartner's top 10 infrastructure and operations trends for 2020][2]
> “The vast majority of organisations that do not adopt a shared self-service platform approach will find that their DevOps initiatives simply do not scale,” said Winser. "Adopting a shared platform approach enables product teams to draw from an I&amp;O digital toolbox of possibilities, while benefiting from high standards of governance and efficiency needed for scale."
**The impact**: The breakneck change of technology development and adoption will not slow down next year, as the things you've been reading about for the last two years become things you have to figure out to deal with every day.
## [A guide to Kubernetes etcd: All you need to know to set up etcd clusters][3]
> Etcd is a distributed reliable key-value store which is simple, fast and secure. It acts like a backend service discovery and database, runs on different servers in Kubernetes clusters at the same time to monitor changes in clusters and to store state/configuration data that should to be accessed by a Kubernetes master or clusters. Additionally, etcd allows Kubernetes master to support discovery service so that deployed application can declare their availability for inclusion in service.
**The impact**: This is actually way more than I needed to know about setting up etcd clusters, but now I have a mental model of what that could look like, and you can too.
## [How the open source model could fuel the future of digital marketing][4]
> In other words, the broad adoption of open source culture has the power to completely invert the traditional marketing funnel. In the future, prospective customers could be first introduced to “late funnel” materials and then buy into the broader narrative — a complete reversal of how traditional marketing approaches decision-makers today.
**The impact**: The SEO on this cuts two ways: It can introduce uninitiated marketing people to open source and uninitiated technical people to the ways that technology actually gets adopted. Neat!
## [Kubernetes integrates interoperability, storage, waits on sidecars][5]
> In a [recent interview][6], Lachlan Evenson, and was also a lead on the Kubernetes 1.16 release, said sidecar containers was one of the features that team was a “little disappointed” it could not include in their release.
>
> Guinevere Saenger, software engineer at GitHub and lead for the 1.17 release team, explained that sidecar containers gained increased focus “about a month ago,” and that its implementation “changes the pod spec, so this is a change that affects a lot of areas and needs to be handled with care.” She noted that it did move closer to completion and “will again be prioritized for 1.18.”
**The impact**: You can read between the lines to understand a lot more about the Kubernetes sausage-making process. It's got governance, tradeoffs, themes, and timeframes; all the stuff that is often invisible to consumers of a project.
_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/gartner-ectd-and-more-industry-trends
作者:[Tim Hildred][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/thildred
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data)
[2]: https://www.information-age.com/gartner-top-10-infrastructure-and-operations-trends-2020-123486509/
[3]: https://superuser.openstack.org/articles/a-guide-to-kubernetes-etcd-all-you-need-to-know-to-set-up-etcd-clusters/
[4]: https://www.forbes.com/sites/forbescommunicationscouncil/2019/11/19/how-the-open-source-model-could-fuel-the-future-of-digital-marketing/#71b602fb20a5
[5]: https://www.sdxcentral.com/articles/news/kubernetes-integrates-interoperability-storage-waits-on-sidecars/2019/12/
[6]: https://kubernetes.io/blog/2019/12/06/when-youre-in-the-release-team-youre-family-the-kubernetes-1.16-release-interview/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (Morisun029)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,67 @@
[#]: collector: (lujun9972)
[#]: translator: (Morisun029)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 ways to volunteer this holiday season)
[#]: via: (https://opensource.com/article/19/12/ways-volunteer)
[#]: author: (John Jones https://opensource.com/users/johnjones4)
4 ways to volunteer this holiday season
======
Looking to spread some holiday cheer? Donate your talents to open source
organizations that help communities in need.
![Gift box opens with colors coming out][1]
Social impact happens when leaders deploy individuals and resources to make positive change, but many social efforts are lacking technology resources that are up to the task of serving these change-makers. However, there are organizations helping to accelerate tech for good by connecting developers who want to make a change with communities and nonprofits who desperately need better technology. These organizations often serve specific audiences and recruit specific kinds of technologists, but they all share a common thread: open source.
As developers, we all seek to participate in the open source community for a variety of reasons. Some participate for professional development, some participate so that they may collaborate with a vast, impressive network of technologists, and others participate because they know their contributions are necessary for the success of a project. Why not also volunteer your talents as a developer to an effort that needs them, and contribute to open source all at the same time? The organizations below are prime examples of how you can do that.
### Code for America
Code for America is an example of how government can still be by the people and for the people in the digital age. Through its Brigade Network, the organization has cultivated a national alliance of volunteer programmers, data scientists, concerned citizens, and designers organized in cities all over the United States. These local affiliates host regular meet-ups which are open to the community to both pitch new projects to the group and collaborate on ongoing efforts. To match volunteers with projects, the brigades websites often list the specific skills needed for a project such as data analysis, content creation, and JavaScript. While the brigades focus on local issues, shared experiences like natural disasters can foster collaboration. For example, a multi-brigade effort from the New Orleans, Houston, and Tampa Bay teams developed a hurricane response website that can be quickly adapted to different cities when disaster strikes.
To get involved, visit Code for Americas [website][2] for a list of its over 70 brigades, and a path for individuals to start their own if there is not one already in their community.
### Code for Change
Code for Change shows that social impact can start even in high school. A group of high school coders in Indianapolis started their own club to give back to local organizations by creating open source software solutions to issues in their community. Code for Change encourages local organizations to reach out with a project idea, and the student group steps in to develop a completely free and open source solution. The group has developed projects such as "Sapphire," which optimized volunteer management systems for a local refugee organization, and a Civil Rights Commission complaint form that makes it easier for citizens to voice their concerns online.
For more information on how to create a Code for Change chapter in your own community, [visit their website][3].
### Python for Good/Ruby for Good
Python for Good and Ruby for Good are twin annual events in Portland, Oregon and Fairfax, Virginia, that bring people together to develop and program solutions for those respective communities. Over a weekend, individuals get together to hear pitches from local nonprofits and tackle their issues by building open source solutions. In 2017, Ruby For Good participants created "Justice for Juniors," which mentors and tutors current and formerly incarcerated youths to integrate them back into the community. Participants have also created "Diaperbase," an inventory management system that has been used by diaper banks all over the United States. One of the main objectives of these events is to bring organizations and people from seemingly different industries and mindsets to come together for a common good. Companies can sponsor the events, nonprofits can submit project ideas, and people of all skill levels can register to attend the event and contribute. Through their bicoastal efforts, Ruby for Good and Python for Good are living up to their motto of "making the world gooder."
[Ruby for Good][4] is held in the summer and hosted on George Masons campus in Fairfax, Virginia.
### Social Coder
UK-based Ed Guiness created Social Coder to bring together volunteers and charities to create and use open source projects for nonprofits across six continents. Social Coder actively recruits a network of skilled IT volunteers from all over the world and matches them to charities and nonprofits registered through Social Coder. Projects can range from simple website updates to entire mobile app development.
For example, PHASE Worldwide, a small non-governmental association supporting efforts in Nepal, got access to key support and expertise leveraging open source technology because of Social Coder.
While a bulk of the charities already partnered with Social Coder are based in the UK, organizations in other countries are welcome. Through their website, individuals can register to work on social software projects and connect with organizations and charities seeking their help.
Individuals interested in volunteering with Social Coder can sign up [here][5].
The four-day-long siege of a Nairobi mall ended Tuesday with a death toll of more than 60 people ...
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/ways-volunteer
作者:[John Jones][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/johnjones4
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
[2]: https://brigade.codeforamerica.org/
[3]: http://codeforchange.herokuapp.com/
[4]: https://rubyforgood.org/
[5]: https://socialcoder.org/Home/Programmer

View File

@ -0,0 +1,346 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to add a Help facility to your Bash program)
[#]: via: (https://opensource.com/article/19/12/help-bash-program)
[#]: author: (David Both https://opensource.com/users/dboth)
How to add a Help facility to your Bash program
======
In the third article in this series, learn about using functions as you
create a simple Help facility for your Bash script.
![bash logo on green background][1]
In the [first article][2] in this series, you created a very small, one-line Bash script and explored the reasons for creating shell scripts and why they are the most efficient option for the system administrator, rather than compiled programs. In the [second article][3], you began the task of creating a fairly simple template that you can use as a starting point for other Bash programs, then explored ways to test it.
This third of the four articles in this series explains how to create and use a simple Help function. While creating your Help facility, you will also learn about using functions and how to handle command-line options such as **-h**.
### Why Help?
Even fairly simple Bash programs should have some sort of Help facility, even if it is fairly rudimentary. Many of the Bash shell programs I write are used so infrequently that I forget the exact syntax of the command I need. Others are so complex that I need to review the options and arguments even when I use them frequently.
Having a built-in Help function allows you to view those things without having to inspect the code itself. A good and complete Help facility is also a part of program documentation.
### About functions
Shell functions are lists of Bash program statements that are stored in the shell's environment and can be executed, like any other command, by typing their name at the command line. Shell functions may also be known as procedures or subroutines, depending upon which other programming language you are using.
Functions are called in scripts or from the command-line interface (CLI) by using their names, just as you would for any other command. In a CLI program or a script, the commands in the function execute when they are called, then the program flow sequence returns to the calling entity, and the next series of program statements in that entity executes.
The syntax of a function is:
```
`FunctionName(){program statements}`
```
Explore this by creating a simple function at the CLI. (The function is stored in the shell environment for the shell instance in which it is created.) You are going to create a function called **hw**, which stands for "hello world." Enter the following code at the CLI and press **Enter**. Then enter **hw** as you would any other shell command:
```
[student@testvm1 ~]$ hw(){ echo "Hi there kiddo"; }
[student@testvm1 ~]$ hw
Hi there kiddo
[student@testvm1 ~]$
```
OK, so I am a little tired of the standard "Hello world" starter. Now, list all of the currently defined functions. There are a lot of them, so I am showing just the new **hw** function. When it is called from the command line or within a program, a function performs its programmed task and then exits and returns control to the calling entity, the command line, or the next Bash program statement in a script after the calling statement:
```
[student@testvm1 ~]$ declare -f | less
&lt;snip&gt;
hw ()
{
    echo "Hi there kiddo"
}
&lt;snip&gt;
```
Remove that function because you do not need it anymore. You can do that with the **unset** command:
```
[student@testvm1 ~]$ unset -f hw ; hw
bash: hw: command not found
[student@testvm1 ~]$
```
### Creating the Help function
Open the **hello** program in an editor and add the Help function below to the **hello** program code after the copyright statement but before the **echo "Hello world!"** statement. This Help function will display a short description of the program, a syntax diagram, and short descriptions of the available options. Add a call to the Help function to test it and some comment lines that provide a visual demarcation between the functions and the main portion of the program:
```
################################################################################
# Help                                                                         #
################################################################################
Help()
{
   # Display Help
   echo "Add description of the script functions here."
   echo
   echo "Syntax: scriptTemplate [-g|h|v|V]"
   echo "options:"
   echo "g     Print the GPL license notification."
   echo "h     Print this Help."
   echo "v     Verbose mode."
   echo "V     Print software version and exit."
   echo
}
################################################################################
################################################################################
# Main program                                                                 #
################################################################################
################################################################################
Help
echo "Hello world!"
```
The options described in this Help function are typical for the programs I write, although none are in the code yet. Run the program to test it:
```
[student@testvm1 ~]$ ./hello
Add description of the script functions here.
Syntax: scriptTemplate [-g|h|v|V]
options:
g     Print the GPL license notification.
h     Print this Help.
v     Verbose mode.
V     Print software version and exit.
Hello world!
[student@testvm1 ~]$
```
Because you have not added any logic to display Help only when you need it, the program will always display the Help. Since the function is working correctly, read on to add some logic to display the Help only when the **-h** option is used when you invoke the program at the command line. 
### Handling options
A Bash script's ability to handle command-line options such as **-h** gives some powerful capabilities to direct the program and modify what it does. In the case of the **-h** option, you want the program to print the Help text to the terminal session and then quit without running the rest of the program. The ability to process options entered at the command line can be added to the Bash script using the **while** command (see [_How to program with Bash: Loops_][4] to learn more about **while**) in conjunction with the **getops** and **case** commands.
The **getops** command reads any and all options specified at the command line and creates a list of those options. In the code below, the **while** command loops through the list of options by setting the variable **$options** for each. The **case** statement is used to evaluate each option in turn and execute the statements in the corresponding stanza. The **while** statement will continue to evaluate the list of options until they have all been processed or it encounters an exit statement, which terminates the program.
Be sure to delete the Help function call just before the **echo "Hello world!"** statement so that the main body of the program now looks like this:
```
################################################################################
################################################################################
# Main program                                                                 #
################################################################################
################################################################################
################################################################################
# Process the input options. Add options as needed.                            #
################################################################################
# Get the options
while getopts ":h" option; do
   case $option in
      h) # display Help
         Help
         exit;;
   esac
done
echo "Hello world!"
```
Notice the double semicolon at the end of the exit statement in the case option for **-h**. This is required for each option added to this case statement to delineate the end of each option.
### Testing
Testing is now a little more complex. You need to test your program with a number of different options—and no options—to see how it responds. First, test with no options to ensure that it prints "Hello world!" as it should:
```
[student@testvm1 ~]$ ./hello
Hello world!
```
That works, so now test the logic that displays the Help text:
```
[student@testvm1 ~]$ ./hello -h
Add description of the script functions here.
Syntax: scriptTemplate [-g|h|t|v|V]
options:
g     Print the GPL license notification.
h     Print this Help.
v     Verbose mode.
V     Print software version and exit.
```
That works as expected, so try some testing to see what happens when you enter some unexpected options:
```
[student@testvm1 ~]$ ./hello -x
Hello world!
[student@testvm1 ~]$ ./hello -q
Hello world!
[student@testvm1 ~]$ ./hello -lkjsahdf
Add description of the script functions here.
Syntax: scriptTemplate [-g|h|t|v|V]
options:
g     Print the GPL license notification.
h     Print this Help.
v     Verbose mode.
V     Print software version and exit.
[student@testvm1 ~]$
```
The program just ignores any options without specific responses without generating any errors. But notice the last entry (with **-lkjsahdf** for options): because there is an **h** in the list of options, the program recognizes it and prints the Help text. This testing has shown that the program doesn't have the ability to handle incorrect input and terminate the program if any is detected.
You can add another case stanza to the case statement to match any option that doesn't have an explicit match. This general case will match anything you have not provided a specific match for. The case statement now looks like this, with the catch-all match of **\?** as the last case. Any additional specific cases must precede this final one:
```
while getopts ":h" option; do
   case $option in
      h) # display Help
         Help
         exit;;
     \?) # incorrect option
         echo "Error: Invalid option"
         exit;;
   esac
done
```
Test the program again using the same options as before and see how it works now.
### Where you are
You have accomplished a good amount in this article by adding the capability to process command-line options and a Help procedure. Your Bash script now looks like this:
```
#!/usr/bin/bash
################################################################################
#                              scriptTemplate                                  #
#                                                                              #
# Use this template as the beginning of a new program. Place a short           #
# description of the script here.                                              #
#                                                                              #
# Change History                                                               #
# 11/11/2019  David Both    Original code. This is a template for creating     #
#                           new Bash shell scripts.                            #
#                           Add new history entries as needed.                 #
#                                                                              #
#                                                                              #
################################################################################
################################################################################
################################################################################
#                                                                              #
#  Copyright (C) 2007, 2019 David Both                                         #
#  [LinuxGeek46@both.org][5]                                                        #
#                                                                              #
#  This program is free software; you can redistribute it and/or modify        #
#  it under the terms of the GNU General Public License as published by        #
#  the Free Software Foundation; either version 2 of the License, or           #
#  (at your option) any later version.                                         #
#                                                                              #
#  This program is distributed in the hope that it will be useful,             #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
#  GNU General Public License for more details.                                #
#                                                                              #
#  You should have received a copy of the GNU General Public License           #
#  along with this program; if not, write to the Free Software                 #
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   #
#                                                                              #
################################################################################
################################################################################
################################################################################
################################################################################
# Help                                                                         #
################################################################################
Help()
{
   # Display Help
   echo "Add description of the script functions here."
   echo
   echo "Syntax: scriptTemplate [-g|h|t|v|V]"
   echo "options:"
   echo "g     Print the GPL license notification."
   echo "h     Print this Help."
   echo "v     Verbose mode."
   echo "V     Print software version and exit."
   echo
}
################################################################################
################################################################################
# Main program                                                                 #
################################################################################
################################################################################
################################################################################
# Process the input options. Add options as needed.                            #
################################################################################
# Get the options
while getopts ":h" option; do
   case $option in
      h) # display Help
         Help
         exit;;
     \?) # incorrect option
         echo "Error: Invalid option"
         exit;;
   esac
done
echo "Hello world!"
```
Be sure to test this version of the program very thoroughly. Use random inputs and see what happens. You should also try testing valid and invalid options without using the dash (**-**) in front.
### Next time
In this article, you added a Help function as well as the ability to process command-line options to display it selectively. The program is getting a little more complex, so testing is becoming more important and requires more test paths in order to be complete.
The next article will look at initializing variables and doing a bit of sanity checking to ensure that the program will run under the correct set of conditions.
### Resources
* [How to program with Bash: Syntax and tools][6]
* [How to program with Bash: Logical operators and shell expansions][7]
* [How to program with Bash: Loops][4]
* * *
_This series of articles is partially based on Volume 2, Chapter 10 of David Both's three-part Linux self-study course, [Using and Administering Linux—Zero to SysAdmin][8]._
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/help-bash-program
作者:[David Both][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
[2]: https://opensource.com/article/19/12/introduction-automation-bash-scripts
[3]: https://opensource.com/article/19/12/creating-bash-script-template
[4]: https://opensource.com/article/19/10/programming-bash-loops
[5]: mailto:LinuxGeek46@both.org
[6]: https://opensource.com/article/19/10/programming-bash-syntax-tools
[7]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions
[8]: http://www.both.org/?page_id=1183

View File

@ -0,0 +1,105 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager)
[#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Why Vim fans love the Herbstluftwm Linux window manager
======
This article is part of a special series of 24 days of Linux desktops.
If you're a Vim fan, check out herbstluftwm, a tile-based Linux window
manager that takes the "Vim way" as inspiration.
![OpenStack source code \(Python\) in VIM][1]
Everybody loves Vim (aside from Dvorak and Emacs users). Vim is so popular that there are entire web browsers dedicated to navigating the web with Vim keybindings, a Vim mode in the wildly popular [Zsh][2] terminal emulator, and even a text editor. There's also a window manager called [herbstluftwm][3] that models itself partly after the "Vim way." Herbstluftwm does away with windows, as such, and replaces them with tiles, or quadrants, into which applications are loaded and used. You use the keyboard (**Alt+h**, **Alt+j**, **Alt+k**, and **Alt+l**) to navigate from one tile to another.
![Herbstluftwm][4]
Install herbstluftwm from your distribution's software repository. After installing it, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in.
With GDM:
![][5]
With SDDM:
![][6]
### Herbstluftwm desktop tour
The first time you log into herbstluftwm, you are greeted with nothing but a green screen with a darker green border around the edges. What you're seeing is the initial tile with no application loaded into it. To start the default application, xterm, press **Alt+Return**.
The documentation emphasizes the **$HOME/.config/herbstluftwm/autostart** configuration file as a way to start important applications when you log in. For applications you don't necessarily want to start every time you log in, you can use xterm as your launch daemon. As usual, placing an ampersand (**&amp;**) symbol after the command returns control of the shell to you. To start Emacs, for instance:
```
`% emacs &`
```
This launches an Emacs window in a new tile and returns you to a prompt.
![Emacs running in Herbstluftwm][7]
#### Switching tiles
To move from one tile to another, use the classic Vim navigation combination of **h**, **j**, **k**, or **l**, along with the **Alt** key. For example, to switch from the terminal to an application in a tile below it (i.e., at the bottom of the screen), press **Alt+j**. To navigate back up, **Alt+k**. Left and right navigations are **Alt+h** and **Alt+l**, respectively.
#### Split screen
You can manually split a screen vertically with **Alt+o** and horizontally with **Alt+u**.
To remove an empty tile, navigate into it and press **Alt+r**.
### Configuring herbstluftwm
Aside from the **Alt** keybindings, you communicate with herbstluftwm through the **herbstclient** command. This command can be used interactively from a shell, or you can preserve your preferences in a configuration file.
You can view all attributes available in Herbstluftwm with:
```
`$ herbstclient attr`
```
Herbstluftwm's default behavior is defined in the default config file, which you can copy to your home directory and modify. Upon launch, herbstluftwm executes the commands contained in the config file. For instance, if you find it awkward to use keybindings centered around the **Alt** key, which is traditionally a key reserved for in-application shortcuts, you can change the key used to trigger herbstluftwm actions in the config file:
```
% mkdir ~/.config/herbstluftwm
% cp /usr/xdg/herbstluftwm/autostart \
~/.config/herbstluftwm
% sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm
% herbstclient reload
```
This changes the herbstluftwm modifier to the Super key (the "Windows" or "Tux" key, depending on your keyboard).
Using the autostart file, you can set custom keybindings, create tags for applications of a specific type so you can tile applications in a consistent way, and do much more.
### Why you need to try herbstluftwm
Herbstluftwm is a fine example of a tiling window manager. It tiles windows by default and lets the user define exceptions to global rules. It uses Vim-like navigation but allows for quick and easy overrides. It's very likely the tiling manager you've been looking for, so try it soon.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM)
[2]: https://opensource.com/article/19/9/getting-started-zsh
[3]: https://herbstluftwm.org
[4]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm.png (Herbstluftwm)
[5]: https://opensource.com/sites/default/files/advent-gdm_1.jpg
[6]: https://opensource.com/sites/default/files/advent-kdm_0.jpg
[7]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm-emacs.jpg (Emacs running in Herbstluftwm)

View File

@ -0,0 +1,154 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?)
[#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Pop!_OS vs Ubuntu: Which One is Better?
======
Well, you might find it easy to pick one from the list of [best Linux distributions][1]. However, it is often confusing to compare two similar Linux distros, just like Pop!_OS vs Ubuntu.
Interestingly, Pop!_OS is based on [Ubuntu][2]. So, what is the difference between Pop!_OS and Ubuntu? Why should you choose one over other?
In this article, Im going to compare Pop!_OS and Ubuntu (both of which happen to be my favorites).
**Note:** _You might find some of the points opinionated, this article is just a reference for the comparison. With constant developments and updates to Linux distros, a lot can change over time._
### Comparing Ubuntu and Pop!_OS
![Pop!_OS Vs Ubuntu][3]
Spotting the similarity helps you distinguish other differences. So, let me start noting down some of the obvious similarities.
Like I mentioned, Pop!_OS is a Linux distribution on top of Ubuntu. So, you get all the benefits of using Ubuntu (technically the same thing at its core) when you use Pop!_OS.
They both ship with the [GNOME desktop environment][4] by default and hence they feature a similar user interface (UI).
Without going into all the under-the-hood differences, I will be highlighting some important ones here.
#### User Experience &amp; Theming
![Pop!_OS][5]
A lot of users think that Pop!_OS is just Ubuntu with a different skin.
From my experience, Ill mention that it is not entirely true.
Yes, they both rock [GNOME desktop environment][4] however, Pop!_OS just feels more polished.
In addition to the look and feel, [Ubuntu customizes the GNOME experience][6] by adding a dock and a few more tricks. You might find it better if you like a customized GNOME experience.
But, if you prefer a pure GNOME experience, Pop!_OS gives you that by default.
I cannot convince you enough until you try it out for yourself. But, the overall color scheme, icons, and the theme that goes on in Pop!_OS is arguably more pleasing as a superior user experience.
It can be a subjective thing but it is what I observed. You can also check out the video tour for Ubuntu 19.10 to check it out for yourself:
#### Ease of Installing Third-Party Apps
![Pop Os PPA][7]
Ubuntu puts a lot of emphasis on Snap packages. This increases the number of application it offers.
But there are some major issues with Snap packages. They take too much of disk space and they take a lot of time to start.
This is why I prefer using the APT version of any application.
Why am I telling you this?
Because Pop!_OS has its [own official PPA][8] which is enabled by default. Youll find some useful applications like Android Studio, TensorFlow in here. No need to download a 1 GB snap package for the Android Studio. Just use [apt-get install][9] and get done with it.
#### Pre-installed Applications
![Ubuntu installation slideshow][10]
It may not be the biggest deal-breaker for some but having a lot of pre-installed apps could affect the experience and performance. Even if it does not affect the performance some users just prefer fewer pre-installed apps.
Pop!_OS comes bundled with fewer default apps (potentially less bloatware, if I may call it that) when compared to Ubuntu.
Yet again, this is something subjective. If you want to have more apps pre-installed, you may consider Ubuntu over Pop!_OS.
#### Snap Package Support
![][11]
For users comfortable with the snap packages, Ubuntus software center is a slightly better solution to Pop!_OS shop because you can have snap packages listed right in your software center.
You cannot filter the snap packages in the software center but it will be easier to install a snap package when you notice one (look at the details for the source of the app as _Snap store_ / _Snapcraft_) in the Software Center.
Pop!_OS does support snap packages as well if youre confused. But, you wont find them through the Pop!_OS shop, thats the only difference here.
If you are not sure what a snap package is and what it does, you can check out our article on [installing snap apps on Linux][12].
#### Separate NVIDIA/AMD ISO File
![ISOs][13]
Technically, it isnt a part of the comparison internally but it is a factor that some users care for.
So, it is worth highlighting that Pop!_OS provides separate ISOs. One for the systems with NVIDIA graphics card and another for systems with/without AMD graphics.
With Ubuntu 19.10, you get NVIDIA drivers on the Ubuntu ISO but there is no such thing for AMD graphics.
#### Reliability &amp; Issues
Unquestionably, both the [distributions are beginner-friendly][14] and quite reliable. You might want to hold on to a Long Term Support (LTS) release if you want better reliability and fewer issues.
When a new version of Ubuntu comes up, Pop!_OS works on it and potentially fixes the issues that users encounter on Ubuntus original release before making the new upgrade available. This gives them a slight edge but thats nothing substantial because those fixes eventually reach Ubuntu.
#### Performance
The performance will highly depend on what you have installed and the hardware configuration you install it on.
Unless you have a super old system, both distributions seem to perform very well.
Im rocking an i5-7400 processor coupled with 16 Gigs of RAM (with a GTX 1050ti Graphics Card) and I find the experience good enough on both the distros.
Of course, you could manually do a few optimization tweaks to fit your requirements if either of them does not work out for your hardware configuration.
But, if you want to get your hands on a System76 laptop, Pop!_OS will prove to be [the Apple of Linux space][15] because Pop!_OS has been tailored for their hardware, unlike Ubuntu.
#### Hardware Compatibility
This is definitely something to consider when comparing other Linux distributions. However, in this case, theres really no significant difference.
You might consider Pop!_OS to constantly work with newer hardware configurations because they primarily tailor the OS for their laptops with a variety of configurations. And, its just an observation not a fact.
**Wrapping Up**
I know its not easy to choose one among the two popular Linux distro without trying them out. If its a possibility, Ill recommend you to give them both a try while keeping this comparison for reference.
Whats your choice between these two? Did I miss something in the comparison? Let me know in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/pop-os-vs-ubuntu/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/best-linux-distributions/
[2]: https://ubuntu.com/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/pop_os_vs_ubuntu.png?ssl=1
[4]: https://www.gnome.org/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-UI.jpg?ssl=1
[6]: https://itsfoss.com/gnome-tricks-ubuntu/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-ppa.jpg?ssl=1
[8]: https://launchpad.net/~system76/+archive/ubuntu/pop/
[9]: https://itsfoss.com/apt-get-linux-guide/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?resize=800%2C516&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/snapcraft.jpg?ssl=1
[12]: https://itsfoss.com/install-snap-linux/
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/iso-amd-nvidia-pop-os.jpg?ssl=1
[14]: https://itsfoss.com/best-linux-beginners/
[15]: https://www.phoronix.com/scan.php?page=news_item&px=System76-Integrated-Vision

View File

@ -1,147 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (hj24)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to write a Python web API with Flask)
[#]: via: (https://opensource.com/article/19/11/python-web-api-flask)
[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston)
如何使用Flask编写Python Web API
======
这是一个快速教程用来展示如何通过Flask目前发展最迅速的Python框架之一来从服务器获取数据。
![spiderweb diagram][1]
[Python][2]是一个以语法简洁著称的高级的面向对象的程序语言。它一直都是一个用来构建RESTful API的顶级编程语言。
[Flask][3]是一个高度可定制化的Python框架可以为开发人员提供用户访问数据方式的完全控制。Flask是一个基于Werkzeug的[WSGI][4]工具包和Jinja 2模板引擎的”微框架“。它是一个被设计来开发RESTful API的web框架。
Flask是Python发展最迅速的框架之一很多知名网站如Netflix, Pinterest, 和LinkedIn都将Flask纳入了它们的开发技术栈。下面是一个简单的示例展示了Flask是如何允许用户通过HTTP GET请求来从服务器获取数据的。
### 初始化一个Flask应用
首先创建一个你的Flask项目的目录结构。你可以在你系统的任何地方来做这件事。
```
$ mkdir tutorial
$ cd tutorial
$ touch main.py
$ python3 -m venv env
$ source env/bin/activate
(env) $ pip3 install flask-restful
Collecting flask-restful
Downloading <https://files.pythonhosted.org/packages/17/44/6e49...8da4/Flask\_RESTful-0.3.7-py2.py3-none-any.whl>
Collecting Flask&gt;=0.8 (from flask-restful)
[...]
```
### 导入Flask模块
Next, import the **flask** module and its **flask_restful** library into your **main.py** code:
然后,在你的**main.py**代码中导入**flask**模块和它的**flask_restful**库:
```
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class Quotes(Resource):
    def get(self):
        return {
            'William Shakespeare': {
                'quote': ['Love all,trust a few,do wrong to none',
                'Some are born great, some achieve greatness, and some greatness thrust upon them.']
        },
        'Linus': {
            'quote': ['Talk is cheap. Show me the code.']
            }
        }
api.add_resource(Quotes, '/')
if __name__ == '__main__':
    app.run(debug=True)
```
### 运行app
Flask includes a built-in HTTP server for testing. Test the simple API you built:
Flask包含一个内建的用于测试的HTTP服务器。来测试一下这个你创建的简单的API
```
(env) $ python main.py
 * Serving Flask app "main" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on <http://127.0.0.1:5000/> (Press CTRL+C to quit)
```
启动开发服务器时将启动Flask应用程序该应用程序包含一个名为 **get** 的方法来响应简单的HTTP GET请求。你可以通过 **wget**、**curl** 命令或者任意的web浏览器来测试它。
```
$ curl <http://localhost:5000>
{
    "William Shakespeare": {
        "quote": [
            "Love all,trust a few,do wrong to none",
            "Some are born great, some achieve greatness, and some greatness thrust upon them."
        ]
    },
    "Linus": {
        "quote": [
            "Talk is cheap. Show me the code."
        ]
    }
}
```
要查看使用Python和Flask的类似Web API的更复杂版本请导航至美国国会图书馆的[Chronicling America] [5]网站,该网站可提供有关这些信息的历史报纸和数字化报纸。
### 为什么使用 Flask?
Flask有以下几个主要的优点
1. Python很流行并且广泛被应用所以任何熟悉Python的人都可以使用Flask来开发。
2. 它轻巧而简约。
3. 考虑安全性而构建。
4. 出色的文档,其中包含大量清晰,有效的示例代码。
还有一些潜在的缺点:
1. 它轻巧而简约。但如果您正在寻找具有大量捆绑库和预制组件的框架,那么这可能不是最佳选择。
2. 如果必须围绕Flask构建自己的框架则你可能会发现维护自定义项的成本可能会抵消使用Flask的好处。
如果您要构建Web程序或API可以考虑选择Flask。它功能强大且健壮并且其优秀的项目文档使入门变得容易。试用一下评估一下看看它是否适合您的项目。
在本课中了解更多信息关于Python异常处理以及如何以安全的方式进行操作。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/11/python-web-api-flask
作者:[Rachel Waston][a]
选题:[lujun9972][b]
译者:[hj24](https://github.com/hj24)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/rachelwaston
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-cms-build-howto-tutorial.png?itok=bRbCJt1U (spiderweb diagram)
[2]: https://www.python.org/
[3]: https://palletsprojects.com/p/flask/
[4]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
[5]: https://chroniclingamerica.loc.gov/about/api