Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-02-21 20:37:11 +08:00
commit cc0bb6fc9e
5 changed files with 279 additions and 49 deletions

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11913-1.html)
[#]: subject: (Zipping files on Linux: the many variations and how to use them)
[#]: via: (https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-the-many-variations-and-how-to-use-them.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
@ -12,13 +12,13 @@
> 除了压缩和解压缩文件外,你还可以使用 zip 命令执行许多有趣的操作。这是一些其他的 zip 选项以及它们如何提供帮助。
![](https://images.idgesg.net/images/article/2019/01/zipper-100785364-large.jpg)
![](https://img.linux.net.cn/data/attachment/album/202002/21/120507ox11ak23f9x2hxaq.jpg)
为了节省一些磁盘空间并将文件打包在一起进行归档,我们中的一些人已经在 Unix 和 Linux 系统上压缩文件数十年了。即使这样,并不是所有人都尝试过一些有趣的压缩工具的变体。因此,在本文中,我们将介绍标准的压缩和解压缩以及其他一些有趣的压缩选项。
### 基本的 zip 命令
首先,让我们看一下基本的 `zip` 命令。它使用了与 `gzip` 基本上相同的压缩算法,但是有一些重要的区别。一方面,`gzip` 命令仅用于压缩单个文件,而 `zip` 既可以压缩文件,也可以将多个文件结合在一起成为归档文件。另外,`gzip` 命令是“就地”压缩。换句话说,它会留下一个压缩文件,而不是原始文件。 这是工作中的 `gzip` 示例:
首先,让我们看一下基本的 `zip` 命令。它使用了与 `gzip` 基本上相同的压缩算法,但是有一些重要的区别。一方面,`gzip` 命令仅用于压缩单个文件,而 `zip` 既可以压缩文件,也可以将多个文件结合在一起成为归档文件。另外,`gzip` 命令是“就地”压缩。换句话说,它会留下一个压缩文件,而原始文件则没有了。 这是工作中的 `gzip` 示例:
```
$ gzip onefile
@ -26,7 +26,7 @@ $ ls -l
-rw-rw-r-- 1 shs shs 10514 Jan 15 13:13 onefile.gz
```
`zip`。请注意,此命令要求为压缩存档提供名称,其中 `gzip`(执行压缩操作后)仅使用原始文件名并添加 `.gz` 扩展名。
下面`zip`。请注意,此命令要求为压缩存档提供名称,其中 `gzip`(执行压缩操作后)仅使用原始文件名并添加 `.gz` 扩展名。
```
$ zip twofiles.zip file*
@ -61,7 +61,7 @@ $ zip mybin.zip ~/bin/*
### unzip 命令
`unzip` 命令将从一个 zip 文件中恢复内容,并且,如你所料,原来的 zip 文件还保留在那里,而类似的`gunzip` 命令将仅保留未压缩的文件。
`unzip` 命令将从一个 zip 文件中恢复内容,并且,如你所料,原来的 zip 文件还保留在那里,而类似的 `gunzip` 命令将仅保留未压缩的文件。
```
$ unzip twofiles.zip
@ -272,13 +272,13 @@ $ zipnote twofiles.zip
@ (zip file comment below this line)
```
如果要添加注释,请先将 `zipnote` 命令的输出写入文件:
如果要添加注释,请先将 `zipnote` 命令的输出写入文件:
```
$ zipnote twofiles.zip > comments
```
接下来,编辑你刚刚创建的文件,将注释插入到 `(comment above this line)` 行上方。然后使用像这样的`zipnote` 命令添加注释:
接下来,编辑你刚刚创建的文件,将注释插入到 `(comment above this line)` 行上方。然后使用像这样的 `zipnote` 命令添加注释:
```
$ zipnote -w twofiles.zip < comments
@ -286,7 +286,7 @@ $ zipnote -w twofiles.zip < comments
### zipsplit 命令
当归档文件太大时,可以使用 `zipsplit` 命令将一个 zip 归档文件分解为多个 zip 归档文件,这样你就可以将其中某一个文件放到小型 U 盘中。最简单的方法似乎是为每个部分的压缩文件指定最大大小,此大小必须足够大以容纳最大的包含文件。
当归档文件太大时,可以使用 `zipsplit` 命令将一个 zip 归档文件分解为多个 zip 归档文件,这样你就可以将其中某一个文件放到小型 U 盘中。最简单的方法似乎是为每个部分的压缩文件指定最大大小,此大小必须足够大以容纳最大的包含文件。
```
$ zipsplit -n 12000 twofiles.zip
@ -312,7 +312,7 @@ via: https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-t
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,20 +1,22 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11912-1.html)
[#]: subject: (Use Vim to manage your task list and access Reddit and Twitter)
[#]: via: (https://opensource.com/article/20/1/vim-task-list-reddit-twitter)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
使用 Vim 管理任务列表和访问 Reddit 和 Twitter
======
在我们的 20 个使用开源提升生产力的系列的第十七篇文章中了解在编辑器中处理待办列表以及获取社交信息。
![Chat via email][1]
> 在 2020 年用开源实现更高生产力的二十种方式的第十七篇文章中,了解在编辑器中处理待办列表以及获取社交信息。
![](https://img.linux.net.cn/data/attachment/album/202002/21/112633yf3mx8qlssltugzm.jpg)
去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。
### 使用 Vim 执行(几乎)所有操作,第 2 部分
### 用 Vim 做(几乎)所有事情,第 2 部分
在[昨天的文章][2]中,你开始用 Vim 检查邮件和日历。今天,你可以做的更多。首先,你会在 Vim 编辑器中跟踪任务,然后获取社交信息。
@ -24,13 +26,12 @@
使用 Vim 编辑一个文本待办事件是一件自然的事,而 [todo.txt-vim][4] 包使其更加简单。首先安装 todo.txt-vim 包:
```
git clone <https://github.com/freitass/todo.txt-vim> ~/.vim/bundle/todo.txt-vim
git clone https://github.com/freitass/todo.txt-vim ~/.vim/bundle/todo.txt-vim
vim ~/path/to/your/todo.txt
```
todo.txt-vim 自动识别以 todo.txt 和 done.txt 结尾的文件作为 [todo.txt][5] 文件。它添加特定于 todo.txt 格式的键绑定。你可以使用 **\x** 标记“已完成”的内容,使用 **\d** 将其设置为当前日期,然后使用 **\a**、**\b** 和 **\c** 更改优先级。你可以提升(**\k**)或降低(**\j**)优先级,并根据项目(**\s+**)、上下文(**\s@**)或日期(**\sd**)排序(**\s**)。完成后,你可以和平常一样关闭和保存文件。
todo.txt-vim 自动识别以 `todo.txt``done.txt` 结尾的文件作为 [todo.txt][5] 文件。它添加特定于 todo.txt 格式的键绑定。你可以使用 `\x` 标记“已完成”的内容,使用 `\d` 将其设置为当前日期,然后使用 `\a`、`\b` 和 `\c` 更改优先级。你可以提升(`\k`)或降低(`\j`)优先级,并根据项目(`\s+`)、上下文(`\s@`)或日期(`\sd`)排序(`\s`)。完成后,你可以和平常一样关闭和保存文件。
todo.txt-vim 包是我几天前写的 [todo.sh 程序][6]的一个很好的补充,使用 [todo edit][7] 加载项,它可以增强的你待办事项列表跟踪。
@ -40,13 +41,12 @@ todo.txt-vim 包是我几天前写的 [todo.sh 程序][6]的一个很好的补
Vim 还有一个不错的用于 [Reddit][9] 的加载项,叫 [vim-reddit][10]。它不如 [Tuir][11] 好,但是用于快速查看最新的文章,它还是不错的。首先安装捆绑包:
```
git clone <https://github.com/DougBeney/vim-reddit.git> ~/.vim/bundle/vim-reddit
git clone https://github.com/DougBeney/vim-reddit.git ~/.vim/bundle/vim-reddit
vim
```
现在输入 **:Reddit** 将加载 Reddit 首页。你可以使用 **:Reddit name** 加载特定子板。打开文章列表后,使用箭头键导航或使用鼠标滚动。按 **o** 将在 Vim 中打开文章(除非它多媒体文章,它会打开浏览器),然后按 **c** 打开评论。如果要直接转到页面,请按 **O** 而不是 **o**。只需按 **u** 就能返回。当你 Reddit 看完后,输入 **:bd** 就行。vim-reddit 唯一的缺点是无法登录或发布新文章和评论。话又说回来,有时这是一件好事。
现在输入 `:Reddit` 将加载 Reddit 首页。你可以使用 `:Reddit name` 加载特定子板。打开文章列表后,使用箭头键导航或使用鼠标滚动。按 `o` 将在 Vim 中打开文章(除非它多媒体文章,它会打开浏览器),然后按 `c` 打开评论。如果要直接转到页面,请按 `O` 而不是 `o`。只需按 `u` 就能返回。当你 Reddit 看完后,输入 `:bd` 就行。vim-reddit 唯一的缺点是无法登录或发布新文章和评论。话又说回来,有时这是一件好事。
#### 使用 twitvim 在 Vim 中发推
@ -54,17 +54,15 @@ vim
最后,我们有 [twitvim][13],这是一个于阅读和发布 Twitter 的 Vim 软件包。它需要更多设置。首先从 GitHub 安装 twitvim
```
`git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim`
git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim
```
现在你需要编辑 **.vimrc** 文件并设置一些选项。它帮助插件知道使用哪些库与 Twitter 交互。运行 **vim --version** 并查看哪些语言的前面有 **+** 就代表你的 Vim 支持它。
现在你需要编辑 `.vimrc` 文件并设置一些选项。它帮助插件知道使用哪些库与 Twitter 交互。运行 `vim --version` 并查看哪些语言的前面有 `+` 就代表你的 Vim 支持它。
![Enabled and Disabled things in vim][14]
因为我的是 **+perl -python +python3**,所以我知道我可以启用 Perl 和 Python 3 但不是 Python 2 python
因为我的是 `+perl -python +python3`,所以我知道我可以启用 Perl 和 Python 3 但不是 Python 2 python
```
" TwitVim Settings
@ -73,9 +71,9 @@ let twitvim_enable_perl = 1
let twitvim_enable_python3 = 1
```
现在,你可以通过运行 **:SetLoginTwitter** 启动浏览器窗口,它会打开一个浏览器窗口要求你授权 VimTwit 访问你的帐户。在 Vim 中输入提供的 PIN 后就可以了。
现在,你可以通过运行 `:SetLoginTwitter` 启动浏览器窗口,它会打开一个浏览器窗口要求你授权 VimTwit 访问你的帐户。在 Vim 中输入提供的 PIN 后就可以了。
Twitvim 的命令不像其他包中一样简单。要加载好友和关注者的时间线,请输入 **:FriendsTwitter**。要列出提及你的和回复,请使用 **:MentionsTwitter**。发布新推文是 **:PosttoTwitter &lt;Your message&gt;**。你可以滚动列表并输入 **\r** 回复特定推文,你可以用 **\d** 直接给某人发消息。
Twitvim 的命令不像其他包中一样简单。要加载好友和关注者的时间线,请输入 `:FriendsTwitter`。要列出提及你的和回复,请使用 `:MentionsTwitter`。发布新推文是 `:PosttoTwitter <Your message>`。你可以滚动列表并输入 `\r` 回复特定推文,你可以用 `\d` 直接给某人发消息。
就是这些了。你现在可以在 Vim 中做(几乎)所有事了!
@ -86,14 +84,14 @@ via: https://opensource.com/article/20/1/vim-task-list-reddit-twitter
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email)
[2]: https://opensource.com/article/20/1/send-email-and-check-your-calendar-vim
[2]: https://linux.cn/article-11908-1.html
[3]: https://opensource.com/sites/default/files/uploads/productivity_17-1.png (to-dos and Twitter with Vim)
[4]: https://github.com/freitass/todo.txt-vim
[5]: http://todotxt.org

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11915-1.html)
[#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution)
[#]: via: (https://itsfoss.com/furybsd/)
[#]: author: (John Paul https://itsfoss.com/author/john/)
@ -10,23 +10,23 @@
认识 FuryBSD一个新的桌面 BSD 发行版
======
在过去的几个月中,出现了一些新的桌面 BSD。之前有 [HyperbolaBSD它是 Hyperbola GNU/Linux][1]。[BSD][2] 世界中的另一个新入者是 [FuryBSD][3]。
在过去的几个月中,出现了一些新的桌面 BSD。之前有 [HyperbolaBSD之前是 Hyperbola GNU/Linux][1]。[BSD][2] 世界中的另一个新入者是 [FuryBSD][3]。
### FuryBSD一个新的BSD发行版
### FuryBSD一个新的 BSD 发行版
![][4]
从本质上讲FuryBSD 是一个非常简单的发行版。根据[它的网站][5]“FuryBSD 一个是基于 FreeBSD 的轻量级桌面发行版。” 它基本上是预配置了桌面环境,并预安装了多个应用的 FreeBSD。目标是在快速地你的计算机上运行基于 FreeBSD 的系统。
从本质上讲FuryBSD 是一个非常简单的小东西。根据[它的网站][5]“FuryBSD 一个是基于 FreeBSD 的轻量级桌面发行版。” 它基本上是预配置了桌面环境,并预安装了多个应用的 FreeBSD。目地是快速地在你的计算机上运行基于 FreeBSD 的系统。
你可能会认为这听起来很像其他几个已有的 BSD例如 [NomadBSD][6] 和 [GhostBSD][7]。这些 BSD 与 FuryBSD 之间的主要区别在于 FuryBSD 与现有的 FreeBSD 更加接近。例如FuryBSD 使用 FreeBSD 安装程序,而其他发行版则用了自己的安装程序和工具。
正如[[它的网站][8]所说:“尽管 FuryBSD 可能类似于 PC-BSD 和 TrueOS 等图形化 BSD 项目,但 FuryBSD 是由不同的团队创建的,并且采用了与 FreeBSD 紧密集成的不同方法。这样可以降低开销,并保持与上游的兼容性。”开发领导还告诉我“FuryBSD 的一个主要重点是使其成为一种小型 Live 媒体,并带有一些辅助工具来测试硬件驱动程序。”
正如[它的网站][8]所说:“尽管 FuryBSD 可能类似于 PC-BSD 和 TrueOS 等图形化 BSD 项目,但 FuryBSD 是由不同的团队创建的,并且采用了不同与 FreeBSD 着重于紧密集成的方法。这样可以降低开销,并保持与上游的兼容性。”开发负责人还告诉我“FuryBSD 的一个主要重点是使其成为一种小型现场版介质,并带有一些测试硬件驱动程序的辅助工具。”
当前,你可以进入 [FuryBSD 主页][3]并下载 XFCE 或 KDE LiveCD。GNOME 版本正在开发中。
当前,你可以进入 [FuryBSD 主页][3]并下载 XFCE 或 KDE LiveCD。GNOME 版本正在开发中。
### FuryBSD 的背后是谁
FuryBSD 的主要开发者是 [Joe Maloney][9]。Joe 多年来一直是 FreeBSD 的用户。他为 PC-BSD 等其他 BSD 项目做出了贡献。他还与 GhostBSD 的创建者 Eric Turgeon 一起重写了 GhostBSD LiveCD。在此过程中他对 BSD 有了更好的了解,并开始形成自己如何进行发行的想法。
FuryBSD 的主要开发者是 [Joe Maloney][9]。Joe 多年来一直是 FreeBSD 的用户。他为 PC-BSD 等其他 BSD 项目做贡献。他还与 GhostBSD 的创建者 Eric Turgeon 一起重写了 GhostBSD LiveCD。在此过程中他对 BSD 有了更好的了解,并开始形成自己如何做一个发行版的想法。
Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 Jaron Parsons、Josh Smith 和 Damian Szidiropulosz。
@ -34,7 +34,7 @@ Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 J
目前FuryBSD 仅仅是预配置的 FreeBSD。但是开发者有一份[要改进的清单][5]。包括:
* 可靠的加载框架、第三方专有图形驱动、无线
* 可靠的加载框架、第三方专有图形驱动、无线网络
* 进一步整理 LiveCD 体验,以使其更加友好
* 开箱即用的打印支持
* 包含更多默认应用,以提供完整的桌面体验
@ -47,9 +47,7 @@ Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 J
* 目录服务集成
* 安全加固
开发者非常清楚地表明,他们所做的任何更改都需要大量的思考和研究。他们不会赞美某个功能,只会在它破坏一些东西时删除或者修改它。
开发者非常清楚地表明,他们所做的任何更改都需要大量的思考和研究。他们不会改进某个功能,只会在它破坏一些东西时删除或者修改它。
![FuryBSD desktop][11]
@ -72,7 +70,7 @@ via: https://itsfoss.com/furybsd/
作者:[John Paul][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,234 @@
[#]: collector: (lujun9972)
[#]: translator: (lujun9972)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Fun and Games in Emacs)
[#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs)
[#]: author: (Mickey Petersen https://www.masteringemacs.org/about)
Fun and Games in Emacs
======
Its yet another Monday and youre hard at work on those [TPS reports][1] for your boss, Lumbergh. Why not play Emacss Zork-like text adventure game to take your mind off the tedium of work?
But seriously, yes, there are both games and quirky playthings in Emacs. Some you have probably heard of or played before. The only thing they have in common is that most of them were added a long time ago: some are rather odd inclusions (as youll see below) and others were clearly written by bored employees or graduate students. What they all have in common is a whimsy and a casualness that I rarely see in Emacs today. Emacs is Serious Business now in a way that it probably wasnt back in the 1980s when some of these games were written.
### Tower of Hanoi
The [Tower of Hanoi][2] is an ancient mathematical puzzle game and one that is probably familiar to some of us as it is often used in Computer Science as a teaching aid because of its recursive and iterative solutions.
![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png)
In Emacs there are three commands you can run to trigger the Tower of Hanoi puzzle: M-x hanoi with a default of 3 discs; M-x hanoi-unix and M-x hanoi-unix-64 uses the unix timestamp, making a move each second in line with the clock, and with the latter pretending it uses a 64-bit clock.
The Tower of Hanoi implementation in Emacs dates from the mid 1980s — an awful long time ago indeed. There are a few Customize options (M-x customize-group RET hanoi RET) such as enabling colorized discs. And when you exit the Hanoi buffer or type a character you are treated to a sarcastic goodbye message (see above.)
### 5x5
![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png)
The 5x5 game is a logic puzzle: you are given a 5x5 grid with a central cross already filled-in; your goal is to fill all the cells by toggling them on and off in the right order to win. Its not as easy as it sounds!
To play, type M-x 5x5, and with an optional digit argument you can change the size of the grid. What makes this game interesting is its rather complex ability to suggest the next move and attempt to solve the game grid. It uses Emacss very own, and very cool, symbolic RPN calculator M-x calc (and in [Fun with Emacs Calc][3] I use it to solve a simple problem.)
So what I like about this game is that it comes with a very complex solver really, you should read the source code with M-x find-library RET 5x5 and a “cracker” that attempts to brute force solutions to the game.
Try creating a bigger game grid, such as M-10 M-x 5x5, and then run one of the crack commands below. The crackers will attempt to iterate their way to the best solution. This runs in real time and is fun to watch:
`M-x 5x5-crack-mutating-best`
Attempt to crack 5x5 by mutating the best solution.
`M-x 5x5-crack-mutating-current`
Attempt to crack 5x5 by mutating the current solution.
`M-x 5x5-crack-randomly`
Attempt to crack 5x5 using random solutions.
`M-x 5x5-crack-xor-mutate`
Attempt to crack 5x5 by xoring the current and best solution.
### Text Animation
You can display a fancy birthday present animation by running M-x animate-birthday-present and giving it your name. It looks rather cool!
![xkcd](https://imgs.xkcd.com/comics/real_programmers.png)
The animate package is also used by M-x butterfly command, a command added to Emacs as an homage to the [XKCD][4] strip above. Of course the Emacs command in the strip is teeechnically not valid but the humor more than makes up for it.
### Blackbox
The objective of this game I am going to quote literally:
> The object of the game is to find four hidden balls by shooting rays into the black box. There are four possibilities: 1) the ray will pass thru the box undisturbed, 2) it will hit a ball and be absorbed, 3) it will be deflected and exit the box, or 4) be deflected immediately, not even being allowed entry into the box.
So, its a bit like the [Battleship][5] most of us played as kids but… for people with advanced degrees in physics?
Its another game that was added back in the 1980s. I suggest you read the extensive documentation on how to play by typing C-h f blackbox.
### Bubbles
![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png)
The M-x bubbles game is rather simple: you must clear out as many “bubbles” as you can in as few moves as possible. When you remove bubbles the other bubbles drop and stick together. Its a fun game that, as an added bonus, comes with graphics if you use Emacss GUI. It also works with your mouse.
You can configure the difficulty of the game by calling M-x bubbles-set-game- where is one of: easy, medium, difficult, hard, or userdefined. Furthermore, you can alter the graphics, grid size and colors using Customize: M-x customize-group bubbles.
For its simplicity and fun factor, this ranks as one of my favorite games in Emacs.
### Fortune & Cookie
I like the fortune command. Snarky, unhelpful and often sarcastic “advice” mixed in with literature and riddles brightens up my day whenever I launch a new shell.
Rather confusingly there are two packages in Emacs that does more-or-less the same thing: fortune and cookie1. The former is geared towards putting fortune cookie messages in email signatures and the latter is just a simple reader for the fortune format.
Anyway, to use Emacss cookie1 package you must first tell it where to find the file by customizing the variable cookie-file with customize-option RET cookie RET.
If youre on Ubuntu you will have to install the fortune package first. The files are found in the /usr/share/games/fortunes/ directory.
You can then call M-x cookie or, should you want to do this, find all matching cookies with M-x cookie-apropos.
### Decipher
This package perfectly captures the utilitarian nature of Emacs: its a package to help you break simple substitution ciphers (like cryptogram puzzles) using a helpful user interface. You just know that more than twenty years ago someone really had a dire need to break a lot of basic ciphers. Its little things like this module that makes me overjoyed to use Emacs: a module of scant importance to all but a few people and, yet, should you need it there it is.
So how do you use it then? Well, lets consider the “rot13” cipher: rotating characters by 13 places in a 26-character alphabet. Its an easy thing to try out in Emacs with M-x ielm, Emacss REPL for [Evaluating Elisp][6]:
```
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (rot13 "Hello, World")
"Uryyb, Jbeyq"
ELISP> (rot13 "Uryyb, Jbeyq")
"Hello, World"
ELISP>
```
So how can the decipher module help us here? Well, create a new buffer test-cipher and type in your cipher text (in my case Uryyb, Jbeyq)
![cipher](https://www.masteringemacs.org/static/uploads/cipher.png)
Youre now presented with a rather complex interface. You can now place the point on any of the characters in the ciphertext on the purple line and guess what the character might be: Emacs will update the rest of the plaintext guess with your choices and tell you how the characters in the alphabet have been allocated thus far.
You can then start winnowing down the options using various helper commands to help infer which cipher characters might correspond to which plaintext character:
`D`
Shows a list of digrams (two-character combinations from the cipher) and their frequency
`F`
Shows the frequency of each ciphertext letter
`N`
Shows adjacency of characters. I am not entirely sure how this works.
`M` and `R`
Save and restore a checkpoint, allowing you to branch your work and explore different ways of cracking the cipher.
All in all, for such an esoteric task, this package is rather impressive! If you regularly solve cryptograms maybe this package can help?
### Doctor
![doctor](https://www.masteringemacs.org/static/uploads/doctor.png)
Ah, the Emacs doctor. Based on the original [ELIZA][7] the “Doctor” tries to psychoanalyze what you say and attempts to repeat the question back to you. Rather fun, for a few minutes, and one of the more famous Emacs oddities. You can run it with M-x doctor.
### Dunnet
Emacss very own Zork-like text adventure game. To play it, type M-x dunnet. Its rather good, if short, but its another rather famous Emacs game that too few have actually played through to the end.
If you find yourself with time to kill between your TPS reports then its a great game with a built-in “boss screen” as its text-only.
Oh, and, dont try to eat the CPU card :)
### Gomoku
![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png)
Another game written in the 1980s. You have to connect 5 squares, tic-tac-toe style. You can play against Emacs with M-x gomoku. The game also supports the mouse, which is rather handy. You can customize the group gomoku to adjust the size of the grid.
### Game of Life
[Conways Game of Life][8] is a famous example of cellular automata. The Emacs version comes with a handful of starting patterns that you can (programmatically with elisp) alter by adjusting the life-patterns variable.
You can trigger a game of life with M-x life. The fact that the whole thing, display code, comments and all, come in at less than 300 characters is also rather impressive.
### Pong, Snake and Tetris
![tetris](https://www.masteringemacs.org/static/uploads/tetris.png)
These classic games are all implemented using the Emacs package gamegrid, a generic framework for building grid-based games like Tetris and Snake. The great thing about the gamegrid package is its compatibility with both graphical and terminal Emacs: if you run Emacs in a GUI you get fancy graphics; if you dont, you get simple ASCII art.
You can run the games by typing M-x pong, M-x snake, or M-x tetris.
The Tetris game in particular is rather faithfully implemented, having both gradual speed increase and the ability to slide blocks into place. And given you have the code to it, you can finally remove that annoying Z-shaped piece no one likes!
### Solitaire
![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png)
This is not the card game, unfortunately. But a peg-based game where you have to end up with just one stone on the board, by taking a stone (the o) and “jumping” over an adjacent stone into the hole (the .), removing the stone you jumped over in the process. Rinse and repeat until the board is empty.
There is a handy solver built in called M-x solitaire-solve if you get stuck.
### Zone
Another of my favorites. This times its a screensaver or rather, a series of screensavers.
Type M-x zone and watch what happens to your screen!
You can configure a screensaver idle time by running M-x zone-when-idle (or calling it from elisp) with an idle time in seconds. You can turn it off with M-x zone-leave-me-alone.
This ones guaranteed to make your coworkers freak out if it kicks off while they are looking.
### Multiplication Puzzle
![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png)
This is another brain-twisting puzzle game. When you run M-x mpuz you are given a multiplication puzzle where you have to replace the letters with numbers and ensure the numbers add (multiply?) up.
You can run M-x mpuz-show-solution to solve the puzzle if you get stuck.
### Miscellaneous
There are more, but theyre not the most useful or interesting:
* You can translate a region into morse code with M-x morse-region and M-x unmorse-region.
* The Dissociated Press is a very simple command that applies something like a random walk markov-chain generator to a body of text in a buffer and generates nonsensical text from the source body. Try it with M-x dissociated-press.
* The Gamegrid package is a generic framework for building grid-based games. So far only Tetris, Pong and Snake use it. Its called gamegrid.
* The gametree package is a complex way of notating and tracking chess games played via email.
* The M-x spook command inserts random words (usually into emails) designed to confuse/overload the “NSA trunk trawler” and keep in mind this module dates from the 1980s and 1990s with various words the spooks are supposedly listening for. Of course, even ten years ago that wouldve seemed awfully paranoid and quaint but not so much any more…
### Conclusion
I love the games and playthings that ship with Emacs. A lot of them date from, well, lets just call a different era: an era where whimsy was allowed or perhaps even encouraged. Some are known classics (like Tetris and Tower of Hanoi) and some of the others are fun variations on classics (like blackbox) — and yet I love that they ship with Emacs after all these years. I wonder if any of these would make it into Emacss codebase today; well, they probably wouldnt — theyd be relegated to the package manager where, in a clean and sterile world, they no doubt belong.
Theres a mandate in Emacs to move things not essential to the Emacs experience to ELPA, the package manager. I mean, as a developer myself, that does make sense, but… surely for every package removed and exiled to ELPA we chip away the essence of what defines Emacs?
--------------------------------------------------------------------------------
via: https://www.masteringemacs.org/article/fun-games-in-emacs
作者:[Mickey Petersen][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.masteringemacs.org/about
[b]:https://github.com/lujun9972
[1]:https://en.wikipedia.org/wiki/Office_Space
[2]:https://en.wikipedia.org/wiki/Tower_of_Hanoi
[3]:https://www.masteringemacs.org/article/fun-emacs-calc
[4]:http://www.xkcd.com
[5]:https://en.wikipedia.org/wiki/Battleship_(game)
[6]:https://www.masteringemacs.org/article/evaluating-elisp-emacs
[7]:https://en.wikipedia.org/wiki/ELIZA
[8]:https://en.wikipedia.org/wiki/Conway's_Game_of_Life

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (heguangzhi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
@ -38,7 +38,7 @@ via: https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compu
作者:[Swapnil Bhartiya][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[heguangzhi](https://github.com/heguangzhi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出