mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
43bcb10ff2
@ -1,38 +1,36 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10621-1.html)
|
||||
[#]: subject: (HTTP: Brief History of HTTP)
|
||||
[#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol)
|
||||
[#]: author: (Ilya Grigorik https://www.igvita.com/)
|
||||
|
||||
HTTP: HTTP 历史简介
|
||||
HTTP 简史
|
||||
======
|
||||
<to 校正:这篇可能得费费心了。。。>
|
||||
|
||||
译注:本文来源于 2013 年出版的《High Performance Browser Networking》的第九章,因此有些信息略有过时。事实上,现在 HTTP/2 已经有相当的不是,而新的 HTTP/3 也在设计和标准制定当中。
|
||||
|
||||
### 介绍
|
||||
|
||||
超文本传输协议(HTTP)是 Internet 上最普遍和广泛采用的应用程序协议之一。它是客户端和服务器之间的通用语言,支持现代 Web。从最初作为一个简单的关键字和文档路径开始,它已成为不仅仅是浏览器的首选协议,而且几乎是所有连接互联网硬件和软件应用程序的首选协议。
|
||||
<ruby>超文本传输协议<rt>Hypertext Transfer Protocol</rt></ruby>(HTTP)是互联网上最普遍和广泛采用的应用程序协议之一。它是客户端和服务器之间的通用语言,支持现代 Web。从最初作为单个的关键字和文档路径开始,它已成为不仅仅是浏览器的首选协议,而且几乎是所有连接互联网硬件和软件应用程序的首选协议。
|
||||
|
||||
在本文中,我们将简要回顾 HTTP 协议的发展历史。对 HTTP 不同语义的完整讨论超出了本文的范围,但理解 HTTP 的关键设计变更以及每个变更背后的动机将为我们讨论 HTTP 性能提供必要的背景,特别是在 HTTP/2 中即将进行的许多改进。
|
||||
|
||||
### §HTTP 0.9: 单向协议
|
||||
### HTTP 0.9: 单行协议
|
||||
|
||||
Tim Berners-Lee 最初的 HTTP 提案在设计时考虑到了简单性,以帮助他采用他的另一个新想法:万维网(World Wide Web)。这个策略看起来奏效了:注意,他是一个有抱负的协议设计者。
|
||||
<ruby>蒂姆·伯纳斯·李<rt>Tim Berners-Lee</rt></ruby> 最初的 HTTP 提案在设计时考虑到了简单性,以帮助他采用他的另一个新想法:<ruby>万维网<rt>World Wide Web</rt></ruby>。这个策略看起来奏效了:注意,他是一个有抱负的协议设计者。
|
||||
|
||||
1991 年,Berners-Lee 概述了新协议的动机,并列出了几个高级设计目标:文件传输功能,请求超文档存档索引搜索的能力,格式协商以及将客户端引用到另一个服务器的能力。为了证明该理论的实际应用,我们构建了一个简单原型,它实现了所提议功能的一小部分。
|
||||
1991 年,伯纳斯·李概述了这个新协议的动机,并列出了几个高级设计目标:文件传输功能、请求超文档存档索引搜索的能力,格式协商以及将客户端引用到另一个服务器的能力。为了证明该理论的实际应用,构建了一个简单原型,它实现了所提议功能的一小部分。
|
||||
|
||||
* 客户端请求是一个 ASCII 字符串。
|
||||
|
||||
* 客户端请求以回车符(CRLF)终止。
|
||||
|
||||
* 服务器响应是 ASCII 字符流。
|
||||
|
||||
* 服务器响应是一种超文本标记语言(HTML)。
|
||||
|
||||
* 文档传输完成后连接终止。
|
||||
|
||||
这些听起来就挺复杂,而实际情况比这复杂得多。这些规则支持的是一种非常简单的,对 Telnet 友好的协议,一些 Web 服务器至今仍然支持这种协议:
|
||||
然而,即使这听起来也比实际复杂得多。这些规则支持的是一种非常简单的,对 Telnet 友好的协议,一些 Web 服务器至今仍然支持这种协议:
|
||||
|
||||
```
|
||||
$> telnet google.com 80
|
||||
@ -45,39 +43,32 @@ GET /about/
|
||||
(connection closed)
|
||||
```
|
||||
|
||||
请求包含这样一行:`GET` 方法和请求文档的路径。响应是一个超文本文档-没有标题或任何其他元数据,只有 HTML。真的是再简单不过了。此外,由于之前的交互是预期协议的子集,因此它获得了一个非官方的 HTTP 0.9 标签。其余的,就像他们所说的,都是历史。
|
||||
请求包含这样一行:`GET` 方法和请求文档的路径。响应是一个超文本文档,没有标题或任何其他元数据,只有 HTML。真的是再简单不过了。此外,由于之前的交互是预期协议的子集,因此它获得了一个非官方的 HTTP 0.9 标签。其余的,就像他们所说的,都是历史。
|
||||
|
||||
从 1991 年这些不起眼的开始,HTTP 就有了自己的生命,并在接下来几年里迅速发展。让我们快速回顾一下 HTTP 0.9 的特性:
|
||||
|
||||
* 采用客户端-服务器架构,是一种请求-响应协议。
|
||||
|
||||
* 采用 ASCII 协议,运行在 TCP/IP 链路上。
|
||||
|
||||
* 旨在传输超文本文档(HTML)。
|
||||
|
||||
* 每次请求后,服务器和客户端之间的连接都将关闭。
|
||||
|
||||
```
|
||||
流行的 Web 服务器,如 Apache 和 Nginx,仍然支持 HTTP 0.9 协议,部分原因是因为它没有太多功能!如果你感兴趣,打开 Telnet 会话并尝试通过 HTTP 0.9 访问 google.com 或你最喜欢的网站,并检查早期协议的行为和限制。
|
||||
> 流行的 Web 服务器,如 Apache 和 Nginx,仍然支持 HTTP 0.9 协议,部分原因是因为它没有太多功能!如果你感兴趣,打开 Telnet 会话并尝试通过 HTTP 0.9 访问 google.com 或你最喜欢的网站,并检查早期协议的行为和限制。
|
||||
|
||||
```
|
||||
### §HTTP/1.0: 快速增长和 Informational RFC
|
||||
### HTTP/1.0: 快速增长和 Informational RFC
|
||||
|
||||
1991 年至 1995 年期间, HTML 规范和一种称为 “web 浏览器”的新型软件快速发展,面向消费者的公共互联网基础设施也开始出现并快速增长。
|
||||
1991 年至 1995 年期间,HTML 规范和一种称为 “web 浏览器”的新型软件快速发展,面向消费者的公共互联网基础设施也开始出现并快速增长。
|
||||
|
||||
```
|
||||
##### §完美风暴: 1990 年代初的互联网热潮
|
||||
> **完美风暴:1990 年代初的互联网热潮**
|
||||
|
||||
基于 Tim Berner-Lee 最初的浏览器原型,美国国家超级计算机应用中心(NCSA)的一个团队决定实现他们自己的版本。就这样,第一个流行的浏览器诞生了:NCSA Mosaic。1994 年 10 月,NCSA 团队的一名程序员 Marc Andreessen 与 Jim Clark 合作创建了 Mosaic Communications,该公司后来改名为 Netscape(网景),并于 1994 年 12 月发布了 Netscape Navigator 1.0。从这一点来说,已经很清楚了,万维网已经不仅仅是学术上的好奇心了。
|
||||
> 基于蒂姆·伯纳斯·李最初的浏览器原型,美国国家超级计算机应用中心(NCSA)的一个团队决定实现他们自己的版本。就这样,第一个流行的浏览器诞生了:NCSA Mosaic。1994 年 10 月,NCSA 团队的一名程序员 Marc Andreessen 与 Jim Clark 合作创建了 Mosaic Communications,该公司后来改名为 Netscape(网景),并于 1994 年 12 月发布了 Netscape Navigator 1.0。从这一点来说,已经很清楚了,万维网已经不仅仅是学术上的好奇心了。
|
||||
|
||||
实际上,同年在瑞士日内网组织了第一次万维网会议,这导致万维网联盟(W3C)的成立,以帮助指导 HTML 的发展。同样,在 IETF 内部建立了一个并行的 HTTP 工作组(HTTP-WG),专注于改进 HTTP 协议。后来这两个团体一直对 Web 的发展起着重要作用。
|
||||
> 实际上,同年在瑞士日内瓦组织了第一次万维网会议,这导致<ruby>万维网联盟<rt>World Wide Web Consortium</rt></ruby>(W3C)的成立,以帮助指导 HTML 的发展。同样,在 IETF 内部建立了一个并行的<ruby>HTTP 工作组<rt>HTTP Working Group</rt></ruby>(HTTP-WG),专注于改进 HTTP 协议。后来这两个团体一直对 Web 的发展起着重要作用。
|
||||
|
||||
最后,完美的风暴来临,CompuServe,AOL 和 Prodigy 在 1994-1995 年的同一时间开始向公众提供拨号上网服务。凭借这股迅速的浪潮,Netscape 在 1995 年 8 月 9 日凭借其成功的 IPO 创造了历史。这预示着互联网热潮已经到来,人人都想分一杯羹!
|
||||
```
|
||||
> 最后,完美风暴来临,CompuServe,AOL 和 Prodigy 在 1994-1995 年的同一时间开始向公众提供拨号上网服务。凭借这股迅速的浪潮,Netscape 在 1995 年 8 月 9 日凭借其成功的 IPO 创造了历史。这预示着互联网热潮已经到来,人人都想分一杯羹!
|
||||
|
||||
不断增长的新 Web 所需功能及其在公共网站上的用例很快暴露了 HTTP 0.9 的许多基础限制:我们需要一种能够提供超文本文档、提供关于请求和响应的更丰富的元数据,支持内容协商等等的协议。相应地,新兴的 Web 开发人员社区通过一个特殊的过程生成了大量实验性的 HTTP 服务器和客户端实现来回应:实现,部署,并查看其他人是否采用它。
|
||||
不断增长的新 Web 所需功能及其在公共网站上的应用场景很快暴露了 HTTP 0.9 的许多基础限制:我们需要一种能够提供超文本文档、提供关于请求和响应的更丰富的元数据,支持内容协商等等的协议。相应地,新兴的 Web 开发人员社区通过一个特殊的过程生成了大量实验性的 HTTP 服务器和客户端实现来回应:实现,部署,并查看其他人是否采用它。
|
||||
|
||||
从这些急速增长的实验开始,一系列最佳实践和常见模式开始出现。1996 年 5 月,HTTP 工作组(HTTP-WG)发布了 RFC 1945,它记录了许多被广泛使用的 HTTP/1.0 实现的“常见用法”。请注意,这只是一个信息 RFC:HTTP/1.0,因为我们知道它不是一个正式规范或 Internet 标准!
|
||||
从这些急速增长的实验开始,一系列最佳实践和常见模式开始出现。1996 年 5 月,<ruby>HTTP 工作组<rt>HTTP Working Group</rt></ruby>(HTTP-WG)发布了 RFC 1945,它记录了许多被广泛使用的 HTTP/1.0 实现的“常见用法”。请注意,这只是一个信息性 RFC:HTTP/1.0,如你所知的,它不是一个正式规范或 Internet 标准!
|
||||
|
||||
话虽如此,HTTP/1.0 请求看起来应该是:
|
||||
|
||||
@ -86,11 +77,11 @@ $> telnet website.org 80
|
||||
|
||||
Connected to xxx.xxx.xxx.xxx
|
||||
|
||||
GET /rfc/rfc1945.txt HTTP/1.0
|
||||
GET /rfc/rfc1945.txt HTTP/1.0 ❶
|
||||
User-Agent: CERN-LineMode/2.15 libwww/2.17b3
|
||||
Accept: */*
|
||||
|
||||
HTTP/1.0 200 OK
|
||||
HTTP/1.0 200 OK ❷
|
||||
Content-Type: text/plain
|
||||
Content-Length: 137582
|
||||
Expires: Thu, 01 Dec 1997 16:00:00 GMT
|
||||
@ -101,34 +92,26 @@ Server: Apache 0.84
|
||||
(connection closed)
|
||||
```
|
||||
|
||||
1. 请求行有 HTTP 版本号,后面跟请求头
|
||||
- ❶ 请求行有 HTTP 版本号,后面跟请求头
|
||||
- ❷ 响应状态,后跟响应头
|
||||
|
||||
2. 响应状态,后跟响应头
|
||||
前面的交互并不是 HTTP/1.0 功能的详尽列表,但它确实说明了一些关键的协议更改:
|
||||
|
||||
* 请求可能多个由换行符分隔的请求头字段组成。
|
||||
* 响应对象的前缀是响应状态行。
|
||||
* 响应对象有自己的一组由换行符分隔的响应头字段。
|
||||
* 响应对象不限于超文本。
|
||||
* 每次请求后,服务器和客户端之间的连接都将关闭。
|
||||
|
||||
前面交换的并不是 HTTP/1.0 功能的详尽列表,但它确实说明了一些关键的协议更改:
|
||||
请求头和响应头都保留为 ASCII 编码,但响应对象本身可以是任何类型:HTML 文件、纯文本文件、图像或任何其他内容类型。因此,HTTP 的“超文本传输”部分在引入后不久就变成了用词不当。实际上,HTTP 已经迅速发展成为一种超媒体传输,但最初的名称没有改变。
|
||||
|
||||
* 请求可能多个由换行符分隔的请求头字段组成。
|
||||
除了媒体类型协商之外,RFC 还记录了许多其他常用功能:内容编码、字符集支持、多部分类型、授权、缓存、代理行为、日期格式等。
|
||||
|
||||
* 响应对象的前缀是响应状态行。
|
||||
> 今天,几乎所有 Web 上的服务器都可以并且仍将使用 HTTP/1.0。不过,现在你应该更加清楚了!每个请求都需要一个新的 TCP 连接,这会对 HTTP/1.0 造成严重的性能损失。参见[三次握手][1],接着会[慢启动][2]。
|
||||
|
||||
* 响应对象有自己的一组由换行符分隔的响应头字段。
|
||||
### HTTP/1.1: Internet 标准
|
||||
|
||||
* 响应对象不限于超文本。
|
||||
|
||||
* 每次请求后,服务器和客户端之间的连接都将关闭。
|
||||
|
||||
请求头和响应头都保留为 ASCII 编码,但响应对象本身可以是任何类型:一个 HTML 文件,一个纯文本文件,一个图像或任何其他内容类型。因此,HTTP 的“超文本传输”部分在引入后不久就变成了用词不当。实际上,HTTP 已经迅速发展成为一种超媒体传输,但最初的名称没有改变。
|
||||
|
||||
除了媒体类型协商之外,RFC 还记录了许多其他常用功能:内容编码,字符集支持,多部分类型,授权,缓存,代理行为,日期格式等。
|
||||
|
||||
```
|
||||
今天,几乎所有 Web 上的服务器都可以并且仍将使用 HTTP/1.0。不过,现在你应该更加清楚了!每个请求都需要一个新的 TCP 连接,这会对 HTTP/1.0 造成严重的性能损失。参见[三次握手][1],接着会[慢启动][2]。
|
||||
```
|
||||
|
||||
### §HTTP/1.1: Internet 标准
|
||||
|
||||
将 HTTP 转变为官方 IETF 互联网标准的工作与围绕 HTTP/1.0 的文档工作并行进行,并计划从 1995 年至 1999 年完成。事实上,第一个正式的 HTTP/1.1 标准定义于 RFC 2068,它在 HTTP/1.0 发布大约六个月后,即 1997 年 1 月正式发布。两年半后,即 1999 年 6 月,一些新的改进和更新被纳入标准,并作为 RFC 2616 发布。
|
||||
将 HTTP 转变为官方 IETF 互联网标准的工作与围绕 HTTP/1.0 的文档工作并行进行,并计划从 1995 年至 1999 年完成。事实上,第一个正式的 HTTP/1.1 标准定义于 RFC 2068,它在 HTTP/1.0 发布大约六个月后,即 1997 年 1 月正式发布。两年半后,即 1999 年 6 月,一些新的改进和更新被纳入标准,并作为 RFC 2616 发布。
|
||||
|
||||
HTTP/1.1 标准解决了早期版本中发现的许多协议歧义,并引入了一些关键的性能优化:保持连接,分块编码传输,字节范围请求,附加缓存机制,传输编码和请求管道。
|
||||
|
||||
@ -138,7 +121,7 @@ HTTP/1.1 标准解决了早期版本中发现的许多协议歧义,并引入
|
||||
$> telnet website.org 80
|
||||
Connected to xxx.xxx.xxx.xxx
|
||||
|
||||
GET /index.html HTTP/1.1
|
||||
GET /index.html HTTP/1.1 ❶
|
||||
Host: website.org
|
||||
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip)
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
||||
@ -147,7 +130,7 @@ Accept-Language: en-US,en;q=0.8
|
||||
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
|
||||
Cookie: __qca=P0-800083390... (snip)
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
HTTP/1.1 200 OK ❷
|
||||
Server: nginx/1.0.11
|
||||
Connection: keep-alive
|
||||
Content-Type: text/html; charset=utf-8
|
||||
@ -157,27 +140,27 @@ Expires: Wed, 25 Jul 2012 20:23:35 GMT
|
||||
Cache-Control: max-age=0, no-cache
|
||||
Transfer-Encoding: chunked
|
||||
|
||||
100
|
||||
100 ❸
|
||||
<!doctype html>
|
||||
(snip)
|
||||
|
||||
100
|
||||
(snip)
|
||||
|
||||
0
|
||||
0 ❹
|
||||
|
||||
GET /favicon.ico HTTP/1.1
|
||||
GET /favicon.ico HTTP/1.1 ❺
|
||||
Host: www.website.org
|
||||
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip)
|
||||
Accept: */*
|
||||
Referer: http://website.org/
|
||||
Connection: close
|
||||
Connection: close ❻
|
||||
Accept-Encoding: gzip,deflate,sdch
|
||||
Accept-Language: en-US,en;q=0.8
|
||||
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
|
||||
Cookie: __qca=P0-800083390... (snip)
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
HTTP/1.1 200 OK ❼
|
||||
Server: nginx/1.0.11
|
||||
Content-Type: image/x-icon
|
||||
Content-Length: 3638
|
||||
@ -194,40 +177,29 @@ Etag: W/PSA-GAu26oXbDi
|
||||
(connection closed)
|
||||
```
|
||||
|
||||
1. 请求的 HTML 文件,包括编码,字符集和 cookie 元数据
|
||||
|
||||
2. 原始 HTML 请求的分块响应
|
||||
|
||||
3. 以 ASCII 十六进制数字(256 字节)表示块中的八位元数
|
||||
|
||||
4. 分块流响应结束
|
||||
|
||||
5. 在相同的 TCP 连接上请求一个图标文件
|
||||
|
||||
6. 通知服务器不再重用连接
|
||||
|
||||
7. 图标响应后,然后关闭连接
|
||||
|
||||
- ❶ 请求的 HTML 文件,包括编、字符集和 cookie 元数据
|
||||
- ❷ 原始 HTML 请求的分块响应
|
||||
- ❸ 以 ASCII 十六进制数字(256 字节)表示块中的八位元的数量
|
||||
- ❹ 分块流响应结束
|
||||
- ❺ 在相同的 TCP 连接上请求一个图标文件
|
||||
- ❻ 通知服务器不再重用连接
|
||||
- ❼ 图标响应后,然后关闭连接
|
||||
|
||||
哇,这里发生了很多事情!第一个也是最明显的区别是我们有两个对象请求,一个用于 HTML 页面,另一个用于图像,它们都通过一个连接完成。这就是保持连接的实际应用,它允许我们重用现有的 TCP 连接到同一个主机的多个请求,提供一个更快的最终用户体验。参见[TCP 优化][3]。
|
||||
|
||||
要终止持久连接,注意第二个客户端请求通过 `Connection` 请求头向服务器发送显示的 `close`。类似地,一旦传输响应,服务器就可以通知客户端关闭当前 TCP 连接。从技术上讲,任何一方都可以在没有此类信号的情况下终止 TCP 连接,但客户端和服务器应尽可能提供此类信号,以便双方都启用更好的连接重用策略。
|
||||
|
||||
```
|
||||
HTTP/1.1 改变了 HTTP 协议的语义,默认情况下使用保持连接。这意味着,除非另有说明(通过 `Connection:close` 头),否则服务器应默认保持连接打开。
|
||||
> HTTP/1.1 改变了 HTTP 协议的语义,默认情况下使用保持连接。这意味着,除非另有说明(通过 `Connection:close` 头),否则服务器应默认保持连接打开。
|
||||
|
||||
但是,同样的功能也被反向移植到 HTTP/1.0 上,通过 `Connection:keep-Alive` 头启用。因此,如果你使用 HTTP/1.1,从技术上讲,你不需要 `Connection:keep-Alive` 头,但许多客户端仍然选择提供它。
|
||||
```
|
||||
> 但是,同样的功能也被反向移植到 HTTP/1.0 上,通过 `Connection:keep-Alive` 头启用。因此,如果你使用 HTTP/1.1,从技术上讲,你不需要 `Connection:keep-Alive` 头,但许多客户端仍然选择提供它。
|
||||
|
||||
此外,HTTP/1.1 协议还添加了内容、编码、字符集,甚至语言协商、传输编码、缓存指令、客户端 cookie,以及可以针对每个请求协商的十几个其他功能。
|
||||
|
||||
我们不打算详细讨论每个 HTTP/1.1 特性的语义。这个主题可以写一本专门的书了,已经有了很多很棒的书。相反,前面的示例很好地说明了 HTTP 的快速进展和演变,以及每个客户端-服务器交换的错综复杂的过程,里面发生了很多事情!
|
||||
|
||||
```
|
||||
要了解 HTTP 协议所有内部工作原理,参考 David Gourley 和 Brian Totty 共同撰写的权威指南: The Definitive Guide。(to 校正:这里翻译的不准确)
|
||||
```
|
||||
> 要了解 HTTP 协议所有内部工作原理,参考 David Gourley 和 Brian Totty 共同撰写的权威指南: The Definitive Guide。
|
||||
|
||||
### §HTTP/2: 提高传输性能
|
||||
### HTTP/2: 提高传输性能
|
||||
|
||||
RFC 2616 自发布以来,已经成为互联网空前增长的基础:数十亿各种形状和大小的设备,从台式电脑到我们口袋里的小型网络设备,每天都在使用 HTTP 来传送新闻,视频,在我们生活中的数百万的其他网络应用程序都在依靠它。
|
||||
|
||||
@ -239,7 +211,7 @@ RFC 2616 自发布以来,已经成为互联网空前增长的基础:数十
|
||||
>
|
||||
> RFC 2616: HTTP/1.1, June 1999
|
||||
|
||||
HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上,现在使用 HTTP 作为主要控制和数据协议的嵌入式设备(传感器,执行器和咖啡壶)并不罕见。但在其自身成功的重压下,随着我们越来越多地继续将日常互动转移到网络-社交、电子邮件、新闻和视频,以及越来越多的个人和工作空间,它也开始显示出压力的迹象。用户和 Web 开发人员现在都要求 HTTP/1.1 提供近乎实时的响应能力和协议
|
||||
HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上,现在使用 HTTP 作为主要控制和数据协议的嵌入式设备(传感器,执行器和咖啡壶)并不罕见。但在其自身成功的重压下,随着我们越来越多地继续将日常互动转移到网络 —— 社交、电子邮件、新闻和视频,以及越来越多的个人和工作空间,它也开始显示出压力的迹象。用户和 Web 开发人员现在都要求 HTTP/1.1 提供近乎实时的响应能力和协议
|
||||
性能,如果不进行一些修改,就无法满足这些要求。
|
||||
|
||||
为了应对这些新挑战,HTTP 必须继续发展,因此 HTTPbis 工作组在 2012 年初宣布了一项针对 HTTP/2 的新计划:
|
||||
@ -252,7 +224,7 @@ HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上
|
||||
|
||||
HTTP/2 的主要重点是提高传输性能并支持更低的延迟和更高的吞吐量。主要的版本增量听起来像是一个很大的步骤,但就性能而言,它将是一个重大的步骤,但重要的是要注意,没有任何高级协议语义收到影响:所有的 HTTP 头,值和用例是相同的。
|
||||
|
||||
任何现有的网站或应用程序都可以并且将通过 HTTP/2 传送而无需修改。你无需修改应用程序标记来利用 HTTP/2。HTTP 服务器必须使用 HTTP/2,但这对大多数用户来说应该是透明的升级。如果工作组实现目标,唯一的区别应该是我们的应用程序以更低的延迟和更好的网络连接利用率来传送数据。
|
||||
任何现有的网站或应用程序都可以并且将通过 HTTP/2 传送而无需修改。你无需修改应用程序标记来利用 HTTP/2。HTTP 服务器将来一定会使用 HTTP/2,但这对大多数用户来说应该是透明的升级。如果工作组实现目标,唯一的区别应该是我们的应用程序以更低的延迟和更好的网络连接利用率来传送数据。
|
||||
|
||||
话虽如此,但我们不要走的太远了。在讨论新的 HTTP/2 协议功能之前,有必要回顾一下我们现有的 HTTP/1.1 部署和性能最佳实践。HTTP/2 工作组正在新规范上取得快速的进展,但即使最终标准已经完成并准备就绪,在可预见的未来,我们仍然必须支持旧的 HTTP/1.1 客户端,实际上,这得十年或更长时间。
|
||||
|
||||
@ -263,7 +235,7 @@ via: https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol
|
||||
作者:[Ilya Grigorik][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
104
sources/talk/20190313 Why is no one signing their emails.md
Normal file
104
sources/talk/20190313 Why is no one signing their emails.md
Normal file
@ -0,0 +1,104 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why is no one signing their emails?)
|
||||
[#]: via: (https://arp242.net/weblog/signing-emails.html)
|
||||
[#]: author: (Martin Tournoij https://arp242.net/)
|
||||
|
||||
Why is no one signing their emails?
|
||||
======
|
||||
|
||||
|
||||
I received this email a while ago:
|
||||
|
||||
> Queensland University of Technology sent you an Amazon.com Gift Card!
|
||||
>
|
||||
> You’ve received an Amazon.com gift card! You’ll need the claim code below to place your order.
|
||||
>
|
||||
> Happy shopping!
|
||||
|
||||
Queensland University of Technology? Why would they send me anything? Where is that even? Australia right? That’s the other side of the world! Looks like spam!
|
||||
|
||||
It did look pretty good for spam, so I took a second look. And a very close third look, and then I decided it wasn’t spam.
|
||||
|
||||
I was still confused why they sent me this. A week later I remembered: half a year prior I had done an interview regarding my participation on Stack Overflow for someone’s paper; she was studying somewhere in Australia – presumably the university of Queensland. No one had ever mentioned anything about a reward or Amazon gift card so I wasn’t expecting it. It’s a nice bonus though.
|
||||
|
||||
Here’s the thing: I’ve spent several years professionally developing email systems; I administered email servers; I read all the relevant RFCs. While there are certainly people who are more knowledgable, I know more about email than the vast majority of the population. And I still had to take a careful look to verify the email wasn’t a phishing attempt.
|
||||
|
||||
And I’m not even a target; I’m just this guy, you know? [Ask John Podesta what it is to be targeted][1]:
|
||||
|
||||
> SecureWorks concluded Fancy Bear had sent Podesta an email on March 19, 2016, that had the appearance of a Google security alert, but actually contained a misleading link—a strategy known as spear-phishing. [..] The email was initially sent to the IT department as it was suspected of being a fake but was described as “legitimate” in an e-mail sent by a department employee, who later said he meant to write “illegitimate”.
|
||||
|
||||
Yikes! If I was even remotely high-profile I’d be crazy paranoid about all emails I get.
|
||||
|
||||
It seems to me that there is a fairly easy solution to verify the author of an email: sign it with a digital signature; PGP is probably the best existing solution right now. I don’t even care about encryption here, just signing to prevent phishing.
|
||||
|
||||
PGP has a well-deserved reputation for being hard, but that’s only for certain scenarios. A lot of the problems/difficulties stem from trying to accommodate the “random person A emails random person B” use case, but this isn’t really what I care about here. “Large company with millions of users sends thousands of emails daily” is a very different use case.
|
||||
|
||||
Much of the key exchange/web-of-trust dilemma can be bypassed by shipping email clients with keys for large organisations (PayPal, Google, etc.) baked in, like browsers do with some certificates. Even just publishing your key on your website (or, if you’re a bank, in local branches etc.) is already a lot better than not signing anything at all. Right now there seems to be a catch-22 scenario: clients don’t implement better support as very few people are using PGP, while very few companies bother signing their emails with PGP because so few people can benefit from it.
|
||||
|
||||
On the end-user side, things are also not very hard; we’re just conceded with validating signatures, nothing more. For this purpose PGP isn’t hard. It’s like verifying your Linux distro’s package system: all of them sign their packages (usually with PGP) and they get verified on installation, but as an end-user I never see it unless something goes wrong.
|
||||
|
||||
There are many aspects of PGP that are hard to set up and manage, but verifying signatures isn’t one of them. The user-visible part of this is very limited. Remember, no one is expected to sign their own emails: just verify that the signature is correct (which the software will do). Conceptually, it’s not that different from verifying a handwritten signature.
|
||||
|
||||
DKIM and SPF already exist and are useful, but limited. All both do is verify that an email which claims to be from `amazon.com` is really from `amazon.com`. If I send an email from `mail.amazon-account-security.com` or `amazonn.com` then it just verifies that it was sent from that domain, not that it was sent from the organisation Amazon.
|
||||
|
||||
What I am proposing is subtly different. In my (utopian) future every serious organisation will sign their email with PGP (just like every serious organisation uses https). Then every time I get an email which claims to be from Amazon I can see it’s either not signed, or not signed by a key I know. If adoption is broad enough we can start showing warnings such as “this email wasn’t signed, do you want to trust it?” and “this signature isn’t recognized, yikes!”
|
||||
|
||||
There’s also S/MIME, which has better client support and which works more or less the same as HTTPS: you get a certificate from the Certificate Authority Mafia, sign your email with it, and presto. The downside of this is that anyone can sign their emails with a valid key, which isn’t necessarily telling you much (just because haxx0r.ru has a certificate doesn’t mean it’s trustworthy).
|
||||
|
||||
Is it perfect? No. I understand stuff like key exchange is hard and that baking in keys isn’t perfect. Is it better? Hell yes. Would probably have avoided Podesta and the entire Democratic Party a lot of trouble. Here’s a “[sophisticated new phishing campaign][2]” targeted at PayPal users. How “sophisticated”? Well, by not having glaring stupid spelling errors, duplicating the PayPal layout in emails, duplicating the PayPal login screen, a few forms, and getting an SSL certificate. Truly, the pinnacle of Computer Science.
|
||||
|
||||
Okay sure, they spent some effort on it; but any nincompoop can do it; if this passes for “sophisticated phishing” where “it’s easy to see how users could be fooled” then the bar is pretty low.
|
||||
|
||||
I can’t recall receiving a single email from any organisation that is signed (much less encrypted). Banks, financial services, utilities, immigration services, governments, tax services, voting registration, Facebook, Twitter, a zillion websites … all happily sent me emails hoping I wouldn’t consider them spam and hoping I wouldn’t confuse a phishing email for one of theirs.
|
||||
|
||||
Interesting experiment: send invoices for, say, a utility bill for a local provider. Just copy the layout from the last utility bill you received. I’ll bet you’ll make more money than freelancing on UpWork if you do it right.
|
||||
|
||||
I’ve been intending to write this post for years, but never quite did because “surely not everyone is stupid?” I’m not a crypto expert, so perhaps I’m missing something here, but I wouldn’t know what. Let me know if I am.
|
||||
|
||||
In the meanwhile PayPal is attempting to solve the problem by publishing [articles which advise you to check for spelling errors][3]. Okay, it’s good advice, but do we really want this to be the barrier between an attacker and your money? Or Russian hacking groups and your emails? Anyone can sign any email with any key, but “unknown signature” warnings strike me as a lot better UX than “carefully look for spelling errors or misleading domain names”.
|
||||
|
||||
The way forward is to make it straight-forward to implement signing in apps and then just do it as a developer, whether asked or not; just as you set up https whether you’re asked or not. I’ll write a follow-up with more technical details later, assuming no one pokes holes in this article :-)
|
||||
|
||||
#### Response to some feedback
|
||||
|
||||
Some response to some feedback that I couldn’t be bothered to integrate in the article’s prose:
|
||||
|
||||
* “You can’t trust webmail with crypto!”
|
||||
If you use webmail then you’re already trusting the email provider with everything. What’s so bad with trusting them to verify a signature, too?
|
||||
|
||||
We’re not communicating state secrets over encrypted email here; we’re just verifying the signature on “PayPal sent you a message, click here to view it”-kind of emails.
|
||||
|
||||
* “Isn’t this ignoring the massive problem that is key management?”
|
||||
Yes, it’s hard problem; but that doesn’t mean it can’t be done. I already mentioned some possible solutions in the article.
|
||||
|
||||
|
||||
|
||||
|
||||
**Footnotes**
|
||||
|
||||
1. We could make something better; PGP contians a lot of cruft. But for now PGP is “good enough”.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://arp242.net/weblog/signing-emails.html
|
||||
|
||||
作者:[Martin Tournoij][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://arp242.net/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://en.wikipedia.org/wiki/Podesta_emails#Data_theft
|
||||
[2]: https://www.eset.com/us/about/newsroom/corporate-blog/paypal-users-targeted-in-sophisticated-new-phishing-campaign/
|
||||
[3]: https://www.paypal.com/cs/smarthelp/article/how-to-spot-fake,-spoof,-or-phishing-emails-faq2340
|
@ -0,0 +1,252 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (lujun9972)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Advanced Techniques for Reducing Emacs Startup Time)
|
||||
[#]: via: (https://blog.d46.us/advanced-emacs-startup/)
|
||||
[#]: author: (Joe Schafer https://blog.d46.us/)
|
||||
|
||||
Advanced Techniques for Reducing Emacs Startup Time
|
||||
======
|
||||
|
||||
Six techniques to reduce Emacs startup time by the author of the [Emacs Start Up Profiler][1].
|
||||
|
||||
tl;dr: Do these steps:
|
||||
|
||||
1. Profile with Esup.
|
||||
2. Adjust the garbage collection threshold.
|
||||
3. Autoload **everything** with use-package.
|
||||
4. Avoid helper functions which cause eager loads.
|
||||
5. See my Emacs [config][2] for an example.
|
||||
|
||||
|
||||
|
||||
### From .emacs.d Bankruptcy to Now
|
||||
|
||||
I recently declared my third .emacs.d bankruptcy and finished the fourth iteration of my Emacs configuration. The evolution was:
|
||||
|
||||
1. Copy and paste elisp snippets into `~/.emacs` and hope it works.
|
||||
2. Adopt a more structured approach with `el-get` to manage dependencies.
|
||||
3. Give up and outsource to Spacemacs.
|
||||
4. Get tired of Spacemacs intricacies and rewrite with `use-package`.
|
||||
|
||||
|
||||
|
||||
This article is a collection of tips collected during the 3 rewrites and from creating the Emacs Start Up Profiler. Many thanks to the teams behind Spacemacs, use-package and general. Without these dedicated voluteers, this task would be vastly more difficult.
|
||||
|
||||
### But What About Daemon Mode
|
||||
|
||||
Before we get started, let me acknowledge the common retort when optimizing Emacs: “Emacs is meant to run as a daemon so you’ll only start it once.” That’s all well and good except:
|
||||
|
||||
* Fast things feel nicer.
|
||||
* When customizing Emacs, you sometimes get into weird states that can be hard to recover from without restarting. For example, if you add a slow `lambda` function to your `post-command-hook`, it’s tough to remove it.
|
||||
* Restarting Emacs helps verify that customization will persist between sessions.
|
||||
|
||||
|
||||
|
||||
### 1\. Establish the Current and Best Possible Start Up Time
|
||||
|
||||
The first step is to measure the current start up time. The easy way is to display the information at startup which will show progress through the next steps.
|
||||
|
||||
```
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(message "Emacs ready in %s with %d garbage collections."
|
||||
(format "%.2f seconds"
|
||||
(float-time
|
||||
(time-subtract after-init-time before-init-time)))
|
||||
gcs-done)))
|
||||
```
|
||||
|
||||
Second, measure the best possible startup speed so you know what’s possible. Mine is 0.3 seconds.
|
||||
|
||||
```
|
||||
emacs -q --eval='(message "%s" (emacs-init-time))'
|
||||
|
||||
;; For macOS users:
|
||||
open -n /Applications/Emacs.app --args -q --eval='(message "%s" (emacs-init-time))'
|
||||
```
|
||||
|
||||
### 2\. Profile Emacs Startup for Easy Wins
|
||||
|
||||
The [Emacs StartUp Profiler][1] (ESUP) will give you detailed metrics for top-level expressions.
|
||||
|
||||
![esup.png][3]
|
||||
|
||||
Figure 1:
|
||||
|
||||
Emacs Start Up Profiler Screenshot
|
||||
|
||||
WARNING: Spacemacs users, ESUP currently chokes on the Spacemacs init.el file. Follow <https://github.com/jschaf/esup/issues/48> for updates.
|
||||
|
||||
### 3\. Set the Garbage Collection Threshold Higher during Startup
|
||||
|
||||
This saves about ****0.3 seconds**** on my configuration.
|
||||
|
||||
The default value for Emacs is 760kB which is extremely conservative on a modern machine. The real trick is to lower it back to something reasonable after initialization. This saves about 0.3 seconds on my init files.
|
||||
|
||||
```
|
||||
;; Make startup faster by reducing the frequency of garbage
|
||||
;; collection. The default is 800 kilobytes. Measured in bytes.
|
||||
(setq gc-cons-threshold (* 50 1000 1000))
|
||||
|
||||
;; The rest of the init file.
|
||||
|
||||
;; Make gc pauses faster by decreasing the threshold.
|
||||
(setq gc-cons-threshold (* 2 1000 1000))
|
||||
```
|
||||
|
||||
### 4\. Never require anything; autoload with use-package instead
|
||||
|
||||
The best way to make Emacs faster is to do less. Running `require` eagerly loads the underlying source file. It’s rare the you’ll need functionality immediately at startup time.
|
||||
|
||||
With [`use-package`][4], you declare which features you need from a package and `use-package` does the right thing. Here’s what it looks like:
|
||||
|
||||
```
|
||||
(use-package evil-lisp-state ; the Melpa package name
|
||||
|
||||
:defer t ; autoload this package
|
||||
|
||||
:init ; Code to run immediately.
|
||||
(setq evil-lisp-state-global nil)
|
||||
|
||||
:config ; Code to run after the package is loaded.
|
||||
(abn/define-leader-keys "k" evil-lisp-state-map))
|
||||
```
|
||||
|
||||
To see what packages Emacs currently has loaded, examine the `features` variable. For nice output see [lpkg explorer][5] or my variant in [abn-funcs-benchmark.el][6]. The output looks like:
|
||||
|
||||
```
|
||||
479 features currently loaded
|
||||
- abn-funcs-benchmark: /Users/jschaf/.dotfiles/emacs/funcs/abn-funcs-benchmark.el
|
||||
- evil-surround: /Users/jschaf/.emacs.d/elpa/evil-surround-20170910.1952/evil-surround.elc
|
||||
- misearch: /Applications/Emacs.app/Contents/Resources/lisp/misearch.elc
|
||||
- multi-isearch: nil
|
||||
- <many more>
|
||||
```
|
||||
|
||||
### 5\. Avoid Helper Functions to Set Up Modes
|
||||
|
||||
Often, Emacs packages will suggest running a helper function to set up keybindings. Here’s a few examples:
|
||||
|
||||
* `(evil-escape-mode)`
|
||||
* `(windmove-default-keybindings) ; Sets up keybindings.`
|
||||
* `(yas-global-mode 1) ; Complex snippet setup.`
|
||||
|
||||
|
||||
|
||||
Rewrite these with use-package to improve startup speed. These helper functions are really just sneaky ways to trick you into eagerly loading packages before you need them.
|
||||
|
||||
As an example, here’s how to autoload `evil-escape-mode`.
|
||||
|
||||
```
|
||||
;; The definition of evil-escape-mode.
|
||||
(define-minor-mode evil-escape-mode
|
||||
(if evil-escape-mode
|
||||
(add-hook 'pre-command-hook 'evil-escape-pre-command-hook)
|
||||
(remove-hook 'pre-command-hook 'evil-escape-pre-command-hook)))
|
||||
|
||||
;; Before:
|
||||
(evil-escape-mode)
|
||||
|
||||
;; After:
|
||||
(use-package evil-escape
|
||||
:defer t
|
||||
;; Only needed for functions without an autoload comment (;;;###autoload).
|
||||
:commands (evil-escape-pre-command-hook)
|
||||
|
||||
;; Adding to a hook won't load the function until we invoke it.
|
||||
;; With pre-command-hook, that means the first command we run will
|
||||
;; load evil-escape.
|
||||
:init (add-hook 'pre-command-hook 'evil-escape-pre-command-hook))
|
||||
```
|
||||
|
||||
For a much trickier example, consider `org-babel`. The common recipe is:
|
||||
|
||||
```
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((shell . t)
|
||||
(emacs-lisp . nil)))
|
||||
```
|
||||
|
||||
This is bad because `org-babel-do-load-languages` is defined in `org.el`, which is over 24k lines of code and takes about 0.2 seconds to load. After examining the source code, `org-babel-do-load-languages` is simply requiring the `ob-<lang>` package like so:
|
||||
|
||||
```
|
||||
;; From org.el in the org-babel-do-load-languages function.
|
||||
(require (intern (concat "ob-" lang)))
|
||||
```
|
||||
|
||||
In the `ob-<lang>.el`, there’s only two methods we care about, `org-babel-execute:<lang>` and `org-babel-expand-body:<lang>`. We can autoload the org-babel functionality instead of `org-babel-do-load-languages` like so:
|
||||
|
||||
```
|
||||
;; Avoid `org-babel-do-load-languages' since it does an eager require.
|
||||
(use-package ob-python
|
||||
:defer t
|
||||
:ensure org-plus-contrib
|
||||
:commands (org-babel-execute:python))
|
||||
|
||||
(use-package ob-shell
|
||||
:defer t
|
||||
:ensure org-plus-contrib
|
||||
:commands
|
||||
(org-babel-execute:sh
|
||||
org-babel-expand-body:sh
|
||||
|
||||
org-babel-execute:bash
|
||||
org-babel-expand-body:bash))
|
||||
```
|
||||
|
||||
### 6\. Defer Packages you don’t need Immediately with Idle Timers
|
||||
|
||||
This saves about ****0.4 seconds**** for the 9 packages I defer.
|
||||
|
||||
Some packages are useful and you want them available soon, but are not essential for immediate editing. These modes include:
|
||||
|
||||
* `recentf`: Saves recent files.
|
||||
* `saveplace`: Saves point of visited files.
|
||||
* `server`: Starts Emacs daemon.
|
||||
* `autorevert`: Automatically reloads files that changed on disk.
|
||||
* `paren`: Highlight matching parenthesis.
|
||||
* `projectile`: Project management tools.
|
||||
* `whitespace`: Highlight trailing whitespace.
|
||||
|
||||
|
||||
|
||||
Instead of requiring these modes, ****load them after N seconds of idle time****. I use 1 second for the more important packages and 2 seconds for everything else.
|
||||
|
||||
```
|
||||
(use-package recentf
|
||||
;; Loads after 1 second of idle time.
|
||||
:defer 1)
|
||||
|
||||
(use-package uniquify
|
||||
;; Less important than recentf.
|
||||
:defer 2)
|
||||
```
|
||||
|
||||
### Optimizations that aren’t Worth It
|
||||
|
||||
Don’t bother byte-compiling your personal Emacs files. It saved about 0.05 seconds. Byte compiling causes difficult to debug errors when the source file gets out of sync with compiled file.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://blog.d46.us/advanced-emacs-startup/
|
||||
|
||||
作者:[Joe Schafer][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://blog.d46.us/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://github.com/jschaf/esup
|
||||
[2]: https://github.com/jschaf/dotfiles/blob/master/emacs/start.el
|
||||
[3]: https://blog.d46.us/images/esup.png
|
||||
[4]: https://github.com/jwiegley/use-package
|
||||
[5]: https://gist.github.com/RockyRoad29/bd4ca6fdb41196a71662986f809e2b1c
|
||||
[6]: https://github.com/jschaf/dotfiles/blob/master/emacs/funcs/abn-funcs-benchmark.el
|
@ -0,0 +1,77 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (lujun9972)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Asynchronous rsync with Emacs, dired and tramp.)
|
||||
[#]: via: (https://vxlabs.com/2018/03/30/asynchronous-rsync-with-emacs-dired-and-tramp/)
|
||||
[#]: author: (cpbotha https://vxlabs.com/author/cpbotha/)
|
||||
|
||||
Asynchronous rsync with Emacs, dired and tramp.
|
||||
======
|
||||
|
||||
[tmtxt-dired-async][1] by [Trần Xuân Trường][2] is an unfortunately lesser known Emacs package which extends dired, the Emacs file manager, to be able to run rsync and other commands (zip, unzip, downloading) asynchronously.
|
||||
|
||||
This means you can copy gigabytes of directories around whilst still happily continuing with all of your other tasks in the Emacs operating system.
|
||||
|
||||
It has a feature where you can add any number of files from different locations into a wait list with `C-c C-a`, and then asynchronously rsync the whole wait list into a final destination directory with `C-c C-v`. This alone is worth the price of admission.
|
||||
|
||||
For example here it is pointlessly rsyncing the arduino 1.9 beta archive to another directory:
|
||||
|
||||
[![][3]][4]
|
||||
|
||||
When the process is complete, the window at the bottom will automatically be killed after 5 seconds. Here is a separate session right after the asynchronous unzipping of the above-mentioned arduino archive:
|
||||
|
||||
[![][5]][6]
|
||||
|
||||
This package has further increased the utility of my dired configuration.
|
||||
|
||||
I just contributed [a pull request that enables tmtxt-dired-async to rsync to remote tramp-based directories][7], and I immediately used this new functionality to sort a few gigabytes of new photos onto the Linux server.
|
||||
|
||||
To add tmtxt-dired-async to your config, download [tmtxt-async-tasks.el][8] (a required library) and [tmtxt-dired-async.el][9] (check that my PR is in there if you plan to use this with tramp) into your `~/.emacs.d/` and add the following to your config:
|
||||
|
||||
```
|
||||
;; no MELPA packages of this, so we have to do a simple check here
|
||||
(setq dired-async-el (expand-file-name "~/.emacs.d/tmtxt-dired-async.el"))
|
||||
(when (file-exists-p dired-async-el)
|
||||
(load (expand-file-name "~/.emacs.d/tmtxt-async-tasks.el"))
|
||||
(load dired-async-el)
|
||||
(define-key dired-mode-map (kbd "C-c C-r") 'tda/rsync)
|
||||
(define-key dired-mode-map (kbd "C-c C-z") 'tda/zip)
|
||||
(define-key dired-mode-map (kbd "C-c C-u") 'tda/unzip)
|
||||
|
||||
(define-key dired-mode-map (kbd "C-c C-a") 'tda/rsync-multiple-mark-file)
|
||||
(define-key dired-mode-map (kbd "C-c C-e") 'tda/rsync-multiple-empty-list)
|
||||
(define-key dired-mode-map (kbd "C-c C-d") 'tda/rsync-multiple-remove-item)
|
||||
(define-key dired-mode-map (kbd "C-c C-v") 'tda/rsync-multiple)
|
||||
|
||||
(define-key dired-mode-map (kbd "C-c C-s") 'tda/get-files-size)
|
||||
|
||||
(define-key dired-mode-map (kbd "C-c C-q") 'tda/download-to-current-dir))
|
||||
```
|
||||
|
||||
Enjoy!
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://vxlabs.com/2018/03/30/asynchronous-rsync-with-emacs-dired-and-tramp/
|
||||
|
||||
作者:[cpbotha][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[lujun9972](https://github.com/lujun9972)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://vxlabs.com/author/cpbotha/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://truongtx.me/tmtxt-dired-async.html
|
||||
[2]: https://truongtx.me/about.html
|
||||
[3]: https://i0.wp.com/vxlabs.com/wp-content/uploads/2018/03/rsync-arduino-zip.png?resize=660%2C340&ssl=1
|
||||
[4]: https://i0.wp.com/vxlabs.com/wp-content/uploads/2018/03/rsync-arduino-zip.png?ssl=1
|
||||
[5]: https://i1.wp.com/vxlabs.com/wp-content/uploads/2018/03/progress-window-5s.png?resize=660%2C310&ssl=1
|
||||
[6]: https://i1.wp.com/vxlabs.com/wp-content/uploads/2018/03/progress-window-5s.png?ssl=1
|
||||
[7]: https://github.com/tmtxt/tmtxt-dired-async/pull/6
|
||||
[8]: https://github.com/tmtxt/tmtxt-async-tasks
|
||||
[9]: https://github.com/tmtxt/tmtxt-dired-async
|
202
sources/tech/20180826 Be productive with Org-mode.md
Normal file
202
sources/tech/20180826 Be productive with Org-mode.md
Normal file
@ -0,0 +1,202 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (lujun9972)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Be productive with Org-mode)
|
||||
[#]: via: (https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/)
|
||||
[#]: author: (Ayrat Badykov https://www.badykov.com)
|
||||
|
||||
Be productive with Org-mode
|
||||
======
|
||||
|
||||
|
||||
![org-mode-collage][1]
|
||||
|
||||
### Introduction
|
||||
|
||||
In my [previous post about emacs][2] I mentioned [Org-mode][3], a note manager and organizer. In this post, I’ll describe my day-to-day Org-mode use cases.
|
||||
|
||||
### Notes and to-do lists
|
||||
|
||||
First and foremost, Org-mode is a tool for managing notes and to-do lists and all work in Org-mode is centered around writing notes in plain text files. I manage several kinds of notes using Org-mode.
|
||||
|
||||
#### General notes
|
||||
|
||||
The most basic Org-mode use case is writing simple notes about things that you want to remember. For example, here are my notes about things I’m learning right now:
|
||||
|
||||
```
|
||||
* Learn
|
||||
** Emacs LISP
|
||||
*** Plan
|
||||
|
||||
- [ ] Read best practices
|
||||
- [ ] Finish reading Emacs Manual
|
||||
- [ ] Finish Exercism Exercises
|
||||
- [ ] Write a couple of simple plugins
|
||||
- Notification plugin
|
||||
|
||||
*** Resources
|
||||
|
||||
https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html
|
||||
http://exercism.io/languages/elisp/about
|
||||
[[http://batsov.com/articles/2011/11/30/the-ultimate-collection-of-emacs-resources/][The Ultimate Collection of Emacs Resources]]
|
||||
|
||||
** Rust gamedev
|
||||
*** Study [[https://github.com/SergiusIW/gate][gate]] 2d game engine with web assembly support
|
||||
*** [[ggez][https://github.com/ggez/ggez]]
|
||||
*** [[https://www.amethyst.rs/blog/release-0-8/][Amethyst 0.8 Relesed]]
|
||||
|
||||
** Upgrade Elixir/Erlang Skills
|
||||
*** Read Erlang in Anger
|
||||
```
|
||||
|
||||
How it looks using [org-bullets][4]:
|
||||
|
||||
![notes][5]
|
||||
|
||||
In this simple example you can see some of the Org-mode features:
|
||||
|
||||
* nested notes
|
||||
* links
|
||||
* lists with checkboxes
|
||||
|
||||
|
||||
|
||||
#### Project todos
|
||||
|
||||
Often when I’m working on some task I notice things that I can improve or fix. Instead of leaving TODO comment in source code files (bad smell) I use [org-projectile][6] which allows me to write TODO items with a single shortcut in a separate file. Here’s an example of this file:
|
||||
|
||||
```
|
||||
* [[elisp:(org-projectile-open-project%20"mana")][mana]] [3/9]
|
||||
:PROPERTIES:
|
||||
:CATEGORY: mana
|
||||
:END:
|
||||
** DONE [[file:~/Development/mana/apps/blockchain/lib/blockchain/contract/create_contract.ex::insufficient_gas_before_homestead%20=][fix this check using evm.configuration]]
|
||||
CLOSED: [2018-08-08 Ср 09:14]
|
||||
[[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md][eip2]]:
|
||||
If contract creation does not have enough gas to pay for the final gas fee for
|
||||
adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas)
|
||||
rather than leaving an empty contract.
|
||||
** DONE Upgrade Elixir to 1.7.
|
||||
CLOSED: [2018-08-08 Ср 09:14]
|
||||
** TODO [#A] Difficulty tests
|
||||
** TODO [#C] Upgrage to OTP 21
|
||||
** DONE [#A] EIP150
|
||||
CLOSED: [2018-08-14 Вт 21:25]
|
||||
*** DONE operation cost changes
|
||||
CLOSED: [2018-08-08 Ср 20:31]
|
||||
*** DONE 1/64th for a call and create
|
||||
CLOSED: [2018-08-14 Вт 21:25]
|
||||
** TODO [#C] Refactor interfaces
|
||||
** TODO [#B] Caching for storage during execution
|
||||
** TODO [#B] Removing old merkle trees
|
||||
** TODO do not calculate cost twice
|
||||
* [[elisp:(org-projectile-open-project%20".emacs.d")][.emacs.d]] [1/3]
|
||||
:PROPERTIES:
|
||||
:CATEGORY: .emacs.d
|
||||
:END:
|
||||
** TODO fix flycheck issues (emacs config)
|
||||
** TODO use-package for fetching dependencies
|
||||
** DONE clean configuration
|
||||
CLOSED: [2018-08-26 Вс 11:48]
|
||||
```
|
||||
|
||||
How it looks in Emacs:
|
||||
|
||||
![project-todos][7]
|
||||
|
||||
In this example you can see more Org mode features:
|
||||
|
||||
* todo items have states - `TODO`, `DONE`. You can define your own states (`WAITING` etc)
|
||||
* closed items have `CLOSED` timestamp
|
||||
* some items have priorities - A, B, C.
|
||||
* links can be internal (`[[file:~/...]`)
|
||||
|
||||
|
||||
|
||||
#### Capture templates
|
||||
|
||||
As described in Org-mode’s documentation, capture lets you quickly store notes with little interruption of your workflow.
|
||||
|
||||
I configured several capture templates which help me to quickly create notes about things that I want to remember.
|
||||
|
||||
```
|
||||
(setq org-capture-templates
|
||||
'(("t" "Todo" entry (file+headline "~/Dropbox/org/todo.org" "Todo soon")
|
||||
"* TODO %? \n %^t")
|
||||
("i" "Idea" entry (file+headline "~/Dropbox/org/ideas.org" "Ideas")
|
||||
"* %? \n %U")
|
||||
("e" "Tweak" entry (file+headline "~/Dropbox/org/tweaks.org" "Tweaks")
|
||||
"* %? \n %U")
|
||||
("l" "Learn" entry (file+headline "~/Dropbox/org/learn.org" "Learn")
|
||||
"* %? \n")
|
||||
("w" "Work note" entry (file+headline "~/Dropbox/org/work.org" "Work")
|
||||
"* %? \n")
|
||||
("m" "Check movie" entry (file+headline "~/Dropbox/org/check.org" "Movies")
|
||||
"* %? %^g")
|
||||
("n" "Check book" entry (file+headline "~/Dropbox/org/check.org" "Books")
|
||||
"* %^{book name} by %^{author} %^g")))
|
||||
```
|
||||
|
||||
For a book note I should add its name and its author, for a movie note I should add tags etc.
|
||||
|
||||
### Planning
|
||||
|
||||
Another great feature of Org-mode is that you can use it as a day planner. Let’s see an example of one of my days:
|
||||
|
||||
![schedule][8]
|
||||
|
||||
I didn’t give a lot of thought to this example, it’s my real file for today. It doesn’t look like much but it helps to spend your time on things that important to you and fight with procrastination.
|
||||
|
||||
#### Habits
|
||||
|
||||
From Org mode’s documentation, Org has the ability to track the consistency of a special category of TODOs, called “habits”. I use this feature along with day planning when I want to create new habits:
|
||||
|
||||
![habits][9]
|
||||
|
||||
As you can see currently I’m trying to wake early every day and workout once in two days. Also, it helped to start reading books every day.
|
||||
|
||||
#### Agenda views
|
||||
|
||||
Last but not least I use agenda views. Todo items can be scattered throughout different files (in my case daily plan and habits are in separate files), agenda views give an overview of all todo items:
|
||||
|
||||
![agenda][10]
|
||||
|
||||
### More Org mode features
|
||||
|
||||
|
||||
+ Smartphone apps (Android, ios)
|
||||
|
||||
+ Exporting Org mode files into different formats (html, markdown, pdf, latex etc)
|
||||
|
||||
+ Tracking Finances with ledger
|
||||
|
||||
### Conclusion
|
||||
|
||||
In this post, I described a small subset of Org-mode’s extensive functionality that helps me be productive every day, spending time on things that important to me.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/
|
||||
|
||||
作者:[Ayrat Badykov][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[lujun9972](https://github.com/lujun9972)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.badykov.com
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i.imgur.com/hgqCyen.jpg
|
||||
[2]: http://www.badykov.com/emacs/2018/07/31/why-emacs-is-a-great-editor/
|
||||
[3]: https://orgmode.org/
|
||||
[4]: https://github.com/sabof/org-bullets
|
||||
[5]: https://i.imgur.com/lGi60Uw.png
|
||||
[6]: https://github.com/IvanMalison/org-projectile
|
||||
[7]: https://i.imgur.com/Hbu8ilX.png
|
||||
[8]: https://i.imgur.com/z5HpuB0.png
|
||||
[9]: https://i.imgur.com/YJIp3d0.png
|
||||
[10]: https://i.imgur.com/CKX9BL9.png
|
@ -1,176 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Emoji-Log: A new way to write Git commit messages)
|
||||
[#]: via: (https://opensource.com/article/19/2/emoji-log-git-commit-messages)
|
||||
[#]: author: (Ahmad Awais https://opensource.com/users/mrahmadawais)
|
||||
|
||||
Emoji-Log: A new way to write Git commit messages
|
||||
======
|
||||
Add context to your commits with Emoji-Log.
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji_tech_keyboard.jpg?itok=ncBNKZFl)
|
||||
|
||||
I'm a full-time open source developer—or, as I like to call it, an 🎩 open sourcerer. I've been working with open source software for over a decade and [built hundreds][1] of open source software applications.
|
||||
|
||||
I also am a big fan of the Don't Repeat Yourself (DRY) philosophy and believe writing better Git commit messages—ones that are contextual enough to serve as a changelog for your open source software—is an important component of DRY. One of the many workflows I've written is [Emoji-Log][2], a straightforward, open source Git commit log standard. It improves the developer experience (DX) by using emoji to create better Git commit messages.
|
||||
|
||||
I've used Emoji-Log while building the [VSCode Tips & Tricks repo][3], my 🦄 [Shades of Purple VSCode theme repo][4], and even an [automatic changelog][5] that looks beautiful.
|
||||
|
||||
### Emoji-Log's philosophy
|
||||
|
||||
I like emoji (which is, in fact, the plural of emoji). I like 'em a lot. Programming, code, geeks/nerds, open source… all of that is inherently dull and sometimes boring. Emoji help me add colors and emotions to the mix. There's nothing wrong with wanting to attach feelings to the 2D, flat, text-based world of code.
|
||||
|
||||
Instead of memorizing [hundreds of emoji][6], I've learned it's better to keep the categories small and general. Here's the philosophy that guides writing commit messages with Emoji-Log:
|
||||
|
||||
1. **Imperative**
|
||||
* Make your Git commit messages imperative.
|
||||
* Write commit message like you're giving an order.
|
||||
* e.g., Use ✅ **Add** instead of ❌ **Added**
|
||||
* e.g., Use ✅ **Create** instead of ❌ **Creating**
|
||||
2. **Rules**
|
||||
* A small number of categories are easy to memorize.
|
||||
* Nothing more, nothing less
|
||||
* e.g. **📦 NEW** , **👌 IMPROVE** , **🐛 FIX** , **📖 DOC** , **🚀 RELEASE** , and **✅ TEST**
|
||||
3. **Actions**
|
||||
* Make Git commits based on actions you take.
|
||||
* Use a good editor like [VSCode][7] to commit the right files with commit messages.
|
||||
|
||||
|
||||
|
||||
### Writing commit messages
|
||||
|
||||
Use only the following Git commit messages. The simple and small footprint is the key to Emoji-Logo.
|
||||
|
||||
1. **📦 NEW: IMPERATIVE_MESSAGE**
|
||||
* Use when you add something entirely new.
|
||||
* e.g., **📦 NEW: Add Git ignore file**
|
||||
2. **👌 IMPROVE: IMPERATIVE_MESSAGE**
|
||||
* Use when you improve/enhance piece of code like refactoring etc.
|
||||
* e.g., **👌 IMPROVE: Remote IP API Function**
|
||||
3. **🐛 FIX: IMPERATIVE_MESSAGE**
|
||||
* Use when you fix a bug. Need I say more?
|
||||
* e.g., **🐛 FIX: Case converter**
|
||||
4. **📖 DOC: IMPERATIVE_MESSAGE**
|
||||
* Use when you add documentation, like README.md or even inline docs.
|
||||
* e.g., **📖 DOC: API Interface Tutorial**
|
||||
5. **🚀 RELEASE: IMPERATIVE_MESSAGE**
|
||||
* Use when you release a new version. e.g., **🚀 RELEASE: Version 2.0.0**
|
||||
6. **✅ TEST: IMPERATIVE_MESSAGE**
|
||||
* Use when you release a new version.
|
||||
* e.g., **✅ TEST: Mock User Login/Logout**
|
||||
|
||||
|
||||
|
||||
That's it for now. Nothing more, nothing less.
|
||||
|
||||
### Emoji-Log functions
|
||||
|
||||
For quick prototyping, I have made the following functions that you can add to your **.bashrc** / **.zshrc** files to use Emoji-Log quickly.
|
||||
|
||||
```
|
||||
#.# Better Git Logs.
|
||||
|
||||
### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log).
|
||||
|
||||
|
||||
|
||||
# Git Commit, Add all and Push — in one step.
|
||||
|
||||
function gcap() {
|
||||
git add . && git commit -m "$*" && git push
|
||||
}
|
||||
|
||||
# NEW.
|
||||
function gnew() {
|
||||
gcap "📦 NEW: $@"
|
||||
}
|
||||
|
||||
# IMPROVE.
|
||||
function gimp() {
|
||||
gcap "👌 IMPROVE: $@"
|
||||
}
|
||||
|
||||
# FIX.
|
||||
function gfix() {
|
||||
gcap "🐛 FIX: $@"
|
||||
}
|
||||
|
||||
# RELEASE.
|
||||
function grlz() {
|
||||
gcap "🚀 RELEASE: $@"
|
||||
}
|
||||
|
||||
# DOC.
|
||||
function gdoc() {
|
||||
gcap "📖 DOC: $@"
|
||||
}
|
||||
|
||||
# TEST.
|
||||
function gtst() {
|
||||
gcap "✅ TEST: $@"
|
||||
}
|
||||
```
|
||||
|
||||
To install these functions for the [fish shell][8], run the following commands:
|
||||
|
||||
```
|
||||
function gcap; git add .; and git commit -m "$argv"; and git push; end;
|
||||
function gnew; gcap "📦 NEW: $argv"; end
|
||||
function gimp; gcap "👌 IMPROVE: $argv"; end;
|
||||
function gfix; gcap "🐛 FIX: $argv"; end;
|
||||
function grlz; gcap "🚀 RELEASE: $argv"; end;
|
||||
function gdoc; gcap "📖 DOC: $argv"; end;
|
||||
function gtst; gcap "✅ TEST: $argv"; end;
|
||||
funcsave gcap
|
||||
funcsave gnew
|
||||
funcsave gimp
|
||||
funcsave gfix
|
||||
funcsave grlz
|
||||
funcsave gdoc
|
||||
funcsave gtst
|
||||
```
|
||||
|
||||
If you prefer, you can paste these aliases directly in your **~/.gitconfig** file:
|
||||
|
||||
```
|
||||
# Git Commit, Add all and Push — in one step.
|
||||
cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f"
|
||||
|
||||
# NEW.
|
||||
new = "!f() { git cap \"📦 NEW: $@\"; }; f"
|
||||
# IMPROVE.
|
||||
imp = "!f() { git cap \"👌 IMPROVE: $@\"; }; f"
|
||||
# FIX.
|
||||
fix = "!f() { git cap \"🐛 FIX: $@\"; }; f"
|
||||
# RELEASE.
|
||||
rlz = "!f() { git cap \"🚀 RELEASE: $@\"; }; f"
|
||||
# DOC.
|
||||
doc = "!f() { git cap \"📖 DOC: $@\"; }; f"
|
||||
# TEST.
|
||||
tst = "!f() { git cap \"✅ TEST: $@\"; }; f"
|
||||
```
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/2/emoji-log-git-commit-messages
|
||||
|
||||
作者:[Ahmad Awais][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mrahmadawais
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://github.com/ahmadawais
|
||||
[2]: https://github.com/ahmadawais/Emoji-Log/
|
||||
[3]: https://github.com/ahmadawais/VSCode-Tips-Tricks
|
||||
[4]: https://github.com/ahmadawais/shades-of-purple-vscode/commits/master
|
||||
[5]: https://github.com/ahmadawais/shades-of-purple-vscode/blob/master/CHANGELOG.md
|
||||
[6]: https://gitmoji.carloscuesta.me/
|
||||
[7]: https://VSCode.pro
|
||||
[8]: https://en.wikipedia.org/wiki/Friendly_interactive_shell
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (hopefully2333)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
200
sources/tech/20190312 BackBox Linux for Penetration Testing.md
Normal file
200
sources/tech/20190312 BackBox Linux for Penetration Testing.md
Normal file
@ -0,0 +1,200 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (BackBox Linux for Penetration Testing)
|
||||
[#]: via: (https://www.linux.com/blog/learn/2019/3/backbox-linux-penetration-testing)
|
||||
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
|
||||
|
||||
BackBox Linux for Penetration Testing
|
||||
======
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/security-2688911_1920.jpg?itok=yZ9TjAXu)
|
||||
|
||||
Any given task can succeed or fail depending upon the tools at hand. For security engineers in particular, building just the right toolkit can make life exponentially easier. Luckily, with open source, you have a wide range of applications and environments at your disposal, ranging from simple commands to complicated and integrated tools.
|
||||
|
||||
The problem with the piecemeal approach, however, is that you might wind up missing out on something that can make or break a job… or you waste a lot of time hunting down the right tools for the job. To that end, it’s always good to consider an operating system geared specifically for penetration testing (aka pentesting).
|
||||
|
||||
Within the world of open source, the most popular pentesting distribution is [Kali Linux][1]. It is, however, not the only tool in the shop. In fact, there’s another flavor of Linux, aimed specifically at pentesting, called [BackBox][2]. BackBox is based on Ubuntu Linux, which also means you have easy access to a host of other outstanding applications besides those that are included, out of the box.
|
||||
|
||||
### What Makes BackBox Special?
|
||||
|
||||
BackBox includes a suite of ethical hacking tools, geared specifically toward pentesting. These testing tools include the likes of:
|
||||
|
||||
* Web application analysis
|
||||
|
||||
* Exploitation testing
|
||||
|
||||
* Network analysis
|
||||
|
||||
* Stress testing
|
||||
|
||||
* Privilege escalation
|
||||
|
||||
* Vulnerability assessment
|
||||
|
||||
* Computer forensic analysis and exploitation
|
||||
|
||||
* And much more
|
||||
|
||||
|
||||
|
||||
|
||||
Out of the box, one of the most significant differences between Kali Linux and BackBox is the number of installed tools. Whereas Kali Linux ships with hundreds of tools pre-installed, BackBox significantly limits that number to around 70. Nonetheless, BackBox includes many of the tools necessary to get the job done, such as:
|
||||
|
||||
* Ettercap
|
||||
|
||||
* Msfconsole
|
||||
|
||||
* Wireshark
|
||||
|
||||
* ZAP
|
||||
|
||||
* Zenmap
|
||||
|
||||
* BeEF Browser Exploitation
|
||||
|
||||
* Sqlmap
|
||||
|
||||
* Driftnet
|
||||
|
||||
* Tcpdump
|
||||
|
||||
* Cryptcat
|
||||
|
||||
* Weevely
|
||||
|
||||
* Siege
|
||||
|
||||
* Autopsy
|
||||
|
||||
|
||||
|
||||
|
||||
BackBox is in active development, the latest version (5.3) was released February 18, 2019. But how is BackBox as a usable tool? Let’s install and find out.
|
||||
|
||||
### Installation
|
||||
|
||||
If you’ve installed one Linux distribution, you’ve installed them all … with only slight variation. BackBox is pretty much the same as any other installation. [Download the ISO][3], burn the ISO onto a USB drive, boot from the USB drive, and click the Install icon.
|
||||
|
||||
The installer (Figure 1) will be instantly familiar to anyone who has installed a Ubuntu or Debian derivative. Just because BackBox is a distribution geared specifically toward security administrators, doesn’t mean the operating system is a challenge to get up and running. In fact, BackBox is a point-and-click affair that anyone, regardless of skills, can install.
|
||||
|
||||
![installation][5]
|
||||
|
||||
Figure 1: The installation of BackBox will be immediately familiar to anyone.
|
||||
|
||||
[Used with permission][6]
|
||||
|
||||
The trickiest section of the installation is the Installation Type. As you can see (Figure 2), even this step is quite simple.
|
||||
|
||||
![BackBox][8]
|
||||
|
||||
Figure 2: Selecting the type of installation for BackBox.
|
||||
|
||||
[Used with permission][6]
|
||||
|
||||
Once you’ve installed BackBox, reboot the system, remove the USB drive, and wait for it to land on the login screen. Log into the desktop and you’re ready to go (Figure 3).
|
||||
|
||||
![desktop][10]
|
||||
|
||||
Figure 3: The BackBox Linux desktop, running as a VirtualBox virtual machine.
|
||||
|
||||
[Used with permission][6]
|
||||
|
||||
### Using BackBox
|
||||
|
||||
Thanks to the [Xfce desktop environment][11], BackBox is easy enough for a Linux newbie to navigate. Click on the menu button in the top left corner to reveal the menu (Figure 4).
|
||||
|
||||
![desktop menu][13]
|
||||
|
||||
Figure 4: The BackBox desktop menu in action.
|
||||
|
||||
[Used with permission][6]
|
||||
|
||||
From the desktop menu, click on any one of the favorites (in the left pane) or click on a category to reveal the related tools (Figure 5).
|
||||
|
||||
![Auditing][15]
|
||||
|
||||
Figure 5: The Auditing category in the BackBox menu.
|
||||
|
||||
[Used with permission][6]
|
||||
|
||||
The menu entries you’ll most likely be interested in are:
|
||||
|
||||
* Anonymous - allows you to start an anonymous networking session.
|
||||
|
||||
* Auditing - the majority of the pentesting tools are found in here.
|
||||
|
||||
* Services - allows you to start/stop services such as Apache, Bluetooth, Logkeys, Networking, Polipo, SSH, and Tor.
|
||||
|
||||
|
||||
|
||||
|
||||
Before you run any of the testing tools, I would recommend you first making sure to update and upgrade BackBox. This can be done via a GUI or the command line. If you opt to go the GUI route, click on the desktop menu, click System, and click Software Updater. When the updater completes its check for updates, it will prompt you if any are available, or if (after an upgrade) a reboot is necessary (Figure 6).
|
||||
|
||||
![reboot][17]
|
||||
|
||||
Figure 6: Time to reboot after an upgrade.
|
||||
|
||||
[Used with permission][6]
|
||||
|
||||
Should you opt to go the manual route, open a terminal window and issue the following two commands:
|
||||
|
||||
```
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get upgrade -y
|
||||
```
|
||||
|
||||
Many of the BackBox pentesting tools do require a solid understanding of how each tool works, so before you attempt to use any given tool, make sure you know how to use said tool. Some tools (such as Metasploit) are made a bit easier to work with, thanks to BackBox. To run Metasploit, click on the desktop menu button and click msfconsole from the favorites (left pane). When the tool opens for the first time, you’ll be asked to configure a few options. Simply select each default given by clicking your keyboard Enter key when prompted. Once you see the Metasploit prompt, you can run commands like:
|
||||
|
||||
```
|
||||
db_nmap 192.168.0/24
|
||||
```
|
||||
|
||||
The above command will list out all discovered ports on a 192.168.1.x network scheme (Figure 7).
|
||||
|
||||
![Metasploit][19]
|
||||
|
||||
Figure 7: Open port discovery made simple with Metasploit on BackBox.
|
||||
|
||||
[Used with permission][6]
|
||||
|
||||
Even often-challenging tools like Metasploit are made far easier than they are with other distributions (partially because you don’t have to bother with installing the tools). That alone is worth the price of entry for BackBox (which is, of course, free).
|
||||
|
||||
### The Conclusion
|
||||
|
||||
Although BackBox usage may not be as widespread as Kali Linux, it still deserves your attention. For anyone looking to do pentesting on their various environments, BackBox makes the task far easier than so many other operating systems. Give this Linux distribution a go and see if it doesn’t aid you in your journey to security nirvana.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/learn/2019/3/backbox-linux-penetration-testing
|
||||
|
||||
作者:[Jack Wallen][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linux.com/users/jlwallen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.kali.org/
|
||||
[2]: https://linux.backbox.org/
|
||||
[3]: https://www.backbox.org/download/
|
||||
[4]: /files/images/backbox1jpg
|
||||
[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_1.jpg?itok=pn4fQVp7 (installation)
|
||||
[6]: /licenses/category/used-permission
|
||||
[7]: /files/images/backbox2jpg
|
||||
[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_2.jpg?itok=tf-1zo8Z (BackBox)
|
||||
[9]: /files/images/backbox3jpg
|
||||
[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_3.jpg?itok=GLowoAUb (desktop)
|
||||
[11]: https://www.xfce.org/
|
||||
[12]: /files/images/backbox4jpg
|
||||
[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_4.jpg?itok=VmQXtuZL (desktop menu)
|
||||
[14]: /files/images/backbox5jpg
|
||||
[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_5.jpg?itok=UnfM_OxG (Auditing)
|
||||
[16]: /files/images/backbox6jpg
|
||||
[17]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/backbox_6.jpg?itok=2t1BiKPn (reboot)
|
||||
[18]: /files/images/backbox7jpg
|
||||
[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_7.jpg?itok=Vw_GEub3 (Metasploit)
|
@ -0,0 +1,95 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Game Review: Steel Rats is an Enjoyable Bike-Combat Game)
|
||||
[#]: via: (https://itsfoss.com/steel-rats)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Game Review: Steel Rats is an Enjoyable Bike-Combat Game
|
||||
======
|
||||
|
||||
Steel Rats is a quite impressive 2.5D motorbike combat game with exciting stunts involved. It was already available for Windows on [Steam][1] – however, recently it has been made available for Linux and Mac as well.
|
||||
|
||||
In case you didn’t know, you can easily [install Steam on Ubuntu][2] or other distributions and [enable Steam Play feature to run some Windows games on Linux][3].
|
||||
|
||||
So, in this article, we shall take a look at what the game is all about and if it is a good purchase for you.
|
||||
|
||||
This game is neither free nor open source. We have covered it here because the game developers made an effort to port it to Linux.
|
||||
|
||||
### Story Overview
|
||||
|
||||
![steel rats][4]
|
||||
|
||||
You belong to a biker gang – “ **Steel Rats** ” – who stepped up to protect their city from alien robots invasion. The alien robots aren’t just any tiny toys that you can easily defeat but with deadly weapons and abilities.
|
||||
|
||||
The games features the setting as an alternative version of 1940’s USA – with the retro theme in place. You have to use your bike as the ultimate weapon to go against waves of alien robot and boss fights as well.
|
||||
|
||||
You will encounter 4 different characters with unique abilities to switch from after progressing through a couple of rounds.
|
||||
|
||||
You will start playing as “ **Toshi** ” and unlock other characters as you progress. **Toshi** is a genius and will be using a drone as his gadget to fight the alien robots. **James** – is the leader with the hammer attack as his special ability. **Lisa** would be the one utilizing fire to burn the junk robots. And, **Randall** will have his harpoon ready to destroy aerial robots with ease.
|
||||
|
||||
### Gameplay
|
||||
|
||||
![][5]
|
||||
|
||||
Honestly, I am not a fan of 2.5 D (or 2D games). But, games like [Unravel][6] will be the exception – which is still not available for Linux, such a shame – EA.
|
||||
|
||||
In this case, I did end up enjoying “ **Steel Rats** ” as one of the few 2D games I play.
|
||||
|
||||
There is really no rocket science for this game – you just have to get good with the controls. No matter whether you use a controller or a keyboard, it is definitely challenging to get comfortable with the controls.
|
||||
|
||||
You do not need to plan ahead in order to save your health or nitro boost because you will always have it when needed while also having checkpoints to resume your progress.
|
||||
|
||||
You just need to keep the right pace and the perfect jump while hitting every enemy to get the best score in the leader boards. Once you do that, the game ends up being an easy and fun experience.
|
||||
|
||||
If you’re curious about the gameplay, we recommend watching this video:
|
||||
|
||||
<https://www.youtube.com/embed/e2RhSKjLKf0?enablejsapi=1&autoplay=0&cc_load_policy=0&iv_load_policy=1&loop=0&modestbranding=1&rel=0&showinfo=0&fs=1&playsinline=0&autohide=2&theme=dark&color=red&controls=2&?
|
||||
|
||||
### Performance & Visuals
|
||||
|
||||
![][7]
|
||||
|
||||
The graphics or visuals do matter in a game. Even though the minimum system requirements is not something to worry about, you should be good with a processor similar to or better than **Intel Core 2 Duo** coupled with **4 Gigs of RAM** at least and a dedicated GPU ( **GeForce GT 630 / Radeon HD 7570)**.
|
||||
|
||||
I tried it on my system with **i5-7400** coupled with **8 Gigs of RAM** and a **GTX 1050** graphics card on board. With the highest settings, the game worked smooth and looked visually good as well. Of course, we will avoid talking about the frames I got – because anything above **25-30 FPS** for this kind of game is perfectly fine.
|
||||
|
||||
However, I did encounter multiple crashes – so had to restart the game. Maybe the [Nvidia driver][8] was at fault? Maybe the fact that I’m using Elementary OS?
|
||||
|
||||
I’m not so sure why I had issues – but just a heads up for you. Once the game launches successfully without a crash, it works well without any hiccups.
|
||||
|
||||
### Final Verdict
|
||||
|
||||
While this may not be the most challenging game you’ve come across but it surely is a fun experience. Along with a good gameplay and visuals – the background theme music of the game is also very good.
|
||||
|
||||
The music actually sets up the mood of a gamer while playing this – so thought of pointing this out as well.
|
||||
|
||||
Depending on your region – you will find this game listed on Steam for either **19.99 USD** or **529 INR**.
|
||||
|
||||
Is it worth it? **Yes** , if you want a exciting and fun motorbike-action game in a 2.5D experience. **No** , if you want an extremely challenging 2D game in your library.
|
||||
|
||||
What do you think about the game? Let us know in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/steel-rats
|
||||
|
||||
作者:[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://store.steampowered.com/app/619700/Steel_Rats/
|
||||
[2]: https://itsfoss.com/install-steam-ubuntu-linux/
|
||||
[3]: https://itsfoss.com/steam-play/
|
||||
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/steel-rats-screenshot-1.jpg?fit=800%2C450&ssl=1
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/steel-rats-screenshot-2.jpg?fit=800%2C450&ssl=1
|
||||
[6]: https://en.wikipedia.org/wiki/Unravel_(video_game)
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/steel-rats-screenshot-3.jpg?fit=800%2C450&ssl=1
|
||||
[8]: https://itsfoss.com/install-additional-drivers-ubuntu/
|
@ -1,50 +1,50 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (zero-MK)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How To Install, Configure And Use Fish Shell In Linux?)
|
||||
[#]: via: (https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "zero-MK"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "How To Install, Configure And Use Fish Shell In Linux?"
|
||||
[#]: via: "https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/"
|
||||
[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/"
|
||||
|
||||
How To Install, Configure And Use Fish Shell In Linux?
|
||||
如何在Linux中安装,配置和使用Fish Shell?
|
||||
======
|
||||
|
||||
Every Linux administrator might heard the word called shell.
|
||||
每个 Linux 管理员都可能听到过 shell 这个词。
|
||||
|
||||
Do you know what is shell? Do you know what is the role for shell in Linux? How many shell is available in Linux?
|
||||
你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少 shell 可用?
|
||||
|
||||
A shell is a program that provides an interface between a user and kernel.
|
||||
shell 是一个程序,它是提供用户和内核之间交互的接口。
|
||||
|
||||
kernel is a heart of the Linux operating system that manage everything between user and operating system (OS).
|
||||
内核是 Linux 操作系统的核心,它管理用户和操作系统( OS )之间的所有内容。
|
||||
|
||||
Shell is available for all the users when they launch the terminal.
|
||||
Shell 可供所有用户在启动终端时使用。
|
||||
|
||||
Once the terminal launched then user can run any commands which is available for him.
|
||||
终端启动后,用户可以运行任何可用的命令。
|
||||
|
||||
When shell completes the command execution then you will be getting the output on the terminal window.
|
||||
当shell完成命令执行时,您将在终端窗口上获取输出。
|
||||
|
||||
Bash stands for Bourne Again Shell is the default shell which is running on most of the Linux distribution on today’s.
|
||||
Bash 全称是 Bourne Again Shell 是默认的 shell ,它运行在今天的大多数 Linux 发行版上。
|
||||
|
||||
It’s very popular and has a lot of features. Today we are going to discuss about the fish shell.
|
||||
它非常受欢迎,并具有很多功能。今天我们将讨论 Fish Shell 。
|
||||
|
||||
### What Is Fish Shell?
|
||||
### 什么是 Fish Shell?
|
||||
|
||||
[Fish][1] stands for friendly interactive shell, is a fully-equipped, smart and user-friendly command line shell for Linux which comes with some handy features that is not available in most of the shell.
|
||||
[Fish][1] 是友好的交互式 shell , 是一个功能齐全,智能且对用户友好的 Linux 命令行 shell ,它带有一些在大多数 shell 中都不具备的方便功能。
|
||||
|
||||
The features are Autosuggestion, Sane Scripting, Man Page Completions, Web Based configuration and Glorious VGA Color. Are you curious to test it? if so, go ahead and install it by following the below installation steps.
|
||||
这些功能包括 自动补全建议,Sane Scripting,手册页完成,基于 Web 的配置器和 Glorious VGA Color 。你对它感到好奇并想测试它吗?如果是这样,请按照以下安装步骤继续安装。
|
||||
|
||||
### How To Install Fish Shell In Linux?
|
||||
### 如何在 Linux 中安装 Fish Shell ?
|
||||
|
||||
It’s very simple to install but it doesn’t available in most of the distributions except few. However, it can be easily installed by using the following [fish repository][2].
|
||||
它的安装非常简单,但除了少数几个发行版外,它在大多数发行版中都不可用。但是,可以使用以下 [fish repository][2] 轻松安装。
|
||||
|
||||
For **`Arch Linux`** based systems, use **[Pacman Command][3]** to install fish shell.
|
||||
对于基于 **`Arch Linux`** 的系统, 使用 **[Pacman Command][3]** 来安装 fish shell。
|
||||
|
||||
```
|
||||
$ sudo pacman -S fish
|
||||
```
|
||||
|
||||
For **`Ubuntu 16.04/18.04`** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install fish shell.
|
||||
对于 **`Ubuntu 16.04/18.04`** 系统来说,,请使用 **[APT-GET Command][4]** 或者 **[APT Command][5]** 安装 fish shell。
|
||||
|
||||
```
|
||||
$ sudo apt-add-repository ppa:fish-shell/release-3
|
||||
@ -52,25 +52,25 @@ $ sudo apt-get update
|
||||
$ sudo apt-get install fish
|
||||
```
|
||||
|
||||
For **`Fedora`** system, use **[DNF Command][6]** to install fish shell.
|
||||
对于 **`Fedora`** 系统来说,请使用 **[DNF Command][6]** 安装 fish shell。
|
||||
|
||||
For Fedora 29 System:
|
||||
对于 Fedora 29 系统来说:
|
||||
|
||||
```
|
||||
$ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_29/shells:fish:release:3.repo
|
||||
$ sudo dnf install fish
|
||||
```
|
||||
|
||||
For Fedora 28 System:
|
||||
对于 Fedora 28 系统来说:
|
||||
|
||||
```
|
||||
$ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_28/shells:fish:release:3.repo
|
||||
$ sudo dnf install fish
|
||||
```
|
||||
|
||||
For **`Debian`** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install fish shell.
|
||||
对于 **`Debian`** 系统来说,,请使用 **[APT-GET Command][4]** 或者 **[APT Command][5]** 安装 fish shell。
|
||||
|
||||
For Debian 9 System:
|
||||
对于 Debian 9 系统来说:
|
||||
|
||||
```
|
||||
$ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_9.0/Release.key -O Release.key
|
||||
@ -80,7 +80,7 @@ $ sudo apt-get update
|
||||
$ sudo apt-get install fish
|
||||
```
|
||||
|
||||
For Debian 8 System:
|
||||
对于 Debian 8 系统来说:
|
||||
|
||||
```
|
||||
$ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_8.0/Release.key -O Release.key
|
||||
@ -90,37 +90,37 @@ $ sudo apt-get update
|
||||
$ sudo apt-get install fish
|
||||
```
|
||||
|
||||
For **`RHEL/CentOS`** systems, use **[YUM Command][7]** to install fish shell.
|
||||
对于 **`RHEL/CentOS`** 系统来说,请使用 **[YUM Command][7]** 安装 fish shell。
|
||||
|
||||
For RHEL 7 System:
|
||||
对于 RHEL 7 系统来说:
|
||||
|
||||
```
|
||||
$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RHEL_7/shells:fish:release:3.repo
|
||||
$ sudo yum install fish
|
||||
```
|
||||
|
||||
For RHEL 6 System:
|
||||
对于 RHEL 6 系统来说:
|
||||
|
||||
```
|
||||
$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RedHat_RHEL-6/shells:fish:release:3.repo
|
||||
$ sudo yum install fish
|
||||
```
|
||||
|
||||
For CentOS 7 System:
|
||||
对于 CentOS 7 系统来说:
|
||||
|
||||
```
|
||||
$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo
|
||||
$ sudo yum install fish
|
||||
```
|
||||
|
||||
For CentOS 6 System:
|
||||
对于 CentOS 6 系统来说:
|
||||
|
||||
```
|
||||
$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_6/shells:fish:release:2.repo
|
||||
$ sudo yum install fish
|
||||
```
|
||||
|
||||
For **`openSUSE Leap`** system, use **[Zypper Command][8]** to install fish shell.
|
||||
对于 **`openSUSE Leap`** 系统来说,请使用 **[Zypper Command][8]** 安装 fish shell。
|
||||
|
||||
```
|
||||
$ sudo zypper addrepo https://download.opensuse.org/repositories/shells:/fish:/release:/3/openSUSE_Leap_42.3/shells:fish:release:3.repo
|
||||
@ -128,9 +128,9 @@ $ suod zypper refresh
|
||||
$ sudo zypper install fish
|
||||
```
|
||||
|
||||
### How To Use Fish Shell?
|
||||
### 如何使用 Fish Shell ?
|
||||
|
||||
Once you have successfully installed the fish shell. Simply type `fish` on your terminal, which will automatically switch to the fish shell from your default bash shell.
|
||||
一旦你成功安装了 fish shell 。只需在您的终端上输入 `fish` ,它将自动从默认的 bash shell 切换到 fish shell 。
|
||||
|
||||
```
|
||||
$ fish
|
||||
@ -138,37 +138,37 @@ $ fish
|
||||
|
||||
![][10]
|
||||
|
||||
### Auto Suggestions
|
||||
### 自动补全建议
|
||||
|
||||
When you type any commands in the fish shell, it will auto suggest a command in a light grey color after typing few letters.
|
||||
当你在 fish shell 中键入任何命令时,它会在输入几个字母后自动建议一个浅灰色的命令。
|
||||
![][11]
|
||||
|
||||
Once you got a suggestion then simple hit the `Left Arrow Mark` to complete it instead of typing the full command.
|
||||
一旦你得到一个建议然后点击 ` Right Arrow Mark` (译者注:原文是左,错的)就能完成它而不是输入完整的命令。
|
||||
![][12]
|
||||
|
||||
Instantly you can access the previous history based on the command by pressing `Up Arrow Mark` after typing a few letters. It’s similar to bash shell `CTRL+r` option.
|
||||
您可以在键入几个字母后立即按下 `Up Arrow Mark` 检索该命令以前的历史记录。它类似于 bash shell 的 `CTRL+r `选项。
|
||||
|
||||
### Tab Completions
|
||||
### Tab 补全
|
||||
|
||||
If you would like to see if there are any other possibilities for the given command then simple press the `Tab` button once after typing a few letters.
|
||||
如果您想查看给定命令是否还有其他可能性,那么在键入几个字母后,只需按一下 `Tab` 按钮即可。
|
||||
![][13]
|
||||
|
||||
Press the `Tab` button one more time to see the full lists.
|
||||
再次按 `Tab` 按钮可查看完整列表。
|
||||
![][14]
|
||||
|
||||
### Syntax highlighting
|
||||
### 语法高亮
|
||||
|
||||
fish performs syntax highlighting, that you can see when you are typing any commands in the terminal. Invalid commands are colored by `RED color`.
|
||||
fish 执行语法高亮显示,您可以在终端中键入任何命令时看到。 无效的命令被着色为 `RED color` 。
|
||||
![][15]
|
||||
|
||||
The same way valid commands are shown in a different color. Also, fish will underline valid file paths when you type and it doesn’t show the underline if the path is not valid.
|
||||
同样的,有效命令以不同的颜色显示。此外,当您键入有效的文件路径时,fish会在其下面加下划线,如果路径无效,则不会显示下划线。
|
||||
![][16]
|
||||
|
||||
### Web based configuration
|
||||
### 基于 Web 的配置器
|
||||
|
||||
There is a cool feature is available in the fish shell, that allow us to set colors, prompt, functions, variables, history and bindings via web browser.
|
||||
fish shell 中有一个很酷的功能,它允许我们通过网络浏览器设置颜色,提示,功能,变量,历史和绑定。
|
||||
|
||||
Run the following command on your terminal to start the web configuration interface. Simply press `Ctrl+c` to exit it.
|
||||
在终端上运行以下命令以启动 Web 配置界面。只需按下 `Ctrl+c` 即可退出。
|
||||
|
||||
```
|
||||
$ fish_config
|
||||
@ -182,9 +182,9 @@ Shutting down.
|
||||
|
||||
### Man Page Completions
|
||||
|
||||
Other shells support programmable completions, but only fish generates them automatically by parsing your installed man pages.
|
||||
其他 shell 支持 programmable completions, 但只有 fish 可以通过解析已安装的手册页自动生成它们。
|
||||
|
||||
To do so, run the below command.
|
||||
如果是这样,请运行以下命令
|
||||
|
||||
```
|
||||
$ fish_update_completions
|
||||
@ -192,18 +192,18 @@ Parsing man pages and writing completions to /home/daygeek/.local/share/fish/gen
|
||||
3466 / 3466 : zramctl.8.gz
|
||||
```
|
||||
|
||||
### How To Set Fish as default shell
|
||||
### 如何将 Fish 设置为默认 shell
|
||||
|
||||
If you would like to test the fish shell for some times then you can set the fish shell as your default shell instead of switching it every time.
|
||||
|
||||
If so, first get the fish shell location by using the below command.
|
||||
如果是这样,首先使用以下命令获取 Fish Shell 的位置。
|
||||
|
||||
```
|
||||
$ whereis fish
|
||||
fish: /usr/bin/fish /etc/fish /usr/share/fish /usr/share/man/man1/fish.1.gz
|
||||
```
|
||||
|
||||
Change your default shell as a fish shell by running the following command.
|
||||
通过运行以下命令将默认 shell 更改为 fish shell 。
|
||||
|
||||
```
|
||||
$ chsh -s /usr/bin/fish
|
||||
@ -211,21 +211,21 @@ $ chsh -s /usr/bin/fish
|
||||
|
||||
![][18]
|
||||
|
||||
`Make note:` Just verify whether the fish shell is added into `/etc/shells` directory or not. If no, then run the following command to append it.
|
||||
`Make note:` 只需验证 Fish Shell 是否已添加到 `/etc/shells` 目录中。如果不是,则运行以下命令以附加它。
|
||||
|
||||
```
|
||||
$ echo /usr/bin/fish | sudo tee -a /etc/shells
|
||||
```
|
||||
|
||||
Once you have done the testing and if you would like to come back to the bash shell permanently then use the following command.
|
||||
完成测试后,如果要返回 bash shell ,请使用以下命令。
|
||||
|
||||
For temporary:
|
||||
暂时的:
|
||||
|
||||
```
|
||||
$ bash
|
||||
```
|
||||
|
||||
For permanent:
|
||||
永久性的:
|
||||
|
||||
```
|
||||
$ chsh -s /bin/bash
|
||||
@ -237,7 +237,7 @@ via: https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[zero-MK](https://github.com/zero-MK)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -0,0 +1,169 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Emoji-Log: A new way to write Git commit messages)
|
||||
[#]: via: (https://opensource.com/article/19/2/emoji-log-git-commit-messages)
|
||||
[#]: author: (Ahmad Awais https://opensource.com/users/mrahmadawais)
|
||||
|
||||
Emoji-Log:编写 Git 提交信息的新方法
|
||||
======
|
||||
使用 Emoji-Log 为你的提交添加上下文。
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji_tech_keyboard.jpg?itok=ncBNKZFl)
|
||||
|
||||
我是一名全职开源开发人员,我喜欢称自己为“开源者”。我从事开源软件工作已经超过十年,并[构建了数百个][1]开源软件应用程序。
|
||||
|
||||
同时我也是不要重复自己 Don't Repeat Yourself(DRY)哲学的忠实粉丝,并且相信编写更好的 Git 提交消息是 DRY 的一个重要组成部分。它们具有足够的上下文关联可以作为你开源软件的变更日志。我编写的众多工作流之一是 [Emoji-Log][2],它是一个简单易用的开源 Git 提交日志标准。它通过使用表情符号来创建更好的 Git 提交消息,从而改善了开发人员的体验(DX)。
|
||||
|
||||
我使用 Emoji-Log 构建了 [VSCode Tips & Tricks 仓库][3] 和我的 🦄 [紫色 VSCode 主题仓库][4],以及一个看起来很漂亮的[自动变更日志][5]。
|
||||
|
||||
### Emoji-Log 的哲学
|
||||
|
||||
我喜欢表情符号,我很喜欢它们。编程,代码,极客/书呆子,开源...所有这一切本质上都很枯燥,有时甚至很无聊。表情符号帮助我添加颜色和情感。想要将感受添加到 2D、平面和基于文本的代码世界并没有错。
|
||||
|
||||
相比于[数百个表情符号][6],我学会了更好的办法是保持小类别和普遍性。以下是指导使用 Emoji-Log 编写提交信息的原则:
|
||||
|
||||
1. **必要的**
|
||||
* Git 提交信息是必要的。
|
||||
* 像下订单一样编写提交信息。
|
||||
* 例如,使用 ✅ **Add** 而不是 ❌ **Added**
|
||||
* 例如,使用 ✅ **Create** 而不是 ❌ **Creating**
|
||||
2. **规则**
|
||||
* 少数类别易于记忆。
|
||||
* 不多不也少
|
||||
* 例如 **📦 NEW** , **👌 IMPROVE** , **🐛 FIX** , **📖 DOC** , **🚀 RELEASE**, **✅ TEST**
|
||||
3. **行为**
|
||||
* 让 Git 基于你所采取的操作提交
|
||||
* 使用像 [VSCode][7] 这样的编辑器来提交带有提交信息的正确文件。
|
||||
|
||||
### 编写提交信息
|
||||
|
||||
仅使用以下 Git 提交信息。简单而小巧的占地面积是 Emoji-Log 的核心。
|
||||
|
||||
1. **📦 NEW: 必要的信息**
|
||||
* 当你添加一些全新的东西时使用。
|
||||
* 例如 **📦 NEW: 添加 Git 忽略的文件**
|
||||
2. **👌 IMPROVE: 必要的信息**
|
||||
* 用于改进/增强代码段,如重构等。
|
||||
* 例如 **👌 IMPROVE: 远程 IP API 函数**
|
||||
3. **🐛 FIX: 必要的信息**
|
||||
* 修复 bug 时使用,不用解释了吧?
|
||||
* 例如 **🐛 FIX: Case converter**
|
||||
4. **📖 DOC: 必要的信息**
|
||||
* 添加文档时使用,比如 README.md 甚至是内联文档。
|
||||
* 例如 **📖 DOC: API 接口教程**
|
||||
5. **🚀 RELEASE: 必要的信息**
|
||||
* 发布新版本时使用。例如, **🚀 RELEASE: Version 2.0.0**
|
||||
6. **✅ TEST: 必要的信息**
|
||||
* 发布新版本时使用。
|
||||
* 例如 **✅ TEST: 模拟用户登录/注销**
|
||||
|
||||
就这些了,不多不少。
|
||||
|
||||
### Emoji-Log 函数
|
||||
|
||||
为了快速构建原型,我写了以下函数,你可以将它们添加到 **.bashrc** 或者 **.zshrc** 文件中以快速使用 Emoji-Log。
|
||||
|
||||
```
|
||||
#.# Better Git Logs.
|
||||
|
||||
### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log).
|
||||
|
||||
# Git Commit, Add all and Push — in one step.
|
||||
|
||||
function gcap() {
|
||||
git add . && git commit -m "$*" && git push
|
||||
}
|
||||
|
||||
# NEW.
|
||||
function gnew() {
|
||||
gcap "📦 NEW: $@"
|
||||
}
|
||||
|
||||
# IMPROVE.
|
||||
function gimp() {
|
||||
gcap "👌 IMPROVE: $@"
|
||||
}
|
||||
|
||||
# FIX.
|
||||
function gfix() {
|
||||
gcap "🐛 FIX: $@"
|
||||
}
|
||||
|
||||
# RELEASE.
|
||||
function grlz() {
|
||||
gcap "🚀 RELEASE: $@"
|
||||
}
|
||||
|
||||
# DOC.
|
||||
function gdoc() {
|
||||
gcap "📖 DOC: $@"
|
||||
}
|
||||
|
||||
# TEST.
|
||||
function gtst() {
|
||||
gcap "✅ TEST: $@"
|
||||
}
|
||||
```
|
||||
|
||||
要为 [fish shell][8] 安装这些函数,运行以下命令:
|
||||
|
||||
```
|
||||
function gcap; git add .; and git commit -m "$argv"; and git push; end;
|
||||
function gnew; gcap "📦 NEW: $argv"; end
|
||||
function gimp; gcap "👌 IMPROVE: $argv"; end;
|
||||
function gfix; gcap "🐛 FIX: $argv"; end;
|
||||
function grlz; gcap "🚀 RELEASE: $argv"; end;
|
||||
function gdoc; gcap "📖 DOC: $argv"; end;
|
||||
function gtst; gcap "✅ TEST: $argv"; end;
|
||||
funcsave gcap
|
||||
funcsave gnew
|
||||
funcsave gimp
|
||||
funcsave gfix
|
||||
funcsave grlz
|
||||
funcsave gdoc
|
||||
funcsave gtst
|
||||
```
|
||||
|
||||
如果你愿意,可以将这些别名直接粘贴到 **~/.gitconfig** 文件:
|
||||
```
|
||||
# Git Commit, Add all and Push — in one step.
|
||||
cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f"
|
||||
|
||||
# NEW.
|
||||
new = "!f() { git cap \"📦 NEW: $@\"; }; f"
|
||||
# IMPROVE.
|
||||
imp = "!f() { git cap \"👌 IMPROVE: $@\"; }; f"
|
||||
# FIX.
|
||||
fix = "!f() { git cap \"🐛 FIX: $@\"; }; f"
|
||||
# RELEASE.
|
||||
rlz = "!f() { git cap \"🚀 RELEASE: $@\"; }; f"
|
||||
# DOC.
|
||||
doc = "!f() { git cap \"📖 DOC: $@\"; }; f"
|
||||
# TEST.
|
||||
tst = "!f() { git cap \"✅ TEST: $@\"; }; f"
|
||||
```
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/2/emoji-log-git-commit-messages
|
||||
|
||||
作者:[Ahmad Awais][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mrahmadawais
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://github.com/ahmadawais
|
||||
[2]: https://github.com/ahmadawais/Emoji-Log/
|
||||
[3]: https://github.com/ahmadawais/VSCode-Tips-Tricks
|
||||
[4]: https://github.com/ahmadawais/shades-of-purple-vscode/commits/master
|
||||
[5]: https://github.com/ahmadawais/shades-of-purple-vscode/blob/master/CHANGELOG.md
|
||||
[6]: https://gitmoji.carloscuesta.me/
|
||||
[7]: https://VSCode.pro
|
||||
[8]: https://en.wikipedia.org/wiki/Friendly_interactive_shell
|
Loading…
Reference in New Issue
Block a user