mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
0497362dce
@ -0,0 +1,159 @@
|
||||
Linux 下如何避免重复性压迫损伤(RSI)
|
||||
======
|
||||
|
||||
![workrave-image][1]
|
||||
|
||||
<ruby>[重复性压迫损伤][2]<rt>Repetitive Strain Injury</rt></ruby>(RSI)是职业性损伤综合症,非特异性手臂疼痛或工作引起的上肢障碍。RSI 是由于过度使用双手从事重复性任务导致的,如打字、书写和使用鼠标. 不幸的是,大部分人不了解什么是 RSI 以及它的危害有多大。你可以使用名叫 Workrave 的开源软件轻松的预防 RSI。
|
||||
|
||||
### RSI 有哪些症状?
|
||||
|
||||
我从这个[页面][3]引用过来的,看看哪些你被说中了:
|
||||
|
||||
1. 疲惫缺乏忍耐力?
|
||||
2. 手掌及上肢乏力
|
||||
3. 疼痛麻木甚至失去知觉?
|
||||
4. 沉重:你有没有感觉手很沉?
|
||||
5. 笨拙: 你有没有感觉抓不紧东西?
|
||||
6. 你有没有感觉手上无力?很难打开罐子或切菜无力?
|
||||
7. 缺乏协调和控制?
|
||||
8. 手总是冰凉的?
|
||||
9. 健康意识有待提高?稍不注意身体就发现有毛病了。
|
||||
10. 是否过敏?
|
||||
11. 频繁的自我按摩(潜意识的)?
|
||||
12. 共鸣的疼痛?当别人在谈论手痛的时候,你是否也感觉到了手疼?
|
||||
|
||||
### 如何减少发展为 RSI 的风险
|
||||
|
||||
* 使用计算机的时候每隔 30 分钟间隔休息一下。借助软件如 workrave 预防 RSI。
|
||||
* 有规律的锻炼可以预防各种损伤,包括 RSI。
|
||||
* 使用合理的姿势。调整你的电脑桌和椅子使身体保持一个肌肉放松状态。
|
||||
|
||||
### Workrave
|
||||
|
||||
Workrave 是一款预防计算机用户发展为 RSI 或近视的自由开源软件。软件会定期锁屏为一个动画: “Workrave 小姐”,引导用户做各种伸展运动并敦促其休息一下。这个软件经常提醒你暂停休息一下,并限制你每天的限度。程序可以运行在 MS-Window、Linux 以及类 UNIX 操作系统下。
|
||||
|
||||
#### 安装 workrave
|
||||
|
||||
在 Debian/Ubuntu Linux 系统运行以下 [apt 命令][4]/[apt-get 命令][5]:
|
||||
|
||||
```
|
||||
$ sudo apt-get install workrave
|
||||
```
|
||||
|
||||
Fedora Linux 发行版用户运行以下 dnf 命令:
|
||||
|
||||
```
|
||||
$ sudo dnf install workrave
|
||||
```
|
||||
|
||||
RHEL/CentOS Linux 用户可以启动 EPEL 仓库并用 [yum 命令][6]安装:
|
||||
|
||||
```
|
||||
### [ **在CentOS/RHEL 7.x 及衍生版本上测试** ] ###
|
||||
$ sudo yum install epel-release
|
||||
$ sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
|
||||
$ sudo yum install workrave
|
||||
```
|
||||
|
||||
Arch Linux 用户运行以下 pacman 命令来安装:
|
||||
|
||||
```
|
||||
$ sudo pacman -S workrave
|
||||
```
|
||||
|
||||
FreeBSD 用户可用以下 pkg 命令安装:
|
||||
|
||||
```
|
||||
# pkg install workrave
|
||||
```
|
||||
|
||||
OpenBSD 用户可用以下 pkg_add 命令安装:
|
||||
|
||||
```
|
||||
$ doas pkg_add workrave
|
||||
```
|
||||
|
||||
#### 如何配置 workrave
|
||||
|
||||
Workrave 以一个小程序运行,它的用户界面位于面板中。你可以为 workrave 增加一个面板来控制软件的动作和外观。
|
||||
|
||||
增加一个新 workrave 对象到面板:
|
||||
|
||||
* 在面板空白区域右键,打开面板弹出菜单
|
||||
* 选择新增到面板
|
||||
* 新增面板对话框打开,在加载器顶部,可以看到可用的面板对象按照字母排列。选中 workrave 程序并单击新增。
|
||||
|
||||
![图 01:新增 workrave 对象到面板][7]
|
||||
|
||||
*图 01:新增 workrave 对象到面板*
|
||||
|
||||
如果修改 workrave 对象的属性,执行以下步骤:
|
||||
|
||||
* 右键 workrave 对象打开面板对象弹出
|
||||
* 选中偏好。使用属性对话框修改对应属性
|
||||
|
||||
![图 02:修改 Workrave 对象属性](https://www.cyberciti.biz/media/new/tips/2009/11/linux-gnome-workwave-preferences-.png)
|
||||
|
||||
*图 02:修改 Workrave 对象属性*
|
||||
|
||||
#### Workrave 运行展示
|
||||
|
||||
主窗口显示下一次提醒休息的剩余时间,这个窗口可以关闭,时间提示窗口会显示在面板上。
|
||||
|
||||
![图 03:时间计数器][8]
|
||||
|
||||
*图 03:时间计数器*
|
||||
|
||||
![图 04:Workrave 小姐 - 引导你做伸展运动的动画][9]
|
||||
|
||||
*图 04:Workrave 小姐 - 引导你做伸展运动的动画*
|
||||
|
||||
休息提示窗口,请求你暂停一下工作:
|
||||
|
||||
![图 05:休息提示倒计时][10]
|
||||
|
||||
*图 05:休息提示倒计时*
|
||||
|
||||
![图 06:你可以跳过休息][11]
|
||||
|
||||
*图 06:你可以跳过休息*
|
||||
|
||||
#### 参考链接:
|
||||
|
||||
1. [Workrave 项目][12] 主页
|
||||
2. [pokoy][13] 防止 RSI 和其他计算机压力的轻量级守护进程
|
||||
3. GNOME3 下的 [Pomodoro][14] 计数器
|
||||
4. [RSI][2] 的维基百科
|
||||
|
||||
### 关于作者
|
||||
|
||||
作者是 nixCraft 创始人,经验丰富的系统管理员,同时也是一个 Linux/Unix 系统下的 shell 脚本培训师。他曾服务于全球客户,并与多个行业合作包括 IT、教育、国防和航天研究,以及非盈利机构。可以在 [Twitter][15]、[Facebook][16]、[Google+][17] 上关注他。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.cyberciti.biz/tips/repetitive-strain-injury-prevention-software.html
|
||||
|
||||
作者:[Vivek Gite][a]
|
||||
译者:[guevaraya](https://github.com/guevaraya)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.cyberciti.biz/
|
||||
[1]:https://www.cyberciti.biz/media/new/tips/2009/11/workrave-image.jpg
|
||||
[2]:https://en.wikipedia.org/wiki/Repetitive_strain_injury
|
||||
[3]:https://web.eecs.umich.edu/~cscott/rsi.html##symptoms
|
||||
[4]:https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/
|
||||
[5]:https://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html
|
||||
[6]:https://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/
|
||||
[7]:https://www.cyberciti.biz/media/new/tips/2009/11/add-workwave-to-panel.png
|
||||
[8]:https://www.cyberciti.biz/media/new/tips/2009/11/screenshot-workrave.png
|
||||
[9]:https://www.cyberciti.biz/media/new/tips/2009/11/miss-workrave.png
|
||||
[10]:https://www.cyberciti.biz/media/new/tips/2009/11/time-for-micro-pause.gif
|
||||
[11]:https://www.cyberciti.biz/media/new/tips/2009/11/Micro-break.png
|
||||
[12]:http://www.workrave.org/
|
||||
[13]:https://github.com/ttygde/pokoy
|
||||
[14]:http://gnomepomodoro.org
|
||||
[15]:https://twitter.com/nixcraft
|
||||
[16]:https://facebook.com/nixcraft
|
||||
[17]:https://plus.google.com/+CybercitiBiz
|
140
published/20181212 Top 5 configuration management tools.md
Normal file
140
published/20181212 Top 5 configuration management tools.md
Normal file
@ -0,0 +1,140 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10497-1.html)
|
||||
[#]: subject: (Top 5 configuration management tools)
|
||||
[#]: via: (https://opensource.com/article/18/12/configuration-management-tools)
|
||||
[#]: author: (Marco Bravo https://opensource.com/users/marcobravo)
|
||||
|
||||
五大最流行的配置管理工具
|
||||
======
|
||||
|
||||
> 了解一下配置管理工具,以找出哪个最适合你的 DevOps 组织。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M)
|
||||
|
||||
DevOps 正因为有提高产品质量、缩短产品开发时间等优势,目前备受业界关注,同时也在长足发展当中。
|
||||
|
||||
[DevOps 的核心价值观][1]是<ruby>团队文化<rt>Culture</rt></ruby>、<ruby>自动化<rt>Automation</rt></ruby>、<ruby>评估<rt>Measurement</rt></ruby>和<ruby>分享<rt>Sharing</rt></ruby>(CAMS),同时,团队对 DevOps 的执行力也是 DevOps 能否成功的重要因素。
|
||||
|
||||
* **团队文化**让大家团结一致;
|
||||
* **自动化**是 DevOps 的基础;
|
||||
* **评估**保证了及时的改进;
|
||||
* **分享**让 CAMS 成为一个完整的循环过程。
|
||||
|
||||
DevOps 的另一个思想是任何东西,包括服务器、数据库、网络、日志文件、应用配置、文档、自动化测试、部署流程等,都可以通过代码来管理。
|
||||
|
||||
在本文中,我主要介绍配置管理的自动化。配置管理工具作为[<ruby>基础架构即代码<rt>Infrastructure as Code</rt></ruby>][2](IaC)的一部分,支持使用经过测试和验证的软件开发实践,通过明文定义文件管理和配置数据中心。
|
||||
|
||||
DevOps 团队只需要通过操作简单的配置文件,就可以实现应用开发中包括版本控制、测试、小型部署、设计模式在内的这些最佳实践。总而言之,配置管理工具实现了通过编写代码来使基础架构的配置和管理变得自动化。
|
||||
|
||||
### 为什么要使用配置管理工具?
|
||||
|
||||
配置管理工具可以提高应用部署和变更的效率,还可以让这些流程变得可重用、可扩展、可预测,甚至让它们维持在期望的状态,从而让资产的可控性提高。
|
||||
|
||||
使用配置管理工具的优势还包括:
|
||||
|
||||
* 让代码遵守编码规范,提高代码可读性;
|
||||
* 具有<ruby>幂等性<rt>Idempotency</rt></ruby>,也就是说,无论执行多少次重复的配置管理操作,得到的结果都是一致的;
|
||||
* 分布式的设计可以方便地管理大量的远程服务器。
|
||||
|
||||
配置管理工具主要分为<ruby>拉取<rt>pull</rt></ruby>模式和<ruby>推送<rt>push</rt></ruby>模式。拉取模式是指安装在各台服务器上的<ruby>代理<rt>agent</rt></ruby>定期从<ruby>中央存储库<rt>central repository</rt></ruby>拉取最新的配置并应用到对应的服务器上;而推送模式则由<ruby>中央服务器<rt>central server</rt></ruby>的中央服务器会触发其它受管服务器的更新。
|
||||
|
||||
### 五大最流行的配置管理工具
|
||||
|
||||
目前配置管理工具有很多,不同的配置管理工具都有自己最适合的使用场景。而对于下面五个我按照字母顺序列出的配置管理工具,都对 DevOps 有明显的帮助:全都具有开源许可证、使用外部配置文件、支持无人值守运行、可以通过脚本自定义运行。下面对它们的介绍都来源于它们的软件库和官网内容。
|
||||
|
||||
#### Ansible
|
||||
|
||||
“Ansible 是一个极其简洁的 IT 自动化平台,可以让你的应用和系统以更简单的方式部署。不需要安装任何代理,只需要使用 SSH 的方式和简单的语言,就可以免去脚本或代码部署应用的过程。”——[GitHub Ansible 代码库][3]
|
||||
|
||||
- [官网](https://www.ansible.com/)
|
||||
- [文档](https://docs.ansible.com/ansible/)
|
||||
- [社区](https://www.ansible.com/community)
|
||||
|
||||
Ansible 是我最喜欢的工具之一,我在几年前就开始使用了。你可以使用 Ansible 在命令行中让多个服务器执行同一个命令,也可以使用 YAML 格式的<ruby>剧本<rt>playbook</rt></ruby>来让它自动执行特定的操作,这促进了技术团队和非技术团队之间的沟通。简洁、无代理、配置文件对非技术人员友好是它的几个主要优点。
|
||||
|
||||
由于 Ansible 不需要代理,因此对服务器的资源消耗会很少。Ansible 默认使用的推送模式需要借助 SSH 连接,但 Ansible 也支持拉取模式。[剧本][4] 可以使用最少的命令集编写,当然也可以扩展为更加精细的自动化任务,包括引入角色、变量和其它人写的模块。
|
||||
|
||||
你可以将 Ansible 和其它工具(包括 Ansible Works、Jenkins、RunDeck、[ARA][5] 等)结合起来使用,因为这些工具 [提供了运行剧本时的可追溯性][6],这样就可以创建控制流程的中央控制台。
|
||||
|
||||
### CFEngine
|
||||
|
||||
“CFEngine 3 是一个流行的开源配置管理系统,它主要用于为大规模的系统提供自动化配置和维护。”——[GitHub CFEngine 代码库][7]
|
||||
|
||||
- [官网](https://cfengine.com/)
|
||||
- [文档](https://docs.cfengine.com/docs/3.12/)
|
||||
- [社区](https://cfengine.com/community/)
|
||||
|
||||
CFEngine 最早在 1993 年由 Mark Burgess 作为自动配置管理的科学方法提出,目的是降低计算机系统配置中的熵,最终收敛到期望的配置状态,同时还阐述了幂等性是让系统达到期望状态的能力。Burgess 在 2004 年又提出了<ruby>[承诺理论][8]<rt>Promise Theory</rt></ruby>,这个理论描述了代理之间自发合作的模型。
|
||||
|
||||
CFEngine 的最新版本已经用到了承诺理论,在各个服务器上的代理程序会从中央存储库拉取配置。CFEngine 的配置对专业技能要求较高,因此它比较适合技术团队使用。
|
||||
|
||||
### Chef
|
||||
|
||||
“为整个基础架构在配置管理上带来便利的一个系统集成框架。”——[GitHub Chef 代码库][9]
|
||||
|
||||
- [官网](http://www.chef.io/chef/)
|
||||
- [文档](https://docs.chef.io/)
|
||||
- [社区](https://www.chef.io/community/)
|
||||
|
||||
Chef 通过由 Ruby 编写的“<ruby>菜谱<rt>recipe</rt></ruby>”来让你的基础架构保持在最新、最兼容的状态,这些“菜谱”描述了一系列应处于某种状态的资源。Chef 既可以通过客户端-服务端的模式运行,也可以在 [chef-solo][10] 这种独立配置的模式下运行。大部分云提供商都很好地集成了 Chef,因此可以使用它为新机器做自动配置。
|
||||
|
||||
Chef 有广泛的用户基础,同时也提供了完备的工具包,让不同技术背景的团队可以通过“菜谱”进行沟通。尽管如此,它仍然算是一个技术导向的工具。
|
||||
|
||||
### Puppet
|
||||
|
||||
“Puppet 是一个可以在 Linux、Unix 和 Windows 系统上运行的自动化管理引擎,它可以根据集中的规范来执行诸如添加用户、安装软件包、更新服务器配置等等管理任务。”——[GitHub Puppet 代码库][11]
|
||||
|
||||
- [官网](https://puppet.com/)
|
||||
- [文档](https://puppet.com/docs)
|
||||
- [社区](https://puppet.com/community)
|
||||
|
||||
Puppet 作为一款面向运维工程师和系统管理员的工具,在更多情况下是作为配置管理工具来使用。它通过客户端-服务端的模式工作,使用代理从主服务器获取配置指令。
|
||||
|
||||
Puppet 使用<ruby>声明式语言<rt>declarative language</rt></ruby>或 Ruby 来描述系统配置。它包含了不同的模块,并使用<ruby>清单文件<rt>manifest files</rt></ruby>记录期望达到的目标状态。Puppet 默认使用推送模式,但也支持拉取模式。
|
||||
|
||||
### Salt
|
||||
|
||||
“为大规模基础结构或应用程序实现自动化管理的软件。”——[GitHub Salt 代码库][12]
|
||||
|
||||
- [官网](https://www.saltstack.com/)
|
||||
- [文档](https://docs.saltstack.com/en/latest/contents.html)
|
||||
- [社区](https://www.saltstack.com/resources/community/)
|
||||
|
||||
Salt 的专长就是快速收集数据,即使是上万台服务器也能够轻松完成任务。它使用 Python 模块来管理配置信息和执行特定的操作,这些模块可以让 Salt 实现所有远程操作和状态管理。但配置 Salt 模块对技术水平有一定的要求。
|
||||
|
||||
Salt 使用客户端-服务端的结构(Salt minions 是客户端,而 Salt master 是服务端),并以 Salt 状态文件记录需要达到的目标状态。
|
||||
|
||||
### 总结
|
||||
|
||||
DevOps 工具领域一直在发展,因此必须时刻关注其中的最新动态。希望这篇文章能够鼓励读者进一步探索相关的概念和工具。为此,<ruby>云原生计算基金会<rt>Cloud Native Computing Foundation</rt></ruby>(CNCF)在 [Cloud Native Landscape Project][13] 中也提供了很好的参考案例。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/12/configuration-management-tools
|
||||
|
||||
作者:[Marco Bravo][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/marcobravo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.oreilly.com/learning/why-use-terraform
|
||||
[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html
|
||||
[3]: https://github.com/ansible/ansible
|
||||
[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try
|
||||
[5]: https://github.com/openstack/ara
|
||||
[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara
|
||||
[7]: https://github.com/cfengine/core
|
||||
[8]: https://en.wikipedia.org/wiki/Promise_theory
|
||||
[9]: https://github.com/chef/chef
|
||||
[10]: https://docs.chef.io/chef_solo.html
|
||||
[11]: https://github.com/puppetlabs/puppet
|
||||
[12]: https://github.com/saltstack/salt
|
||||
[13]: https://github.com/cncf/landscape
|
||||
|
144
published/201901/20150717 The History of Hello World.md
Normal file
144
published/201901/20150717 The History of Hello World.md
Normal file
@ -0,0 +1,144 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "zzzzzzmj"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-10485-1.html"
|
||||
[#]: subject: "The History of Hello World"
|
||||
[#]: via: "https://www.thesoftwareguild.com/blog/the-history-of-hello-world/"
|
||||
[#]: author: "thussong https://www.thesoftwareguild.com/blog/author/thussong/"
|
||||
|
||||
Hello World 的由来
|
||||
=========
|
||||
|
||||
资深软件开发人员都知道 [Hello World][2] 程序,这是一个能在设备显示器上输出某种变体的 “Hello, World!” 的程序,是学习编程的第一步。在这个编程中只涉及到一些最基本语法的程序,可以用大多数编程语言了来编写。事实上,路易斯安纳理工学院计算机协会(ACM)在最近统计[发现][3]这个程序至少有 204 个版本。
|
||||
|
||||
传统意义上,Hello World 程序是用于说明编码过程是如何工作的,以及确保编程语言或系统能正常运行。它们经常是新手程序员学习的第一个程序,因为即使是经验很少或者没有经验的人也能轻松正确的执行 Hello World。
|
||||
|
||||
首先,Hello World 简单,这就是为什么它经常被用做程序执行成功的晴雨表。如果 Hello World 在该框架中无法有效执行,那么其它更复杂的程序中也可能会失败。正如 [Win-Vector][4] 的一位专家所说,Hello World 实际上是一个对抗性程序。“该作者还说道,‘你的计算机系统能不能工作并不是一目了然,除非我能看到它至少能打印一行文字,否则我不会在上面浪费太多时间。’” Win-Vector 博主 John Mount 说。
|
||||
|
||||
但是这个两词短语在计算机科学领域有着重大的影响。以 Hello World 为基础,新手程序员可以轻松的理解计算机科学原理或元素,而拥有多年编码经验的程序员可以用它来学习编程语言的工作原理,特别是在结构与语法方面。这样的一个小程序,在任何难度的应用程序和几乎所有语言中都有着悠久的历史。
|
||||
|
||||
### 用途
|
||||
|
||||
以上概括了 Hello World 程序的主要用途:这是新手程序员熟悉新语言的一种方式。然而,这些程序不仅仅是对编码世界的介绍。例如,Hello World 可以作为测试,以确保语言的组件(编译器、开发和运行环境)安装正确。因为配置完整的编程工具链的过程复杂而漫长,所以像 Hello World 这样简单的程序通常用作新工具链的首次运行测试。
|
||||
|
||||
根据 Cunningham & Cunningham(C2)的编程顾问所说,在系统设计人员并不预期可以执行代码的地方,黑客经常使用 Hello World 程序作为一个可以通过漏洞执行任意代码的概念验证(POC)。事实上,它是在设备上使用自制内容或者“自酿”的第一步,当[有经验的编码人员][5]正在配置环境或在学习新事物时,他们会通过 Hello World 来验证其行为是否正确。
|
||||
|
||||
它也作为调试过程的一部分,允许程序员检查他们是否正确地编辑了可在运行时修改的程序并重新加载。
|
||||
|
||||
Hello World 的一个更常用的用途是作为基础比较。根据 C2 的 wiki 所讲,程序员可以“比较语言生成的可执行文件的大小,以及程序背后必须存在多少支持的基础设施才能执行。”
|
||||
|
||||
### 开端
|
||||
|
||||
虽然 Hello World 的起源还有些不太明了,不过人们普遍认为它作为测试用语,最早出现在 Brian Kernigham 在 1972 年发布的《<ruby>B 语言简介教程<rt>A Tutorial Introduction to the Language B</rt></ruby>》中。在此文中,该程序的第一个已知版本用于说明外部变量。因为该教程中的前一个例子在终端上打印了 “hi!”,而需要更多的字符常量来表达相对复杂的 “hello,world!”,这是学习过程的下一步。
|
||||
|
||||
在那以后,它还被用于 1974 年的贝尔实验室备忘录,以及 1987 年的《<ruby>C 语言程序设计<rt>The C Programming Language</rt></ruby>》。这两篇著名的文字是让 Hello World 闻名于世的主要原因。在书中的一个例子(第一个,也是最著名的例子)打印了没有大写字母和感叹号的 “hello,world”。此时的 Hello World 几乎只是用于说明语言的一些功能,而不是测试系统是否正常运行。
|
||||
|
||||
在 Kernigham 的关于 B 语言和 C 语言的开创性文章之前,没有真正意义上的第一个程序,甚至直到 1974 年,它也没被广泛使用。著名的 BASIC 教程 “<ruby>我的电脑喜欢我用 BASIC 跟它讲话<rt>My Computer Likes Me,When I Speak BASIC</rt></ruby>”,从一个写一行文本的简单程序开始,不过那句话是 “MY HUMAN UNDERSTANDS ME”,跟如今程序员侃侃而谈的这个双词问候语差的有点远。不过,当 Hello World 被发明后,它就迅速传播,并在 20 世纪 70 年代后变成了众所周知。直到今天它也依然受欢迎。
|
||||
|
||||
### 一个声明,多种语言
|
||||
|
||||
以下是目前正在被使用的一些流行的编程语言中的 Hello World 代码。
|
||||
|
||||
#### Java
|
||||
|
||||
```
|
||||
class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, world!");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### C#
|
||||
|
||||
```
|
||||
using System;
|
||||
class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, world!");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Python
|
||||
|
||||
```
|
||||
print("Hello, world!")
|
||||
```
|
||||
|
||||
#### Ruby
|
||||
|
||||
```
|
||||
puts "Hello, world!"
|
||||
```
|
||||
|
||||
#### Scala
|
||||
|
||||
```
|
||||
object HelloWorld extends App {
|
||||
println("Hello, world!")
|
||||
}
|
||||
```
|
||||
|
||||
#### ASP.NET
|
||||
|
||||
```
|
||||
Response.Write("Hello World!");
|
||||
```
|
||||
|
||||
#### Lisp
|
||||
|
||||
```
|
||||
(princ "Hello, world!")
|
||||
```
|
||||
|
||||
#### Haskell
|
||||
|
||||
```
|
||||
main = putStrLn "Hello, world!"
|
||||
```
|
||||
|
||||
#### Malbolge
|
||||
|
||||
```
|
||||
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
|
||||
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>
|
||||
```
|
||||
|
||||
#### Go
|
||||
|
||||
```
|
||||
package main
|
||||
import "fmt"
|
||||
func main() {
|
||||
fmt.Println("Hello, world!")
|
||||
}
|
||||
```
|
||||
|
||||
### 如今的 Hello world:各种形式下的标准实践
|
||||
|
||||
在现在的编程语言中,Hello World 有着不同的复杂程度。例如,Go 语言中引入一个多语言版的 Hello World 程序,XL 则会提供一个具有图形、可旋转的 3D 版本。一些编程语言,像 Ruby、Python,仅仅需要一个语句去打印“Hello World”,但是低级汇编语言则需要几个命令才能做到这样。现在的编程语言还引入对标点符号和大小写的变化,包括是否有逗号或者感叹号,以及两个词的大写形式。举个例子,当系统只支持大写字母,会呈现像“HELLO WORLD”的短语。值得纪念的第一个 Malbolge 程序打印出了“HEllO WORld”(LCTT 译注:Malbolge 是最难的编程语言之一。事实上,在它诞生后,花了 2 年时间才完成第一个 Malbolge 程序)。它的变体跨越了原本的字面意思。像 Lisp、Haskell 这样函数语言,用阶乘程序替代了 Hello World,从而注重递归技术。这与原来的示例不同,后者更强调 I/O 以及产生的副作用。
|
||||
|
||||
随着现在的编程语言越来越复杂,Hello World 比以往显得更加重要。作为测试和教学工具,它已经成为程序员测试配置的编程环境的标准方法。没有人能确切说出为什么 Hello World 能在快速创新著称的行业中经受住时间的考验,但是它又确实留下来了。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/
|
||||
|
||||
作者:[thussong][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[zzzzzzmj](https://github.com/zzzzzzmj)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.thesoftwareguild.com/blog/author/thussong/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World
|
||||
[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program
|
||||
[3]: http://whatis.techtarget.com/definition/Hello-World
|
||||
[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/
|
||||
[5]: http://c2.com/cgi/wiki?HelloWorld
|
100
published/201901/20171222 10 keys to quick game development.md
Normal file
100
published/201901/20171222 10 keys to quick game development.md
Normal file
@ -0,0 +1,100 @@
|
||||
快速开发游戏的十个关键
|
||||
======
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb)
|
||||
|
||||
十月初,由 Opensource.com 赞助的首届 [Open Jam][1] 吸引了来自世界各地的团队的 45 个参赛项目。这些队伍只用了三天时间就用开源软件制作出一个游戏来参与角逐,[有三支队伍取得了胜利][2]。
|
||||
|
||||
我们在我们的大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。我们预留了周末的计算机实验室,并教大家使用开源软件来创建游戏和游戏素材:游戏引擎:[Godot][3]、音乐:[LMMS][4]、2D 素材:[GIMP][5]、3D 素材:[Blender][6]。我们的活动产出了三个游戏:[Loathsome][7]、[Lost Artist][8] 和 [Paint Rider][9](我做的)。
|
||||
|
||||
根据我在游戏开发和游戏开发方面的经验,这里有 10 条关于游戏引擎、编码和快速游戏开发的经验教训。
|
||||
|
||||
### 1、限定规模
|
||||
|
||||
很容易想要去做一个规模宏大的冒险游戏或者可以比拟你最喜欢的游戏的东西。如果你有一些经验,追求超乎游戏 Jam 活动的东西可能很酷,但不要高估自己拥有的时间。我欣赏游戏 Jam 活动的一点是它强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要的原因。
|
||||
|
||||
这个 Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏适合该主题。一个想法就是做玩家能在敌人身上留下伤痕的 3D 拳击游戏。我几乎没有做 3D 游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。
|
||||
|
||||
### 2、尽早可玩
|
||||
|
||||
这是我对游戏 Jam 活动最中肯的建议。试着做出核心机制,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,你的游戏才可玩。像 Open Jam 这样的三天的活动,不应该花费几个小时以上来做一个可以运行的演示。
|
||||
|
||||
### 3、保持简单
|
||||
|
||||
你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏 Jam 活动中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能正常。
|
||||
|
||||
### 4、从其他游戏获取灵感
|
||||
|
||||
可能你想做出完全原创的作品,但有个可以基于它开发的原型极其有用。这将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,所以你也能从再创作其他人的作品中得到很好地练习。
|
||||
|
||||
考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得有款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了这个概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。进入到 Jam 活动大概一两个小时后,我就有了基本模型,可以用一个按钮上下移动和留下小黑圈的痕迹。
|
||||
|
||||
### 5、不要忽视可得性
|
||||
|
||||
确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有 VR 设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏 Jam 活动),注意可得性是很重要的。
|
||||
|
||||
Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有个浏览器版本就可以支持大多数人玩。但尽你所能去发布在更多的平台和操作系统上。我甚至试着在移动端发布 Paint Rider,但技术有限。
|
||||
|
||||
### 6、不要做得太难
|
||||
|
||||
如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。要保持简单和限定规模,这在游戏计划阶段非常重要。再次重申,想出一个需要花上十天半个月开发的宏大的游戏创意很容易;难的是做出好玩、简单的游戏。
|
||||
|
||||
给我的妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。
|
||||
|
||||
### 7、不用太整洁
|
||||
|
||||
如果你习惯于花时间在设计模式上和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。
|
||||
|
||||
这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型,直到找出值得做成完整游戏的,然后你可以潜心建立完美的代码来支持它。为游戏 Jame 活动创作的游戏就像是个快速开发一个可验证的模型一样。
|
||||
|
||||
### 8、但也不要太随意
|
||||
|
||||
另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎都考虑到了设计模式。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点 —— 这是你的设计自动成型的[观察者模式][14]。只要你知道如何利用这种游戏引擎的特性的优势,就可以快速写代码,你的代码也不会特别难读。
|
||||
|
||||
### 9、取得反馈
|
||||
|
||||
向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你预料之外的事。如果游戏 Jam 活动有 [Discord][15] 频道或者类似的,把你的游戏放上去,人们会反馈给你想法。Paint Rider 的一个确定的功能是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个机制。
|
||||
|
||||
团队协作的话,确保有可以传递周围反馈的人参与这个开发。
|
||||
|
||||
而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。
|
||||
|
||||
### 10、哪里找资源
|
||||
|
||||
做出所有你自己的资源真的会拖你后腿。Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上。你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,但这里还有其他选择。试着寻找 [Creative Commons][16] 许可的或免费音乐站点(比如 [Anttis Instrumentals][17])的资源。或者,可行的话,组建一个有专门艺术家、作家或者音乐家的团队。
|
||||
|
||||
其他你可能觉得有用的软件有 [Krita][18],这是一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板的话;还有 [sfxr][19],这是一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“它的基本用法包括了按下随机按钮。”(Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。
|
||||
|
||||
你参加 Open Jam 或者其他游戏 Jam 并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development
|
||||
|
||||
作者:[Ryan Estes][a]
|
||||
译者:[XYenChi](https://github.com/XYenChi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/figytuna
|
||||
[1]:https://itch.io/jam/open-jam-1
|
||||
[2]:https://opensource.com/article/17/11/open-jam
|
||||
[3]:https://godotengine.org/
|
||||
[4]:https://lmms.io/
|
||||
[5]:https://www.gimp.org/
|
||||
[6]:https://www.blender.org/
|
||||
[7]:https://astropippin.itch.io/loathsome
|
||||
[8]:https://masonraus.itch.io/lost-artist
|
||||
[9]:https://figytuna.itch.io/paint-rider
|
||||
[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/
|
||||
[11]:https://itch.io/
|
||||
[12]:https://en.wikipedia.org/wiki/Spaghetti_code
|
||||
[13]:http://kidscancode.org/blog/2017/03/godot_101_07/
|
||||
[14]:https://en.wikipedia.org/wiki/Observer_pattern
|
||||
[15]:https://discordapp.com/
|
||||
[16]:https://creativecommons.org/
|
||||
[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008
|
||||
[18]:https://krita.org/en/
|
||||
[19]:http://www.drpetter.se/project_sfxr.html
|
||||
[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md
|
@ -1,20 +1,17 @@
|
||||
tmux - 适用于重度命令行 Linux 用户的强大终端复用器
|
||||
tmux:适用于重度命令行 Linux 用户的终端复用器
|
||||
======
|
||||
|
||||
tmux 是终端复用的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制。
|
||||
tmux 是<ruby>终端复用器<rt>terminal multiplexer</rt></ruby>的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制它们。
|
||||
|
||||
它使用客户端-服务器模型,允许用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。
|
||||
它使用客户端-服务器模型,允许在用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。
|
||||
|
||||
|
||||
tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号,窗口名称,用户名,主机名,当前时间和日期。
|
||||
tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号、窗口名称、用户名、主机名、当前时间和日期。
|
||||
|
||||
启动 tmux 时,它会在一个单独窗口上创建一个新的会话,并将其显示在屏幕上。它允许用户在同一个会话中创建任意数量的窗口。
|
||||
|
||||
许多人说它相当于一块屏幕,但我不这么认为,因为它提供了许多配置选项。
|
||||
许多人说它类似于 `screen`,但我不这么认为,因为它提供了许多配置选项。
|
||||
|
||||
**注意:** `Ctrl+b` 是 tmux 中的默认前缀,因此,要在 tmux 中执行任何操作,你必须先输入前缀然后输入所需的选项。
|
||||
|
||||
**建议阅读:** [适用于 Linux 的终端仿真器列表][1]
|
||||
**注意:** `Ctrl+b` 是 tmux 中的默认命令前缀,因此,要在 tmux 中执行任何操作,你必须先输入该前缀然后输入所需的选项。
|
||||
|
||||
### tmux 特性
|
||||
|
||||
@ -26,34 +23,40 @@ tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一
|
||||
* tmux 提供许多配置技巧
|
||||
|
||||
**建议阅读:**
|
||||
**(#)** [tmate - 马上与其他人分享你的终端会话][2]
|
||||
**(#)** [Teleconsole - 一个与其他人分享终端会话的工具][3]
|
||||
|
||||
- [tmate - 马上与其他人分享你的终端会话][2]
|
||||
- [Teleconsole - 一个与其他人分享终端会话的工具][3]
|
||||
|
||||
### 如何安装 tmux 命令
|
||||
|
||||
大多数 Linux 系统默认预安装 tmux 命令。如果没有,按照以下步骤安装。
|
||||
|
||||
对于 **`Debian/Ubuntu`**,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装:
|
||||
对于 Debian/Ubuntu,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装:
|
||||
|
||||
```
|
||||
$ sudo apt install tmux
|
||||
```
|
||||
|
||||
对于 **`RHEL/CentOS`**,使用 [YUM 命令][6]来安装:
|
||||
对于 RHEL/CentOS,使用 [YUM 命令][6]来安装:
|
||||
|
||||
```
|
||||
$ sudo yum install tmux
|
||||
```
|
||||
|
||||
对于 **`Fedora`**,使用 [DNF 命令][7]来安装:
|
||||
对于 Fedora,使用 [DNF 命令][7]来安装:
|
||||
|
||||
```
|
||||
$ sudo dnf install tmux
|
||||
```
|
||||
|
||||
对于 **`Arch Linux`**,使用 [Pacman 命令][8]来安装:
|
||||
对于 Arch Linux,使用 [Pacman 命令][8]来安装:
|
||||
|
||||
```
|
||||
$ sudo pacman -S tmux
|
||||
```
|
||||
|
||||
对于 **`openSUSE`**,使用 [Zypper 命令][9]来安装:
|
||||
对于 openSUSE,使用 [Zypper 命令][9]来安装:
|
||||
|
||||
```
|
||||
$ sudo zypper in tmux
|
||||
```
|
||||
@ -61,56 +64,51 @@ $ sudo zypper in tmux
|
||||
### 如何使用 tmux
|
||||
|
||||
在终端上运行以下命令来启动 tmux 会话。启动 tmux 后,它会在一个新窗口中创建新会话,并将使用你的用户账户自动登录到你的默认 shell。
|
||||
|
||||
```
|
||||
$ tmux
|
||||
```
|
||||
|
||||
![][11]
|
||||
|
||||
你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息,日期,时间等。
|
||||
你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息、日期、时间等。
|
||||
|
||||
状态栏信息如下:
|
||||
|
||||
* **`0 :`** 它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。
|
||||
* **`0:username@host: :`** ) 0 表示会话号。用户名和主机名是当前的使用窗口的人。
|
||||
* **`~ :`** 它表示当前目录(我们在家目录中)。
|
||||
* **`* :`** 这表示窗口现在处于活动状态。
|
||||
* **`Hostname :`** 显示服务器的完全主机名。
|
||||
* **`Date& Time:`** 显示当前日期和时间。
|
||||
* `[0]`:它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。
|
||||
* `0:bash`:表示会话号、命令行提示符(这里的 `bash` 表示 shell 名称)。
|
||||
* `*`:这表示该窗口现在处于活动状态。
|
||||
* 主机名:显示服务器的完全主机名。
|
||||
* 日期与时间:显示当前日期和时间。
|
||||
|
||||
(LCTT 译注:tmux 的状态可以根据需要定制,也会因环境、版本的不同而不同。)
|
||||
|
||||
### 如何拆分窗口
|
||||
### 如何拆分窗口
|
||||
|
||||
tmux 允许用户垂直或水平分割窗口。我们来看看如何做到这一点。
|
||||
tmux 允许用户垂直或水平分割窗口,称为窗格。每个窗格都包含自己独立运行的终端实例。我们来看看如何做到这一点。
|
||||
|
||||
按下 `Ctrl+b, %` 来垂直分割窗格。
|
||||
|
||||
按下 `**(Ctrl+b), %**` 来垂直分割窗口。
|
||||
![][13]
|
||||
|
||||
Press `**(Ctrl+b), "**` 来水平分割窗口。
|
||||
按下 `Ctrl+b, "` 来水平分割窗格。
|
||||
|
||||
![][14]
|
||||
|
||||
### 如何在窗格之间移动
|
||||
|
||||
假设,我们创建了一些窗格,希望在它们之间移动,这该怎么做?如果你不知道怎么做,那么使用 tmux 就没有意义了。使用以下控制键执行操作。在窗格之间移动有许多方法。
|
||||
|
||||
- 按 `Ctrl+b, ←` - 选择左边的窗格
|
||||
- 按 `Ctrl+b, →` - 选择右边的窗格
|
||||
- 按 `Ctrl+b, ↑` - 选择上边的窗格
|
||||
- 按 `Ctrl+b, ↓` - 选择下边的窗格
|
||||
- 按 `Ctrl+b, {` - 来向左交换窗格
|
||||
- 按 `Ctrl+b, }` - 来向右交换窗格
|
||||
- 按 `Ctrl+b, o` - 切换到下一个窗格(从左到右,从上到下)
|
||||
- 按 `Ctrl+b, ;` - 移动到先前活动的窗格
|
||||
|
||||
按 `(Ctrl+b), 左箭头` - 来向左移动
|
||||
|
||||
按 `(Ctrl+b), 右箭头` - 来向右移动
|
||||
|
||||
按 `(Ctrl+b), 上箭头` - 来向上移动
|
||||
|
||||
按 `(Ctrl+b), 下箭头` - 来向下移动
|
||||
|
||||
按 `(Ctrl+b), {` - 来向左移动
|
||||
|
||||
按 `(Ctrl+b), }` - 来向右移动
|
||||
|
||||
按 `(Ctrl+b), o` - 切换到下一个窗格(从左到右,从上到下)
|
||||
|
||||
按 `(Ctrl+b), ;` - 移动到先前活动的窗格
|
||||
|
||||
出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它 `lsb_release -a` 命令的输出。
|
||||
出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它展示了 `lsb_release -a` 命令的输出。
|
||||
|
||||
![][15]
|
||||
|
||||
@ -120,25 +118,23 @@ Press `**(Ctrl+b), "**` 来水平分割窗口。
|
||||
|
||||
### 如何打开/创建新窗口
|
||||
|
||||
你可以在一个终端内打开任意数量的窗口。终端窗口可以垂直和水平分割,称为 `panes`。每个窗格都包含自己独立运行的终端实例。
|
||||
你可以在一个终端内打开任意数量的窗口。
|
||||
|
||||
按 `(Ctrl+b), c` 来创建一个新窗口。
|
||||
- 按 `Ctrl+b, c` 来创建一个新窗口。
|
||||
- 按 `Ctrl+b, n` 移动到下一个窗口。
|
||||
- 按 `Ctrl+b, p` 移动到上一个窗口。
|
||||
- 按 `Ctrl+b, 0` ~ `Ctrl+b, 9` 立即移动到特定窗口。
|
||||
- 按 `Ctrl+b, l` 移动到先前选择的窗口。
|
||||
|
||||
按 `(Ctrl+b), n` 移动到下一个窗口
|
||||
我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,`top` 命令输出和内核信息。
|
||||
|
||||
按 `(Ctrl+b), p` 移动到上一个窗口。
|
||||
|
||||
按 `(Ctrl+b), (0-9)` 立即移动到特定窗口。
|
||||
|
||||
按 `(Ctrl+b), l` 移动到先前选择的窗口。
|
||||
|
||||
我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,top 命令输出和内核信息。
|
||||
![][17]
|
||||
|
||||
第二个窗口有两个窗格,其中包含 Linux 发行版 logo 信息。使用以下命令执行操作:
|
||||
|
||||
![][18]
|
||||
|
||||
按 `(Ctrl+b), w` 以交互方式选择当前窗口。
|
||||
按 `Ctrl+b, w` 以交互方式选择当前窗口。
|
||||
|
||||
![][19]
|
||||
|
||||
@ -146,46 +142,48 @@ Press `**(Ctrl+b), "**` 来水平分割窗口。
|
||||
|
||||
你正在一些非常小的窗格中工作,并且你希望将其缩小以进行进一步的工作。要做到这一点,使用以下键绑定。
|
||||
|
||||
目前我们有三个窗格,我在 `pane1` 工作,它使用 **Top** 命令显示系统活动信息,我将缩放它。
|
||||
目前我们有三个窗格,我在 `pane1` 工作,它使用 `top` 命令显示系统活动信息,我将缩放它。
|
||||
|
||||
![][17]
|
||||
|
||||
缩放窗格时,它将隐藏所有其它窗格,并只显示窗口中的缩放窗格。
|
||||
|
||||
![][20]
|
||||
|
||||
按 `(Ctrl+b), z` 缩放窗格并再次按下它,使缩放窗格恢复原状。
|
||||
按 `Ctrl+b, z` 缩放窗格,并再次按下它使缩放窗格恢复原状。
|
||||
|
||||
### 显示窗格信息
|
||||
|
||||
要了解窗格编号及其大小,运行以下命令。
|
||||
|
||||
按 `(Ctrl+b), q` 可简单显示窗格索引。
|
||||
按 `Ctrl+b, q` 可简单显示窗格索引。
|
||||
|
||||
![][21]
|
||||
|
||||
### 显示窗口信息
|
||||
|
||||
要知道窗口编号,布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。
|
||||
要知道窗口编号、布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。
|
||||
|
||||
只需运行 `tmux list-windows` 即可查看窗口信息。
|
||||
|
||||
![][22]
|
||||
|
||||
### 如何调整窗格大小
|
||||
|
||||
你可能需要调整窗格大小来满足你的要求。你必须按下 `(Ctrl+b), :`,然后在页面底部的 `黄色(yellow)` 颜色条上输入以下详细信息。
|
||||
你可能需要调整窗格大小来满足你的要求。你必须按下 `Ctrl+b, :`,然后在页面底部的黄色颜色条上输入以下详细信息。
|
||||
|
||||
![][23]
|
||||
|
||||
在上一部分中,我们有打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向上增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。
|
||||
在上一部分中,我们打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。
|
||||
|
||||
![][24]
|
||||
|
||||
**语法:** `(Ctrl+b), :` 然后输入 `resize-pane [options] [cells size]`
|
||||
**语法:** `Ctrl+b, :` 然后输入 `resize-pane [options] [cells size]`
|
||||
|
||||
`(Ctrl+b), :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。
|
||||
|
||||
`(Ctrl+b), :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。
|
||||
|
||||
`(Ctrl+b), :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。
|
||||
|
||||
`(Ctrl+b), :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。
|
||||
- `Ctrl+b, :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。
|
||||
- `Ctrl+b, :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。
|
||||
- `Ctrl+b, :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。
|
||||
- `Ctrl+b, :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。
|
||||
|
||||
### 分离并重新连接 tmux 会话
|
||||
|
||||
@ -208,23 +206,23 @@ $ rsync -avzhe ssh /backup root@192.168.0.161:/backups/week-1/
|
||||
```
|
||||
|
||||
运行以下命令以列出可用的 tmux 会话。
|
||||
|
||||
```
|
||||
$ tmux ls
|
||||
0: 3 windows (created Tue Jan 30 06:17:47 2018) [109x45]
|
||||
```
|
||||
|
||||
现在,使用适当的会话 ID 重新连接 tmux 会话,如下所示:
|
||||
|
||||
```
|
||||
$ tmux attach -t 0
|
||||
```
|
||||
|
||||
### 如何关闭窗格和窗口
|
||||
|
||||
只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `(Ctrl+b), &`。
|
||||
只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `Ctrl+b, &`。
|
||||
|
||||
好了,就到这里了,希望你喜欢上它。
|
||||
(to 校正:这句话是加的,感觉它结尾很突然,可以删掉。)
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -232,7 +230,7 @@ via: https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for-
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
译者:[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/) 荣誉推出
|
||||
|
@ -1,131 +1,146 @@
|
||||
如何设置一个即时静态文件服务器
|
||||
如何即时设置一个静态文件服务器
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/04/serve-720x340.png)
|
||||
|
||||
曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”,这更适合这个实用程序的目的。
|
||||
曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”(提供),这更适合这个实用程序的目的。
|
||||
|
||||
### 使用 Serve 来设置一个静态文件服务器
|
||||
|
||||
要安装 "serve",首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。
|
||||
要安装 serve,首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。
|
||||
|
||||
* [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/)
|
||||
* [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/)
|
||||
|
||||
NodeJS 和 NPM 安装完成后,运行以下命令来安装 serve:
|
||||
|
||||
NodeJS 和 NPM 安装完成后,运行以下命令来安装 "serve":
|
||||
```
|
||||
$ npm install -g serve
|
||||
```
|
||||
|
||||
完成!现在是时候 serve 文件或文件夹了。
|
||||
|
||||
使用 "serve" 的典型语法是:
|
||||
使用 serve 的典型语法是:
|
||||
|
||||
```
|
||||
$ serve [options] <path-to-files-or-folders>
|
||||
```
|
||||
|
||||
### Serve 特定文件或文件夹
|
||||
### 提供特定文件或文件夹
|
||||
|
||||
例如,让我们共享 `Documents` 目录里的内容。为此,运行:
|
||||
|
||||
例如,让我们共享 **Documents** 目录里的内容。为此,运行:
|
||||
```
|
||||
$ serve Documents/
|
||||
```
|
||||
|
||||
示例输出:
|
||||
|
||||
![][2]
|
||||
|
||||
正如你在上图中看到的,给定目录的内容已通过两个 URL 提供网络支持。
|
||||
|
||||
要从本地系统访问内容,你只需打开 Web 浏览器,输入 **<http://localhost:5000/>** URL:
|
||||
要从本地系统访问内容,你只需打开 Web 浏览器,输入 URL `http://localhost:5000/`:
|
||||
|
||||
![][3]
|
||||
|
||||
Serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。
|
||||
serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。
|
||||
|
||||
如果想要在浏览器中自动打开本地地址,使用 `-o` 选项。
|
||||
|
||||
如果想要在浏览器中自动打开本地地址,使用 **-o** 选项。
|
||||
```
|
||||
$ serve -o Documents/
|
||||
```
|
||||
|
||||
运行上述命令后,Serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。
|
||||
运行上述命令后,serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。
|
||||
|
||||
同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 **<http://192.168.43.192:5000>**。用你系统的 IP 替换 192.168.43.192。
|
||||
同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 `http://192.168.43.192:5000`。用你系统的 IP 替换 192.168.43.192。
|
||||
|
||||
**通过不同的端口 Serve 内容**
|
||||
### 通过不同的端口提供内容
|
||||
|
||||
你可能已经注意到,默认情况下,serve 实用程序使用端口 5000。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 `-p` 选项使用不同端口来提供内容。
|
||||
|
||||
你可能已经注意到,默认情况下,serve 实用程序使用端口 **5000**。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 **-p** 选项使用不同端口来提供内容。
|
||||
```
|
||||
$ serve -p 1234 Documents/
|
||||
```
|
||||
|
||||
上面的命令将通过端口 **1234** 提供 Documents 目录的内容。
|
||||
上面的命令将通过端口 1234 提供 `Documents` 目录的内容。
|
||||
|
||||
![][4]
|
||||
|
||||
要提供文件而不是文件夹,只需给它完整的路径,如下所示。
|
||||
|
||||
```
|
||||
$ serve Documents/Papers/notes.txt
|
||||
```
|
||||
|
||||
只要知道路径,网络上的任何用户都可以访问共享目录的内容。
|
||||
|
||||
**Serve 整个 $HOME 目录**
|
||||
### 提供整个 `$HOME` 目录
|
||||
|
||||
打开终端输入
|
||||
|
||||
```
|
||||
$ serve
|
||||
```
|
||||
|
||||
这将通过网络共享整个 $HOME 目录的内容。
|
||||
这将通过网络共享整个 `$HOME` 目录的内容。
|
||||
|
||||
要停止共享,按下 **CTRL+C**。
|
||||
要停止共享,按下 `CTRL+C`。
|
||||
|
||||
**Serve 选择的文件或文件夹**
|
||||
### 提供选定的文件或文件夹
|
||||
|
||||
你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 `-i` 选项排除文件或目录。
|
||||
|
||||
你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 **-i** 选项排除文件或目录。
|
||||
```
|
||||
$ serve -i Downloads/
|
||||
```
|
||||
|
||||
以上命令将 serve 整个文件系统,除了 **Downloads** 目录。
|
||||
以上命令将提供整个文件系统,除了 `Downloads` 目录。
|
||||
|
||||
**仅在本地主机上提供内容**
|
||||
### 仅在本地主机上提供内容
|
||||
|
||||
有时,你只想在本地系统而不是整个网络上提供内容。为此,使用 `-l` 标志,如下所示:
|
||||
|
||||
有时,你只想在本地系统而不是整个网络上 serve 内容。为此,使用 **-l** 标志,如下所示:
|
||||
```
|
||||
$ serve -l Documents/
|
||||
```
|
||||
|
||||
此命令会仅在本地提供 **Documents** 目录。
|
||||
此命令会仅在本地提供 `Documents` 目录。
|
||||
|
||||
![][5]
|
||||
|
||||
当你在共享服务器上工作时,这可能会很有用。系统中的所有用户都可以访问共享,但远程用户不能。
|
||||
|
||||
**使用 SSL Serve 内容**
|
||||
### 使用 SSL 提供内容
|
||||
|
||||
由于我们通过本地网络提供内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 `-ssl` 选项来使用 SSL 共享内容。
|
||||
|
||||
由于我们通过本地网络 serve 内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 **-ssl** 选项来使用 SSL 共享内容。
|
||||
```
|
||||
$ serve --ssl Documents/
|
||||
```
|
||||
|
||||
![][6]
|
||||
|
||||
要通过 Web 浏览器访问共享,输入 “<https://localhost:5000”> 或 “<https://ip:5000”>.
|
||||
要通过 Web 浏览器访问共享,输入 `https://localhost:5000` 或 `https://ip:5000`。
|
||||
|
||||
![][7]
|
||||
|
||||
**通过身份验证 Serve 内容**
|
||||
### 通过身份验证提供内容
|
||||
|
||||
在上面的所以示例中,我们在没有任何身份验证的情况下 serve 内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。
|
||||
在上面的所有示例中,我们在没有任何身份验证的情况下提供内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。
|
||||
|
||||
为此,使用:
|
||||
|
||||
```
|
||||
$ SERVE_USER=ostechnix SERVE_PASSWORD=123456 serve --auth
|
||||
```
|
||||
|
||||
现在用户需要输入用户名(即 **ostechnix**)和密码(123456)来访问共享。(译者注:123456 是非常不好的密码,仅在实验情况下使用)
|
||||
现在用户需要输入用户名(即 `ostechnix`)和密码(`123456`)来访问共享。(LCTT 译注:123456 是非常不好的密码,仅在实验情况下使用)
|
||||
|
||||
![][8]
|
||||
|
||||
Serve 实用程序还有一些其它功能,例如禁用 [**Gzip 压缩**][9],设置 **CORS** 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。
|
||||
serve 实用程序还有一些其它功能,例如禁用 [Gzip 压缩][9],设置 CORS 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。
|
||||
|
||||
```
|
||||
$ serve help
|
||||
```
|
||||
@ -134,18 +149,18 @@ $ serve help
|
||||
|
||||
共勉!
|
||||
|
||||
来源:
|
||||
资源:
|
||||
|
||||
* [Serve GitHub 仓库](https://github.com/zeit/serve)
|
||||
* [Serve GitHub 仓库](https://github.com/zeit/serve)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-setup-static-file-server-instantly/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -23,7 +23,7 @@ sudo dnf -y update
|
||||
dnf module list
|
||||
```
|
||||
|
||||
输出列出了一组模块,这些模块显示了每个模块的关联流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。
|
||||
输出列出了一组模块,这些模块显示了每个模块的关联的流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。
|
||||
|
||||
输出还显示大多数模块都有名为 `default` 的配置文件。这不是巧合,因为 `default` 是默认配置文件使用的名称。
|
||||
|
||||
@ -83,22 +83,22 @@ sudo dnf -y module install reviewboard/server
|
||||
|
||||
但是,安装 reviewboard:3.0/server 配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 —— 因此无需安装。
|
||||
|
||||
### 启动 Review Board 网站
|
||||
### 启动 Review Board 网站
|
||||
|
||||
现在已经安装了 Review Board 3.0 模块及其相关软件包,[创建一个本地运行的 Review Board 网站][6]。无需解释,请复制并粘贴以下命令:
|
||||
|
||||
```
|
||||
sudo rb-site install --noinput \
|
||||
--domain-name=localhost --db-type=sqlite3 \
|
||||
--db-name=/var/www/rev.local/data/reviewboard.db \
|
||||
--admin-user=rbadmin --admin-password=secret \
|
||||
/var/www/rev.local
|
||||
--domain-name=localhost --db-type=sqlite3 \
|
||||
--db-name=/var/www/rev.local/data/reviewboard.db \
|
||||
--admin-user=rbadmin --admin-password=secret \
|
||||
/var/www/rev.local
|
||||
sudo chown -R apache /var/www/rev.local/htdocs/media/uploaded \
|
||||
/var/www/rev.local/data
|
||||
/var/www/rev.local/data
|
||||
sudo ln -s /var/www/rev.local/conf/apache-wsgi.conf \
|
||||
/etc/httpd/conf.d/reviewboard-localhost.conf
|
||||
/etc/httpd/conf.d/reviewboard-localhost.conf
|
||||
sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \
|
||||
httpd_can_network_memcache=1 httpd_unified=1
|
||||
httpd_can_network_memcache=1 httpd_unified=1
|
||||
sudo systemctl enable --now httpd
|
||||
```
|
||||
|
||||
@ -131,7 +131,7 @@ via: https://fedoramagazine.org/working-modules-fedora-28/
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://fedoramagazine.org/author/merlinm/
|
||||
[1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/
|
||||
[1]:https://linux.cn/article-10479-1.html
|
||||
[2]:https://getfedora.org/server/
|
||||
[3]:https://fedoramagazine.org/howto-use-sudo/
|
||||
[4]:https://fedoramagazine.org/modularity-fedora-28-server-edition/#comment-476696
|
@ -0,0 +1,140 @@
|
||||
微型计算机的始祖:Altair 8800
|
||||
======
|
||||
|
||||
《<ruby>大众电子<rt>Popular Electronics</rt></ruby>》的订阅者们是个复杂的群体,该杂志的编辑 Arthur Salsberg 不得不在 [1974 年 12 月刊][1] 中的前言部分指出这点。此前,杂志编辑组曾收到了对《如何搭建家庭媒体中心》文章的抱怨,称这篇文章激励了许多业余电视爱好者走出去,削弱了专业修理人员存在的必要性,这对许多人的电视造成了极大伤害。Salsberg 认为,这个担忧的产生可能是因为大家不清楚《大众电子》读者们的真实水平。他解释道,据杂志内部调查的数据显示,52% 的订阅者都是某方面的电子专家,并且其中的 150,000 人在最近 60 天之内都修过电视。此外,订阅者们平均在电子产品上花费了 470 美金(2018 年则是 3578 美金),并且他们拥有万用表、真空管伏特计、电子管测试仪、晶体管测试仪、射频讯号产生器和示波器等必要设备。“《大众电子》的读者们并不全都是新手。”Salsberg 总结道。
|
||||
|
||||
熟悉《大众电子》的人居然会质疑它的订阅者,这令我十分吃惊。不过最近 60 天我的确没修过电视。我的电脑对我来说就是一块铝,我甚至没把它拆开看过。1974 年 12 月的《大众电子》刊登的像《驻波比是什么以及如何处理它》和《对万用表的测试》之类的特色文章,甚至连广告都令人生畏。它们中有个看起来像某种立体声系统的东西大胆地写道“除了‘四通道单元(即内建的 SQ、RM 和 CD-4 解码接收器)’,没有任何音频设备是值得期待的”。这也表明了《大众电子》的订阅者一定对电子有很多深入的了解。
|
||||
|
||||
不过在 [1975 年 1 月刊][2] 中,该杂志为读者们带来了一些他们从没见过的东西。在标题“突破性项目”下面,杂志的封面是一个大大的黑灰色盒子,其前面板上有一组复杂开关和灯。这便是 Altair 8800,“世界上首个有商业竞争力的小型机”,它的售价低于 400 美元。尽管 Altair 被宣传作“<ruby>小型机<rt>minicomputer</rt></ruby>”,但它实际上是首个商业上成功的新型计算机成员,它首先被称为“<ruby>微型计算机<rt>microcomputers</rt></ruby>”,最终被称为 PC(<ruby>个人计算机<rt>Personal Computer</rt></ruby>)。Altair 十分小巧而且很便宜,以至于它成为了当时家家户户都能用起的电脑。正如 Salsberg 所写道,它在《大众电子》上的出现意味着:“家用电脑的时代终于到来了。”
|
||||
|
||||
![《大众电子》1975 年 1 月刊的封面][3]
|
||||
|
||||
此前,我曾写过 [关于 Altair 的文章][4],但我觉得 Altair 值得重新审视。与当时其它的计算机相比,它并不是一台性能强劲的计算机(尽管它的成本要低得多),它也不是首个采用微处理器的通用计算机(在它之前已经至少有三个基于微处理器的计算机)。但是 Altair 是一种可供我们所有人使用的计算机。它是历史上我们所拥有的设备中首台流行的计算机,而早于 Altair 计算机都是完全不同的机器,那些大型机和笨重的迷你计算机由穿孔卡编程并且很少与之直接交互。不过 Altair 也是台极其简单的计算机,它没有附带任何操作系统甚至是引导程序。除非你为它购买外围设备,否则 Altair 就是一台装配了 RAM、前面板只有一组开关和灯泡的机器。由于 Altair 操作简单,使得重新理解基本的计算概念都成了十分简单的事情,正如模拟信号时代的人们第一次接触到数字设备一样。
|
||||
|
||||
### Roberts 和他的公司
|
||||
|
||||
Altair 是由一家名为<ruby>微型仪器和遥测系统<rt>Micro Instrumentation and Telemetry Systems</rt></ruby>(MITS)的公司所设计制造,这家公司位于美国新墨西哥州的阿尔布开克。MITS 由一个叫 H. Edward Roberts 的人经营。在进入计算器市场之前,该公司已经开始制造模型火箭的遥测系统,该市场在 20 世纪 70 年代初期蓬勃发展。集成电路大大降低了计算器的成本,突然之间它就成了美国每个在职的专业人士的必需品。不幸的是,由于计算器市场竞争过于激烈,到了 1974 年初,MITS 便负债累累。
|
||||
|
||||
1974 年在计算机界是<ruby>奇迹迭出的一年<rt>annus mirabilis</rt></ruby>。[^1] 一月的时候,惠普公司推出了世界首个可编程的手持计算器 HP-65。四月的时候,Intel 发布了 Intel 8080,这是他们的第二款 8 位微处理器,它也是首款广受欢迎的微处理器。接着,六月的时候,《<ruby>无线电电子<rt>Radio Electronics</rt></ruby>》杂志宣传了一台名为 Mark-8 的自制小型计算机,它使用了 Intel 在 1972 年推出的 Intel 8008 微处理器。Mark-8 是有史以来使用微处理器搭建的第三台电脑,它的首次登场是在杂志的封面上。[^2] Mark-8 在《无线电电子》上的出现促使了《大众电子》寻找他们要自己宣传的小型机项目。
|
||||
|
||||
《大众电子》的订阅者们其实早在 1974 年 12 月就通过邮件获得了 1975 年 1 月刊的刊物。[^3] 所以 Altair 的宣布为这个<ruby>奇迹迭出的一年<rt>annus mirabilis</rt></ruby>画上了圆满的句号。Altair 的出现是十分重要的,因为此前从未有过向公众提供的价格公道而又功能齐全的电脑。当时,作为最受欢迎的小型计算机之一的 PDP-8 要几千美金才能买到。然而作为 Altair 核心的 Intel 8080 芯片几乎能与 PDP-8 匹敌,甚至更强;8080 支持更广泛的指令集,而且 Altair 可以扩展到 64 kb 内存,显然强于仅有 4 kb 内存的 PDP-8。并且,Mark-8 也不是它的对手,因为它搭载的是只能处理 16 kb 内存的 Intel 8008。在 Mark-8 必须由用户按照说明书在印刷电路板上手动拼装的情况下,Altair 在购买时就已经被组装好了(不过由于后来 MITS 被大量订单淹没,最后真正能获得 Altair 的方式也只有买套件拼装了)。
|
||||
|
||||
对许多《大众电子》的读者来说,Altair 是他们了解数字计算的起点。1975 年 1 月刊上那篇介绍 Altair 的文章由 Roberts 和 Altair 的共同设计师 William Yates 所写。Roberts 和 Yates 煞费苦心地用电工和无线电狂热者们所熟悉的词汇来介绍了数字硬件和计算机编程的基本概念。他们写道:“一台计算机其实由一块可变的硬件。仅需修改储存于内存之中的位组合形式,便可改变硬件设备的种类。”同时,Roberts 和 Yates 认为编程的基本概念是“足够简单并能在较短时间内掌握,但是想要成为一个高效的程序员必须经验丰富且富有创造力。”对此我十分认同。尽管该部分已经完全组装好了,文章仍包含了用来讲解 Intel 8080 的组成电路的详细图表。文章解释了 CPU 和计算机内存单元的区别,堆栈指针的用法,和汇编语言以及更高级的语言(例如 FORTRAN 和 BASIC)比起手动输入机器码所带来的巨大优势。
|
||||
|
||||
其实,《大众电子》在 1975 年 1 月刊之前就出版过 Roberts 撰写的系列文章。这一系列作为短期课程被收录在“数字逻辑”专栏中。在 1974 年 12 月刊中,Roberts 为读者们带来了关于构建“超低成本计算机终端”的文章,文章中介绍了可以用于 8 位电脑中输入值的八进制键盘。在介绍这个键盘时,Roberts 解释了晶体管到晶体管的逻辑工作原理,以及关于构建一种可以“记住”数字值的触发器的方法。Roberts 承诺说,这个键盘可以在下个月即将公布的 Altair 电脑中使用。
|
||||
|
||||
有多少《大众电子》的读者制作了这个键盘我们无从得知,但是那个键盘的确是个很有用的东西。如果没有键盘和其它输入设备,我们只能通过拨动 Altair 面板上的开关来输入值。Altair 的前面板上有一行 16 个开关被用来设置地址,而下方的 8 个则是用来操作计算机的。一行 16 个开关中最右边的 8 个开关也能用来指定要储存在内存中的值。这么做不无道理,因为 Intel 8080 使用 16 位的值来寻址 8 位的字。而前面板的这 16 个开关每一个都代表了一个位,当开关向上时代表 1,向下则代表 0。用这样的方式与计算机交互是个启示(一会儿我们就会讲到),因为 Altair 的面板是真正的二进制界面。这使得你可以尽可能地接触到计算机实体。
|
||||
|
||||
尽管在当下 Altair 的界面对我们来说完全不像是人用的,不过在那个时代却并不罕见。比如 PDP-8 的面板上有个类似的但更漂亮的二进制输入装置,而且它被涂上了吸引人的黄色和橙色,不过讲真,它真的应该卷土重来。然而 PDP-8 经常与纸带阅读器或电传打字机配合使用,这使得程序输入更加容易。这些 I/O 设备价格高昂,这意味着 Altair 的用户们大都会被那个前面板拦住。正如你可能想象的那样,通过这一堆开关输入一个大型程序是个苦差事。不过幸运的是,Altair 可以与盒式记录器连接,这样一来载入程序就不是什么难事了。Bill Gates 和 Paul Allen 在 MITS 的授权下为 Altair 编写了一个 BASIC 语言版本,并在 1975 年中期发行,这成为了微软有史以来的首次商业尝试。此后,那些买得起电传打字机的用户就能 [通过纸带来将 BASIC 载入 Altair][5] 了,并能使得用户能够通过文字与 Altair 交互。之后,BASIC 便成为了学生们最爱的入门编程语言,并成了早期小型机时代的标准接口。
|
||||
|
||||
### z80pack
|
||||
|
||||
多亏了网络上一些人,特别是 Udo Munk 的努力,你可以在你的计算机上运行 Altair 的模拟器。这个模拟器是在 Zilog Z80 CPU 的虚拟套件上构建的,这个 CPU 可以运行 Intel 8080 的软件。Altair 模拟器允许你像 Altair 的早期用户们一样拨动前面板上的开关。尽管点击这些开关的感觉不如拨动真实开关的触觉,但是使用 Altair 模拟器仍是一个能让你感受二进制人机交互效率有多低的途径,至少在我看来这非常简明直观。
|
||||
|
||||
z80pack 是 Udo Munk 开发的 Z80 模拟器套件,你可以在 z80pack 的官网上找到它的下载链接。我在 [上一篇介绍 Altair 的文章中][4] 写到过在 macOS 上使用它的详细过程。如果你能编译 FrontPanel 库和 `altairsim` 可执行程序,你应该能直接运行 `altairsim` 并看到这个窗口:
|
||||
|
||||
![模拟器中的 Altair 面板][6]
|
||||
|
||||
在新版的 z80pack 中(比如我正在使用的 1.36 版本),你可以使用一个叫 Tarbell boot ROM 的功能,我觉得这是用来加载磁盘镜像的。经我测试,这意味着你不能写入到 RAM 中的前几个字。在编辑 `/altairsim/conf/system.conf` 之后,你可以构建带有一个 16 页 RAM 且没有 ROM 或引导加载器的 Altair。除此之外,你还可以用这个配置文件来扩大运行模拟器的窗口大小,不得不说这还是挺方便的。
|
||||
|
||||
Altair 的面板看起来令人生畏,不过事实上并没有我们想象中的这么可怕。[Altair 说明书][7] 对解释开关和指示灯起到了很大的作用,这个 [YouTube 视频][8] 也是如此。若想输入和运行一个简易的程序,你只需要了解一点点东西。Altair 右上方标签为 D0 到 D7 的指示灯代表当前寻址的字的内容。标签为 A0 到 A15 的指示灯表示当前的地址。地址指示灯下的 16 个开关可以用来设置新地址;当 “EXAMINE” 开关被向上推动时,数据指示灯才会更新以显示新地址上的内容。用这个功能,你便能“观察”到内存中所有的信息了。你也可以将 “EXAMINE” 推下来“EXAMINE NEXT”位置,以自动检查下一个位置上的信息,这使得查看连续的信息更容易了。
|
||||
|
||||
要将位组合方式保存到内存信息中,请使用最右边的 8 个标签为 0 到 7 的开关。然后,请向上推动 “DEPOSIT” 按钮。
|
||||
|
||||
在《大众电子》 的 [1975 年 2 月刊][9] 中,Roberts 和 Yates 引导用户输入一小段程序来确保他们的 Altair 正常工作。这个程序从内存中读取两个整型数据并相加之后将和存回内存中。这个小程序仅由 6 条指令组成,但是这 6 条指令涉及了 14 个字的内存,所以要正确地输入它们需要一点时间。这个示例程序也被写入了 Altair 的说明书,原文如下:
|
||||
|
||||
| Address | Mnemonic | Bit Pattern | Octal Equivalent |
|
||||
| :------: | :------: | :------: | :------: |
|
||||
| 0 | LDA | 00 111 010 | 0 7 2 |
|
||||
| 1 | (address) | 10 000 000 | 2 0 0 |
|
||||
| 2 | (address) | 00 000 000 | 0 0 0 |
|
||||
| 3 | MOV B, A | 01 000 111 | 1 0 7 |
|
||||
| 4 | LDA | 00 111 010 | 0 7 2 |
|
||||
| 5 | (address) | 10 000 001 | 2 0 1 |
|
||||
| 6 | (address) | 00 000 000 | 0 0 0 |
|
||||
| 7 | ADD B | 10 000 000 | 2 0 0 |
|
||||
| 8 | STA | 00 110 010 | 0 6 2 |
|
||||
| 9 | (address) | 10 000 010 | 2 0 2 |
|
||||
| 10 | (address) | 00 000 000 | 0 0 0 |
|
||||
| 11 | JMP | 11 000 011 | 3 0 3 |
|
||||
| 12 | (address) | 00 000 000 | 0 0 0 |
|
||||
| 13 | (address) | 00 000 000 | 0 0 0 |
|
||||
|
||||
如果你通过开关来将上表的这些值输入到 Altair,最终会得到一个程序,它会读取内存 128 中的值,并将其与 129 中的值相加,最终将其保存至 130 中。伴随每条取一个地址的指令的地址,它们最开始会给出最低有效位,这便是第二个字节总会被清零的原因了(没有高于 255 的地址)。在输入这个程序并在 128 和 129 中输入了一些值之后,你可以向下短暂推动 “RUN” ,之后再将它推到 “STOP” 位置。因为程序循环执行,以一秒内执行上千次的速度反复地添加并保存那些值。并且最后得到的值总是相同的,如果你停止该程序并查看 130 的内容,你应该能找到正确答案。
|
||||
|
||||
我不知道普通的 Altair 用户是否使用过汇编程序,不过 z80pack 包括了一个:`z80asm`,意思是<ruby>适用于 Z80 的汇编程序<rt>Z80 assembly</rt></ruby>,所以它使用了一组不同的助记符。不过因为 Z80 是被设计来兼容为 Intel 8080 写的软件的,所以即使助记符不一样,它们的操作码也是相同的。你可以直接将 `z80asm` 汇编码装载进 Altair:
|
||||
|
||||
```
|
||||
ORG 0000H
|
||||
START: LD A,(80H) ;Load from address 128.
|
||||
LD B,A ;Move loaded value from accumulator (A) to reg B.
|
||||
LD A,(81H) ;Load from address 129.
|
||||
ADD A,B ;Add A and B.
|
||||
LD (82H),A ;Store A at address 130.
|
||||
JP START ;Jump to start.
|
||||
```
|
||||
|
||||
编译之后,你可以调用汇编程序来将其转换为 Intel HEX 文件:
|
||||
|
||||
```shell
|
||||
$ ./z80asm -fh -oadd.hex add.asm
|
||||
```
|
||||
|
||||
我们用带有 `h` 参数的 `-f` 标识来定义输出的 HEX 文件。你可以用 `-x` 标识来传递 HEX 文件,从而使得 Altair 能够加载该程序:
|
||||
|
||||
```shell
|
||||
$ ./altairsim -x add.hex
|
||||
```
|
||||
|
||||
这会在内存中自动设置前 14 个字,就和你通过开关手动输入这些值一样。你可以直接使用 “RUN” 按钮来替代以前那些繁琐的步骤,这是如此的简单!
|
||||
|
||||
我不觉得有很多 Altair 用户以这种方式来编写软件。Altair BASIC 发布后,使得 BASIC 成为了 Altair 编程最简单的方法。z80pack 同时也包括了一些不同版本 Altair BASIC 的 HEX 文件;在模拟器中,你可以用这个方式加载 4.0 版本的 4K BASIC:
|
||||
|
||||
```shell
|
||||
$ ./altairsim -x basic4k40.hex
|
||||
```
|
||||
|
||||
当你开启模拟器并按下 “RUN” 按钮之后,你就会看到 BASIC 开始执行了,同时它会在终端中与你交互。它首先会提示你输入你的内存可用量,我们输入 4000 字节。随后,在显示 “OK” 提示符之前,它会问你几个问题,Gates 和 Allen 用这个“OK”来代替标准的 “READY” 并以此节省内存。在这之后,你便可以使用 BASIC 了:
|
||||
|
||||
```
|
||||
OK
|
||||
PRINT 3 + 4
|
||||
7
|
||||
```
|
||||
|
||||
虽然运行 BASIC 只有 4kb 的内存并没有给你足够的空间,但你可以看到它是如何从使用前面板迈出了重要的一步。
|
||||
|
||||
很显然,Altair 远不及如今的家用电脑和笔记本电脑,并且比它晚十多年发布的 Mac 电脑看上去也是对 这个简朴的 Altair 电脑的巨大飞跃。但是对第一批购买并亲手组装了 Altair 的《大众电子》的读者们来说,Altair 才是他们拥有的第一个真正的全功能电脑,而这一切只用了 400 美金低价和一半的书柜空间。对那时只能用 [一叠卡片][10] 或一卷磁带来与计算机交互的人们来说,Altair 是个令人眼前一亮的玩意。这之后的微型计算机基本都是在对 Altair 改进,使得它更易用。从某种意义上来说,它们只是更复杂的 Altair。Altair,一个野兽派的极简作品,却为之后的许多微型计算机打下了铺垫。
|
||||
|
||||
如果你觉得这篇文章写的不错,你可以在推特上关注 [@TwoBitHistory][11] 或订阅 [RSS feed][12] 来获得我们文章的更新提醒。文章每两周就会更新一次!
|
||||
|
||||
[^1]: Paul E. Ceruzzi, A History of Modern Computing (Cambridge, Mass: MIT Press, 2003), 226.
|
||||
[^2]: “Mark-8 Minicomputer,” Byran’s Old Computers, accessed July 21, 2018, http://bytecollector.com/mark_8.htm.
|
||||
[^3]: Paul E. Ceruzzi, A History of Modern Computing (Cambridge, Mass: MIT Press, 2003), 226.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html
|
||||
|
||||
作者:[Sinclair Target][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[zhs852](https://github.com/zhs852)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://twobithistory.org
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1974/Poptronics-1974-12.pdf
|
||||
[2]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-01.pdf
|
||||
[3]: https://twobithistory.org/images/jan1975-altair.jpg
|
||||
[4]: https://linux.cn/article-10181-1.html
|
||||
[5]: https://www.youtube.com/watch?v=qv5b1Xowxdk
|
||||
[6]: https://www.autometer.de/unix4fun/z80pack/altair.png
|
||||
[7]: http://www.classiccmp.org/dunfield/altair/d/88opman.pdf
|
||||
[8]: https://www.youtube.com/watch?v=suyiMfzmZKs
|
||||
[9]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-02.pdf
|
||||
[10]: https://linux.cn/article-10382-1.html
|
||||
[11]: https://twitter.com/TwoBitHistory
|
||||
[12]: https://twobithistory.org/feed.xml
|
||||
[13]: https://twitter.com/TwoBitHistory/status/1015647820353867776?ref_src=twsrc%5Etfw
|
@ -1,28 +1,26 @@
|
||||
Perform robust unit tests with PyHamcrest
|
||||
使用 PyHamcrest 执行健壮的单元测试
|
||||
======
|
||||
> 使用此框架编写断言,提高开发测试的准确性。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh)
|
||||
|
||||
在[测试金字塔][1]的底部是单元测试。单元测试每次只测试一个代码单元,通常是一个函数或方法。
|
||||
|
||||
通常,设计单个单元测试是为了测试通过函数或特定分支选择的特定流,这使得失败的单元测试和导致失败的 bug 之间的映射变得容易。
|
||||
通常,设计单个单元测试是为了测试通过一个函数或特定分支的特定执行流程,这使得将失败的单元测试和导致失败的 bug 对应起来变得容易。
|
||||
|
||||
理想情况下,单元测试使用很少或不使用外部资源,从而隔离它们并使它们更快。
|
||||
理想情况下,单元测试很少使用或不使用外部资源,从而隔离它们并使它们更快。
|
||||
|
||||
_好_ 测试通过尽早发现 bug 并加快测试速度来提高开发人员的工作效率。_坏_ 测试降低了开发人员的工作效率。
|
||||
单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试可以在代码离开开发人员机器之前捕获 bug,或者至少可以在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:*好的*测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。*坏的*测试降低了开发人员的工作效率。
|
||||
|
||||
单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试在代码离开开发人员机器之前捕获 bug,或者至少在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:好的测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。坏的测试降低了开发人员的工作效率。
|
||||
|
||||
当测试 _附带的特性_ 时,生产率通常会降低。当代码更改时测试失败,即时它仍然是正确的。发生这种情况是因为输出不同,但在某种程度上它不是函数契约的一部分。
|
||||
当测试*附带的特性*时,生产率通常会降低。当代码更改时测试会失败,即使它仍然是正确的。发生这种情况是因为输出的不同,但在某种程度上是因为它不是<ruby>函数契约<rt>function's contract</rt></ruby>的一部分。
|
||||
|
||||
因此,一个好的单元测试可以帮助执行函数所提交的契约。
|
||||
|
||||
如果单元测试中断,那意味着契约被违反了,应该明确修改(通过更改文档和测试),或者被修复(通过修复代码并保持测试不变)。
|
||||
如果单元测试中断,那意味着该契约被违反了,应该(通过更改文档和测试)明确修改,或者(通过修复代码并保持测试不变)来修复。
|
||||
|
||||
虽然将测试限制为只执行公共契约是一项需要学习的复杂技能,但有一些工具可以提供帮助。
|
||||
|
||||
其中一个工具是 [Hamcrest][2],一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,它现在支持多种语言,包括 [Python][3]。
|
||||
其中一个工具是 [Hamcrest][2],这是一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,但它现在支持多种语言,包括 [Python][3]。
|
||||
|
||||
Hamcrest 旨在使测试断言更容易编写和更精确。
|
||||
|
||||
@ -36,7 +34,8 @@ def test_add():
|
||||
assert_that(add(2, 2), equal_to(4))
|
||||
```
|
||||
|
||||
这是一个用于简单功能的断言。如果我们想要断言更复杂的怎么办?
|
||||
这是一个用于简单函数的断言。如果我们想要断言更复杂的函数怎么办?
|
||||
|
||||
```
|
||||
def test_set_removal():
|
||||
my_set = {1, 2, 3, 4}
|
||||
@ -45,13 +44,14 @@ def test_set_removal():
|
||||
assert_that(my_set, is_not(has_item(3)))
|
||||
```
|
||||
|
||||
注意,我们可以简单地断言结果的顺序为 `1`, `2` 和 `4`,因为集合不保证顺序。
|
||||
注意,我们可以简单地断言其结果是任何顺序的 `1`、`2` 和 `4`,因为集合不保证顺序。
|
||||
|
||||
我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写 _精确的断言_,使我们能够把自己限制在执行职能的公共契约方面。
|
||||
我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写*精确的断言*,使我们能够把自己限制在执行函数的公共契约方面。
|
||||
|
||||
然而,有时候,内置功能都不是我们 _真正_ 需要的。在这些情况下,Hamcrest 允许我们编写自己的匹配器。
|
||||
然而,有时候,内置的功能都不是我们*真正*需要的。在这些情况下,Hamcrest 允许我们编写自己的<ruby>匹配器<rt>matchers</rt></ruby>。
|
||||
|
||||
想象一下以下功能:
|
||||
|
||||
```
|
||||
def scale_one(a, b):
|
||||
scale = random.randint(0, 5)
|
||||
@ -59,9 +59,10 @@ def scale_one(a, b):
|
||||
return scale * pick
|
||||
```
|
||||
|
||||
我们可以自信地断言结果均匀地划分为至少一个输入。(to 校正:???什么意思)
|
||||
我们可以自信地断言其结果均匀地分配到至少一个输入。
|
||||
|
||||
匹配器继承自 `hamcrest.core.base_matcher.BaseMatcher`,重写两个方法:
|
||||
|
||||
```
|
||||
class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher):
|
||||
def __init__(self, factor):
|
||||
@ -76,12 +77,14 @@ class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher):
|
||||
```
|
||||
|
||||
编写高质量的 `describe_to` 方法很重要,因为这是测试失败时显示的消息的一部分。
|
||||
|
||||
```
|
||||
def divisible_by(num):
|
||||
return DivisibleBy(num)
|
||||
```
|
||||
|
||||
按照惯例,我们将匹配器包装在一个函数中。有时这给了我们进一步处理输入的机会,但在这种情况下,我们不需要进一步处理。
|
||||
|
||||
```
|
||||
def test_scale():
|
||||
result = scale_one(3, 7)
|
||||
@ -92,7 +95,8 @@ def test_scale():
|
||||
|
||||
请注意,我们将 `divisible_by` 匹配器与内置的 `any_of` 匹配器结合起来,以确保我们只测试函数提交的内容。
|
||||
|
||||
在编辑这篇文章时,我听到一个传言,“Hamcrest” 这个名字被认为是 “matches” 的字谜。人力资源管理...
|
||||
在编辑这篇文章时,我听到一个传言,取 “Hamcrest” 这个名字是因为它是 “matches” 字母组成的字谜。嗯...
|
||||
|
||||
```
|
||||
>>> assert_that("matches", contains_inanyorder(*"hamcrest")
|
||||
Traceback (most recent call last):
|
||||
@ -106,13 +110,14 @@ Expected: a sequence over ['h', 'a', 'm', 'c', 'r', 'e', 's', 't'] in any order
|
||||
but: no item matches: 'r' in ['m', 'a', 't', 'c', 'h', 'e', 's']
|
||||
```
|
||||
|
||||
经过进一步的研究,我找到了谣言的来源:它是 “matchers” 的字谜。
|
||||
经过进一步的研究,我找到了传言的来源:它是 “matchers” 字母组成的字谜。
|
||||
|
||||
```
|
||||
>>> assert_that("matchers", contains_inanyorder(*"hamcrest"))
|
||||
>>>
|
||||
```
|
||||
|
||||
如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加 _精确_,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。
|
||||
如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加*精确*,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -121,8 +126,8 @@ via: https://opensource.com/article/18/8/robust-unit-tests-hamcrest
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,103 @@
|
||||
5 款开源的 Linux 策略模拟游戏
|
||||
======
|
||||
|
||||
> 用这些开源游戏来挑战你的战略技能,探索新世界。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32)
|
||||
|
||||
长久以来,游戏都是 Linux 的软肋。近些年,Steam、GOG 等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。
|
||||
|
||||
那么,我们能找到既自由开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和 3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。就算某个游戏在不在某个发行版本的库中,我们也可以在这个游戏项目的网站上找到直接的安装方法。
|
||||
|
||||
本篇文章将会介绍策略和模拟类游戏。我已经写了[街机游戏][1]、[桌面卡牌游戏][2]、[解谜游戏][3]、[竞速飞行游戏][4]以及[角色扮演游戏][5]。
|
||||
|
||||
### 开源版“文明”(Freeciv)
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/freeciv.png)
|
||||
|
||||
[Freeciv][6] 可以被视为是[文明系列][7]游戏的开源版本。游戏玩法和文明系列最早期的游戏十分类似,Freeciv 可以让玩家选择选用文明 1 或者文明 2 中的游戏规则设置。Freeciv 中包含了很多元素,例如建造城市、探索世界地图、发展科技以及和其他扩张中的文明竞争。胜利条件包括打败所有其他的文明或建立一个外星殖民地,如果在前两者都没有达成的话,在游戏时间期限前存活下来也可以算作胜利。这个游戏可以和其他玩家联机也可以和 AI 对战,不同的地图集可以改变游戏的外观。
|
||||
|
||||
安装 Freeciv,你只需要在终端下运行以下指令。
|
||||
|
||||
* Fedora 用户: `dnf install freeciv`
|
||||
* Debian/Ubuntu 用户:`apt install freeciv`
|
||||
|
||||
### MegaGlest
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/megaglest.png)
|
||||
|
||||
[MegaGlest][8] 是一个开源的实时战略游戏,类似暴雪公司制作的游戏[魔兽世界][9]和[星际争霸][10]。玩家控制不同派别的人员、建造新建筑、招募士兵、拓展领土并与敌人作战。在游戏比赛的最开始,玩家仅能建造最基础的建筑和招募最基础的士兵。为了建造更高级的建筑并招募级别更高的人员,玩家必须通过增加建筑和人员从而一路提高科技树、解锁更加高级的选项。当敌人进入国土领域之中,战斗单元将会迎战。但是最好的应对策略是,通过控制战斗单元直接操控每一场战斗。在管理新建筑的建立,新人员的招募的同时控制战斗局势听上去十分困难,但是这就是 RTS(实时战略游戏)游戏的精华所在。MegaGlest 这个游戏提供了大量的人员派别,玩家可以不断尝试这些不同的技巧。
|
||||
|
||||
安装 MegaGlest,你只需要在终端下运行以下指令:
|
||||
|
||||
* Fedora 用户: `dnf install megaglest`
|
||||
* Debian/Ubuntu 用户:`apt install megaglest`
|
||||
|
||||
### 开源版“运输大亨”(OpenTTD)
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/openttd.png)
|
||||
|
||||
[OpenTTD][11](见我们的 [评测][12] )是一个开源实现的 [运输大亨][13] 。该游戏的目的在于创建一个交通运输网络并获得金钱,从而建立更加复杂的运输网络。这个运输网络包括了船只、巴士、火车、货车和飞机。默认的游戏时间在 1950 和 2050 之间,玩家的目标就是在规定时间内拿到最高的游戏分数。游戏的最终分数基于很多因素,例如货物运输的数量、玩家所拥有的汽车数量以及他们赚到的钱。
|
||||
|
||||
安装 OpenTTD,你只需要在终端运行以下指令:
|
||||
|
||||
* Fedora 用户: `dnf install openttd`
|
||||
* Debian/Ubuntu 用户 `apt install openttd`
|
||||
|
||||
### <ruby>韦诺之战<rt>The Battle for Wesnoth</rt></ruby>
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/the_battle_for_wesnoth.png)
|
||||
|
||||
[韦诺之战][14] 是目前最完善的开源游戏之一。这个回合制游戏在一个奇幻的故事设定下。游戏在一个六角形网格中进行,各个单元可以互相操作进行战斗。每个类型的单元都有它独特的能力和弱点,因此玩家需要根据这些特点来设计不同的行动。韦诺之战中有很多不同的行动分支,每个行动分支都有它特别的故事线和目标。韦诺之战同时也有一个地图编辑器,感兴趣的玩家可以创作自己的地图以及行动分支。
|
||||
|
||||
安装韦诺之战,你只需要在终端运行以下指令:
|
||||
|
||||
* Fedora 用户: `dnf install wesnoth`
|
||||
* Debian/Ubuntu 用户: `apt install wesnoth`
|
||||
|
||||
### <ruby>UFO:外星入侵<rt>UFO: Alien Invasion</rt></ruby>
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/ufo_alien_invasion.png)
|
||||
|
||||
[UFO: Alien Invasion][15] 是一个开源策略游戏,基于 <ruby>[幽浮系列][20]<rt>X-COM</rt></ruby>。 有两个不同的游戏模式: geoscape 和 tactical。在 geoscape 模式下,玩家控制大局、管理基地、开发新技术以及掌控整体策略。 在 tactical 游戏模式下,玩家控制一群士兵并且以回合制的形式直接迎战外星侵略者。两个游戏模式提供了不同的游戏玩法,两者都需要相当复杂的策略和战术。
|
||||
|
||||
安装这个游戏,你只需要在终端下运行以下指令:
|
||||
|
||||
* Debian/Ubuntu 用户: `apt install ufoai`
|
||||
|
||||
遗憾的是,UFO: 外星入寝不支持 Fedora 发行版。
|
||||
|
||||
如果你知道除了这些以外的开源策略模拟游戏的话,欢迎在评论中分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/8/strategy-simulation-games-linux
|
||||
|
||||
作者:[Joshua Allen Holm][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[Scoutydren](https://github.com/Scoutydren)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/holmja
|
||||
[1]:https://linux.cn/article-10433-1.html
|
||||
[2]:https://opensource.com/article/18/3/card-board-games-linux
|
||||
[3]:https://opensource.com/article/18/6/puzzle-games-linux
|
||||
[4]:https://opensource.com/article/18/7/racing-flying-games-linux
|
||||
[5]:https://opensource.com/article/18/8/role-playing-games-linux
|
||||
[6]:http://www.freeciv.org/
|
||||
[7]:https://en.wikipedia.org/wiki/Civilization_(series)
|
||||
[8]:https://megaglest.org/
|
||||
[9]:https://en.wikipedia.org/wiki/Warcraft
|
||||
[10]:https://en.wikipedia.org/wiki/StarCraft
|
||||
[11]:https://www.openttd.org/
|
||||
[12]:https://opensource.com/life/15/7/linux-game-review-openttd
|
||||
[13]:https://en.wikipedia.org/wiki/Transport_Tycoon#Transport_Tycoon_Deluxe
|
||||
[14]:https://www.wesnoth.org/
|
||||
[15]:https://ufoai.org/
|
||||
[16]:https://opensource.com/downloads/cheat-sheets?intcmp=7016000000127cYAAQ
|
||||
[17]:https://opensource.com/alternatives?intcmp=7016000000127cYAAQ
|
||||
[18]:https://opensource.com/tags/linux?intcmp=7016000000127cYAAQ
|
||||
[19]:https://developers.redhat.com/cheat-sheets/advanced-linux-commands/?intcmp=7016000000127cYAAQ
|
||||
[20]:https://en.wikipedia.org/wiki/X-COM
|
@ -1,4 +1,4 @@
|
||||
Caffeinated 6.828:实验 6:最终的 JOS 项目
|
||||
Caffeinated 6.828:实验 7:最终的 JOS 项目
|
||||
======
|
||||
|
||||
### 简介
|
@ -0,0 +1,88 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: subject: (How to bring good fortune to your Linux terminal)
|
||||
[#]: via: (https://opensource.com/article/18/12/linux-toy-fortune)
|
||||
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||
[#]: url: (https://linux.cn/article-10486-1.html)
|
||||
|
||||
如何为你的 Linux 终端带来好运
|
||||
======
|
||||
> 使用 fortune 实用程序将名言和俏皮话带到命令行。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer)
|
||||
|
||||
这是 12 月,如果你还没有找到一款能激发你灵感的[科技降临节日历][1],那么,也许这个系列可以。从现在到 24 日,每天我们都会为你带来一个不同的 Linux 命令行玩具。你可能会问,什么是命令行玩具?它可能是一个游戏或任何简单的娱乐程序,为你的终端带来一点点快乐。
|
||||
|
||||
你可能之前已经看过其中的一些,我们希望你也能发现一些新的东西。不管怎样,我们都希望你在关注时保有乐趣。
|
||||
|
||||
今天的玩具是 `fortune`,它很古老。它的版本可以追溯到 1980 年,当时它包含在 Unix 中。我在 Fedora 中安装的版本是在 BSD 许可下提供的,我可以使用以下命令获取它。(LCTT 译注:fortune 这个命令得名于 fortune cookies,是流行于西方的中餐馆的一种脆饼干,里面包含格言、幸运数字等。)
|
||||
|
||||
```
|
||||
$ sudo dnf install fortune-mod -y
|
||||
```
|
||||
|
||||
你的发行版可能会有所不同。在某些情况下,你可能需要在 `fortune` 命令之外单独安装那些“幸运饼干”(尝试在你的包管理器中搜索 “fortunes”)。你还可以在 [GitHub][2] 上查看它的源代码,然后,只需运行 `fortune` 即可获得好运。
|
||||
|
||||
```
|
||||
$ fortune
|
||||
"Time is an illusion. Lunchtime doubly so."
|
||||
-- Ford Prefect, _Hitchhiker's Guide to the Galaxy_
|
||||
```
|
||||
|
||||
那么,你为什么会在终端上需要 `fortune` 呢?当然是为了好玩啦。也许你想将它们添加到系统上的每天消息(motd)中?
|
||||
|
||||
就我个人而言,当我使用终端来解析文本时,我喜欢使用 `fortune` 命令作为一段内置的虚拟数据,特别是使用[正则表达式][3]时,我想要一些简单的东西来尝试一下。
|
||||
|
||||
例如,假设我使用 `tr` 命令来测试转换,用数字 3 替换字母 e。
|
||||
|
||||
```
|
||||
$ fortune | tr 'eE' '3'
|
||||
Unix 3xpr3ss:
|
||||
All pass3ng3r bring a pi3c3 of th3 a3roplan3 and a box of tools with th3m to
|
||||
th3 airport. Th3y gath3r on th3 tarmac, arguing constantly about what kind
|
||||
of plan3 th3y want to build and how to put it tog3th3r. 3v3ntually, th3
|
||||
pass3ng3rs split into groups and build s3v3ral diff3r3nt aircraft, but giv3
|
||||
th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations.
|
||||
All pass3ng3rs b3li3v3 th3y got th3r3.
|
||||
```
|
||||
|
||||
那么你的发行版带来了什么幸运饼干呢?看看你的 `/usr/share/games/fortune` 目录,找到它们。以下我最喜欢的几个。
|
||||
|
||||
```
|
||||
Never laugh at live dragons.
|
||||
-- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"]
|
||||
|
||||
I dunno, I dream in Perl sometimes...
|
||||
-- Larry Wall in <8538@jpl-devvax.JPL.NASA.GOV>
|
||||
|
||||
I have an existential map. It has "You are here" written all over it.
|
||||
-- Steven Wright
|
||||
```
|
||||
|
||||
关于 `fortune` 想要了解更多?当然,你可以经常查看 man 页来了解更多选项,或者在[维基百科][4]上阅读更多关于此命令的历史信息。
|
||||
|
||||
你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。
|
||||
|
||||
看看昨天的玩具:[驾驶火车头通过你的 Linux 终端][5]。记得明天再来!
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/12/linux-toy-fortune
|
||||
|
||||
作者:[Jason Baker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jason-baker
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/article/16/11/7-tech-advent-calendars-holiday-season
|
||||
[2]: https://github.com/shlomif/fortune-mod
|
||||
[3]: https://opensource.com/article/18/5/getting-started-regular-expressions
|
||||
[4]: https://en.wikipedia.org/wiki/Fortune_%28Unix%29
|
||||
[5]: https://opensource.com/article/18/12/linux-toy-sl
|
@ -1,24 +1,26 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10495-1.html)
|
||||
[#]: subject: (Plan your own holiday calendar at the Linux command line)
|
||||
[#]: via: (https://opensource.com/article/18/12/linux-toy-cal)
|
||||
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||
|
||||
Plan your own holiday calendar at the Linux command line
|
||||
在 Linux 命令行中规划你的假期日历
|
||||
======
|
||||
Link commands together to build a colorful calendar, and then whisk it away in a snowstorm.
|
||||
|
||||
> 将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cal.png?itok=S0F8RY9k)
|
||||
|
||||
Welcome to today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal.
|
||||
欢迎阅读今天推出的 Linux 命令行玩具降临日历。如果这是你第一次访问本系列,你可能会问:什么是命令行玩具。即使我不太确定,但一般来说,它可以是一个游戏或任何简单的娱乐,可以帮助你在终端玩得开心。
|
||||
|
||||
It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone.
|
||||
很可能你们中的一些人之前已经看过我们日历上的各种选择,但我们希望给每个人至少一件新东西。
|
||||
|
||||
We've somehow made it to the seventh day of our series without creating an actual calendar to celebrate with, so let's use a command-line tool to do that today: **cal**. By itself, **cal** is perhaps not the most amazing of tools, but we can use a few other utilities to spice it up a bit.
|
||||
我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:`cal`。就其本身而言,`cal` 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。
|
||||
|
||||
Chances are, **cal** is installed on your system already. To use it in this instance, just type **cal**.
|
||||
很可能,你的系统上已经安装了 `cal`。要使用它,只需要输入 `cal` 即可。
|
||||
|
||||
```
|
||||
$ cal
|
||||
@ -32,9 +34,10 @@ Su Mo Tu We Th Fr Sa
|
||||
30 31
|
||||
```
|
||||
|
||||
We aren't going to go into advanced usage in this article, so if you want to learn more about **cal** , go check out Opensource.com Community Moderator Don Watkin's excellent [overview of the date and cal commands][1].
|
||||
我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 `cal` 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。
|
||||
|
||||
现在,让我们用一个漂亮的盒子来为它增添趣味,就像我们在上一篇 Linux 玩具文章中介绍的那样。我将使用钻石块,用一点内边距来对齐。
|
||||
|
||||
Now, let's spice it up with a pretty box, as we covered in our previous Linux toy article. I'll use the diamonds box, and use a little bit of padding to get it nicely aligned.
|
||||
|
||||
```
|
||||
$ cal | boxes -d diamonds -p a1l4t2
|
||||
@ -60,7 +63,7 @@ $ cal | boxes -d diamonds -p a1l4t2
|
||||
\/ \/ \/
|
||||
```
|
||||
|
||||
That looks nice, but for good measure, let's put the whole thing in a second box, just for fun. We'll use the scoll design this time.
|
||||
看起来很不错,但是为了更规整,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用卷轴式设计。
|
||||
|
||||
```
|
||||
cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll
|
||||
@ -92,25 +95,25 @@ cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll
|
||||
~~~ ~~~
|
||||
```
|
||||
|
||||
Perfect. Now, here's where things get a little crazy. I like our design, but, I'd like to go all out. So I'm going to colorize it. But here in the Raleigh, NC office where Opensource.com's staff are based, there's a good chance for snow this weekend. So let's enjoy our colorized advent calendar, and then wipe it out with snow.
|
||||
完美。现在,这事有点小激动了。我喜欢我们的设计,但我想更妙一些,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。
|
||||
|
||||
For the snow, I'm grabbing a nifty [snippet][2] of Bash and Gawk goodness I found over on CLIMagic. If you're not familiar with CLIMagic, go check out their [website][3] and follow them on [Twitter][4]. You'll be glad you did.
|
||||
关于雪,我抓取了一些 Bash 和 Gawk 的漂亮[代码片段][2],幸亏我发现了 CLIMagic。如果你不熟悉 CLIMagic,去查看他们的[网站][3],在 [Twitter][4] 上关注他们。你会满意的。
|
||||
|
||||
So here we go. Let's clear the screen, throw up our boxy calendar, colorize it, wait a few seconds, then snowstorm it away. All here at the terminal, in one line.
|
||||
我们开始吧。让我们清除屏幕,扔掉四四方方的日历,给它上色,等几秒钟,然后用暴风雪把它吹走。这些在终端可以用一行命令完成。
|
||||
|
||||
```
|
||||
$ clear;cal|boxes -d diamonds -p a1t2l3|boxes -a c -d scroll|lolcat;sleep 3;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS)) $(printf "\u2744\n");sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH%s \033[0;0H",a[x],x,$4;}}'
|
||||
```
|
||||
|
||||
And there we go.
|
||||
大功告成。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/linux-toy-cal-animated.gif)
|
||||
|
||||
For this to work on your system, you'll need all of the referenced utilities (boxes, lolcat, cal, gawk, etc.), and you'll need to use a terminal emulator that supports Unicode.
|
||||
要使它在你的系统上工作,你需要所有它引用的实用程序(`box`、`lolcat`、`gawk` 等),还需要使用支持 Unicode 的终端仿真器。
|
||||
|
||||
Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.
|
||||
你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。
|
||||
|
||||
Check out yesterday's toy, [Take a break at the Linux command line with Nyan Cat][5], and check back tomorrow for another!
|
||||
看看昨天的玩具:[使用 Nyan Cat 在 Linux 命令行休息][5]。记得明天再来!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -118,8 +121,8 @@ via: https://opensource.com/article/18/12/linux-toy-cal
|
||||
|
||||
作者:[Jason Baker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,68 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10488-1.html)
|
||||
[#]: subject: (The Linux terminal is no one-trick pony)
|
||||
[#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay)
|
||||
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||
|
||||
Linux 终端上的漂亮小马
|
||||
======
|
||||
|
||||
> 将小马宝莉的魔力带到终端
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-ponysay.png?itok=ehl6pTr_)
|
||||
|
||||
欢迎再次来到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们正在思考中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。
|
||||
|
||||
很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。
|
||||
|
||||
读者 [Lori][1] 在我之前关于 [cowsay][2] 的文章的评论中提出了今天玩具的建议:
|
||||
|
||||
“嗯,我一直在玩一个叫 ponysay 的东西,它似乎是你的 cowsay 的彩色变种。”
|
||||
|
||||
我对此感到好奇,并去看了一下,发现没有让我失望。
|
||||
|
||||
简而言之,[ponysay][3] 的 cowsay 的重写,它包括了来自[小马宝莉][4]中的许多全彩色人物,你可以用它在 Linux 命令行输出短句。它实际上是一个非常完善的项目,拥有超过 400 个字符和字符组合,它还有让人难以置信的的 [78 页的 PDF 文档][5]涵盖了所有的用法。
|
||||
|
||||
要安装 `ponysay`,你需要查看项目的 [README][6] 来选择最适合你的发行版和情况的安装方法。由于 `ponysay` 似乎没有为我的 Fedora 发行版打包,我选择试用 Docker 容器镜像,但你可以选择最适合你的方法。从源码安装可能也适合你。
|
||||
|
||||
作为一个业余容器用户,我很想试试 [podman][7] 来代替 docker。至少对于我而言,它可以正常工作。
|
||||
|
||||
```
|
||||
$ podman run -ti --rm mpepping/ponysay 'Ponytastic'
|
||||
```
|
||||
|
||||
输出很神奇,我建议你也试下,然后告诉我你最喜欢的。这是我其中一个:
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/linux-toy-ponysay-output.png)
|
||||
|
||||
它的开发人员选择用 [Pony][8] 来编写代码。(更新:很遗憾我写错了。虽然 Gihutb 根据它的文件扩展名认为它是 Pony,但是它是用 Python 写的。)Ponysay 使用 GPLv3 许可,你可以在 [GitHub][3] 中获取它的源码。
|
||||
|
||||
你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。
|
||||
|
||||
查看昨天的玩具,[在 Linux 终端中用火焰放松][9],记得明天再来!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/12/linux-toy-ponysay
|
||||
|
||||
作者:[Jason Baker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jason-baker
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/users/n8chz
|
||||
[2]: https://opensource.com/article/18/12/linux-toy-cowsay
|
||||
[3]: https://github.com/erkin/ponysay
|
||||
[4]: https://en.wikipedia.org/wiki/My_Little_Pony
|
||||
[5]: https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true
|
||||
[6]: https://github.com/erkin/ponysay/blob/master/README.md
|
||||
[7]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers
|
||||
[8]: https://opensource.com/article/18/5/pony
|
||||
[9]: https://opensource.com/article/18/12/linux-toy-aafire
|
@ -0,0 +1,114 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10491-1.html)
|
||||
[#]: subject: (How to open source your Python library)
|
||||
[#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
如何开源你的 Python 库
|
||||
======
|
||||
|
||||
> 这 12 个步骤能确保成功发布。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx)
|
||||
|
||||
你写了一个 Python 库。自己觉着这太棒了!如果让人们能够轻松使用它不是很优雅么?这有一个需要考虑的清单,以及在开源 Python 库时要采取的具体步骤。
|
||||
|
||||
### 1、源码
|
||||
|
||||
将代码放在 [GitHub][1] 上,这里有很多开源项目,并且人们很容易提交拉取请求。
|
||||
|
||||
### 2、许可证
|
||||
|
||||
选择一个开源许可证。一般来说 [MIT 许可证][2]是一个挺好的宽容许可证。如果你有特定要求,Creative Common 的[选择许可证][3]可以指导你完成其它选择。最重要的是,在选择许可证时要记住三条规则:
|
||||
|
||||
* 不要创建自己的许可证。
|
||||
* 不要创建自己的许可证。
|
||||
* 不要创建自己的许可证。
|
||||
|
||||
### 3、README
|
||||
|
||||
将一个名为 `README.rst` 的文件(使用 ReStructured Text 格式化)放在项目树的顶层。
|
||||
|
||||
GitHub 将像 Markdown 一样渲染 ReStructured Text,而 ReST 在 Python 的文档生态系统中的表现更好。
|
||||
|
||||
### 4、测试
|
||||
|
||||
写测试。这对你来说没有用处。但对于想要编写避免破坏相关功能的补丁的人来说,它非常有用。
|
||||
|
||||
测试可帮助协作者进行协作。
|
||||
|
||||
通常情况下,如果可以用 [pytest][4] 运行就最好了。还有其他测试工具 —— 但很少有理由去使用它们。
|
||||
|
||||
### 5、样式
|
||||
|
||||
使用 linter 制定样式:PyLint、Flake8 或者带上 `--check` 的 Black 。除非你使用 Black,否则请确保在一个文件中指定配置选项,并签入到版本控制系统中。
|
||||
|
||||
### 6、API 文档
|
||||
|
||||
使用 docstrings 来记录模块、函数、类和方法。
|
||||
|
||||
你可以使用几种样式。我更喜欢 [Google 风格的 docstrings][5],但 [ReST docstrings][6] 也是一种选择。
|
||||
|
||||
Sphinx 可以同时处理 Google 风格和 ReST 的 docstrings,以将零散的文档集成为 API 文档。
|
||||
|
||||
### 7、零散文档
|
||||
|
||||
使用 [Sphinx][7]。(阅读[我们这篇文章][8]。)教程很有用,但同样重要的是要指明这是什么、它有什么好处、它有什么坏处、以及任何特殊的考虑因素。
|
||||
|
||||
### 8、构建
|
||||
|
||||
使用 tox 或 nox 自动运行测试和 linter,并构建文档。这些工具支持“依赖矩阵”。这些矩阵往往会快速增长,但你可以尝试针对合理的样本进行测试,例如 Python 版本、依赖项版本以及可能安装的可选依赖项。
|
||||
|
||||
### 9、打包
|
||||
|
||||
使用 [setuptools][9] 工具。写一个 `setup.py` 和一个 `setup.cfg`。如果同时支持 Python 2 和 3,请在 `setup.cfg` 中指定 universal 格式的 wheel。
|
||||
|
||||
tox 或 nox 应该做的一件事是构建 wheel 并对已安装的 wheel 进行测试。
|
||||
|
||||
避免使用 C 扩展。如果出于性能或绑定的原因一定需要它们,请将它们放在单独的包中。正确打包 C 扩展可以写一篇新的文章。这里有很多问题!
|
||||
|
||||
### 10、持续集成
|
||||
|
||||
使用公共持续工具。[TravisCI][10] 和 [CircleCI][11] 为开源项目提供免费套餐。将 GitHub 或其他仓库配置为在合并拉请求之前需要先通过检查,那么你就不必担心在代码评审中告知用户修复测试或样式。
|
||||
|
||||
### 11、版本
|
||||
|
||||
使用 [SemVer][12] 或 [CalVer][13]。有许多工具可以帮助你管理版本:[incremental][14]、[bumpversion][15] 和 [setuptools_scm][16] 等都是 PyPI 上的包,都可以帮助你管理版本。
|
||||
|
||||
### 12、发布
|
||||
|
||||
通过运行 tox 或 nox 并使用 twine 将文件上传到 PyPI 上发布。你可以通过在 [DevPI][17] 中“测试上传”。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://github.com/
|
||||
[2]: https://en.wikipedia.org/wiki/MIT_License
|
||||
[3]: https://choosealicense.com/
|
||||
[4]: https://docs.pytest.org/en/latest/
|
||||
[5]: https://github.com/google/styleguide/blob/gh-pages/pyguide.md
|
||||
[6]: https://www.python.org/dev/peps/pep-0287/
|
||||
[7]: http://www.sphinx-doc.org/en/master/
|
||||
[8]: https://opensource.com/article/18/11/building-custom-workflows-sphinx
|
||||
[9]: https://pypi.org/project/setuptools/
|
||||
[10]: https://travis-ci.org/
|
||||
[11]: https://circleci.com/
|
||||
[12]: https://semver.org/
|
||||
[13]: https://calver.org/
|
||||
[14]: https://pypi.org/project/incremental/
|
||||
[15]: https://pypi.org/project/bumpversion/
|
||||
[16]: https://pypi.org/project/setuptools_scm/
|
||||
[17]: https://opensource.com/article/18/7/setting-devpi
|
@ -0,0 +1,114 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (jrglinux)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10493-1.html)
|
||||
[#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN)
|
||||
[#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi)
|
||||
[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver)
|
||||
|
||||
将树莓派 3B+ 变为 PriTunl VPN
|
||||
======
|
||||
|
||||
> PriTunl 是一种 VPN 解决方案,适用于希望私密的访问其网络的小型企业和个人。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2)
|
||||
|
||||
[PriTunl][1] 是一款出色的 VPN 终端解决方案,非常适合希望以简单快捷的方式私密的访问网络的小型企业和个人。它是开源的,基本的免费版本涵盖最通用的简单的实例,足以让你快速入门。也有集成了活动目录等高级功能的付费企业版。
|
||||
|
||||
### 有关树莓派 3B+ 的特别注意事项
|
||||
|
||||
PriTunl 的安装通常也很简单,但要在树莓派 3B+ 上安装 PriTunl 有点小复杂。比如,PriTunl 只提供了 AMD64 和 i386 架构的二进制文件,但树莓派 3B+ 是 ARM 架构的,这意味着需要从源码自行编译可用于树莓派 3B+ 的 PriTunl 可执行文件。不过,无需担心,编译过程很简单,只需花一点时间执行几行命令即可。
|
||||
|
||||
另一个问题:PriTunl 好像必须要是 64 位处理器架构,当我在 32 位操作系统上尝试编译的时候报错了。但幸运的是,用于 ARM64 架构的 Ubuntu 18.04 测试版本可以安装在树莓派 3B+ 上。
|
||||
|
||||
同样,树莓派 3B+ 需要和其他树莓派不同的引导程序。需要一组小复杂的命令来安装更新树莓派 3B+ 上必要的组件。
|
||||
|
||||
### 安装 PriTunl
|
||||
|
||||
你可以先在树莓派 3B+ 上安装 64 位的操作系统来避免下面这些问题。此处需要一些必要的基础知识如在树莓派上执行命令行。
|
||||
|
||||
打开终端,用如下命令下载 Ubuntu 18.04 用于 ARM64 架构的测试版:
|
||||
|
||||
```
|
||||
$ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img.xz
|
||||
```
|
||||
|
||||
将下载的固件解压:
|
||||
|
||||
```
|
||||
$ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz
|
||||
```
|
||||
|
||||
将准备好的 SD 卡插入电脑读卡槽,电脑会为 SD 卡分配一个驱动分配器号,例如 `/dev/sda` 或者 `/dev/sdb`。 输入命令 `dmesg` 然后观察屏幕上的最后几行找到 SD 卡的驱动分配器。
|
||||
|
||||
**下一步小心操作,如果搞错了驱动分配器号,可能会破坏你的系统。**
|
||||
|
||||
用如下命令往 SD 卡中写入数据,将其中的 `<DRIVE>` 替换成你的 SD 驱动器号。
|
||||
|
||||
```
|
||||
$ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of=<DRIVE> bs=8M
|
||||
```
|
||||
|
||||
完成上一步之后,将 SD 卡插入树莓派 3B+ ,并启动它。确保树莓派 3B+ 是连网的,然后登录系统,用户名/密码:`ubuntu` / `ubuntu`。
|
||||
|
||||
在树莓派上输入以下命令以安装一些编译 PriTunl 所需的包:
|
||||
|
||||
```
|
||||
$ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb
|
||||
```
|
||||
|
||||
和 PriTunl 标准源码上的 [安装说明][2] 有一点不一样。确保已经登录进树莓派然后切换到管理员账户:
|
||||
|
||||
```
|
||||
$ sudo su -
|
||||
```
|
||||
|
||||
现在你应该在管理员账户的目录下,按如下命令来安装 PriTunl 1.29.1914.98 版本:
|
||||
|
||||
```
|
||||
export VERSION=1.29.1914.98
|
||||
tee -a ~/.bashrc << EOF
|
||||
export GOPATH=\$HOME/go
|
||||
export PATH=/usr/local/go/bin:\$PATH
|
||||
EOF
|
||||
source ~/.bashrc
|
||||
mkdir pritunl && cd pritunl
|
||||
go get -u github.com/pritunl/pritunl-dns
|
||||
go get -u github.com/pritunl/pritunl-web
|
||||
sudo ln -s ~/go/bin/pritunl-dns /usr/bin/pritunl-dns
|
||||
sudo ln -s ~/go/bin/pritunl-web /usr/bin/pritunl-web
|
||||
wget https://github.com/pritunl/pritunl/archive/$VERSION.tar.gz
|
||||
tar -xf $VERSION.tar.gz
|
||||
cd pritunl-$VERSION
|
||||
python2 setup.py build
|
||||
pip install -r requirements.txt
|
||||
python2 setup.py install --prefix=/usr/local
|
||||
```
|
||||
|
||||
现在,不出意外的话应该可以启动 MongoDB 和 PriTunl 的 systemd 单元了。假如现在还是以管理员账户登录的话,输入:
|
||||
|
||||
```
|
||||
systemctl daemon-reload
|
||||
systemctl start mongodb pritunl
|
||||
systemctl enable mongodb pritunl
|
||||
```
|
||||
|
||||
大功告成!你现在可以登录 PriTunl 的用户界面并按照官网上的 [安装和配置手册][3] 来配置它了。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi
|
||||
|
||||
作者:[Stephen Bancroft][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[jrg](https://github.com/jrglinux)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/stevereaver
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://pritunl.com/
|
||||
[2]: https://github.com/pritunl/pritunl
|
||||
[3]: https://docs.pritunl.com/docs/configuration-5
|
@ -0,0 +1,91 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10484-1.html)
|
||||
[#]: subject: (Get started with WTF, a dashboard for the terminal)
|
||||
[#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard)
|
||||
[#]: author: (Kevein Sonney https://opensource.com/users/ksonney)
|
||||
|
||||
开始使用 WTF 吧,一款终端仪表板
|
||||
======
|
||||
|
||||
> 使用 WTF 将关键信息置于视野之中,这个系列中第六个开源工具可使你在 2019 年更有工作效率。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr)
|
||||
|
||||
每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。
|
||||
|
||||
这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。
|
||||
|
||||
### WTF
|
||||
|
||||
曾几何时,我在一家使用[彭博终端][1]的公司做咨询。我的反应是,“哇,在一个屏幕上显示的信息太多了。” 然而,现在,当我正在工作并且打开多个网页、仪表板和控制台应用程序以试图跟踪事物时,我似乎无法在屏幕上获得足够的信息。
|
||||
|
||||
虽然 [tmux][2] 和 [Screen][3] 可以进行分屏和打开多个窗口,但它们很难设置,并且它们的键绑定可能需要一段时间才能学会(还经常与其他应用程序冲突)。
|
||||
|
||||
[WTF][4] 是一个简单的、易于配置的终端信息仪表板。它是用 [Go][5] 语言编写的,使用 YAML 配置文件,可以从几个不同的源提取数据。所有的数据源都包含在[模块][6]中,包括天气、问题跟踪器、日期和时间、Google 表格以及更多内容。有些窗格是交互式的,有些窗格只是使用最新的信息进行更新。
|
||||
|
||||
安装它就像下载适用于您的操作系统的最新版本并运行命令一样简单。因为它是用 Go 编写的,所以它的移植性很好,应该可以在任何可以编译它的地方运行(尽管开发人员目前只为 Linux 和 MacOS 做了构建)。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/wtf-1.png)
|
||||
|
||||
当您第一次运行 WTF 时,您将看到如上图的默认屏幕。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/wtf-2.png)
|
||||
|
||||
其默认配置文件在 `~/.wtf/config.yml`,您可以编辑该文件以满足您的需要。网格布局的配置在文件的顶部。
|
||||
|
||||
```
|
||||
grid:
|
||||
columns: [45, 45]
|
||||
rows: [7, 7, 7, 4]
|
||||
```
|
||||
|
||||
网格设置中的数字表示每个块的字符尺寸。默认配置是两列,每列 40 个字符,两行 13 个字符高,一行 4 个字符高。在上面的代码中,我使列更宽(`45,45`),行更小,并添加了第四行,所以我可以放更多的小部件。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/wtf-3.png)
|
||||
|
||||
我喜欢在仪表板上看到当天的天气。有两个天气模块可供选择:[Weather][7],它只显示文本信息;[Pretty Weather][8] 则色彩丰富,并使用基于文本的图形显示。
|
||||
|
||||
```
|
||||
prettyweather:
|
||||
enabled: true
|
||||
position:
|
||||
top: 0
|
||||
left: 1
|
||||
height: 2
|
||||
width: 1
|
||||
```
|
||||
|
||||
此代码创建了一个窗格,高为两个块(`height: 2`),宽为一个块(`width: 1`),位于顶行(`top: 0`)的第二列(`left: 1`)上,包含 Pretty Weather 模块.
|
||||
|
||||
一些模块是交互式的,如 Jira、GitHub 和 Todo,您可以在其中滚动、更新和保存信息。您可以使用 Tab 键在交互式窗格之间移动。`\` 键会显示活动窗格的帮助屏幕,以便您可以查看可以执行的操作以及操作方式。Todo 模块允许您添加、编辑和删除待办事项,并在完成后勾掉它们。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/wtf-4.png)
|
||||
|
||||
还有一些模块可以执行命令并显示输出、监视文本文件,以及监视构建和集成服务器的输出。所有文档都做得很好。
|
||||
|
||||
对于需要在不同来源的一个屏幕上查看大量数据的人来说,WTF 是一个有价值的工具。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/1/wtf-information-dashboard
|
||||
|
||||
作者:[Kevein Sonney][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ksonney
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://en.wikipedia.org/wiki/Bloomberg_Terminal
|
||||
[2]: https://github.com/tmux/tmux
|
||||
[3]: https://www.gnu.org/software/screen/
|
||||
[4]: https://wtfutil.com/
|
||||
[5]: https://golang.org/
|
||||
[6]: https://wtfutil.com/posts/modules/
|
||||
[7]: https://wtfutil.com/posts/modules/weather/
|
||||
[8]: https://wtfutil.com/posts/modules/prettyweather/
|
190
published/201901/20190118 Top 5 Linux Server Distributions.md
Normal file
190
published/201901/20190118 Top 5 Linux Server Distributions.md
Normal file
@ -0,0 +1,190 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10490-1.html)
|
||||
[#]: subject: (Top 5 Linux Server Distributions)
|
||||
[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions)
|
||||
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
|
||||
|
||||
5 个用于 SOHO 的 Linux 服务器发行版
|
||||
======
|
||||
|
||||
> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf)
|
||||
|
||||
啊,这个古老的问题:哪种 Linux 发行版最适合做服务器?通常,问这种问题时,所浮现出来的标准的答复就是:
|
||||
|
||||
* RHEL
|
||||
* SUSE
|
||||
* Ubuntu 服务器
|
||||
* Debian
|
||||
* CentOS
|
||||
|
||||
然而,假如你将眼界放得更宽(不将服务器只看做是 IDC 托管的那种互联网服务器时),可能答案会有点不同。我准备稍微来点不同的。我想做出一个满足入选标准的发行版列表,这些发行版不仅是优秀的候选者,而且易于使用,可以为你的业务中的许多功能提供服务。在某些情况下,我选择的是一些替代品,可以取代其它需要一些工作才能达成要求的操作系统。
|
||||
|
||||
我的一些选择是企业级服务器的社区版本,它们可以被视为购买更强大平台的入门级产品。你甚至可以在这里找到一两个作为特定任务平台的候选者。然而,最重要的是,你在此列表中找到的并非寻常的泛泛之辈。
|
||||
|
||||
### ClearOS
|
||||
|
||||
什么是 ClearOS?对于家庭和小型企业用途,你可能找不到比它更好的解决方案。ClearOS 开箱即用,包括了入侵检测、强大的防火墙、带宽管理工具、邮件服务器、域控制器等工具。其目的是将服务器作为一个简单的家庭和 SOHO 服务器,并具有用户友好的基于 Web 的图形化界面,这使得 ClearOS 在某些评比中脱颖而出。从其界面中,你可以找到一个应用程序市场(图 1),其中包含数百个应用程序(其中一些是免费的,而另一些则具有相关费用),这使得扩展 ClearOS 功能集非常容易。换句话说,你可以将 ClearOS 作为你的家庭和小型企业所需的平台。最重要的是,与许多其他替代方案不同,你只需支付所需的软件和支持。
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch)
|
||||
|
||||
*图 1:ClearOS 应用程序市场*
|
||||
|
||||
有三种版本的 ClearOS:
|
||||
|
||||
* [ClearOS Community][1] - 免费版 ClearOS
|
||||
* [ClearOS Home][2] - 适于家庭办公
|
||||
* [ClearOS Business][3] - 适于小型企业,包括了付费支持。
|
||||
|
||||
为了使软件安装更加容易,ClearOS 应用市场允许你通过以下方式进行选择软件:
|
||||
|
||||
* 按功能(根据任务显示应用程序)
|
||||
* 按类别(显示相关应用程序组)
|
||||
* 快速选择文件(允许你按预先配置的模板选择,以帮助你快速启动和运行)
|
||||
|
||||
换句话说,如果你正在寻找 Linux 的家庭、SOHO 或 SMB 服务器,ClearOS 是一个出色的选择(特别是如果你没有启动和运行标准的 Linux 服务器的能力时)。
|
||||
|
||||
### Fedora 服务器
|
||||
|
||||
你肯定听说过 Fedora Linux。它是市场上最好的前沿发行版之一。但是你知道这个出色的 Fedora 桌面发行版的开发者们也开发了服务器版吗?Fedora 服务器平台是一个短生命周期的、社区支持的服务器操作系统。这使得经验丰富的、或对任何类型的 Linux(或任何操作系统)有经验的系统管理员,可以使用开源社区中提供的最新技术。在这段描述中有三个关键词:
|
||||
|
||||
* 经验丰富
|
||||
* 系统
|
||||
* 管理员
|
||||
|
||||
换言之,新用户就不要考虑了。虽然 Fedora 服务器完全能够处理你抛出的任何任务,但它需要一些拥有更多的 Linux 功夫的人来使它工作并且运行良好。Fedora 服务器非常好的一点是,开箱即用,它包括了市场上用于服务器的开源的基于 Web 的最好的界面之一。通过 Cockpit(图 2),你可以快速浏览系统资源、日志、存储、网络以及拥有管理帐户、服务、应用程序和更新的能力。
|
||||
|
||||
![Fedora Server][5]
|
||||
|
||||
*图 2:运行在 Fedora 服务器上的 Cockpit*
|
||||
|
||||
如果你可以使用最前沿的软件,并想要一个出色的管理仪表板,Fedora 服务器可能就是你要的平台。
|
||||
|
||||
### NethServer
|
||||
|
||||
正如你所发现的那样,NethServer 是每个人都知道的简单 SMB Linux 服务器。通过 NethServer 的最新版本,你的小型企业将得到:
|
||||
|
||||
* 内置 Samba 活动目录控制器
|
||||
* 与 Nextcloud 的无缝集成
|
||||
* 证书管理
|
||||
* HTTPS 透明代理
|
||||
* 防火墙
|
||||
* 邮件服务器和过滤器
|
||||
* Web 服务器和过滤器
|
||||
* 群件
|
||||
* IPS / IDS 或 VPN
|
||||
|
||||
所有包含的功能都可以通过用户友好的基于 Web 的界面轻松配置,包括单击安装模块以扩展 NethServer 功能集(图 3)。NethServer 与 ClearOS 的区别在于它的设计目的是使管理工作更轻松。换句话说,这个平台提供了更多的灵活性和功能。与面向家庭办公室和 SOHO 部署的 ClearOS 不同,NethServer 在小型商业环境中用起来就像在家庭里使用一样方便。
|
||||
|
||||
![NethServer][8]
|
||||
|
||||
*图 3:给 NethServer 添加模块*
|
||||
|
||||
### Rockstor
|
||||
|
||||
Rockstor 是采用 Linux 和 Btfrs 的高级网络附加存储(NAS)和云存储服务器,可部署用于家庭、SOHO 以及中小型企业。借助 Rockstor,你可以获得一个完整的 NAS /云解决方案,其中包含一个用户友好的基于 Web 的 GUI 工具,管理员可以像普通用户一样轻松使用它来设置。一旦部署好了 Rockstor,你就可以创建存储池、共享、快照、管理复制和用户、共享文件(借助 Samba、NFS、SFTP 和 AFP),甚至扩展它的功能集,这要归功于附加组件(称为 Rock-ons)。Rock-ons 列表包括:
|
||||
|
||||
* CouchPotato(Usenet 和 BitTorrent 用户的下载器)
|
||||
* Deluge(BitTorrent 用户的电影下载器)
|
||||
* EmbyServer(Emby 媒体服务器)
|
||||
* Ghost(专业博主的发布平台)
|
||||
* GitLab CE(Git 仓库托管和协作)
|
||||
* Gogs Go Git Service(轻量级 Git 版本控制服务器和前端)
|
||||
* Headphones(NZB 和 Torrent 的音乐自动下载器)
|
||||
* 用于 Squeezebox 设备的罗技 Squeezebox 服务器
|
||||
* MariaDB(关系型数据管理系统)
|
||||
* NZBGet(高效的 usenet 下载器)
|
||||
* OwnCloud-Official(安全的文件共享和托管)
|
||||
* Plexpy(基于 Python 的 Plex 用量跟踪器)
|
||||
* Rocket.Chat(开源聊天平台)
|
||||
* SaBnzbd(Usenet 下载器)
|
||||
* Sickbeard(用于电视节目的互联网个人视频录像机)
|
||||
* Sickrage(电视节目的自动视频库管理器)
|
||||
* Sonarr(Usenet 和 BitTorrent 用户的个人视频录像机)
|
||||
* Symform(备份设备)
|
||||
|
||||
Rockstor 还包括了一目了然的仪表板,使管理员可以快速访问他们所需的有关其服务器的所有信息(图 4)。
|
||||
|
||||
![Rockstor][10]
|
||||
|
||||
*图 4: Rockstor 面板*
|
||||
|
||||
### Zentyal
|
||||
|
||||
Zentyal 是另一个小型企业服务器,可以很好地处理多个任务。如果你正在寻找可以处理以下内容的 Linux 发行版:
|
||||
|
||||
* 目录和域服务器
|
||||
* 邮件服务器
|
||||
* 网关
|
||||
* DHCP、DNS 和 NTP 服务器
|
||||
* 认证机构(CA)
|
||||
* VPN
|
||||
* 实时消息(IM)
|
||||
* FTP 服务器
|
||||
* 反病毒
|
||||
* SSO 认证
|
||||
* 文件共享
|
||||
* RADIUS 认证
|
||||
* 虚拟化管理
|
||||
* 等等
|
||||
|
||||
Zentyal 可能是你的新选择。从 2004 年 Zentyal 就存在了,它基于 Ubuntu Server,因此它拥有坚实的基础和丰富的应用程序。在 Zentyal 仪表板的帮助下(图 5),管理员可以轻松管理:
|
||||
|
||||
* 系统
|
||||
* 网络
|
||||
* 日志
|
||||
* 软件更新和安装
|
||||
* 用户/组
|
||||
* 域
|
||||
* 文件共享
|
||||
* 邮件
|
||||
* DNS
|
||||
* 防火墙
|
||||
* 证书
|
||||
* 等等
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6)
|
||||
|
||||
*图 5:Zentyal 仪表板*
|
||||
|
||||
向 Zentyal 服务器添加新组件只需要打开仪表板,单击“软件管理” -> “Zentyal 组件”,选择要添加的组件,然后单击安装。Zentyal 可能会遇到的一个问题是,它提供不了与 Nethserver 和 ClearOS 一样多的插件。但它提供的服务,则做得非常好。
|
||||
|
||||
### 更多来自于
|
||||
|
||||
这个 Linux 服务器列表显然不是详尽无遗的。然而,这是一种对你可能没有听说过的五大服务器发行版的独特视角。当然,如果你更愿意使用更传统的 Linux 服务器发行版,你可以随时坚持使用 [CentOS][11]、[Ubuntu 服务器][12]、[SUSE][13]、[RHEL][14] 或 [Debian][15]……它们大多都出现在市场上最好的服务器发行版列表中。但是,如果你正在寻找一些不同的东西,那么试试这五个发行版中的一个。
|
||||
|
||||
通过 Linux 基金会和 edX 的免费[“Linux 简介”][16]课程了解有关 Linux 的更多信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions
|
||||
|
||||
作者:[Jack Wallen][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linux.com/users/jlwallen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.clearos.com/clearfoundation/software/clearos-7-community
|
||||
[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home
|
||||
[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business
|
||||
[4]: https://www.linux.com/files/images/fedoraserverjpg
|
||||
[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server)
|
||||
[6]: https://www.linux.com/licenses/category/used-permission
|
||||
[7]: https://www.linux.com/files/images/nethserverjpg
|
||||
[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer)
|
||||
[9]: https://www.linux.com/files/images/rockstorejpg
|
||||
[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor)
|
||||
[11]: https://www.centos.org/
|
||||
[12]: https://www.ubuntu.com/download/server
|
||||
[13]: https://www.suse.com/
|
||||
[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux
|
||||
[15]: https://www.debian.org/
|
||||
[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
@ -0,0 +1,61 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10494-1.html)
|
||||
[#]: subject: (Getting started with Isotope, an open source webmail client)
|
||||
[#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
|
||||
|
||||
开始使用 Isotope 吧,一款开源的 Web 邮件客户端
|
||||
======
|
||||
|
||||
> 使用轻量级的电子邮件客户端 Isotope 阅读富文本电子邮件,这个开源工具系列的第十一个工具将使你在 2019 年更高效。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH)
|
||||
|
||||
在每年的年初,似乎都有一股疯狂的寻找提高工作效率方法的冲动。新年决心,渴望以正确的方式开始新的一年。当然,“旧不去的,新的不来”的态度都会导致这种情况。一般的建议都偏向于闭源和专有软件,然而并不是必须这样。
|
||||
|
||||
以下是我挑选的 19 个新的(或者对你来说是新的)开源工具中的第 11 个,它将帮助你在 2019 年提高工作效率。
|
||||
|
||||
### Isotope
|
||||
|
||||
正如我们在[本系列的第四篇文章][1](Cypht)中所讨论的那样,我们花了很多时间来处理电子邮件。有很多方法可以解决它,我已经花了很多时间来寻找最适合我的电子邮件客户端。我认为这是一个重要的区别:对我有效的方法并不总是对其它人有效。有时对我有用的是像 [Thunderbird][2] 这样的完整客户端,有时是像 [Mutt][3] 这样的控制台客户端,有时是像 [Gmail][4] 和 [RoundCube][5] 这样基于 Web 的界面。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/isotope_1.png)
|
||||
|
||||
[Isotope][6] 是一个本地托管的、基于 Web 的电子邮件客户端。它非常轻巧,只使用 IMAP 协议,占用的磁盘空间非常小。与 Cypht 不同,Isotope 具有完整的 HTML 邮件支持,这意味着显示富文本电子邮件没有问题。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png)
|
||||
|
||||
如果你安装了 [Docker][7],那么安装 Isotope 非常容易。你只需将文档中的命令复制到控制台中,然后按下回车键。在浏览器中输入 `localhost` 来访问 Isotope 登录界面,输入你的 IMAP 服务器,登录名和密码将打开收件箱视图。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/isotope_3.png)
|
||||
|
||||
在这一点上,Isotope 的功能和你想象的差不多。单击消息进行查看,单击铅笔图标以创建新邮件等。你会注意到用户界面(UI)非常简单,没有“移动到文件夹”、“复制到文件夹”和“存档”等常规按钮。你可以通过拖动来移动消息,因此其实你并不太需要这些按钮。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/isotope_4.png)
|
||||
|
||||
总的来说,Isotope 干净、速度快、工作得非常好。更棒的是,它正在积极开发中(最近一次的提交是在我撰写本文的两小时之前),所以它正在不断得到改进。你可以查看代码并在 [GitHub][8] 上为它做出贡献。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/1/productivity-tool-isotope
|
||||
|
||||
作者:[Kevin Sonney][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/article/19/1/productivity-tool-cypht-email
|
||||
[2]: https://www.thunderbird.net/
|
||||
[3]: http://www.mutt.org/
|
||||
[4]: https://mail.google.com/
|
||||
[5]: https://roundcube.net/
|
||||
[6]: https://blog.marcnuri.com/isotope-mail-client-introduction/
|
||||
[7]: https://www.docker.com/
|
||||
[8]: https://github.com/manusa/isotope-mail
|
@ -0,0 +1,62 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10500-1.html)
|
||||
[#]: subject: (Get started with HomeBank, an open source personal finance app)
|
||||
[#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
|
||||
|
||||
开始使用 HomeBank 吧,一款开源个人财务应用
|
||||
======
|
||||
> 使用 HomeBank 跟踪你的资金流向,这是我们开源工具系列中的第八个工具,它将在 2019 年提高你的工作效率。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1)
|
||||
|
||||
每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。
|
||||
|
||||
这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。
|
||||
|
||||
### HomeBank
|
||||
|
||||
管理我的财务可能会很有压力。我不会每天查看我的银行余额,有时也很难跟踪我的钱流向哪里。我经常会花更多的时间来管理我的财务,挖掘账户和付款历史并找出我的钱去了哪里。了解我的财务状况可以帮助我保持冷静,并让我专注于其他事情。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/homebank-1.png)
|
||||
|
||||
[HomeBank][1] 是一款个人财务桌面应用,帮助你轻松跟踪你的财务状况,来帮助减少此类压力。它有很好的报告可以帮助你找出你花钱的地方,允许你设置导入交易的规则,并支持大多数现代格式。
|
||||
|
||||
HomeBank 默认可在大多数发行版上可用,因此安装它非常简单。当你第一次启动它时,它将引导你完成设置并让你创建一个帐户。之后,你可以导入任意一种支持的文件格式或开始输入交易。交易簿本身就是一个交易列表。[与其他一些应用不同][2],你不必学习[复式记账法][3]来使用 HomeBank。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/homebank-2.png)
|
||||
|
||||
从银行导入文件将使用另一个分步向导进行处理,该向导提供了创建新帐户或填充现有帐户的选项。导入新帐户可节省一点时间,因为你无需在开始导入之前预先创建所有帐户。你还可以一次将多个文件导入帐户,因此不需要对每个帐户中的每个文件重复相同的步骤。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/homebank-3.png)
|
||||
|
||||
我在导入和管理帐户时遇到的一个痛点是指定类别。一般而言,类别可以让你分解你的支出,看看你花钱的方式。HomeBank 与一些商业服务(以及一些商业程序)不同,它要求你手动设置所有类别。但这通常是一次性的事情,它可以在添加/导入交易时自动添加类别。还有一个按钮来分析帐户并跳过已存在的内容,这样可以加快对大量导入的分类(就像我第一次做的那样)。HomeBank 提供了大量可用的类别,你也可以添加自己的类别。
|
||||
|
||||
HomeBank 还有预算功能,允许你计划未来几个月的开销。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/homebank-4.png)
|
||||
|
||||
对我来说,最棒的功能是 HomeBank 的报告。主页面上不仅有一个图表显示你花钱的地方,而且还有许多其他报告可供你查看。如果你使用预算功能,还会有一份报告会根据预算跟踪你的支出情况。你还可以以饼图和条形图的方式查看报告。它还有趋势报告和余额报告,因此你可以回顾并查看一段时间内的变化或模式。
|
||||
|
||||
总的来说,HomeBank 是一个非常友好,有用的程序,可以帮助你保持良好的财务状况。如果跟踪你的钱是你生活中的一件麻烦事,它使用起来很简单并且非常有用。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/1/productivity-tools-homebank
|
||||
|
||||
作者:[Kevin Sonney][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: http://homebank.free.fr/en/index.php
|
||||
[2]: https://www.gnucash.org/
|
||||
[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system
|
@ -0,0 +1,157 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (dianbanjiu)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10498-1.html)
|
||||
[#]: subject: (Commands to help you monitor activity on your Linux server)
|
||||
[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html)
|
||||
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
|
||||
|
||||
监控 Linux 服务器活动的几个命令
|
||||
======
|
||||
|
||||
> `watch`、`top` 和 `ac` 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。
|
||||
|
||||
![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg)
|
||||
|
||||
为了在获取系统活动时更加轻松,Linux 系统提供了一系列相关的命令。在这篇文章中,我们就一起来看看这些对我们很有帮助的命令吧。
|
||||
|
||||
### watch 命令
|
||||
|
||||
`watch` 是一个用来轻松地重复检测 Linux 系统中一系列数据命令,例如用户活动、正在运行进程、登录、内存使用等。这个命令实际上是重复地运行一个特定的命令,每次都会重写之前显示的输出,它提供了一个比较方便的方式用以监测在你的系统中发生的活动。
|
||||
|
||||
首先以一个基础且不是特别有用的命令开始,你可以运行 `watch -n 5 date`,然后你可以看到在终端中显示了当前的日期和时间,这些数据会每五秒更新一次。你可能已经猜到了,`-n 5` 选项指定了运行接下来一次命令需要等待的秒数。默认是 2 秒。这个命令将会一直运行并按照指定的时间更新显示,直到你使用 `^C` 停下它。
|
||||
|
||||
```
|
||||
Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019
|
||||
|
||||
Wed Jan 23 15:59:14 EST 2019
|
||||
```
|
||||
|
||||
下面是一个更有趣的命令实例,你可以监控一个在服务器中登录用户的列表,该列表会按照指定的时间定时更新。就像下面写到的,这个命令会每 10 秒更新一次这个列表。登出的用户将会从当前显示的列表中消失,那些新登录的将会被添加到这个表格当中。如果没有用户再登录或者登出,这个表格跟之前显示的将不会有任何不同。
|
||||
|
||||
```
|
||||
$ watch -n 10 who
|
||||
|
||||
Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019
|
||||
|
||||
shs :0 2019-01-23 09:45 (:0)
|
||||
dory pts/0 2019-01-23 15:50 (192.168.0.5)
|
||||
nemo pts/1 2019-01-23 16:01 (192.168.0.15)
|
||||
shark pts/3 2019-01-23 11:11 (192.168.0.27)
|
||||
```
|
||||
|
||||
如果你只是想看有多少用户登录进来,可以通过 `watch` 调用 `uptime` 命令获取用户数和负载的平均水平,以及系统的工作状况。
|
||||
|
||||
```
|
||||
$ watch uptime
|
||||
|
||||
Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019
|
||||
|
||||
16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02
|
||||
```
|
||||
|
||||
如果你想使用 `watch` 重复一个包含了管道的命令,就需要将该命令用引号括起来,就比如下面这个每五秒显示一次有多少进程正在运行的命令。
|
||||
|
||||
```
|
||||
$ watch -n 5 'ps -ef | wc -l'
|
||||
|
||||
Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019
|
||||
|
||||
245
|
||||
```
|
||||
|
||||
要查看内存使用,你也许会想要试一下下面的这个命令组合:
|
||||
|
||||
```
|
||||
$ watch -n 5 free -m
|
||||
|
||||
Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019
|
||||
|
||||
Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019
|
||||
|
||||
total used free shared buff/cache available
|
||||
Mem: 5959 776 3276 12 1906 4878
|
||||
Swap: 2047 0 2047
|
||||
```
|
||||
|
||||
你可以在 `watch` 后添加一些选项查看某个特定用户下运行的进程,不过 `top` 为此提供了更好的选择。
|
||||
|
||||
### top 命令
|
||||
|
||||
如果你想查看某个特定用户下的进程,`top` 命令的 `-u` 选项可以很轻松地帮你达到这个目的。
|
||||
|
||||
```
|
||||
$ top -u nemo
|
||||
top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02
|
||||
Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie
|
||||
%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache
|
||||
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd
|
||||
23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam)
|
||||
23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd
|
||||
23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh
|
||||
```
|
||||
|
||||
你可能不仅可以看到某个用户下的进程,还可以查看每个进程所占用的资源,以及系统总的工作状况。
|
||||
|
||||
### ac 命令
|
||||
|
||||
如果你想查看系统中每个用户登录的时长,可以使用 `ac` 命令。运行该命令之前首先需要安装 `acct`(Debian 等)或者 `psacct`(RHEL、Centos 等)包。
|
||||
|
||||
`ac` 命令有一系列的选项,该命令从 `wtmp` 文件中拉取数据。这个例子展示的是最近用户登录的总小时数。
|
||||
|
||||
```
|
||||
$ ac
|
||||
total 1261.72
|
||||
```
|
||||
|
||||
这个命令显示了用户登录的总的小时数:
|
||||
|
||||
```
|
||||
$ ac -p
|
||||
shark 5.24
|
||||
nemo 5.52
|
||||
shs 1251.00
|
||||
total 1261.76
|
||||
```
|
||||
|
||||
这个命令显示了每天登录的用户小时数:
|
||||
|
||||
```
|
||||
$ ac -d | tail -10
|
||||
|
||||
Jan 11 total 0.05
|
||||
Jan 12 total 1.36
|
||||
Jan 13 total 16.39
|
||||
Jan 15 total 55.33
|
||||
Jan 16 total 38.02
|
||||
Jan 17 total 28.51
|
||||
Jan 19 total 48.66
|
||||
Jan 20 total 1.37
|
||||
Jan 22 total 23.48
|
||||
Today total 9.83
|
||||
```
|
||||
|
||||
### 总结
|
||||
|
||||
Linux 系统上有很多命令可以用于检查系统活动。`watch` 命令允许你以重复的方式运行任何命令,并观察输出有何变化。`top` 命令是一个专注于用户进程的最佳选项,以及允许你以动态方式查看进程的变化,还可以使用 `ac` 命令检查用户连接到系统的时间。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[dianbanjiu](https://github.com/dianbanjiu)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.facebook.com/NetworkWorld/
|
||||
[2]: https://www.linkedin.com/company/network-world
|
154
published/20190124 Understanding Angle Brackets in Bash.md
Normal file
154
published/20190124 Understanding Angle Brackets in Bash.md
Normal file
@ -0,0 +1,154 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10502-1.html)
|
||||
[#]: subject: (Understanding Angle Brackets in Bash)
|
||||
[#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash)
|
||||
[#]: author: (Paul Brown https://www.linux.com/users/bro66)
|
||||
|
||||
理解 Bash 中的尖括号
|
||||
======
|
||||
|
||||
> 为初学者介绍尖括号。
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3)
|
||||
|
||||
[Bash][1] 内置了很多诸如 `ls`、`cd`、`mv` 这样的重要的命令,也有很多诸如 `grep`、`awk`、`sed` 这些有用的工具。但除此之外,其实 [Bash][1] 中还有很多可以[起到胶水作用][2]的标点符号,例如点号(`.`)、逗号(`,`)、括号(`<>`)、引号(`"`)之类。下面我们就来看一下可以用来进行数据转换和转移的尖括号(`<>`)。
|
||||
|
||||
### 转移数据
|
||||
|
||||
如果你对其它编程语言有所了解,你会知道尖括号 `<` 和 `>` 一般是作为逻辑运算符,用来比较两个值之间的大小关系。如果你还编写 HTML,尖括号作为各种标签的一部分,就更不会让你感到陌生了。
|
||||
|
||||
在 shell 脚本语言中,尖括号可以将数据从一个地方转移到另一个地方。例如可以这样把数据存放到一个文件当中:
|
||||
|
||||
```
|
||||
ls > dir_content.txt
|
||||
```
|
||||
|
||||
在上面的例子中,`>` 符号让 shell 将 `ls` 命令的输出结果写入到 `dir_content.txt` 里,而不是直接显示在命令行中。需要注意的是,如果 `dir_content.txt` 这个文件不存在,Bash 会为你创建;但是如果 `dir_content.txt` 是一个已有的非空文件,它的内容就会被覆盖掉。所以执行类似的操作之前务必谨慎。
|
||||
|
||||
你也可以不使用 `>` 而使用 `>>`,这样就可以把新的数据追加到文件的末端而不会覆盖掉文件中已有的数据了。例如:
|
||||
|
||||
```
|
||||
ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt
|
||||
```
|
||||
|
||||
在这串命令里,首先将家目录的内容写入到 `dir_content.txt` 文件中,然后使用 `wc -l` 计算出 `dir_content.txt` 文件的行数(也就是家目录中的文件数)并追加到 `dir_content.txt` 的末尾。
|
||||
|
||||
在我的机器上执行上述命令之后,`dir_content.txt` 的内容会是以下这样:
|
||||
|
||||
```
|
||||
Applications
|
||||
bin
|
||||
cloud
|
||||
Desktop
|
||||
Documents
|
||||
Downloads
|
||||
Games
|
||||
ISOs
|
||||
lib
|
||||
logs
|
||||
Music
|
||||
OpenSCAD
|
||||
Pictures
|
||||
Public
|
||||
Templates
|
||||
test_dir
|
||||
Videos
|
||||
17 dir_content.txt
|
||||
```
|
||||
|
||||
你可以将 `>` 和 `>>` 作为箭头来理解。当然,这个箭头的指向也可以反过来。例如,Coen brothers
|
||||
(LCTT 译注:科恩兄弟,一个美国电影导演组合)的一些演员以及他们出演电影的次数保存在 `CBActors` 文件中,就像这样:
|
||||
|
||||
```
|
||||
John Goodman 5
|
||||
John Turturro 3
|
||||
George Clooney 2
|
||||
Frances McDormand 6
|
||||
Steve Buscemi 5
|
||||
Jon Polito 4
|
||||
Tony Shalhoub 3
|
||||
James Gandolfini 1
|
||||
```
|
||||
|
||||
你可以执行这样的命令:
|
||||
|
||||
```
|
||||
sort < CBActors
|
||||
Frances McDormand 6 # 你会得到这样的输出
|
||||
George Clooney 2
|
||||
James Gandolfini 1
|
||||
John Goodman 5
|
||||
John Turturro 3
|
||||
Jon Polito 4
|
||||
Steve Buscemi 5
|
||||
Tony Shalhoub 3
|
||||
```
|
||||
|
||||
就可以使用 [sort][4] 命令将这个列表按照字母顺序输出。但是,`sort` 命令本来就可以接受传入一个文件,因此在这里使用 `<` 会略显多余,直接执行 `sort CBActors` 就可以得到期望的结果。
|
||||
|
||||
如果你想知道 Coens 最喜欢的演员是谁,你可以这样操作。首先:
|
||||
|
||||
```
|
||||
while read name surname films; do echo $films $name $surname > filmsfirst.txt; done < CBActors
|
||||
```
|
||||
|
||||
上面这串命令写在多行中可能会比较易读:
|
||||
|
||||
```
|
||||
while read name surname films;\
|
||||
do
|
||||
echo $films $name $surname >> filmsfirst;\
|
||||
done < CBActors
|
||||
```
|
||||
|
||||
下面来分析一下这些命令做了什么:
|
||||
|
||||
* [while ...; do ... done][5] 是一个循环结构。当 `while` 后面的条件成立时,`do` 和 `done` 之间的部分会一直重复执行;
|
||||
* [read][6] 语句会按行读入内容。`read` 会从标准输入中持续读入,直到没有内容可读入;
|
||||
* `CBActors` 文件的内容会通过 `<` 从标准输入中读入,因此 `while` 循环会将 `CBActors` 文件逐行完整读入;
|
||||
* `read` 命令可以按照空格将每一行内容划分为三个字段,然后分别将这三个字段赋值给 `name`、`surname` 和 `films` 三个变量,这样就可以很方便地通过 `echo $films $name $surname >> filmsfirst;\` 来重新排列几个字段的放置顺序并存放到 `filmfirst` 文件里面了。
|
||||
|
||||
执行完以后,查看 `filmsfirst` 文件,内容会是这样的:
|
||||
|
||||
```
|
||||
5 John Goodman
|
||||
3 John Turturro
|
||||
2 George Clooney
|
||||
6 Frances McDormand
|
||||
5 Steve Buscemi
|
||||
4 Jon Polito
|
||||
3 Tony Shalhoub
|
||||
1 James Gandolfini
|
||||
```
|
||||
|
||||
这时候再使用 `sort` 命令:
|
||||
|
||||
```
|
||||
sort -r filmsfirst
|
||||
```
|
||||
|
||||
就可以看到 Coens 最喜欢的演员是 Frances McDormand 了。(`-r` 参数表示降序排列,因此 McDormand 会排在最前面)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash
|
||||
|
||||
作者:[Paul Brown][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linux.com/users/bro66
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linux.com/blog/2019/1/bash-shell-utility-reaches-50-milestone
|
||||
[2]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot
|
||||
[3]: https://linux.die.net/man/1/wc
|
||||
[4]: https://linux.die.net/man/1/sort
|
||||
[5]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html
|
||||
[6]: https://linux.die.net/man/2/read
|
||||
|
@ -1,100 +0,0 @@
|
||||
XYenChi is translating
|
||||
10 keys to quick game development
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb)
|
||||
|
||||
In early October, the inaugural [Open Jam][1] sponsored by Opensource.com drew 45 entries from teams located around the world. The teams had just three days to create a game using open source software to enter into the competition, and [three teams came out on top][2].
|
||||
|
||||
We hosted our own Open Jam event at our university for anyone who wanted to participate. We reserved a computer lab for the weekend and taught people how to use open source software--[Godot][3] for the game engine, [LMMS][4] for music creation, [GIMP][5] for 2D art, and [Blender][6] for 3D art--to create games and game art assets. Three games were submitted from our event: [Loathsome][7], [Lost Artist][8], and [Paint Rider][9] (which I created).
|
||||
|
||||
From my experience with game jams and game development in general, here are 10 lessons I've learned about game engines, coding, and rapid game development.
|
||||
|
||||
## 1\. Narrow your scope
|
||||
|
||||
It's easy to get carried away with ideas to make an expansive adventure game or something that compares to your favorite game. Pursuing that outside of a game jam can be awesome, once you have some experience, but don't overestimate what you have time for. What I love about game jams is they force you to focus on getting a game from the conceptual stage to a final product quickly, since you have such a limited amount of time. This is why narrowing your scope is so important.
|
||||
|
||||
The theme for Open Jam was "Leave a Mark." As soon as it was announced, my friends and I started brainstorming games that could fit that theme. One idea was a 3D boxing game where the player left bruises on their enemy. I had very little experience making 3D games and, while I would have loved to get better at them, I probably would have spent too much time learning how to get all the textures situated and hit boxes working before I could even start to figure out what would make a fun game.
|
||||
|
||||
## 2\. Have something playable very early
|
||||
|
||||
This is my favorite advice for game jams. Try to come up with the core mechanics and code them to a working state quickly so you can test them and decide whether it's worthy of making a full game. You shouldn't be hours away from the deadline and still trying to get your game playable. For a three-day jam like Open Jam, it shouldn't take more than a few hours to have some sort of demo running.
|
||||
|
||||
## 3\. Keep it simple
|
||||
|
||||
Every feature that you want to include extends your total development time. You never know if committing to a feature will lead to a major time sink because you just can't quite get it to work. Arcade-style high-score games typically work well for game jams because they're usually simple by nature. Once you've finished the core, you can start adding features and polish without having to worry whether you'll have a functioning game in the end.
|
||||
|
||||
## 4\. Take inspiration from other games
|
||||
|
||||
You may be tempted to create something totally original, but having models to base your work on is extremely helpful. It will decrease the time it takes to come up with the mechanics, since you'll already have an idea of what is fun. Remind yourself that the more experience you have under your belt, the easier it is to create that massive game you have so many ideas for, so you might as well practice by trying to recreate things other people have done.
|
||||
|
||||
Considering Open Jam's "Leave a Mark" theme, I thought it would be fun to create a game where you leave a trail of paint as you played, so you could see the mark you left. I remembered the old Flash game [Line Rider 2 Beta][10] (hence the name Paint Rider), and about the secret feature where you could draw a track if you held the Control button down while you played. I simplified that concept even more by requiring only one button for vertical movement (much like old helicopter games). About an hour or two into the jam, I had a basic demo where you could move up or down with one button and leave a trail of little black circles.
|
||||
|
||||
## 5\. Don't overlook accessibility
|
||||
|
||||
Make sure as many people as possible can play your game. One of the games submitted to Open Jam was a virtual-reality game. As cool as that was, hardly anyone was able to play it, because not many people have a VR device. Luckily, its developer didn't expect it would do well in the ratings, and instead considered it practice. But, if you want to share your game with lots of people (or win game jams), it's important to pay attention to accessibility.
|
||||
|
||||
Godot (and most other game engines) allow you to export your game to all major platforms. When submitting a game specifically to [Itch.io][11], having an in-browser version will allow most people to play it. But always look into exporting to as many platforms and operating systems as you can. I even tried exporting Paint Rider to mobile, but technical difficulties got in the way.
|
||||
|
||||
## 6\. Don't make it too difficult
|
||||
|
||||
If your game takes too much effort to learn or play, you'll lose a portion of your audience. This aligns nicely with keeping your game simple and within scope, and it puts even more importance on the game planning phase. Again, it's easy to come up with an epic game idea you could spend weeks or months developing; it's harder to come up with a good, simple game.
|
||||
|
||||
I showed Paint Rider to my Mom and she was able to play it immediately. I don't think I need to say anything more about that.
|
||||
|
||||
## 7\. Don't be too neat
|
||||
|
||||
If you're used to taking your time applying design patterns everywhere and making sure that your code will be reusable and readable, try to loosen up a bit. If you spend too much time worrying about design, when you finally get to the point when you can play your game, you may find out it's not very fun. By then, it's too late to make changes.
|
||||
|
||||
This process is also used for prototyping more serious games: You quickly code up messy proof-of-concept demos until you find one that's worth making into a full game, then you dive into building a perfect code base to support it. Creating a game for a game jam is like quickly coding up a proof of concept.
|
||||
|
||||
## 8\. But don't be too messy, either
|
||||
|
||||
On the other hand, [spaghetti code][12] can easily get out of control, even if there's not a ton of code in a game. Luckily, most game engines are built with design patterns in mind. Take Godot's [Signals][13] functionality, which allows nodes to send messages with data to nodes they've been "connected" with--it's the [observer pattern][14] automatically baked into your design. As long as you know how to take advantage of the game engine's features, you should be able to code quickly without making your code too painful to look at.
|
||||
|
||||
## 9\. Get feedback
|
||||
|
||||
Show people what you're working on. Have them try it out and see what they say about it. Watch how they play your game and see if they find something you didn't expect. If the game jam has a [Discord][15] channel or something similar, post your game there, or bounce your ideas off people. One of Paint Rider's defining features is that the canvas loops, so you see the paint you left before. I hadn't even considered that mechanic until someone asked me why the game didn't have it.
|
||||
|
||||
Working on a team will ensure that there are other people built into the process who can pass feedback around.
|
||||
|
||||
And don't forget to help other people out in the same way; it's a win-win if you realize something that could help your game while you're playing someone else's game.
|
||||
|
||||
## 10\. Know where to find resources
|
||||
|
||||
Creating all your own assets can really slow you down. During Open Jam, I noticed that Loathsome's developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. You could simplify your art style for the game and still come up with something that looks and sounds good, but there are other options. Try looking for assets in [Creative Commons][16] or on free music sites like [Anttis Instrumentals][17]. Or, if possible, form a team with a dedicated artist, writer, or musician.
|
||||
|
||||
Other software you might find useful includes [Krita][18], an open source 2D image creator that's nice for digital painting, especially if you have a drawing tablet, and [sfxr][19], a game sound-effect creator that has a lot of parameters to play with, but as its creator says: "Basic usage involves hitting the randomize button." (All sound effects in Paint Rider were made with Sfxr.) You can also check out [Calinou][20]'s large and neatly organized list of open source game development software.
|
||||
|
||||
Have you participated in Open Jam or another a game jam and have other advice? Or do you have questions I didn't address? If so, please share them in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development
|
||||
|
||||
作者:[Ryan Estes][a]
|
||||
译者:[译者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/figytuna
|
||||
[1]:https://itch.io/jam/open-jam-1
|
||||
[2]:https://opensource.com/article/17/11/open-jam
|
||||
[3]:https://godotengine.org/
|
||||
[4]:https://lmms.io/
|
||||
[5]:https://www.gimp.org/
|
||||
[6]:https://www.blender.org/
|
||||
[7]:https://astropippin.itch.io/loathsome
|
||||
[8]:https://masonraus.itch.io/lost-artist
|
||||
[9]:https://figytuna.itch.io/paint-rider
|
||||
[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/
|
||||
[11]:https://itch.io/
|
||||
[12]:https://en.wikipedia.org/wiki/Spaghetti_code
|
||||
[13]:http://kidscancode.org/blog/2017/03/godot_101_07/
|
||||
[14]:https://en.wikipedia.org/wiki/Observer_pattern
|
||||
[15]:https://discordapp.com/
|
||||
[16]:https://creativecommons.org/
|
||||
[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008
|
||||
[18]:https://krita.org/en/
|
||||
[19]:http://www.drpetter.se/project_sfxr.html
|
||||
[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md
|
@ -0,0 +1,68 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (What happens when a veteran teacher goes to an open source conference)
|
||||
[#]: via: (https://opensource.com/open-organization/19/1/educator-at-open-source-conference)
|
||||
[#]: author: (Ben Owens https://opensource.com/users/engineerteacher)
|
||||
|
||||
What happens when a veteran teacher goes to an open source conference
|
||||
======
|
||||
Sometimes feeling like a fish out of water is precisely what educators need.
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4)
|
||||
|
||||
"Change is going to be continual, and today is the slowest day society will ever move."—[Tony Fadell][1]
|
||||
|
||||
If ever there was an experience that brought the above quotation home for me, it was my experience at the [All Things Open conference][2] in Raleigh, NC last October. Thousands of people from all over the world attended the conference, and many (if not most), worked as open source coders and developers. As one of the relatively few educators in attendance, I saw and heard things that were completely foreign to me—terms like as Istio, Stack Overflow, Ubuntu, Sidecar, HyperLedger, and Kubernetes tossed around for days.
|
||||
|
||||
I felt like a fish out of water. But in the end, that was the perfect dose of reality I needed to truly understand how open principles can reshape our approach to education.
|
||||
|
||||
### Not-so-strange attractors
|
||||
|
||||
All Things Open attracted me to Raleigh for two reasons, both of which have to do with how our schools must do a better job of creating environments that truly prepare students for a rapidly changing world.
|
||||
|
||||
The first is my belief that schools should embrace the ideals of the [open source way][3]. The second is that educators have to periodically force themselves out of their relatively isolated worlds of "doing school" in order to get a glimpse of what the world is actually doing.
|
||||
|
||||
When I was an engineer for 20 years, I developed a deep sense of the power of an open exchange of ideas, of collaboration, and of the need for rapid prototyping of innovations. Although we didn't call these ideas "open source" at the time, my colleagues and I constantly worked together to identify and solve problems using tools such as [Design Thinking][4] so that our businesses remained competitive and met market demands. When I became a science and math teacher at a small [public school][5] in rural Appalachia, my goal was to adapt these ideas to my classrooms and to the school at large as a way to blur the lines between a traditional school environment and what routinely happens in the "real world."
|
||||
|
||||
Through several years of hard work and many iterations, my fellow teachers and I were eventually able to develop a comprehensive, school-wide project-based learning model, where students worked in collaborative teams on projects that [made real connections][6] between required curriculum and community-based applications. Doing so gave these students the ability to develop skills they can use for a lifetime, rather than just on the next test—skills such as problem solving, critical thinking, oral and written communication, perseverance through setbacks, and adapting to changing conditions, as well as how to have routine conversations with adult mentors form the community. Only after reading [The Open Organization][7] did I realize that what we had been doing essentially embodied what Jim Whitehurst had described. In our case, of course, we applied open principles to an educational context (that model, called Open Way Learning, is the subject of a [book][8] published in December).
|
||||
|
||||
I felt like a fish out of water. But in the end, that was the perfect dose of reality I needed to truly understand how open principles can reshape our approach to education.
|
||||
|
||||
As good as this model is in terms of pushing students into a relevant, engaging, and often unpredictable learning environments, it can only go so far if we, as educators who facilitate this type of project-based learning, do not constantly stay abreast of changing technologies and their respective lexicon. Even this unconventional but proven approach will still leave students ill-prepared for a global, innovation economy if we aren't constantly pushing ourselves into areas outside our own comfort zones. My experience at the All Things Open conference was a perfect example. While humbling, it also forced me to confront what I didn't know so that I can learn from it to help the work I do with other teachers and schools.
|
||||
|
||||
### A critical decision
|
||||
|
||||
I made this point to others when I shared a picture of the All Things Open job board with dozens of colleagues all over the country. I shared it with the caption: "What did you do in your school today to prepare your students for this reality tomorrow?" The honest answer from many was, unfortunately, "not much." That has to change.
|
||||
|
||||
![](https://opensource.com/sites/default/files/images/open-org/owens_1.jpg)
|
||||
![](https://opensource.com/sites/default/files/images/open-org/owens_2.jpg)
|
||||
(Images courtesy of Ben Owens, CC BY-SA)
|
||||
|
||||
People in organizations everywhere have to make a critical decision: either embrace the rapid pace of change that is a fact of life in our world or face the hard reality of irrelevance. Our systems in education are at this same crossroads—even ones who think of themselves as being innovative. It involves admitting to students, "I don't know, but I'm willing to learn." That's the kind of teaching and learning experience our students deserve.
|
||||
|
||||
It can happen, but it will take pioneering educators who are willing to move away from comfortable, back-of-the-book answers to help students as they work on difficult and messy challenges. You may very well be a veritable fish out of water.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/19/1/educator-at-open-source-conference
|
||||
|
||||
作者:[Ben Owens][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/engineerteacher
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://en.wikipedia.org/wiki/Tony_Fadell
|
||||
[2]: https://allthingsopen.org/
|
||||
[3]: https://opensource.com/open-source-way
|
||||
[4]: https://dschool.stanford.edu/resources-collections/a-virtual-crash-course-in-design-thinking
|
||||
[5]: https://www.tricountyearlycollege.org/
|
||||
[6]: https://www.bie.org/about/what_pbl
|
||||
[7]: https://www.redhat.com/en/explore/the-open-organization-book
|
||||
[8]: https://www.amazon.com/Open-Up-Education-Learning-Transform/dp/1475842007/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=&sr=
|
74
sources/talk/20190123 Book Review- Fundamentals of Linux.md
Normal file
74
sources/talk/20190123 Book Review- Fundamentals of Linux.md
Normal file
@ -0,0 +1,74 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Book Review: Fundamentals of Linux)
|
||||
[#]: via: (https://itsfoss.com/fundamentals-of-linux-book-review)
|
||||
[#]: author: (John Paul https://itsfoss.com/author/john/)
|
||||
|
||||
Book Review: Fundamentals of Linux
|
||||
======
|
||||
|
||||
There are many great books that cover the basics of what Linux is and how it works. Today, I will be taking a look at one such book. Today, the subject of our discussion is [Fundamentals of Linux][1] by Oliver Pelz and is published by [PacktPub][2].
|
||||
|
||||
[Oliver Pelz][3] has over ten years of experience as a software developer and a system administrator. He holds a degree in bioinformatics.
|
||||
|
||||
### What is the book ‘Fundamentals of Linux’ about?
|
||||
|
||||
![Fundamental of Linux books][4]
|
||||
|
||||
As can be guessed from the title, the goal of Fundamentals of Linux is to give the reader a strong foundation from which to learn about the Linux command line. The book is a little over two hundred pages long, so it only focuses on teaching the everyday tasks and problems that users commonly encounter. The book is designed for readers who want to become Linux administrators.
|
||||
|
||||
The first chapter starts out by giving an overview of virtualization. From there the author instructs how to create a virtual instance of [CentOS][5] in [VirtualBox][6], how to clone it, and how to use snapshots. You will also learn how to connect to the virtual machines via SSH.
|
||||
|
||||
The second chapter covers the basics of the Linux command line. This includes shell globbing, shell expansion, how to work with file names that contain spaces or special characters. It also explains how to interpret a command’s manual page, as well as, how to use `sed`, `awk`, and to navigate the Linux file system.
|
||||
|
||||
The third chapter takes a more in-depth look at the Linux file system. You will learn how files are linked in Linux and how to search for them. You will also be given an overview of users, groups and file permissions. Since the chapter focuses on interacting with files, it tells how to read text files from the command line, as well as, an overview of how to use the VIM editor.
|
||||
|
||||
Chapter four focuses on using the command line. It covers important commands, such as `cat`, `sort`, `awk`. `tee`, `tar`, `rsync`, `nmap`, `htop` and more. You will learn what processes are and how they communicate with each other. This chapter also includes an introduction to Bash shell scripting.
|
||||
|
||||
The fifth and final chapter covers networking on Linux and other advanced command line concepts. The author discusses how Linux handles networking and gives examples using multiple virtual machines. He also covers how to install new programs and how to set up a firewall.
|
||||
|
||||
### Thoughts on the book
|
||||
|
||||
Fundamentals of Linux might seem short at five chapters and a little over two hundred pages. However, quite a bit of information is covered. You are given everything that you need to get going on the command line.
|
||||
|
||||
The book’s sole focus on the command line is one thing to keep in mind. You won’t get any information on how to use a graphical user interface. That is partially because Linux has so many different desktop environments and so many similar system applications that it would be hard to write a book that could cover all of the variables. It is also partially because the book is aimed at potential Linux administrators.
|
||||
|
||||
I was kinda surprised to see that the author used [CentOS][7] to teach Linux. I would have expected him to use a more common Linux distro, like Ubuntu, Debian, or Fedora. However, because it is a distro designed for servers very little changes over time, so it is a very stable basis for a course on Linux basics.
|
||||
|
||||
I’ve used Linux for over half a decade. I spent most of that time using desktop Linux. I dove into the terminal when I needed to, but didn’t spend lots of time there. I have performed many of the actions covered in this book using a mouse. Now, I know how to do the same things via the terminal. It won’t change the way I do my tasks, but it will help me understand what goes on behind the curtain.
|
||||
|
||||
If you have either just started using Linux or are planning to do so in the future, I would not recommend this book. It might be a little overwhelming. If you have already spent some time with Linux or can quickly grasp the technical language, this book may very well be for you.
|
||||
|
||||
If you think this book is apt for your learning needs, you can get the book from the link below:
|
||||
|
||||
We will be trying to review more Linux books in coming months so stay tuned with us.
|
||||
|
||||
What is your favorite introductory book on Linux? Let us know in the comments below.
|
||||
|
||||
If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][8].
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/fundamentals-of-linux-book-review
|
||||
|
||||
作者:[John Paul][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/john/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.packtpub.com/networking-and-servers/fundamentals-linux
|
||||
[2]: https://www.packtpub.com/
|
||||
[3]: http://www.oliverpelz.de/index.html
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/fundamentals-of-linux-book-review.jpeg?resize=800%2C450&ssl=1
|
||||
[5]: https://centos.org/
|
||||
[6]: https://www.virtualbox.org/
|
||||
[7]: https://www.centos.org/
|
||||
[8]: http://reddit.com/r/linuxusersgroup
|
@ -1,142 +0,0 @@
|
||||
Translating By Guevaraya
|
||||
|
||||
Linux/Unix App For Prevention Of RSI (Repetitive Strain Injury)
|
||||
======
|
||||
![workrave-image][1]
|
||||
|
||||
[A repetitive strain injury][2] (RSI) is occupational overuse syndrome, non-specific arm pain or work related upper limb disorder. RSI caused from overusing the hands to perform a repetitive task, such as typing, writing, or clicking a mouse. Unfortunately, most people do not understand what RSI is or how dangerous it can be. You can easily prevent RSI using open source software called Workrave.
|
||||
|
||||
|
||||
### What are the symptoms of RSI?
|
||||
|
||||
I'm quoting from this [page][3]. Do you experience:
|
||||
|
||||
1. Fatigue or lack of endurance?
|
||||
2. Weakness in the hands or forearms?
|
||||
3. Tingling, numbness, or loss of sensation?
|
||||
4. Heaviness: Do your hands feel like dead weight?
|
||||
5. Clumsiness: Do you keep dropping things?
|
||||
6. Lack of strength in your hands? Is it harder to open jars? Cut vegetables?
|
||||
7. Lack of control or coordination?
|
||||
8. Chronically cold hands?
|
||||
9. Heightened awareness? Just being slightly more aware of a body part can be a clue that something is wrong.
|
||||
10. Hypersensitivity?
|
||||
11. Frequent self-massage (subconsciously)?
|
||||
12. Sympathy pains? Do your hands hurt when someone else talks about their hand pain?
|
||||
|
||||
|
||||
|
||||
### How to reduce your risk of Developing RSI
|
||||
|
||||
* Take breaks, when using your computer, every 30 minutes or so. Use software such as workrave to prevent RSI.
|
||||
* Regular exercise can prevent all sort of injuries including RSI.
|
||||
* Use good posture. Adjust your computer desk and chair to support muscles necessary for good posture.
|
||||
|
||||
|
||||
|
||||
### Workrave
|
||||
|
||||
Workrave is a free open source software application intended to prevent computer users from developing RSI or myopia. The software periodically locks the screen while an animated character, "Miss Workrave," walks the user through various stretching exercises and urges them to take a coffee break. The program frequently alerts you to take micro-pauses, rest breaks and restricts you to your daily limit. The program works under MS-Windows and Linux, UNIX-like operating systems.
|
||||
|
||||
#### Install workrave
|
||||
|
||||
Type the following [apt command][4]/[apt-get command][5] under a Debian / Ubuntu Linux:
|
||||
`$ sudo apt-get install workrave`
|
||||
Fedora Linux user should type the following dnf command:
|
||||
`$ sudo dnf install workrave`
|
||||
RHEL/CentOS Linux user should enable EPEL repo and install it using [yum command][6]:
|
||||
```
|
||||
### [ **tested on a CentOS/RHEL 7.x and clones** ] ###
|
||||
$ sudo yum install epel-release
|
||||
$ sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
|
||||
$ sudo yum install workrave
|
||||
```
|
||||
Arch Linux user type the following pacman command to install it:
|
||||
`$ sudo pacman -S workrave`
|
||||
FreeBSD user can install it using the following pkg command:
|
||||
`# pkg install workrave`
|
||||
OpenBSD user can install it using the following pkg_add command
|
||||
```
|
||||
$ doas pkg_add workrave
|
||||
```
|
||||
|
||||
#### How to configure workrave
|
||||
|
||||
Workrave works as an applet which is a small application whose user interface resides within a panel. You need to add workrave to panel to control behavior and appearance of the software.
|
||||
|
||||
##### Adding a New Workrave Object To Panel
|
||||
|
||||
* Right-click on a vacant space on a panel to open the panel popup menu.
|
||||
* Choose Add to Panel.
|
||||
* The Add to Panel dialog opens.The available panel objects are listed alphabetically, with launchers at the top. Select workrave applet and click on Add button.
|
||||
|
||||
![Fig.01: Adding an Object \(Workrave\) to a Panel][7]
|
||||
Fig.01: Adding an Object (Workrave) to a Panel
|
||||
|
||||
##### How Do I Modify Properties Of Workrave Software?
|
||||
|
||||
To modify the properties of an object workrave, perform the following steps:
|
||||
|
||||
* Right-click on the workrave object to open the panel object popup.
|
||||
* Choose Preference. Use the Properties dialog to modify the properties as required.
|
||||
|
||||
![](https://www.cyberciti.biz/media/new/tips/2009/11/linux-gnome-workwave-preferences-.png)
|
||||
Fig.02: Modifying the Properties of The Workrave Software
|
||||
|
||||
#### Workrave in Action
|
||||
|
||||
The main window shows the time remaining until it suggests a pause. The windows can be closed and you will the time remaining on the panel itself:
|
||||
![Fig.03: Time reaming counter ][8]
|
||||
Fig.03: Time reaming counter
|
||||
|
||||
![Fig.04: Miss Workrave - an animated character walks you through various stretching exercises][9]
|
||||
Fig.04: Miss Workrave - an animated character walks you through various stretching exercises
|
||||
|
||||
The break prelude window, bugging you to take a micro-pause:
|
||||
![Fig.05: Time for a micro-pause remainder ][10]
|
||||
Fig.05: Time for a micro-pause remainder
|
||||
|
||||
![Fig.06: You can skip Micro-break ][11]
|
||||
Fig.06: You can skip Micro-break
|
||||
|
||||
##### References:
|
||||
|
||||
1. [Workrave project][12] home page.
|
||||
2. [pokoy][13] lightweight daemon that helps prevent RSI and other computer related stress.
|
||||
3. [A Pomodoro][14] timer for GNOME 3.
|
||||
4. [RSI][2] from the wikipedia.
|
||||
|
||||
|
||||
|
||||
### about the author
|
||||
|
||||
The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on [Twitter][15], [Facebook][16], [Google+][17].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.cyberciti.biz/tips/repetitive-strain-injury-prevention-software.html
|
||||
|
||||
作者:[Vivek Gite][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.cyberciti.biz/
|
||||
[1]:https://www.cyberciti.biz/media/new/tips/2009/11/workrave-image.jpg (workrave-image)
|
||||
[2]:https://en.wikipedia.org/wiki/Repetitive_strain_injury
|
||||
[3]:https://web.eecs.umich.edu/~cscott/rsi.html##symptoms
|
||||
[4]:https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/ (See Linux/Unix apt command examples for more info)
|
||||
[5]:https://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html (See Linux/Unix apt-get command examples for more info)
|
||||
[6]:https://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/ (See Linux/Unix yum command examples for more info)
|
||||
[7]:https://www.cyberciti.biz/media/new/tips/2009/11/add-workwave-to-panel.png (Adding an Object (Workrave) to a Gnome Panel)
|
||||
[8]:https://www.cyberciti.biz/media/new/tips/2009/11/screenshot-workrave.png (Workrave main window shows the time remaining until it suggests a pause.)
|
||||
[9]:https://www.cyberciti.biz/media/new/tips/2009/11/miss-workrave.png (Miss Workrave Sofrware character walks you through various RSI stretching exercises )
|
||||
[10]:https://www.cyberciti.biz/media/new/tips/2009/11/time-for-micro-pause.gif (Workrave RSI Software Time for a micro-pause remainder )
|
||||
[11]:https://www.cyberciti.biz/media/new/tips/2009/11/Micro-break.png (Workrave RSI Software Micro-break )
|
||||
[12]:http://www.workrave.org/
|
||||
[13]:https://github.com/ttygde/pokoy
|
||||
[14]:http://gnomepomodoro.org
|
||||
[15]:https://twitter.com/nixcraft
|
||||
[16]:https://facebook.com/nixcraft
|
||||
[17]:https://plus.google.com/+CybercitiBiz
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (qhwdw)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,4 +1,3 @@
|
||||
Moelf translating
|
||||
Managing Digital Files (e.g., Photographs) in Files and Folders
|
||||
======
|
||||
Update 2014-05-14: added real world example
|
||||
|
@ -1,143 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (The History of Hello World)
|
||||
[#]: via: (https://www.thesoftwareguild.com/blog/the-history-of-hello-world/)
|
||||
[#]: author: (thussong https://www.thesoftwareguild.com/blog/author/thussong/)
|
||||
|
||||
The History of Hello World
|
||||
======
|
||||
|
||||
|
||||
Veteran software developers know the [Hello World][2] program as the first step in learning to code. The program, which outputs some variant of “Hello, World!” on a device’s display, can be created in most languages, making it some of the most basic syntax involved in the coding process. In fact, a recent project at the Association for Computing Machinery (ACM) at Louisiana Tech [found][3] that there are at least 204 versions of the program.
|
||||
|
||||
Traditionally, Hello World programs are used to illustrate how the process of coding works, as well as to ensure that a language or system is operating correctly. They are usually the first programs that new coders learn, because even those with little or no experience can execute Hello World both easily and correctly.
|
||||
|
||||
Above all, Hello World is simple. That’s why it is so often used as a barometer of program success. If Hello World does not work effectively within the framework, then it is likely that other, more complex programs will also fail. As one expert at [Win-Vector][4] puts it, Hello World is actually a confrontational program. “The author is saying ‘it isn’t obvious your computer system will work, so I am not going to invest a lot of time in it until I see it can at least print one line of text,’” Win-Vector blogger John Mount says.
|
||||
|
||||
But this two-word phrase has big implications for the field of computer science. With Hello World as a foundation, novice programmers can easily understand computer science principles or elements. And professionals with years of coding experience can use it to learn how a given programming language works, especially in terms of structure and syntax. With applications at all skill levels and in almost every language, there is a long history behind such a short program.
|
||||
|
||||
### Uses
|
||||
|
||||
The main use for Hello World programs was outlined above: It is a way for rookie coders to become acquainted with a new language. However, the applications of these programs go beyond an introduction to the coding world. Hello World can, for example, be used as a sanity test to make sure that the components of a language (its compiler, development and run-time environment) have been correctly installed. Because the process involved in configuring a complete programming toolchain is lengthy and complex, a simple program like Hello World is often used as a first-run test on a new toolchain.
|
||||
|
||||
Hackers also use Hello World “as proof of concept that arbitrary code can be executed through an exploit where the system designers did not intend code to be executed,” according to programming consultants at Cunningham & Cunningham (C2). In fact, it’s the first step in using homemade content, or “home brew” on a device. When [experienced coders][5] are configuring an environment or learning a previously unknown one, they verify that Hello World behaves correctly.
|
||||
|
||||
It is also used as part of the debugging process, allowing programmers to check that they are editing the right aspect of a modifiable program at runtime and that it is being reloaded.
|
||||
|
||||
One more popular use for Hello World is as a basis for comparison. Coders can “compare the size of the executable that the language generates, and how much supporting infrastructure must exist behind the program for it to execute,” according to C2’s wiki.
|
||||
|
||||
### Beginnings
|
||||
|
||||
Though the origins of Hello World remain somewhat unclear, its use as a test phrase is widely believed to have begun with Brian Kernigham’s 1972 book, A Tutorial Introduction to the Language B. In this text, the first known version of the program was used to illustrate external variables. Because the previous example in the tutorial printed “hi!” on the terminal, the more complex “hello, world!” required more character constants for expression and was the next step in the learning process.
|
||||
|
||||
From there, it was used in a Bell Laboratories memo in 1974, as well as The C Programming Language in 1978. This popular text is what made Hello World famous. The example from that book (the first, and most pure, example) printed “hello, world,” with no capital letters or exclamation point. At this time, Hello World was used almost solely to illustrate a few functions of a language— not to test whether the system was running.
|
||||
|
||||
Before Kernigham’s seminal texts on B and C, there was no standard first program. Even as late as 1972, it was not widely in use. The popular BASIC tutorial, “My Computer Likes Me, When I Speak in Basic,” starts with a simple program that writes a line of text. However, this message was “MY HUMAN UNDERSTANDS ME,” far from the two-word greeting programmers use today. But once Hello World was invented, it spread quickly, becoming well-known by the late 1970s. Its popularity continues to this day.
|
||||
|
||||
### One Statement, Many Languages
|
||||
|
||||
Here’s what the code for Hello World looks like in some of the most popular programming languages currently in use.
|
||||
|
||||
#### Java
|
||||
|
||||
```
|
||||
class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, world!");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### C#
|
||||
|
||||
```
|
||||
using System;
|
||||
class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, world!");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Python
|
||||
|
||||
```
|
||||
print("Hello, world!")
|
||||
```
|
||||
|
||||
#### Ruby
|
||||
|
||||
```
|
||||
puts "Hello, world!"
|
||||
```
|
||||
|
||||
#### Scala
|
||||
|
||||
```
|
||||
object HelloWorld extends App {
|
||||
println("Hello, world!")
|
||||
}
|
||||
```
|
||||
|
||||
#### ASP.NET
|
||||
|
||||
`Response.Write("Hello World!");`
|
||||
|
||||
#### Lisp
|
||||
|
||||
```
|
||||
(princ "Hello, world!")
|
||||
```
|
||||
|
||||
#### Haskell
|
||||
|
||||
```
|
||||
main = putStrLn "Hello, world!"
|
||||
```
|
||||
|
||||
#### Malbolge
|
||||
|
||||
```
|
||||
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
|
||||
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>
|
||||
```
|
||||
|
||||
#### Go
|
||||
|
||||
```
|
||||
package main
|
||||
import "fmt"
|
||||
func main() {
|
||||
fmt.Println("Hello, world!")
|
||||
}
|
||||
```
|
||||
|
||||
### Hello World Today: A Standard Practice in Varied Forms
|
||||
|
||||
In modern coding languages, Hello World is deployed at different levels of sophistication. For example, the Go language introduced a multilingual Hello World program, and XL features a spinning, 3D version complete with graphics. Some languages, like Ruby and Python, need only a single statement to print “hello world,” but a low-level assembly language could require several commands to do so. Modern languages also introduce variations in punctuation and casing. These include the presence or absence of the comma and exclamation point, as well as the capitalization of both words. For example, when systems only support capital letters, the phrase appears as “HELLO WORLD.” The first nontrivial Malbolge program printed “HEllO WORld.” Variations go beyond the literal as well. In functional languages like Lisp and Haskell, factorial programs are substituted for Hello World to emphasize recursive techniques. This is different from the original examples, which emphasized I/O and produced side effects.
|
||||
|
||||
With the increasing complexity of modern coding languages, Hello World is more important than ever. Both as a test and a teaching tool, it has become a standardized way of allowing programmers to configure their environment. No one can be sure why Hello World has stood the test of time in an industry known for rapid-fire innovation, but it is here to stay.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/
|
||||
|
||||
作者:[thussong][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.thesoftwareguild.com/blog/author/thussong/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World
|
||||
[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program
|
||||
[3]: http://whatis.techtarget.com/definition/Hello-World
|
||||
[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/
|
||||
[5]: http://c2.com/cgi/wiki?HelloWorld
|
@ -0,0 +1,78 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Get started with Org mode without Emacs)
|
||||
[#]: via: (https://opensource.com/article/19/1/productivity-tool-org-mode)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
|
||||
|
||||
Get started with Org mode without Emacs
|
||||
======
|
||||
No, you don't need Emacs to use Org, the 16th in our series on open source tools that will make you more productive in 2019.
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh)
|
||||
|
||||
There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way.
|
||||
|
||||
Here's the 16th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019.
|
||||
|
||||
### Org (without Emacs)
|
||||
|
||||
[Org mode][1] (or just Org) is not in the least bit new, but there are still many people who have never used it. They would love to try it out to get a feel for how Org can help them be productive. But the biggest barrier is that Org is associated with Emacs, and many people think one requires the other. Not so! Org can be used with a variety of other tools and editors once you understand the basics.
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/org-1.png)
|
||||
|
||||
Org, at its very heart, is a structured text file. It has headers, subheaders, and keywords that allow other tools to parse files into agendas and to-do lists. Org files can be edited with any flat-text editor (e.g., [Vim][2], [Atom][3], or [Visual Studio Code][4]), and many have plugins that help create and manage Org files.
|
||||
|
||||
A basic Org file looks something like this:
|
||||
|
||||
```
|
||||
* Task List
|
||||
** TODO Write Article for Day 16 - Org w/out emacs
|
||||
DEADLINE: <2019-01-25 12:00>
|
||||
*** DONE Write sample org snippet for article
|
||||
- Include at least one TODO and one DONE item
|
||||
- Show notes
|
||||
- Show SCHEDULED and DEADLINE
|
||||
*** TODO Take Screenshots
|
||||
** Dentist Appointment
|
||||
SCHEDULED: <2019-01-31 13:30-14:30>
|
||||
```
|
||||
|
||||
Org uses an outline format that uses ***** as bullets to indicate an item's level. Any item that begins with the word TODO (yes, in all caps) is just that—a to-do item. The work DONE indicates it is completed. SCHEDULED and DEADLINE indicate dates and times relevant to the item. If there's no time in either field, the item is considered an all-day event.
|
||||
|
||||
With the right plugins, your favorite text editor becomes a powerhouse of productivity and organization. For example, the [vim-orgmode][5] plugin's features include functions to create Org files, syntax highlighting, and key commands to generate agendas and comprehensive to-do lists across files.
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/org-2.png)
|
||||
|
||||
The Atom [Organized][6] plugin adds a sidebar on the right side of the screen that shows the agenda and to-do items in Org files. It can read from multiple files by default with a path set up in the configuration options. The Todo sidebar allows you to click on a to-do item to mark it done, then automatically updates the source Org file.
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/org-3.png)
|
||||
|
||||
There are also a whole host of tools that "speak Org" to help keep you productive. With libraries in Python, Perl, PHP, NodeJS, and more, you can develop your own scripts and tools. And, of course, there is also [Emacs][7], which has Org support within the core distribution.
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/org-4.png)
|
||||
|
||||
Org mode is one of the best tools for keeping on track with what needs to be done and when. And, contrary to myth, it doesn't need Emacs, just a text editor.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/1/productivity-tool-org-mode
|
||||
|
||||
作者:[Kevin Sonney][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/ksonney (Kevin Sonney)
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://orgmode.org/
|
||||
[2]: https://www.vim.org/
|
||||
[3]: https://atom.io/
|
||||
[4]: https://code.visualstudio.com/
|
||||
[5]: https://github.com/jceb/vim-orgmode
|
||||
[6]: https://atom.io/packages/organized
|
||||
[7]: https://www.gnu.org/software/emacs/
|
@ -0,0 +1,101 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Tips and tricks for using CUPS for printing with Linux)
|
||||
[#]: via: (https://opensource.com/article/19/1/cups-printing-linux)
|
||||
[#]: author: (Antoine Thomas https://opensource.com/users/ttoine)
|
||||
|
||||
Tips and tricks for using CUPS for printing with Linux
|
||||
======
|
||||
One of Apple's most important contributions to GNU/Linux was adopting CUPS in Mac OS X.
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ)
|
||||
|
||||
Did you ever try to configure a printer on a GNU/Linux desktop distribution at the end of the '90s? Or even before?
|
||||
|
||||
To make a long story short: That was fine if you worked at a large organization with an IT team to handle it and dedicated hardware or a printing server. There were many different standards and protocols to handle printers. And only a few big vendors (usually Unix vendors) provided specific support and drivers for their entire range of products.
|
||||
|
||||
However, if open source enthusiasts wanted a home printer that would work with their favorite distribution, that was another story. They probably spent a fair amount of time on forums, newsgroups, or IRC (remember those ancestors of social networks and chats?) asking about printers with easy-to-install Linux drivers.
|
||||
|
||||
In 1999, the first version of [CUPS][1] (the Common Unix Printing System) was released by Easy Software Products. Most of the most popular distributions at the time adopted CUPS as their default printing system. That was a huge success: one standard could handle many printers and protocols.
|
||||
|
||||
But if the printer vendor didn't provide a CUPS driver, it was still tricky or impossible to make it work. Some smart people might do reverse engineering. And a few printers, with native support of PostScript and Internet Printing Protocol (IPP), worked "out of the box."
|
||||
|
||||
### Then came Apple
|
||||
|
||||
In the early 2000s, Apple was struggling to build a new printing system for its new Mac OS X. In March 2002, it decided to save time by adopting CUPS for its flagship operating system.
|
||||
|
||||
No printer vendor could ignore Apple computers' market share, so a lot of new printer drivers for Mac OS X's CUPS became available, spanning most vendors and product ranges, including corporate, graphic arts, consumer, and photo printing.
|
||||
|
||||
CUPS became so important for Apple that it bought the software from Easy Software Products in 2007; since then Apple has continued to maintain it and manage its intellectual property.
|
||||
|
||||
### But what does that have to do with GNU/Linux?
|
||||
|
||||
At the time Apple integrated CUPS in Mac OS X, it was already used by default in many distros and available for most others. But few dedicated drivers were available, meaning they were not packaged or listed as "for GNU/Linux."
|
||||
|
||||
However, once CUPS drivers were available for Mac OS X, a simple hack became popular with GNU/Linux enthusiasts: download the Mac driver, extract the PPD files, and test them with your printer. I used this hack many times with my Epson printers.
|
||||
|
||||
That's the CUPS magic: If a driver exists, it usually works with all operating systems that use CUPS for printing, as long as they use a supported protocol (like IPP).
|
||||
|
||||
That's how printer drivers began to be available for GNU/Linux.
|
||||
|
||||
### Nowadays
|
||||
|
||||
Afterward, printer vendors realized it was quite easy to provide drivers for GNU/Linux since they already developed them for Mac. It's now easy to find a GNU/Linux driver for a printer, even a newer one. Some distributions include packages with a lot of drivers, and most vendors provide dedicated drivers—sometimes via a package, other times with PPD files in an archive.
|
||||
|
||||
Advanced control applications are available too, some official, some not, which make it possible (for example) to look at ink levels or clean printing heads.
|
||||
|
||||
In some cases, installing a printer on GNU/Linux is even easier than on other operating systems, particularly with distributions using [zero-configuration networking][2] (e.g., Bonjour, Avahi) to auto-discover and share network printers.
|
||||
|
||||
### Tips and tricks
|
||||
|
||||
* **Install a PDF printer:** Installing a PDF printer on GNU/Linux is very easy. Just look for the **cups-pdf** package in your favorite distribution and install it. If the package doesn't automatically create the PDF printer, you can add one using your system preferences to print in PDF from any application.
|
||||
|
||||
* **Access the CUPS web interface:** If your usual interface for managing printers doesn't work or you don't like it, open a web browser and go to <http://localhost:631/admin>. You can manage all the printers installed on your computer, adjust their settings, and even add new ones—all from this web interface. Note that this might be available on other computers on your network; if so, replace "localhost" with the relevant hostname or IP address.
|
||||
|
||||
* **Check ink level:** If you have an Epson, Canon, HP, or Sony printer, you can see its ink level with a simple application. Look for the "ink" package in your distribution repositories.
|
||||
|
||||
* **Contribute to CUPS:** Like many open source project, CUPS is maintained on GitHub. Check the [CUPS website][1] and [GitHub issues][3] to find out how you can contribute to improving it.
|
||||
|
||||
|
||||
|
||||
|
||||
### CUPS license
|
||||
|
||||
Originally, CUPS was released under GPLv2. I'm not sure why; maybe to make it easier to distribute with GNU/Linux. Or maybe it was just what most open source projects did at the time.
|
||||
|
||||
Apple decided to [change the license][4] in November 2017 to the Apache 2.0 license. Many observers commented that it was consistent with Apple's strategy to move the IP of its open source projects to more business-compliant licenses.
|
||||
|
||||
While this change could create issues with shipping CUPS with GNU/Linux, it is still available in most distributions.
|
||||
|
||||
### Happy 20th birthday, CUPS!
|
||||
|
||||
CUPS was released in 1999, so, let's celebrate and thank all the people involved in this successful open source project, from the original authors to the driver developers to its current maintainers.
|
||||
|
||||
The next time you print with your favorite GNU/Linux operating system, remind yourself to say "thank you" to Apple.
|
||||
|
||||
The company isn't well known for its contributions to open source. But if you look carefully (at, for example, [Apple's Open Source Releases][5] and [Open Source Development][6] pages), you'll see how many open source components are in Apple's operating systems and applications.
|
||||
|
||||
You'll also discover other important open source projects Apple kicked off. For example, it forked KHTML, the KDE browser, to create [WebKit][7] for the Safari Browser. Wait, THE WebKit? Yes, Apple initiated WebKit. But that is another story...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/1/cups-printing-linux
|
||||
|
||||
作者:[Antoine Thomas][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/ttoine
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.cups.org/
|
||||
[2]: https://en.wikipedia.org/wiki/Zero-configuration_networking#Major_implementations
|
||||
[3]: https://github.com/apple/cups/issues
|
||||
[4]: https://www.cups.org/blog/2017-11-07-cups-license-change.html
|
||||
[5]: https://opensource.apple.com/
|
||||
[6]: https://developer.apple.com/opensource/
|
||||
[7]: https://webkit.org/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (fuowang)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: subject: (An introduction to the Flask Python web app framework)
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (Flowsnow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: subject: (An introduction to the Pyramid web framework for Python)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user